[pgpool-hackers: 3977] Re: Proposal: using environment variables instead of script arguments
anirudh.goel at cern.ch
anirudh.goel at cern.ch
Thu Jul 15 15:48:33 JST 2021
Hello Tatsuo
> Unfortunately recovery commands are executed on the PostgreSQL primary
> node by calling pgpool_recovery extension. There's no way to pass
> environment variables from pgpool side. So my proposal is not applied
> to below commands.
Fair point. Then as per our other discussion, to pass PRIMARY_NODE_HOST to the recovery_1st_stage script, can we do it by passing it as an argument to the command?
Thanks!
Anirudh
On 15 Jul 2021, 12:03 PM +0530, Tatsuo Ishii <ishii at sraoss.co.jp>, wrote:
> Oops. I was wrong.
>
> > Currently following scripts receive necessary information as script
> > arguments.
> >
> > failback_command
> > failover_command
> > follow_primary_command
>
> Unfortunately recovery commands are executed on the PostgreSQL primary
> node by calling pgpool_recovery extension. There's no way to pass
> environment variables from pgpool side. So my proposal is not applied
> to below commands.
>
> > recovery_1st_stage_command
> > recovery_2nd_stage_command
> >
> > This is painful for both pgpool developers and users because:
> >
> > - every time new argument is added, pgpool needs to update source code
> > to add the argument. For example, an extension "pgpool_recovery"
> > needs to be updated if new arguments are added. Thus we have 1.0,
> > 1.1, 1,2 and 1.3 versions of the extension. Moreover developers need
> > to write upgrade scripts to update to newer version of extension.
> >
> > - pgpool users need to remember what $1 is, $2 etc. are.
> >
> > I propose to stop using arguments and use environment variables
> > instead. For a backward compatibility sake, it may be better to provide
> > both arguments and environment variables for Pgpool-II 4.3, then
> > eliminate arguments 4.4.
> >
> > Here are list of proposed environment variables:
> >
> > POOL_ATTACHED_NODE DB node ID of the attached node
> > POOL_ATTACHED_HOST Hostname of the attached node
> > POOL_ATTACHED_PORT Port number of the attached node
> > POOL_ATTACHED_PGDATA Database cluster directory of the attached node
> > POOL_DETACHED_NODE DB node ID of the detached node
> > POOL_DETACHED_HOST Hostname of the detached node
> > POOL_DETACHED_PORT Port number of the detached node
> > POOL_DETACHED_PGDATA Database cluster directory of the detached node
> > POOL_NEW_MAIN_NODE_ID New main node ID
> > POOL_NEW_MAIN_NODE_HOST Hostname of the new main node
> > POOL_NEW_MAIN_PORT Port number of the new main node
> > POOL_NEW_MAIN_PGDATA Database cluster directory of the new main node
> > POOL_NEW_PRIMARY_NODE_ID New primary node ID
> > POOL_NEW_PRIMARY_HOST Hostname of the new primary node
> > POOL_NEW_PRIMARY_PORT Port number of the new primary node
> > POOL_NEW_PRIMARY_PGDATA Database cluster directory of the new primary node
> > POOL_OLD_MAIN_NODE_ID Old main node ID
> > POOL_OLD_PRIMARY_NODE_ID Old primary node ID
> > POOL_OLD_PRIMARY_HOST Hostname of the old primary node
> > POOL_OLD_PRIMARY_PORT Port number of the old primary node
> > POOL_DETACHED_NODE DB node ID of the detached node
> > POOL_DETACHED_HOST Hostname of the detached node
> > POOL_DETACHED_PORT Port number of the detached node
> > POOL_DETACHED_PGDATA Database cluster directory of the detached node
> >
> > Followings do not exist in the current arugument list but I would like
> > to add for consistency sake:
> >
> > POOL_OLD_MAIN_HOST Hostname of the old main node
> > POOL_OLD_MAIN_PORT Port number of the old main node
> > POOL_OLD_MAIN_PGDATA Database cluster directory of the old main node
> > POOL_OLD_PRIMARY_PGDATA Database cluster directory of the old primary node
> >
> > All variables are prefixed with "POOL_" to not conflict with user's
> > envrionment variables if any.
> >
> > Comments and suggestions are welcome.
> > --
> > Tatsuo Ishii
> > SRA OSS, Inc. Japan
> > English: http://www.sraoss.co.jp/index_en.php
> > Japanese:http://www.sraoss.co.jp
> _______________________________________________
> pgpool-hackers mailing list
> pgpool-hackers at pgpool.net
> http://www.pgpool.net/mailman/listinfo/pgpool-hackers
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.pgpool.net/pipermail/pgpool-hackers/attachments/20210715/078c666f/attachment.htm>
More information about the pgpool-hackers
mailing list