pgpool2.git / summary / log / commit / refs
commit 80331aa9cdcd741d7cf650e40ecefc13a16c98dd
Author: User yamaguti <yamaguti at pgfoundry.org>
Date: Fri Feb 08 04:10:05 2008 +0000
added a new configuration parameter "recovery_timeout".
pgpool waits so many seconds, specified by recovery_timeout, for:
1) all client connections are closed before the 2nd stage
2) a remote host to start up in the final stage
Note that "recovery_timeout = 0" means NO WAIT; not no timeout.
pgpool.conf.sample | 3 +++
pool.h | 1 +
pool_config.c | 15 +++++++++++++++
pool_config.l | 15 +++++++++++++++
4 files changed, 34 insertions(+)
diff --git a/pgpool.conf.sample b/pgpool.conf.sample
index b2e8b537e..9ac3f8323 100644
--- a/pgpool.conf.sample
+++ b/pgpool.conf.sample
@@ -187,3 +187,6 @@ recovery_1st_stage_command = ''
# execute a command in second stage.
recovery_2nd_stage_command = ''
+
+# maximum time in seconds to wait for remote start-up. 0 means no wait
+recovery_timeout = 90;
diff --git a/pool.h b/pool.h
index 3818fd7b7..98021fe54 100644
--- a/pool.h
+++ b/pool.h
@@ -169,6 +169,7 @@ typedef struct {
char *recovery_password; /* PostgreSQL user password for online recovery */
char *recovery_1st_stage_command; /* Online recovery command in 1st stage */
char *recovery_2nd_stage_command; /* Online recovery command in 2nd stage */
+ int recovery_timeout; /* maximum time in seconds to wait for remote start-up */
int insert_lock; /* if non 0, automatically lock table with INSERT to keep SERIAL
data consistency */
int ignore_leading_white_space; /* ignore leading white spaces of each query */
diff --git a/pool_config.c b/pool_config.c
index 2d9b88795..49af79aaf 100644
--- a/pool_config.c
+++ b/pool_config.c
@@ -1860,6 +1860,7 @@ int pool_init_config(void)
pool_config->recovery_password = "";
pool_config->recovery_1st_stage_command = "";
pool_config->recovery_2nd_stage_command = "";
+ pool_config->recovery_timeout = 90;
res = gethostname(localhostname,sizeof(localhostname));
if(res !=0 )
@@ -2511,6 +2512,20 @@ int pool_get_config(char *confpath, POOL_CONFIG_CONTEXT context)
pool_config->recovery_2nd_stage_command = str;
}
+ else if (!strcmp(key, "recovery_timeout") &&
+ CHECK_CONTEXT(INIT_CONFIG|RELOAD_CONFIG, context))
+ {
+ int v = atoi(yytext);
+
+ if (token != POOL_INTEGER || v < 0)
+ {
+ pool_error("pool_config: %s must be equal or higher than 0 numeric value", key);
+ fclose(fd);
+ return(-1);
+ }
+ pool_config->recovery_timeout = v;
+ }
+
else if (!strcmp(key, "insert_lock") &&
CHECK_CONTEXT(INIT_CONFIG|RELOAD_CONFIG, context))
{
diff --git a/pool_config.l b/pool_config.l
index 686fe5bc1..d327e0595 100644
--- a/pool_config.l
+++ b/pool_config.l
@@ -172,6 +172,7 @@ int pool_init_config(void)
pool_config->recovery_password = "";
pool_config->recovery_1st_stage_command = "";
pool_config->recovery_2nd_stage_command = "";
+ pool_config->recovery_timeout = 90;
res = gethostname(localhostname,sizeof(localhostname));
if(res !=0 )
@@ -823,6 +824,20 @@ int pool_get_config(char *confpath, POOL_CONFIG_CONTEXT context)
pool_config->recovery_2nd_stage_command = str;
}
+ else if (!strcmp(key, "recovery_timeout") &&
+ CHECK_CONTEXT(INIT_CONFIG|RELOAD_CONFIG, context))
+ {
+ int v = atoi(yytext);
+
+ if (token != POOL_INTEGER || v < 0)
+ {
+ pool_error("pool_config: %s must be equal or higher than 0 numeric value", key);
+ fclose(fd);
+ return(-1);
+ }
+ pool_config->recovery_timeout = v;
+ }
+
else if (!strcmp(key, "insert_lock") &&
CHECK_CONTEXT(INIT_CONFIG|RELOAD_CONFIG, context))
{
[parent: bd29665cdc04]