Fix sr check and health check to reopen pool_passwd upon reload.
authorTatsuo Ishii <ishii@postgresql.org>
Tue, 4 Mar 2025 12:27:34 +0000 (21:27 +0900)
committerTatsuo Ishii <ishii@postgresql.org>
Tue, 4 Mar 2025 12:27:34 +0000 (21:27 +0900)
The streaming replication check and health check process forgot to
reopen pool_passwd upon reload.  If sr_check_passwd or
health_check_passwd is empty string, the password is obtained from
pool_passwd. Thus those process read outdated content of pool_passwd
upon reload.

Backpatch-through: v4.2

src/main/health_check.c
src/streaming_replication/pool_worker_child.c

index 64b0507dff3b3ceb2de28c6b0fa4be0502137ed0..ae831dd6d9acd937da9aa00ed1d4a87a6ebdbddc 100644 (file)
@@ -5,7 +5,7 @@
  * pgpool: a language independent connection pool server for PostgreSQL
  * written by Tatsuo Ishii
  *
- * Copyright (c) 2003-2024     PgPool Global Development Group
+ * Copyright (c) 2003-2025     PgPool Global Development Group
  *
  * Permission to use, copy, modify, and distribute this software and
  * its documentation for any purpose and without fee is hereby
@@ -527,6 +527,10 @@ reload_config(void)
        MemoryContextSwitchTo(oldContext);
        if (pool_config->enable_pool_hba)
                load_hba(get_hba_file_name());
+
+       if (strcmp("", pool_config->pool_passwd))
+               pool_reopen_passwd_file();
+
        reload_config_request = 0;
 }
 
index 2a410564a7d1c556435e63611e2949008314da97..746659e0f3e0a05148658141965284e5e2526654 100644 (file)
@@ -3,7 +3,7 @@
  * pgpool: a language independent connection pool server for PostgreSQL
  * written by Tatsuo Ishii
  *
- * Copyright (c) 2003-2024     PgPool Global Development Group
+ * Copyright (c) 2003-2025     PgPool Global Development Group
  *
  * Permission to use, copy, modify, and distribute this software and
  * its documentation for any purpose and without fee is hereby
@@ -146,6 +146,14 @@ do_worker_child(void)
        /* Initialize per process context */
        pool_init_process_context();
 
+       /*
+        * Open pool_passwd.
+        */
+       if (strcmp("", pool_config->pool_passwd))
+       {
+               pool_reopen_passwd_file();
+       }
+
        if (sigsetjmp(local_sigjmp_buf, 1) != 0)
        {
                pool_signal(SIGALRM, SIG_IGN);
@@ -731,6 +739,10 @@ reload_config(void)
        MemoryContextSwitchTo(oldContext);
        if (pool_config->enable_pool_hba)
                load_hba(get_hba_file_name());
+
+       if (strcmp("", pool_config->pool_passwd))
+               pool_reopen_passwd_file();
+
        reload_config_request = 0;
 }