summaryrefslogtreecommitdiff
path: root/src/test/extended-query-test/tests/disable-load-balance-simple-black-function.data
blob: d16f7e0203a2614124e4abac9a77aba6c10cd5f5 (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
# Test for disable_load_balance_on_write on write function feature
# using simple queries.

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

##write_function_list = 'f1'

# Disable load balance in current transaction only. (disable_load_balance_on_write = 'transaction')
# (default behavior)

# Create test read_only function
'Q'	"DROP FUNCTION IF EXISTS f1"
'Y'
'Q'	"CREATE FUNCTION f1(INTEGER) returns INTEGER AS 'SELECT $1' LANGUAGE SQL"
'Y'

# Start a transaction
'Q'	"BEGIN"
'Y'

# Issue Parse SELECT. This should be sent to node 1.
'Q'	"SELECT 1"
'Y'

# Issue INSERT
'Q'	"SELECT f1(1)"
'Y'

# Issue another SELECT. This should be sent to primary node.
'Q'	"SELECT 2"
'Y'

# Issue COMMIT
'Q'	"COMMIT"
'Y'

# Issue another SELECT. This should be sent to node 1 because outside a transaction.
'Q'	"SELECT 3"
'Y'

# Start a transaction
'Q'	"BEGIN"
'Y'

# Issue another SELECT. This should be sent to standby node.
'Q'	"SELECT 4"
'Y'

# Issue COMMIT
'Q'	"COMMIT"
'Y'

# DROP test table
'Q'	"DROP FUNCTION f1"
'Y'

'X'