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

Tatsuo Ishii ishii at sraoss.co.jp
Tue Oct 29 15:21:55 JST 2019


Usama,

I am confused.

> 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).

Surely the path to socket directory is hard coded in the source code,
but I see it no problem because pgpool actually uses the path specified
in pgpool.conf, no?

Actually the situation is same in PostgreSQL. PostgreSQL does not have
configuration option to specify the path to sockets. If PostgreSQL
doesn't need the option in configure, why pgpool needs it?

I see more problem with that pgpool/pcp only accepts single socket
path (PostgreSQL accepts two or more paths). This is annoying in an
environment where each client linked with different libpq which has
different default path to sockets, for example /tmp and
/var/run/postgresql. We need to enhance this for 4.2 I think.

Best regards,
--
Tatsuo Ishii
SRA OSS, Inc. Japan
English: http://www.sraoss.co.jp/index_en.php
Japanese:http://www.sraoss.co.jp

> 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


More information about the pgpool-hackers mailing list