It appears that the last commit below has problem with the case
authorTatsuo Ishii <ishii at sraoss.co.jp>
Thu, 21 Jul 2011 23:19:32 +0000 (23:19 +0000)
committerTatsuo Ishii <ishii at sraoss.co.jp>
Thu, 21 Jul 2011 23:19:32 +0000 (23:19 +0000)
PREPARE(non extended protocol case) raises error, pointed out by
Toshihiro Kitagawa. ReadyForQuery() is changed to call
pool_unset_query_in_progress() whenver query_in_progress is set
(before it was only called when command_success is set).

Subject: [Pgpool-committers] pgpool - pgpool-II: Fix ProcessBackendResponse() so that it calls
From: t-ishii@pgfoundry.org (User T-ishii)
To: pgpool-committers@pgfoundry.org
Date: Wed, 20 Jul 2011 10:41:10 +0000 (UTC)

Log Message:
-----------
Fix ProcessBackendResponse() so that it calls pool_unset_command_success()
rather than pool_set_command_success() when received Error Response.

Modified Files:
--------------
    pgpool-II:
        pool_proto_modules.c (r1.99 -> r1.100)
        (http://cvs.pgfoundry.org/cgi-bin/cvsweb.cgi/pgpool/pgpool-II/pool_proto_modules.c?r1=1.99&r2=1.100)

pool_proto_modules.c

index 2f113571d19f6c853c5248eb1359e14bc29e25bb..72d800b7ff1dd623bd078b122284c51244fbe68a 100644 (file)
@@ -1288,54 +1288,57 @@ POOL_STATUS ReadyForQuery(POOL_CONNECTION *frontend,
                pool_flush(frontend);
        }
 
-       if (pool_is_query_in_progress() && pool_is_command_success())
+       if (pool_is_query_in_progress())
        {
-               node = pool_get_parse_tree();
-               query = pool_get_query_string();
-
-               if (node)
+               if (pool_is_command_success())
                {
-                       /*
-                        * If the query was BEGIN/START TRANSACTION, clear the
-                        * history that we had a writing command in the transaction
-                        * and forget the transaction isolation level.
-                        */
-                       if (is_start_transaction_query(node))
-                       {
-                               pool_unset_writing_transaction();
-                               pool_unset_failed_transaction();
-                               pool_unset_transaction_isolation();
-                       }
+                       node = pool_get_parse_tree();
+                       query = pool_get_query_string();
 
-                       /*
-                        * SET TRANSACTION ISOLATION LEVEL SERIALIZABLE or SET
-                        * SESSION CHARACTERISTICS AS TRANSACTION ISOLATION LEVEL
-                        * SERIALIZABLE, remember it.
-                        */
-                       else if (is_set_transaction_serializable(node, query))
+                       if (node)
                        {
-                               pool_set_transaction_isolation(POOL_SERIALIZABLE);
-                       }
+                               /*
+                                * If the query was BEGIN/START TRANSACTION, clear the
+                                * history that we had a writing command in the transaction
+                                * and forget the transaction isolation level.
+                                */
+                               if (is_start_transaction_query(node))
+                               {
+                                       pool_unset_writing_transaction();
+                                       pool_unset_failed_transaction();
+                                       pool_unset_transaction_isolation();
+                               }
 
-                       /*
-                        * If 2PC commands has been executed, automatically close
-                        * transactions on standbys if there is any open
-                        * transaction since 2PC commands close transaction on
-                        * primary.
-                        */
-                       else if (is_2pc_transaction_query(node, query))
-                       {
-                               if (close_standby_transactions(frontend, backend) != POOL_CONTINUE)
-                                       return POOL_END;
-                       }
+                               /*
+                                * SET TRANSACTION ISOLATION LEVEL SERIALIZABLE or SET
+                                * SESSION CHARACTERISTICS AS TRANSACTION ISOLATION LEVEL
+                                * SERIALIZABLE, remember it.
+                                */
+                               else if (is_set_transaction_serializable(node, query))
+                               {
+                                       pool_set_transaction_isolation(POOL_SERIALIZABLE);
+                               }
 
-                       /*
-                        * If the query was not READ SELECT, remember that we had
-                        * a write query in this transaction.
-                        */
-                       else if (!is_select_query(node, query))
-                       {
-                               pool_set_writing_transaction();
+                               /*
+                                * If 2PC commands has been executed, automatically close
+                                * transactions on standbys if there is any open
+                                * transaction since 2PC commands close transaction on
+                                * primary.
+                                */
+                               else if (is_2pc_transaction_query(node, query))
+                               {
+                                       if (close_standby_transactions(frontend, backend) != POOL_CONTINUE)
+                                               return POOL_END;
+                               }
+
+                               /*
+                                * If the query was not READ SELECT, remember that we had
+                                * a write query in this transaction.
+                                */
+                               else if (!is_select_query(node, query))
+                               {
+                                       pool_set_writing_transaction();
+                               }
                        }
                }
                pool_unset_query_in_progress();