pgpool2.git / summary / log / commit / refs
commit a97eed16ef8c3a481c0cd0282b9950fb4ee28a89
Author: Tatsuo Ishii <ishii at sraoss.co.jp>
Date: Sat Feb 13 11:23:55 2010 +0000
Fix read_status_file so that if all nodes were marked down status,
it is regarded that this file is bogus. This will prevent "all
node down" syndrome.
main.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/main.c b/main.c
index 5a8ea4f1a..7b6f8e8a1 100644
--- a/main.c
+++ b/main.c
@@ -796,6 +796,7 @@ static int read_status_file(void)
FILE *fd;
char fnamebuf[POOLMAXPATHLEN];
int i;
+ bool someone_wakeup = false;
snprintf(fnamebuf, sizeof(fnamebuf), "%s/%s", pool_config->logdir, STATUS_FILE_NAME);
fd = fopen(fnamebuf, "r");
@@ -818,7 +819,21 @@ static int read_status_file(void)
if (backend_rec.status[i] == CON_DOWN)
BACKEND_INFO(i).backend_status = CON_DOWN;
else
+ {
+ BACKEND_INFO(i).backend_status = CON_CONNECT_WAIT;
+ someone_wakeup = true;
+ }
+ }
+
+ /*
+ * If no one woke up, we regard the status file bogus
+ */
+ if (someone_wakeup == false)
+ {
+ for (i=0;i< pool_config->backend_desc->num_backends;i++)
+ {
BACKEND_INFO(i).backend_status = CON_CONNECT_WAIT;
+ }
}
return 0;
[parent: 159e0e9a966e]