Fix load balance in snapshot isolation mode.
authorTatsuo Ishii <ishii@sraoss.co.jp>
Thu, 25 Jun 2020 23:36:20 +0000 (08:36 +0900)
committerTatsuo Ishii <ishii@sraoss.co.jp>
Thu, 25 Jun 2020 23:36:20 +0000 (08:36 +0900)
Commit:6f35af7485732bebec33c174ca7276fe5a62fc06
broke the case when SELECT is in a none read only transaction.

src/context/pool_query_context.c

index e2d9941b8facc9e6af2be0996cbb6e7da979d82d..dd75eda570aa05dc52625e1a3a958a37156488a2 100644 (file)
@@ -663,13 +663,11 @@ pool_where_to_send(POOL_QUERY_CONTEXT * query_context, char *query, Node *node)
                                         */
                                        if (session_context->transaction_read_only)
                                        {
+                                               /* Ok, we can load balance. We are done! */
                                                set_load_balance_info(query_context);
+                                               set_virtual_master_node(query_context);
+                                               return;
                                        }
-
-                                       /* Set virtual master node according to the where_to_send map. */
-                                       set_virtual_master_node(query_context);
-
-                                       return;
                                }
                                else if (TSTATE(backend, MASTER_NODE_ID) == 'I')
                                {
@@ -695,7 +693,7 @@ pool_where_to_send(POOL_QUERY_CONTEXT * query_context, char *query, Node *node)
 
                                        if (load_balance)
                                        {
-                                               /* Ok, we can load balance. We are don! */
+                                               /* Ok, we can load balance. We are done! */
                                                set_load_balance_info(query_context);
                                                set_virtual_master_node(query_context);
                                                return;