pgpool2.git / summary / log / commit / refs

commit    c776772dbedddc4b8a54d721828f817229762dd7
Author:   Yoshiyuki Asaba <y-asaba at pgfoundry.org>
Date:     Fri Oct 12 04:35:31 2007 +0000

    recovery request can be accepted only in replication mode.


pcp_child.c | 41 ++++++++++++++++++++++++++--------------- 1 file changed, 26 insertions(+), 15 deletions(-) diff --git a/pcp_child.c b/pcp_child.c index 26bdf0cf4..caf623bdc 100644 --- a/pcp_child.c +++ b/pcp_child.c @@ -742,26 +742,37 @@ pcp_do_child(int unix_fd, int inet_fd, char *pcp_conf_file) char code[] = "CommandComplete"; int r; - pool_debug("pcp_child: start online recovery"); - node_id = atoi(buf); - - r = start_recovery(node_id); - finish_recovery(); - - if (r == 0) /* success */ + if (!REPLICATION) { - pcp_write(frontend, "c", 1); - wsize = htonl(sizeof(code) + sizeof(int)); + int len = strlen("recovery request is accepted only in replication mode. ") + 1; + pcp_write(frontend, "e", 1); + wsize = htonl(sizeof(int) + len); pcp_write(frontend, &wsize, sizeof(int)); - pcp_write(frontend, code, sizeof(code)); + pcp_write(frontend, "recovery request is accepted only in replication mode. ", len); } else { - int len = strlen("recovery failed") + 1; - pcp_write(frontend, "e", 1); - wsize = htonl(sizeof(int) + len); - pcp_write(frontend, &wsize, sizeof(int)); - pcp_write(frontend, "recovery failed", len); + pool_debug("pcp_child: start online recovery"); + node_id = atoi(buf); + + r = start_recovery(node_id); + finish_recovery(); + + if (r == 0) /* success */ + { + pcp_write(frontend, "c", 1); + wsize = htonl(sizeof(code) + sizeof(int)); + pcp_write(frontend, &wsize, sizeof(int)); + pcp_write(frontend, code, sizeof(code)); + } + else + { + int len = strlen("recovery failed") + 1; + pcp_write(frontend, "e", 1); + wsize = htonl(sizeof(int) + len); + pcp_write(frontend, &wsize, sizeof(int)); + pcp_write(frontend, "recovery failed", len); + } } if (pcp_flush(frontend) < 0) { [parent: 4d49859ef00b]