pgpool2.git / summary / log / commit / refs

commit    0e4565a112e3d7a9cc5b58ac22b2ecfd04c3d9a8
Author:   Tatsuo Ishii <ishii at sraoss.co.jp>
Date:     Tue Dec 23 12:24:09 2008 +0000

    Fix Query() so that it starts transaction *before* checking
    insert lock is needed or not


pool_proto_modules.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/pool_proto_modules.c b/pool_proto_modules.c index 60596b4d3..dc0af95f7 100644 --- a/pool_proto_modules.c +++ b/pool_proto_modules.c @@ -438,15 +438,22 @@ POOL_STATUS NotificationResponse(POOL_CONNECTION *frontend, * - statement is INSERT * - either "INSERT LOCK" comment exists or insert_lock directive specified */ - if (REPLICATION && need_insert_lock(backend, string, node)) + if (REPLICATION) { - /* start a transaction if needed and lock the table */ - status = insert_lock(backend, string, (InsertStmt *)node); - if (status != POOL_CONTINUE) + /* start a transaction if needed */ + if (start_internal_transaction(backend, (Node *)node) != POOL_CONTINUE) + return POOL_END; + + /* check if need lock */ + if (need_insert_lock(backend, string, node)) { - - free_parser(); - return status; + /* if so, issue lock command */ + status = insert_lock(backend, string, (InsertStmt *)node); + if (status != POOL_CONTINUE) + { + free_parser(); + return status; + } } } else if (REPLICATION && query == NULL && start_internal_transaction(backend, node)) [parent: c78517c21b53]