[pgpool-hackers: 3465] Patch for making the default socket path configurable

Muhammad Usama m.usama at gmail.com
Fri Oct 18 23:08:09 JST 2019


Hi Hackers

As different packages of Pgpool-II like Debian and rpm require different
default paths for placing the UNIX domain socket files. But the problem is
that, even if we mention that in the pgpool.conf sample files ( using some
patch or manual editing before creating the package) the actual code still
considers the '*/tmp*' (that is hardcoded in the source) as a
default socket directory path, which is not right and confusing. Especially
in case of PCP utilities as they still try to locate the socket in *'/tmp'*
(because they have no idea about pgpool.conf settings).

So I was thinking of making the default socket directory path configurable
and created a patch for that. The patch adds a new configuration switch "
--with-default-socket-dir"
that can be used to change the default path where Pgpool-II and its utility
will look for the socket files.
On top of that, the configure also automatically modifies all the
pgpool.conf.sample* files to reflect the new default path.

For example, if for Debian packaging we want to use the *'*
*/var/run/postgresql'* as the default directory for Unix domain
sockets we can just set the path during configure step

[usama at 62c5 pgpool2]# ./configure .. --with-default-socket-dir=
/var/run/postgresql


This will not only change the source code to use the *'/var/run/postgresql'*
path as default

but will also change the sample conf files as well.


-- After configure with --with-default-socket-dir option


git diff src/sample/pgpool.conf.sample-stream

diff --git a/src/sample/pgpool.conf.sample-stream
b/src/sample/pgpool.conf.sample-stream

index ef20c0f..7587d22 100644

--- a/src/sample/pgpool.conf.sample-stream

+++ b/src/sample/pgpool.conf.sample-stream

@@ -31,7 +31,7 @@ listen_addresses = 'localhost'

 port = 9999

                                    # Port number

                                    # (change requires restart)

-socket_dir = '/tmp'

+socket_dir = '/var/run/postgresql'

                                    # Unix domain socket path

                                    # The Debian package defaults to

                                    # /var/run/postgresql

@@ -51,7 +51,7 @@ pcp_listen_addresses = '*'

 pcp_port = 9898

                                    # Port number for pcp

                                    # (change requires restart)

-pcp_socket_dir = '/tmp'

+pcp_socket_dir = '/var/run/postgresql'

                                    # Unix domain socket path for pcp

                                    # The Debian package defaults to

                                    # /var/run/postgresql

@@ -581,7 +581,7 @@ wd_authkey = ''

                                     # Authentication key for watchdog
communication

                                     # (change requires restart)



-wd_ipc_socket_dir = '/tmp'

+wd_ipc_socket_dir = '/var/run/postgresql'

                                     # Unix domain socket path for watchdog
IPC socket

                                     # The Debian package defaults to

                                     # /var/run/postgresql


The main idea of this patch is to make the packaging of Pgpool-II easier
and more consistent.
Thoughts and suggestions?

Thanks
Best Regards
Muhammad Usama
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.sraoss.jp/pipermail/pgpool-hackers/attachments/20191018/7327429e/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: adjust_def_sock_dir.diff
Type: application/octet-stream
Size: 10283 bytes
Desc: not available
URL: <http://www.sraoss.jp/pipermail/pgpool-hackers/attachments/20191018/7327429e/attachment-0001.obj>


More information about the pgpool-hackers mailing list