From: Tatsuo Ishii Date: Sun, 11 Aug 2019 02:27:58 +0000 (+0900) Subject: Fix test failure of extended-query-test/disable-load-balance-always. X-Git-Tag: V4_1_0_BETA1~38 X-Git-Url: http://git.postgresql.org/gitweb/?a=commitdiff_plain;h=abe2026bff6d4727bf56813c71293ea6ac7084d0;p=pgpool2.git Fix test failure of extended-query-test/disable-load-balance-always. It expected the first SELECT to be sent to load balance node but a preceding write query (DROP/CREATE TABLE) prevented it because it set the writing_transaction flag. Fix is, instead of issuing DROP/CREATE TABLE before the SELECT, issue harmless SET command after the SELECT in extended query mode. --- diff --git a/src/test/extended-query-test/expected/disable-load-balance-always.data b/src/test/extended-query-test/expected/disable-load-balance-always.data index 6a03a7fab..b0de24a86 100644 --- a/src/test/extended-query-test/expected/disable-load-balance-always.data +++ b/src/test/extended-query-test/expected/disable-load-balance-always.data @@ -1,15 +1,8 @@ -FE=> Query (query="DROP TABLE IF EXISTS pgproto_test1") -<= BE NoticeResponse(S NOTICE V NOTICE C 00000 M table "pgproto_test1" does not exist, skipping F tablecmds.c L 914 R DropErrorMsgNonExistent ) -<= BE CommandComplete(DROP TABLE) -<= BE ReadyForQuery(I) -FE=> Query (query="CREATE TABLE pgproto_test1(i INT)") -<= BE CommandComplete(CREATE TABLE) -<= BE ReadyForQuery(I) FE=> Parse(stmt="", query="BEGIN") FE=> Bind(stmt="", portal="") FE=> Execute(portal="") FE=> Parse(stmt="S1", query="SELECT 1") -FE=> Parse(stmt="", query="INSERT INTO pgproto_test1 VALUES(1)") +FE=> Parse(stmt="", query="SET debug_print_parse = off") FE=> Bind(stmt="", portal="") FE=> Execute(portal="") FE=> Bind(stmt="S1", portal="") @@ -27,7 +20,7 @@ FE=> Sync <= BE ParseComplete <= BE ParseComplete <= BE BindComplete -<= BE CommandComplete(INSERT 0 1) +<= BE CommandComplete(SET) <= BE BindComplete <= BE DataRow <= BE CommandComplete(SELECT 1) @@ -84,9 +77,6 @@ FE=> Query (query="SELECT 1") <= BE DataRow <= BE CommandComplete(SELECT 1) <= BE ReadyForQuery(T) -FE=> Query (query="INSERT INTO pgproto_test1 VALUES(1)") -<= BE CommandComplete(INSERT 0 1) -<= BE ReadyForQuery(T) FE=> Query (query="SELECT 2") <= BE RowDescription <= BE DataRow @@ -111,7 +101,4 @@ FE=> Query (query="SELECT 4") FE=> Query (query="COMMIT") <= BE CommandComplete(COMMIT) <= BE ReadyForQuery(I) -FE=> Query (query="DROP TABLE pgproto_test1") -<= BE CommandComplete(DROP TABLE) -<= BE ReadyForQuery(I) FE=> Terminate diff --git a/src/test/extended-query-test/tests/disable-load-balance-always.data b/src/test/extended-query-test/tests/disable-load-balance-always.data index 1e0f9f7f4..de14f24e3 100644 --- a/src/test/extended-query-test/tests/disable-load-balance-always.data +++ b/src/test/extended-query-test/tests/disable-load-balance-always.data @@ -4,15 +4,9 @@ # Force load balance node to 1. ##backend_weight0 = 0 ##backend_weight1 = 1 +##disable_load_balance_on_write = 'always' -# Disable load balance in current transaction only. -# (default behavior) - -# Create test table -'Q' "DROP TABLE IF EXISTS pgproto_test1" -'Y' -'Q' "CREATE TABLE pgproto_test1(i INT)" -'Y' +# Always disable load balance. # Start a transaction 'P' "" "BEGIN" 0 @@ -22,8 +16,8 @@ # Issue Parse SELECT. This should be sent to node 1. 'P' "S1" "SELECT 1" 0 -# Issue INSERT -'P' "" "INSERT INTO pgproto_test1 VALUES(1)" 0 +# Issue query treaed as write query +'P' "" "SET debug_print_parse = off" 0 'B' "" "" 0 0 0 'E' "" 0 @@ -84,10 +78,6 @@ 'Q' "SELECT 1" 'Y' -# Issue INSERT -'Q' "INSERT INTO pgproto_test1 VALUES(1)" -'Y' - # Issue another SELECT. This should be sent to primary node. 'Q' "SELECT 2" 'Y' @@ -112,8 +102,4 @@ 'Q' "COMMIT" 'Y' -# DROP test table -'Q' "DROP TABLE pgproto_test1" -'Y' - 'X'