Fix test failure of extended-query-test/disable-load-balance-always.
authorTatsuo Ishii <ishii@sraoss.co.jp>
Sun, 11 Aug 2019 02:27:58 +0000 (11:27 +0900)
committerTatsuo Ishii <ishii@sraoss.co.jp>
Sun, 11 Aug 2019 02:27:58 +0000 (11:27 +0900)
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.

src/test/extended-query-test/expected/disable-load-balance-always.data
src/test/extended-query-test/tests/disable-load-balance-always.data

index 6a03a7fab20c3ab88f719d2a56b223aaffb9ddf1..b0de24a86726d881b7931c42dcb3b36586664790 100644 (file)
@@ -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
index 1e0f9f7f444b1b2cd5ed5d6cd63668ac6b959427..de14f24e38c789fad820ab4a593e35f390450bb9 100644 (file)
@@ -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
 
 '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'
 'Q'    "COMMIT"
 'Y'
 
-# DROP test table
-'Q'    "DROP TABLE pgproto_test1"
-'Y'
-
 'X'