pgpool2.git / summary / log / commit / refs
commit e8f094b22197edf9c84c3e1bd34a93c2cdf7b3b2
Author: Toshihiro Kitagawa <kitagawa at sraoss.co.jp>
Date: Mon Mar 07 07:00:14 2011 +0000
Change REAL_MASTER_NODE_ID to consider PRIMARY_NODE_ID.
pcp_child.c | 4 ++--
pool_proto_modules.c | 2 +-
recovery.c | 6 ++++--
3 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/pcp_child.c b/pcp_child.c
index c03b39868..768a2213b 100644
--- a/pcp_child.c
+++ b/pcp_child.c
@@ -5,7 +5,7 @@
* pgpool: a language independent connection pool server for PostgreSQL
* written by Tatsuo Ishii
*
- * Copyright (c) 2003-2010 PgPool Global Development Group
+ * Copyright (c) 2003-2011 PgPool Global Development Group
*
* Permission to use, copy, modify, and distribute this software and
* its documentation for any purpose and without fee is hereby
@@ -779,7 +779,7 @@ pcp_do_child(int unix_fd, int inet_fd, char *pcp_conf_file)
!strcmp(pool_config->master_slave_sub_mode, MODE_STREAMREP))) ||
(MASTER_SLAVE &&
!strcmp(pool_config->master_slave_sub_mode, MODE_STREAMREP) &&
- node_id == REAL_MASTER_NODE_ID))
+ node_id == PRIMARY_NODE_ID))
{
int len;
char *msg;
diff --git a/pool_proto_modules.c b/pool_proto_modules.c
index 76bc9ab3d..c3c0874bc 100644
--- a/pool_proto_modules.c
+++ b/pool_proto_modules.c
@@ -1322,7 +1322,7 @@ POOL_STATUS ReadyForQuery(POOL_CONNECTION *frontend,
if (CONNECTION_SLOT(backend, i) &&
TSTATE(backend, i) == 'T' &&
BACKEND_INFO(i).backend_status == CON_UP &&
- REAL_MASTER_NODE_ID != i)
+ (MASTER_SLAVE ? PRIMARY_NODE_ID : REAL_MASTER_NODE_ID) != i)
{
per_node_statement_log(backend, i, "COMMIT");
if (do_command(frontend, CONNECTION(backend, i), "COMMIT", MAJOR(backend),
diff --git a/recovery.c b/recovery.c
index 4d55f286e..0e0eeb224 100644
--- a/recovery.c
+++ b/recovery.c
@@ -5,7 +5,7 @@
* pgpool: a language independent connection pool server for PostgreSQL
* written by Tatsuo Ishii
*
- * Copyright (c) 2003-2010 PgPool Global Development Group
+ * Copyright (c) 2003-2011 PgPool Global Development Group
*
* Permission to use, copy, modify, and distribute this software and
* its documentation for any purpose and without fee is hereby
@@ -49,6 +49,7 @@ extern volatile sig_atomic_t pcp_wakeup_request;
int start_recovery(int recovery_node)
{
+ int node_id;
BackendInfo *backend;
BackendInfo *recovery_backend;
PGconn *conn;
@@ -63,7 +64,8 @@ int start_recovery(int recovery_node)
Req_info->kind = NODE_RECOVERY_REQUEST;
- backend = &pool_config->backend_desc->backend_info[MASTER_NODE_ID];
+ node_id = MASTER_SLAVE ? PRIMARY_NODE_ID : REAL_MASTER_NODE_ID;
+ backend = &pool_config->backend_desc->backend_info[node_id];
recovery_backend = &pool_config->backend_desc->backend_info[recovery_node];
conn = connect_backend_libpq(backend);
[parent: 9d9cfd9aeaa5]