View Issue Details

IDProjectCategoryView StatusLast Update
0000355Pgpool-IIBugpublic2017-10-18 21:02
Reportervouillon Assigned Tot-ishii  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionopen 
Product Version3.6.3 
Fixed in Version3.6.6 
Summary0000355: SELECT queries are not load balanced after a commit (when using extended queries)
DescriptionAs far as we can see, SELECT queries performed using an extended query outside an explicit transaction are not load balanced after a commit also performed using an extended query.
Additional InformationWhen performing a commit using an extended query message, the writing transaction is initially set when receiving the Execute command from the front-end (in frontend,./protocol/pool_proto_modules.c):
                if (!is_select_query(node, query) && !is_start_transaction_query (node))
                {
                                [...]
                                pool_set_writing_transaction();
                        }
                }
The query in progress flag is then cleared when receiving the CommandComplete message from the back-end:
                        case 'C': /* CommandComplete */
                                status = CommandComplete(frontend, backend, true);
                                pool_set_command_success();
                                if (pool_is_doing_extended_query_message())
                                        pool_unset_query_in_progress();
                                break;
When receiving the ReadyForQuery message from the back-end, the writing transaction flag is therefore not cleared:
         if (pool_is_query_in_progress())
        {
                 [...]
                               else if (is_commit_or_rollback_query(node))
                                {
                                        pool_unset_writing_transaction();
                                        pool_unset_failed_transaction();
                                        pool_unset_transaction_isolation();
                                }
Finally, since the writing transaction flag remains set, queries are thereafter directed to the master back-end when processing the Bind message from the server:
        if (pool_config->load_balance_mode && pool_is_writing_transaction())
        {
                [...]
                if (parse_before_bind(frontend, backend, parse_msg, bind_msg) != POOL_CONTINUE)
                        return POOL_END;
        }

I join a log showing that the writing transaction is set ("DEBUG: session context: setting writing transaction. DONE") but not cleared, and that function parse_before_bind is then called ("DEBUG: parse before bind").
TagsNo tags attached.

Activities

vouillon

2017-10-17 19:42

reporter  

log2 (52,629 bytes)   
log2 (52,629 bytes)   

t-ishii

2017-10-17 20:33

developer   ~0001760

This was fixed in 3.6.6. Please try the version.

vouillon

2017-10-18 20:57

reporter   ~0001765

Indeed, this is fixed in 3.6.6. Great!

t-ishii

2017-10-18 21:01

developer   ~0001766

Thanks for confirmation!
I am going to close this issue.

Issue History

Date Modified Username Field Change
2017-10-17 19:42 vouillon New Issue
2017-10-17 19:42 vouillon File Added: log2
2017-10-17 20:33 t-ishii Note Added: 0001760
2017-10-18 10:46 t-ishii Assigned To => t-ishii
2017-10-18 10:46 t-ishii Status new => feedback
2017-10-18 20:57 vouillon Note Added: 0001765
2017-10-18 20:57 vouillon Status feedback => assigned
2017-10-18 21:01 t-ishii Note Added: 0001766
2017-10-18 21:02 t-ishii Status assigned => closed
2017-10-18 21:02 t-ishii Fixed in Version => 3.6.6