summaryrefslogtreecommitdiff
path: root/src/test/extended-query-test/tests/disable-load-balance-default.data
blob: ff347628c6aeddc18558a3e4d65853a8a8ea3924 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# Test for disable_load_balance_on_write feature.
#

# Force load balance node to 1.
##backend_weight0 = 0
##backend_weight1 = 1

# 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'

# Start a transaction
'P'	""	"BEGIN"	0
'B'	""	""	0	0	0
'E'	""	0

# 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
'B'	""	""	0	0	0
'E'	""	0

# Issue Bind/Execute SELECT. This should be sent to primary node.
'B'	""	"S1"	0	0	0
'E'	""	0

# Issue another SELECT. This should be sent to primary node.
'P'	""	"SELECT 2"
'B'	""	""	0	0	0
'E'	""	0

# Issue COMMIT
'P'	""	"COMMIT"	0
'B'	""	""	0	0	0
'E'	""	0
'S'
'Y'

# Issue another SELECT. This should be sent to node 1 because outside a transaction.
'P'	""	"SELECT 3"
'B'	""	""	0	0	0
'E'	""	0
'S'
'Y'

# Start a transaction
'P'	""	"BEGIN"	0
'B'	""	""	0	0	0
'E'	""	0

# Issue Bind/Execute SELECT. This should be sent to node 0 despite
# disable_load_balance_on_write = 'transaction' because previous prase
# messge was sent to primary node which was done by parse_before_bind.
'B'	""	"S1"	0	0	0
'E'	""	0

# Issue another SELECT. This should be sent to node 1.
'P'	""	"SELECT 4"
'B'	""	""	0	0	0
'E'	""	0

# Issue COMMIT
'P'	""	"COMMIT"	0
'B'	""	""	0	0	0
'E'	""	0
'C'	'S'	"S1"
'S'
'Y'

# DROP test table
'Q'	"DROP TABLE pgproto_test1"
'Y'

'X'