pgpool2.git / summary / log / commit / refs
commit e61eda67ba0bb0fe89f92454a498802c54cf38af
Author: Yugo Nagata <nagata@sraoss.co.jp>
Date: Mon Mar 30 06:23:32 2015 +0000
Fix a hang when an error occurs in a transaction block with replication mode
When an error occurs at a backend node in a transaction block with
replication mode, pgpool-II sends an invalid query to other
backends to sync transaction states. However, previously, this was
not sent to master node, and pgpool-II was waiting for master's
response forever.
This bug is caused to a specification change since 3.3.0 that load
balance is allowed in a transaction block with replication mode.
To fix this, pgpool sends the invalid query to all backends,
including master, except the node which the original query was sent.
src/protocol/pool_proto_modules.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/src/protocol/pool_proto_modules.c b/src/protocol/pool_proto_modules.c
index 802bf8550..2e9a25d4e 100644
--- a/src/protocol/pool_proto_modules.c
+++ b/src/protocol/pool_proto_modules.c
@@ -2980,10 +2980,18 @@ void raise_intentional_error_if_need(POOL_CONNECTION_POOL *backend)
query_context &&
is_select_query(query_context->parse_tree, query_context->original_query))
{
- pool_setall_node_to_be_sent(query_context);
for (i = 0; i < NUM_BACKENDS; i++)
{
- if (VALID_BACKEND(i) && REAL_MASTER_NODE_ID != i)
+ /*
+ * Send a syntax error query to all backends except the node
+ * which the original query was sent.
+ */
+ if (pool_is_node_to_be_sent(query_context, i))
+ continue;
+ else
+ pool_set_node_to_be_sent(query_context, i);
+
+ if (VALID_BACKEND(i))
{
/*
* We must abort transaction to sync transaction state.
[parent: 2c8601e81bea]