pgpool2.git / summary / log / commit / refs
commit 290880f4a51afca14e2c6fd3b57d9fbd83a4bb98
Author: Tatsuo Ishii <ishii@postgresql.org>
Commit: Muhammad Usama <m.usama@gmail.com>
Date: Sun Jan 19 02:07:26 2014 +0000
Fix jdbc DML fails when operated in raw mode and auto commit is off.
When autocommit is off, bind() needs to start a transaction (if not
already in) for DMLs and do an insert lock if sequences are used in
replication mode. The fix was made into pgpool-II
3.3.2. Unfortunately, the fix forgot that it should be applied only
for replication mode. For other mode, that is not needed at all. The
bug reported in #92 happens when operated in raw mode and auto commit
is off. When parse() executes it does not start a transaction because
we are in raw mode. Then bind() starts a transaction by issuing
"BEGIN" which destroys the unnamed statement and the failure occurs.
Per bug #92.
src/protocol/pool_proto_modules.c | 37 ++++++++++++++++++++-----------------
1 file changed, 20 insertions(+), 17 deletions(-)
diff --git a/src/protocol/pool_proto_modules.c b/src/protocol/pool_proto_modules.c
index 4d9bd248e..a5a9d72f3 100644
--- a/src/protocol/pool_proto_modules.c
+++ b/src/protocol/pool_proto_modules.c
@@ -5,7 +5,7 @@
* pgpool: a language independent connection pool server for PostgreSQL
* written by Tatsuo Ishii
*
- * Copyright (c) 2003-2013 PgPool Global Development Group
+ * Copyright (c) 2003-2014 PgPool Global Development Group
*
* Permission to use, copy, modify, and distribute this software and
* its documentation for any purpose and without fee is hereby
@@ -1294,26 +1294,29 @@ POOL_STATUS Bind(POOL_CONNECTION *frontend, POOL_CONNECTION_POOL *backend,
}
/*
- * Start a transaction if necessary
+ * Start a transaction if necessary in replication mode
*/
- pool_debug("Bind: checking strict query");
- if (is_strict_query(query_context->parse_tree))
+ if (REPLICATION)
{
- pool_debug("Bind: strict query");
- start_internal_transaction(frontend, backend, query_context->parse_tree);
- allow_close_transaction = 1;
- }
+ pool_debug("Bind: checking strict query");
+ if (is_strict_query(query_context->parse_tree))
+ {
+ pool_debug("Bind: strict query");
+ start_internal_transaction(frontend, backend, query_context->parse_tree);
+ allow_close_transaction = 1;
+ }
- pool_debug("Bind: checking insert lock");
- insert_stmt_with_lock = need_insert_lock(backend, query_context->original_query, query_context->parse_tree);
- if (insert_stmt_with_lock)
- {
- pool_debug("Bind: issuing insert lock");
- /* issue a LOCK command to keep consistency */
- if (insert_lock(frontend, backend, query_context->original_query, (InsertStmt *)query_context->parse_tree, insert_stmt_with_lock) != POOL_CONTINUE)
+ pool_debug("Bind: checking insert lock");
+ insert_stmt_with_lock = need_insert_lock(backend, query_context->original_query, query_context->parse_tree);
+ if (insert_stmt_with_lock)
{
- pool_query_context_destroy(query_context);
- return POOL_END;
+ pool_debug("Bind: issuing insert lock");
+ /* issue a LOCK command to keep consistency */
+ if (insert_lock(frontend, backend, query_context->original_query, (InsertStmt *)query_context->parse_tree, insert_stmt_with_lock) != POOL_CONTINUE)
+ {
+ pool_query_context_destroy(query_context);
+ return POOL_END;
+ }
}
}
[parent: 6681a0e8d2fb]