Debian Codegraph @

mysql-test/suite/ndb/t/ndb_key_protocol_timeout.test

raw
1 -- source include/have_multi_ndb.inc
2 --echo # We are using some debug-only features in this test
3 -- source include/have_debug.inc
4 -- source have_ndb_error_insert.inc
5
6 #
7 # Test of key protocol timeout behaviour
8 #
9 # Checking behaviour of system over key (PK/UK) request
10 # timeouts
11 #
12 # This test is testing the behaviour of the system
13 # when timeouts occur at the NdbApi level
14 #
15 # Multiple error insert mechanisms are used for testing
16 #
17 # API side : ndb_reduced_api_protocol_timeout
18 # This DBUG option causes the NdbApi
19 # timeout to be set to a low value
20 # (currently 2000 millis) so that blocking
21 # NdbApi calls typically return in
22 # 3 * 2 = 6s
23 #
24 # Kernel side :
25 #
26 # Key protocol timeout is expected to mostly be due
27 # to bugs
28 #
29 # A .cnf file is used to avoid TDDT getting in the
30 # way of API timeout testing
31
32 # STABILISATION_SECS is time taken for error insert
33 # cancellation to cause delayed signal loops to end
34 # and system to reach a stable state
35 #
36 let STABILISATION_SECS=4;
37
38 call mtr.add_suppression("Receive from NDB failed");
39
40 --echo Create some tables suitable for executing operations on
41 --echo -------------------------------------------------------
42 use test;
43 create table test.t1 (a int primary key, b int, key(b), c int, unique(c)) engine=ndb;
44
45 --echo Insert 40 rows
46 --let $keycount=40
47 --let $i = 0
48 while ($i < $keycount)
49 {
50 --eval insert into test.t1 values ($i, $i, $i);
51 --inc $i
52 }
53
54 --echo Take row locks in other session
55 --connection server2
56 begin;
57 select * from test.t1 where a < 10 order by a for update;
58
59 --connection server1
60
61 # Track # Api Connection records allocated
62 --source ndb_get_api_connect_count.inc
63 --let $start_api_conn_count = $api_conn_count
64
65 # Cause reduced API timeout
66 set @save_debug = @@session.debug;
67 SET SESSION debug="+d,ndb_reduced_api_protocol_timeout";
68
69 --echo ----------------------------
70 --echo Autocommit PK SELECT timeout
71 --echo ----------------------------
72
73 --error 1296
74 select * from test.t1 where a=0 for update;
75
76 # Checking pk lookups checks that all usable ApiConnectRecords can
77 # be used for a different transaction
78 --echo Check pk lookups
79 --disable_query_log
80 --disable_result_log
81 --let $i=0
82 while ($i < $keycount)
83 {
84 --eval select * from test.t1 where a=$i;
85 --inc $i
86 }
87 --enable_result_log
88 --enable_query_log
89
90 --echo Check transaction leaks
91 --source ndb_get_api_connect_count.inc
92 --disable_query_log
93 eval select $api_conn_count - $start_api_conn_count as Leaks;
94 --let $start_api_conn_count = $api_conn_count
95 --enable_query_log
96 select count(1) as ops from ndbinfo.cluster_operations;
97
98 --echo --------------------------------------
99 --echo Stateful transaction PK SELECT timeout
100 --echo --------------------------------------
101
102 begin;
103 insert into test.t1 values (100,100,100);
104 --error 1296
105 select * from test.t1 where a=2 for update;
106
107 # Checking pk lookups checks that all usable ApiConnectRecords can
108 # be used for a different transaction
109 --echo Check pk lookups
110 --disable_query_log
111 --disable_result_log
112 --let $i=0
113 while ($i < $keycount)
114 {
115 --eval select * from test.t1 where a=$i;
116 --inc $i
117 }
118 --enable_result_log
119 --enable_query_log
120
121 --echo Check transaction leaks
122 --source ndb_get_api_connect_count.inc
123 --disable_query_log
124 eval select $api_conn_count - $start_api_conn_count as Leaks;
125 --let $start_api_conn_count = $api_conn_count
126 --enable_query_log
127 select count(1) as ops from ndbinfo.cluster_operations;
128
129
130 --echo ----------------------------
131 --echo Autocommit UK SELECT timeout
132 --echo ----------------------------
133
134 --error 1296
135 select * from test.t1 where c=0 for update;
136
137 # Checking pk lookups checks that all usable ApiConnectRecords can
138 # be used for a different transaction
139 --echo Check pk lookups
140 --disable_query_log
141 --disable_result_log
142 --let $i=0
143 while ($i < $keycount)
144 {
145 --eval select * from test.t1 where a=$i;
146 --inc $i
147 }
148 --enable_result_log
149 --enable_query_log
150
151 --echo Check transaction leaks
152 --source ndb_get_api_connect_count.inc
153 --disable_query_log
154 eval select $api_conn_count - $start_api_conn_count as Leaks;
155 --let $start_api_conn_count = $api_conn_count
156 --enable_query_log
157 select count(1) as ops from ndbinfo.cluster_operations;
158
159 --echo --------------------------------------
160 --echo Stateful transaction UK SELECT timeout
161 --echo --------------------------------------
162
163 begin;
164 insert into test.t1 values (100,100,100);
165 --error 1296
166 select * from test.t1 where c=2 for update;
167
168 # Checking pk lookups checks that all usable ApiConnectRecords can
169 # be used for a different transaction
170 --echo Check pk lookups
171 --disable_query_log
172 --disable_result_log
173 --let $i=0
174 while ($i < $keycount)
175 {
176 --eval select * from test.t1 where a=$i;
177 --inc $i
178 }
179 --enable_result_log
180 --enable_query_log
181
182
183 --echo Check transaction leaks
184 --source ndb_get_api_connect_count.inc
185 --disable_query_log
186 eval select $api_conn_count - $start_api_conn_count as Leaks;
187 --let $start_api_conn_count = $api_conn_count
188 --enable_query_log
189 select count(1) as ops from ndbinfo.cluster_operations;
190
191
192
193
194
195 --connection server2
196 rollback;
197
198 --connection server1
199
200 SET SESSION debug=@save_debug;
201
202 drop table test.t1;
203