| 1 |
-- source include/have_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 scan protocol timeout behaviour |
| 8 |
# |
| 9 |
# Scans are generally more prone to protocol timeouts as |
| 10 |
# they can require access to more data, and can apply filtering |
| 11 |
# on the kernel side which results in no results being |
| 12 |
# received for a long time which can cause timeouts in |
| 13 |
# NdbApi |
| 14 |
# |
| 15 |
# This test is testing the behaviour of the system |
| 16 |
# when timeouts occur at the NdbApi level |
| 17 |
# |
| 18 |
# Multiple error insert mechanisms are used for testing |
| 19 |
# |
| 20 |
# API side : ndb_reduced_api_protocol_timeout |
| 21 |
# This DBUG option causes the NdbApi |
| 22 |
# timeout to be set to a low value |
| 23 |
# (currently 2000 millis) so that blocking |
| 24 |
# NdbApi calls typically return in |
| 25 |
# 3 * 2 = 6s |
| 26 |
# |
| 27 |
# Kernel side : 5112 (LQH) |
| 28 |
# LDM causes range scans to return |
| 29 |
# infinite results, so that a more |
| 30 |
# realistic 'busy' behaviour is |
| 31 |
# observed without affecting the |
| 32 |
# behaviour of close() mechanisms |
| 33 |
# |
| 34 |
# 8124 (TC) |
| 35 |
# TC blocks SCAN_FRAGCONF processing |
| 36 |
# This stalls nextResult() and also |
| 37 |
# the ability of scan + transaction |
| 38 |
# close() to cleanup a scan |
| 39 |
# |
| 40 |
# 17123 (SPJ) |
| 41 |
# SPJ blocks SCAN_FRAGCONF processing |
| 42 |
# This stalls nextResult() and also |
| 43 |
# the ability of scan + transaction |
| 44 |
# close() to cleanup |
| 45 |
# |
| 46 |
# Timeout is expected to be mostly a result of |
| 47 |
# operations taking too long, and occasionally a |
| 48 |
# result of bugs |
| 49 |
# |
| 50 |
# Error insert 5112 is used to represent |
| 51 |
# 'scan taking too long' and 8124 to represent |
| 52 |
# 'problem closing scan / bugs'. |
| 53 |
# |
| 54 |
# Ordered (e.g. by API) and unordered scans and SPJ |
| 55 |
# scans are taken separately as they have separate |
| 56 |
# implementations inside NdbApi |
| 57 |
# |
| 58 |
# A .cnf file is used to avoid TDDT getting in the |
| 59 |
# way of API timeout testing |
| 60 |
|
| 61 |
# STABILISATION_SECS is time taken for error insert |
| 62 |
# cancellation to cause delayed signal loops to end |
| 63 |
# and system to reach a stable state |
| 64 |
# |
| 65 |
let STABILISATION_SECS=4; |
| 66 |
|
| 67 |
call mtr.add_suppression("Receive from NDB failed"); |
| 68 |
|
| 69 |
--echo Create some tables suitable for executing operations on |
| 70 |
--echo ------------------------------------------------------- |
| 71 |
create table test.t1 (a int primary key, b int, key(b)) engine=ndb; |
| 72 |
create table test.t2 (a int primary key, b int, key(b)) engine=ndb; |
| 73 |
|
| 74 |
--echo Insert 40 rows |
| 75 |
--let $keycount=40 |
| 76 |
--let $i = 0 |
| 77 |
while ($i < $keycount) |
| 78 |
{ |
| 79 |
--eval insert into test.t1 values ($i, $i); |
| 80 |
--inc $i |
| 81 |
} |
| 82 |
|
| 83 |
insert into test.t2 select * from test.t1; |
| 84 |
|
| 85 |
|
| 86 |
|
| 87 |
--echo Show expected operation outcomes |
| 88 |
--echo -------------------------------- |
| 89 |
select * from test.t1 where a > 70 order by b; # Ordered in MySQL Server, not by API |
| 90 |
select * from test.t1 order by b; # Ordered in MySQL Server, not by API |
| 91 |
select * from test.t1 where a > 70 order by a; # Ordered by API scan |
| 92 |
select * from test.t1 order by a; # Ordered by API scan |
| 93 |
--sorted_result |
| 94 |
select t1.b, t2.b from test.t1 join test.t2 on t2.a = t1.b; # SPJ pushed join |
| 95 |
|
| 96 |
# Track # Api Connection records allocated |
| 97 |
--source ndb_get_api_connect_count.inc |
| 98 |
--let $start_api_conn_count = $api_conn_count |
| 99 |
|
| 100 |
# Cause reduced API timeout |
| 101 |
set @save_debug = @@session.debug; |
| 102 |
SET SESSION debug="+d,ndb_reduced_api_protocol_timeout"; |
| 103 |
|
| 104 |
--echo |
| 105 |
--echo ---------------------------------- |
| 106 |
--echo Unordered scan timeout due to load |
| 107 |
--echo Standalone |
| 108 |
--echo ---------------------------------- |
| 109 |
--echo Time out waiting for response, but close() cleans up |
| 110 |
|
| 111 |
# Error insert 5112 causes range scan to return infinite results |
| 112 |
--exec $NDB_MGM -e "all error 5112" |
| 113 |
|
| 114 |
# Scan using range but with empty result set - will timeout |
| 115 |
--error 1296 |
| 116 |
select * from test.t1 where a > 70 order by b; |
| 117 |
|
| 118 |
# Checking pk lookups checks that all usable ApiConnectRecords can |
| 119 |
# be used for a different transaction |
| 120 |
--echo Check pk lookups |
| 121 |
--disable_query_log |
| 122 |
--disable_result_log |
| 123 |
--let $i=0 |
| 124 |
while ($i < $keycount) |
| 125 |
{ |
| 126 |
--eval select * from test.t1 where a=$i; |
| 127 |
--inc $i |
| 128 |
} |
| 129 |
--enable_result_log |
| 130 |
--enable_query_log |
| 131 |
|
| 132 |
--exec $NDB_MGM -e "all error 0" |
| 133 |
# Give time for stabilisation |
| 134 |
--sleep $STABILISATION_SECS |
| 135 |
|
| 136 |
--echo Check transaction leaks |
| 137 |
--source ndb_get_api_connect_count.inc |
| 138 |
--disable_query_log |
| 139 |
eval select $api_conn_count - $start_api_conn_count as Leaks; |
| 140 |
--let $start_api_conn_count = $api_conn_count |
| 141 |
--enable_query_log |
| 142 |
select count(1) as ops from ndbinfo.cluster_operations; |
| 143 |
#select * from ndbinfo.cluster_operations; |
| 144 |
|
| 145 |
--echo |
| 146 |
--echo ---------------------------------- |
| 147 |
--echo Unordered scan timeout due to load |
| 148 |
--echo As part of a stateful transaction |
| 149 |
--echo ---------------------------------- |
| 150 |
--echo Time out waiting for response, but close() cleans up |
| 151 |
|
| 152 |
# Error insert 5112 causes range scan to return infinite results |
| 153 |
--exec $NDB_MGM -e "all error 5112" |
| 154 |
begin; |
| 155 |
insert into test.t1 values (54,54); |
| 156 |
|
| 157 |
# Scan using range but with empty result set - will timeout |
| 158 |
--error 1296 |
| 159 |
select * from test.t1 where a > 70 order by b; |
| 160 |
|
| 161 |
# Checking pk lookups checks that all usable ApiConnectRecords can |
| 162 |
# be used for a different transaction |
| 163 |
--echo Check pk lookups |
| 164 |
--disable_query_log |
| 165 |
--disable_result_log |
| 166 |
--let $i=0 |
| 167 |
while ($i < $keycount) |
| 168 |
{ |
| 169 |
--eval select * from test.t1 where a=$i; |
| 170 |
--inc $i |
| 171 |
} |
| 172 |
--enable_result_log |
| 173 |
--enable_query_log |
| 174 |
|
| 175 |
--exec $NDB_MGM -e "all error 0" |
| 176 |
# Give time for stabilisation |
| 177 |
--sleep $STABILISATION_SECS |
| 178 |
|
| 179 |
--echo Check transaction leaks |
| 180 |
--source ndb_get_api_connect_count.inc |
| 181 |
--disable_query_log |
| 182 |
eval select $api_conn_count - $start_api_conn_count as Leaks; |
| 183 |
--let $start_api_conn_count = $api_conn_count |
| 184 |
--enable_query_log |
| 185 |
select count(1) as ops from ndbinfo.cluster_operations; |
| 186 |
#select * from ndbinfo.cluster_operations; |
| 187 |
|
| 188 |
|
| 189 |
--echo |
| 190 |
--echo ---------------------------------- |
| 191 |
--echo Unordered scan timeout due to bug |
| 192 |
--echo ---------------------------------- |
| 193 |
--echo Standalone |
| 194 |
|
| 195 |
# Error insert 8124 causes SCAN_FRAGCONF to be delayed indefinitely |
| 196 |
# This affects nextResult() and also close() calls |
| 197 |
# So that the scan transaction object cannot be released |
| 198 |
--exec $NDB_MGM -e "all error 8124" |
| 199 |
|
| 200 |
--error 1296 |
| 201 |
select * from test.t1 order by b; |
| 202 |
|
| 203 |
# Checking pk lookups checks that all usable ApiConnectRecords can |
| 204 |
# be used for a different transaction |
| 205 |
--echo Check pk lookups |
| 206 |
--disable_query_log |
| 207 |
--disable_result_log |
| 208 |
--let $i=0 |
| 209 |
while ($i < $keycount) |
| 210 |
{ |
| 211 |
--eval select * from test.t1 where a=$i; |
| 212 |
--inc $i |
| 213 |
} |
| 214 |
--enable_result_log |
| 215 |
--enable_query_log |
| 216 |
|
| 217 |
--exec $NDB_MGM -e "all error 0" |
| 218 |
# Give time for stabilisation |
| 219 |
--sleep $STABILISATION_SECS |
| 220 |
|
| 221 |
--echo Check transaction leaks |
| 222 |
--source ndb_get_api_connect_count.inc |
| 223 |
--disable_query_log |
| 224 |
eval select $api_conn_count - $start_api_conn_count as Leaks; |
| 225 |
--let $start_api_conn_count = $api_conn_count |
| 226 |
--enable_query_log |
| 227 |
select count(1) as ops from ndbinfo.cluster_operations; |
| 228 |
#select * from ndbinfo.cluster_operations; |
| 229 |
|
| 230 |
|
| 231 |
--echo |
| 232 |
--echo ---------------------------------- |
| 233 |
--echo Unordered scan timeout due to bug |
| 234 |
--echo ---------------------------------- |
| 235 |
--echo As part of a stateful transaction |
| 236 |
|
| 237 |
# Error insert 8124 causes SCAN_FRAGCONF to be delayed indefinitely |
| 238 |
# This affects nextResult() and also close() calls |
| 239 |
# So that the scan transaction object cannot be released |
| 240 |
--exec $NDB_MGM -e "all error 8124" |
| 241 |
|
| 242 |
begin; |
| 243 |
insert into test.t1 values (54,54); |
| 244 |
--error 1296 |
| 245 |
select * from test.t1 order by b; |
| 246 |
|
| 247 |
# Checking pk lookups checks that all usable ApiConnectRecords can |
| 248 |
# be used for a different transaction |
| 249 |
--echo Check pk lookups |
| 250 |
--disable_query_log |
| 251 |
--disable_result_log |
| 252 |
--let $i=0 |
| 253 |
while ($i < $keycount) |
| 254 |
{ |
| 255 |
--eval select * from test.t1 where a=$i; |
| 256 |
--inc $i |
| 257 |
} |
| 258 |
--enable_result_log |
| 259 |
--enable_query_log |
| 260 |
|
| 261 |
--exec $NDB_MGM -e "all error 0" |
| 262 |
# Give time for stabilisation |
| 263 |
--sleep $STABILISATION_SECS |
| 264 |
|
| 265 |
--echo Check transaction leaks |
| 266 |
--source ndb_get_api_connect_count.inc |
| 267 |
--disable_query_log |
| 268 |
eval select $api_conn_count - $start_api_conn_count as Leaks; |
| 269 |
--let $start_api_conn_count = $api_conn_count |
| 270 |
--enable_query_log |
| 271 |
select count(1) as ops from ndbinfo.cluster_operations; |
| 272 |
#select * from ndbinfo.cluster_operations; |
| 273 |
|
| 274 |
|
| 275 |
|
| 276 |
--echo |
| 277 |
--echo ---------------------------------- |
| 278 |
--echo Ordered scan timeout due to load |
| 279 |
--echo Standalone |
| 280 |
--echo ---------------------------------- |
| 281 |
--echo Time out waiting for response, but close() cleans up |
| 282 |
|
| 283 |
# Error insert 5112 causes range scan to return infinite results |
| 284 |
--exec $NDB_MGM -e "all error 5112" |
| 285 |
|
| 286 |
# Scan using range but with empty result set - will timeout |
| 287 |
--error 1296 |
| 288 |
select * from test.t1 where a > 70 order by a; |
| 289 |
|
| 290 |
# Checking pk lookups checks that all usable ApiConnectRecords can |
| 291 |
# be used for a different transaction |
| 292 |
--echo Check pk lookups |
| 293 |
--disable_query_log |
| 294 |
--disable_result_log |
| 295 |
--let $i=0 |
| 296 |
while ($i < $keycount) |
| 297 |
{ |
| 298 |
--eval select * from test.t1 where a=$i; |
| 299 |
--inc $i |
| 300 |
} |
| 301 |
--enable_result_log |
| 302 |
--enable_query_log |
| 303 |
|
| 304 |
--exec $NDB_MGM -e "all error 0" |
| 305 |
# Give time for stabilisation |
| 306 |
--sleep $STABILISATION_SECS |
| 307 |
|
| 308 |
--echo Check transaction leaks |
| 309 |
--source ndb_get_api_connect_count.inc |
| 310 |
--disable_query_log |
| 311 |
eval select $api_conn_count - $start_api_conn_count as Leaks; |
| 312 |
--let $start_api_conn_count = $api_conn_count |
| 313 |
--enable_query_log |
| 314 |
select count(1) as ops from ndbinfo.cluster_operations; |
| 315 |
#select * from ndbinfo.cluster_operations; |
| 316 |
|
| 317 |
|
| 318 |
--echo |
| 319 |
--echo ---------------------------------- |
| 320 |
--echo Ordered scan timeout due to load |
| 321 |
--echo As part of a stateful transaction |
| 322 |
--echo ---------------------------------- |
| 323 |
--echo Time out waiting for response, but close() cleans up |
| 324 |
|
| 325 |
# Error insert 5112 causes range scan to return infinite results |
| 326 |
--exec $NDB_MGM -e "all error 5112" |
| 327 |
|
| 328 |
begin; |
| 329 |
insert into test.t1 values (54,54); |
| 330 |
|
| 331 |
# Scan using range but with empty result set - will timeout |
| 332 |
--error 1296 |
| 333 |
select * from test.t1 where a > 70 order by a; |
| 334 |
|
| 335 |
# Checking pk lookups checks that all usable ApiConnectRecords can |
| 336 |
# be used for a different transaction |
| 337 |
--echo Check pk lookups |
| 338 |
--disable_query_log |
| 339 |
--disable_result_log |
| 340 |
--let $i=0 |
| 341 |
while ($i < $keycount) |
| 342 |
{ |
| 343 |
--eval select * from test.t1 where a=$i; |
| 344 |
--inc $i |
| 345 |
} |
| 346 |
--enable_result_log |
| 347 |
--enable_query_log |
| 348 |
|
| 349 |
--exec $NDB_MGM -e "all error 0" |
| 350 |
# Give time for stabilisation |
| 351 |
--sleep $STABILISATION_SECS |
| 352 |
|
| 353 |
--echo Check transaction leaks |
| 354 |
--source ndb_get_api_connect_count.inc |
| 355 |
--disable_query_log |
| 356 |
eval select $api_conn_count - $start_api_conn_count as Leaks; |
| 357 |
--let $start_api_conn_count = $api_conn_count |
| 358 |
--enable_query_log |
| 359 |
select count(1) as ops from ndbinfo.cluster_operations; |
| 360 |
#select * from ndbinfo.cluster_operations; |
| 361 |
|
| 362 |
|
| 363 |
--echo |
| 364 |
--echo ---------------------------------- |
| 365 |
--echo Ordered scan timeout due to bug |
| 366 |
--echo Standalone |
| 367 |
--echo ---------------------------------- |
| 368 |
|
| 369 |
# Error insert 8124 causes SCAN_FRAGCONF to be delayed indefinitely |
| 370 |
# This affects nextResult() and also close() calls |
| 371 |
# So that the scan transaction object cannot be released |
| 372 |
--exec $NDB_MGM -e "all error 8124" |
| 373 |
|
| 374 |
--error 1296 |
| 375 |
select * from test.t1 order by a; |
| 376 |
|
| 377 |
# Checking pk lookups checks that all usable ApiConnectRecords can |
| 378 |
# be used for a different transaction |
| 379 |
--echo Check pk lookups |
| 380 |
--disable_query_log |
| 381 |
--disable_result_log |
| 382 |
--let $i=0 |
| 383 |
while ($i < $keycount) |
| 384 |
{ |
| 385 |
--eval select * from test.t1 where a=$i; |
| 386 |
--inc $i |
| 387 |
} |
| 388 |
--enable_result_log |
| 389 |
--enable_query_log |
| 390 |
|
| 391 |
--exec $NDB_MGM -e "all error 0" |
| 392 |
# Give time for stabilisation |
| 393 |
--sleep $STABILISATION_SECS |
| 394 |
|
| 395 |
--echo Check transaction leaks |
| 396 |
--source ndb_get_api_connect_count.inc |
| 397 |
--disable_query_log |
| 398 |
eval select $api_conn_count - $start_api_conn_count as Leaks; |
| 399 |
--let $start_api_conn_count = $api_conn_count |
| 400 |
--enable_query_log |
| 401 |
select count(1) as ops from ndbinfo.cluster_operations; |
| 402 |
#select * from ndbinfo.cluster_operations; |
| 403 |
|
| 404 |
|
| 405 |
|
| 406 |
--echo |
| 407 |
--echo ---------------------------------- |
| 408 |
--echo Ordered scan timeout due to bug |
| 409 |
--echo As part of a stateful transaction |
| 410 |
--echo ---------------------------------- |
| 411 |
|
| 412 |
# Error insert 8124 causes SCAN_FRAGCONF to be delayed indefinitely |
| 413 |
# This affects nextResult() and also close() calls |
| 414 |
# So that the scan transaction object cannot be released |
| 415 |
|
| 416 |
--exec $NDB_MGM -e "all error 8124" |
| 417 |
|
| 418 |
begin; |
| 419 |
insert into test.t1 values (54,54); |
| 420 |
--error 1296 |
| 421 |
select * from test.t1 order by a; |
| 422 |
|
| 423 |
# Checking pk lookups checks that all usable ApiConnectRecords can |
| 424 |
# be used for a different transaction |
| 425 |
--echo Check pk lookups |
| 426 |
--disable_query_log |
| 427 |
--disable_result_log |
| 428 |
--let $i=0 |
| 429 |
while ($i < $keycount) |
| 430 |
{ |
| 431 |
--eval select * from test.t1 where a=$i; |
| 432 |
--inc $i |
| 433 |
} |
| 434 |
--enable_result_log |
| 435 |
--enable_query_log |
| 436 |
|
| 437 |
--exec $NDB_MGM -e "all error 0" |
| 438 |
# Give time for stabilisation |
| 439 |
--sleep $STABILISATION_SECS |
| 440 |
|
| 441 |
--echo Check transaction leaks |
| 442 |
--source ndb_get_api_connect_count.inc |
| 443 |
--disable_query_log |
| 444 |
eval select $api_conn_count - $start_api_conn_count as Leaks; |
| 445 |
--let $start_api_conn_count = $api_conn_count |
| 446 |
--enable_query_log |
| 447 |
select count(1) as ops from ndbinfo.cluster_operations; |
| 448 |
#select * from ndbinfo.cluster_operations; |
| 449 |
|
| 450 |
--echo |
| 451 |
--echo ------------------------------- |
| 452 |
--echo SPJ request timeout due to load |
| 453 |
--echo ------------------------------- |
| 454 |
--echo Standalone |
| 455 |
|
| 456 |
# Error insert 5112 causes SPJ request timeout, but close is unaffected |
| 457 |
--exec $NDB_MGM -e "all error 5112" |
| 458 |
|
| 459 |
--sorted_result |
| 460 |
--error 1296 |
| 461 |
select t1.b, t2.b from test.t1 join test.t2 on t2.a = t1.b where t1.a > 70; |
| 462 |
|
| 463 |
# Checking pk lookups checks that all usable ApiConnectRecords can |
| 464 |
# be used for a different transaction |
| 465 |
--echo Check pk lookups |
| 466 |
--disable_query_log |
| 467 |
--disable_result_log |
| 468 |
--let $i=0 |
| 469 |
while ($i < $keycount) |
| 470 |
{ |
| 471 |
--eval select * from test.t1 where a=$i; |
| 472 |
--inc $i |
| 473 |
} |
| 474 |
--enable_result_log |
| 475 |
--enable_query_log |
| 476 |
|
| 477 |
--echo Clear error condition |
| 478 |
--exec $NDB_MGM -e "all error 0" |
| 479 |
--sleep $STABILISATION_SECS |
| 480 |
|
| 481 |
--echo Check transaction leaks |
| 482 |
--source ndb_get_api_connect_count.inc |
| 483 |
--disable_query_log |
| 484 |
eval select $api_conn_count - $start_api_conn_count as Leaks; |
| 485 |
--let $start_api_conn_count = $api_conn_count |
| 486 |
--enable_query_log |
| 487 |
select count(1) as ops from ndbinfo.cluster_operations; |
| 488 |
|
| 489 |
--echo |
| 490 |
--echo ------------------------------- |
| 491 |
--echo SPJ request timeout due to load |
| 492 |
--echo ------------------------------- |
| 493 |
--echo As part of a stateful transaction |
| 494 |
|
| 495 |
# Error insert 5112 causes SPJ request timeout, but close is unaffected |
| 496 |
--exec $NDB_MGM -e "all error 5112" |
| 497 |
|
| 498 |
begin; |
| 499 |
insert into test.t1 values (54,54); |
| 500 |
|
| 501 |
--sorted_result |
| 502 |
--error 1296 |
| 503 |
select t1.b, t2.b from test.t1 join test.t2 on t2.a = t1.b where t1.a > 70; |
| 504 |
|
| 505 |
--echo Clear error condition |
| 506 |
--exec $NDB_MGM -e "all error 0" |
| 507 |
--sleep $STABILISATION_SECS |
| 508 |
|
| 509 |
# Checking pk lookups checks that all usable ApiConnectRecords can |
| 510 |
# be used for a different transaction |
| 511 |
--echo Check pk lookups |
| 512 |
--disable_query_log |
| 513 |
--disable_result_log |
| 514 |
--let $i=0 |
| 515 |
while ($i < $keycount) |
| 516 |
{ |
| 517 |
--eval select * from test.t1 where a=$i; |
| 518 |
--inc $i |
| 519 |
} |
| 520 |
--enable_result_log |
| 521 |
--enable_query_log |
| 522 |
|
| 523 |
--echo Check transaction leaks |
| 524 |
--source ndb_get_api_connect_count.inc |
| 525 |
--disable_query_log |
| 526 |
eval select $api_conn_count - $start_api_conn_count as Leaks; |
| 527 |
--let $start_api_conn_count = $api_conn_count |
| 528 |
--enable_query_log |
| 529 |
select count(1) as ops from ndbinfo.cluster_operations; |
| 530 |
|
| 531 |
--echo |
| 532 |
--echo ------------------------------ |
| 533 |
--echo SPJ request timeout due to bug |
| 534 |
--echo ------------------------------ |
| 535 |
--echo Standalone |
| 536 |
|
| 537 |
# Error insert 17123 causes SPJ request and close() to timeout |
| 538 |
--exec $NDB_MGM -e "all error 17123" |
| 539 |
|
| 540 |
--sorted_result |
| 541 |
--error 1296 |
| 542 |
select t1.b, t2.b from test.t1 join test.t2 on t2.a = t1.b; |
| 543 |
|
| 544 |
# Checking pk lookups checks that all usable ApiConnectRecords can |
| 545 |
# be used for a different transaction |
| 546 |
--echo Check pk lookups |
| 547 |
--disable_query_log |
| 548 |
--disable_result_log |
| 549 |
--let $i=0 |
| 550 |
while ($i < $keycount) |
| 551 |
{ |
| 552 |
--eval select * from test.t1 where a=$i; |
| 553 |
--inc $i |
| 554 |
} |
| 555 |
--enable_result_log |
| 556 |
--enable_query_log |
| 557 |
|
| 558 |
--echo Clear error condition |
| 559 |
--exec $NDB_MGM -e "all error 0" |
| 560 |
--sleep $STABILISATION_SECS |
| 561 |
|
| 562 |
--echo Check transaction leaks |
| 563 |
--source ndb_get_api_connect_count.inc |
| 564 |
--disable_query_log |
| 565 |
eval select $api_conn_count - $start_api_conn_count as Leaks; |
| 566 |
--let $start_api_conn_count = $api_conn_count |
| 567 |
--enable_query_log |
| 568 |
select count(1) as ops from ndbinfo.cluster_operations; |
| 569 |
|
| 570 |
|
| 571 |
--echo |
| 572 |
--echo ------------------------------- |
| 573 |
--echo SPJ request timeout due to bug |
| 574 |
--echo ------------------------------ |
| 575 |
--echo As part of a stateful transaction |
| 576 |
# Error insert 17123 causes SPJ request and close() to timeout |
| 577 |
--exec $NDB_MGM -e "all error 17123" |
| 578 |
|
| 579 |
begin; |
| 580 |
insert into test.t1 values (54,54); |
| 581 |
--sorted_result |
| 582 |
--error 1296 |
| 583 |
select t1.b, t2.b from test.t1 join test.t2 on t2.a = t1.b; |
| 584 |
|
| 585 |
# Checking pk lookups checks that all usable ApiConnectRecords can |
| 586 |
# be used for a different transaction |
| 587 |
--echo Check pk lookups |
| 588 |
--disable_query_log |
| 589 |
--disable_result_log |
| 590 |
--let $i=0 |
| 591 |
while ($i < $keycount) |
| 592 |
{ |
| 593 |
--eval select * from test.t1 where a=$i; |
| 594 |
--inc $i |
| 595 |
} |
| 596 |
--enable_result_log |
| 597 |
--enable_query_log |
| 598 |
|
| 599 |
--echo Clear error condition |
| 600 |
--exec $NDB_MGM -e "all error 0" |
| 601 |
--sleep $STABILISATION_SECS |
| 602 |
|
| 603 |
--echo Check transaction leaks |
| 604 |
--source ndb_get_api_connect_count.inc |
| 605 |
--disable_query_log |
| 606 |
eval select $api_conn_count - $start_api_conn_count as Leaks; |
| 607 |
--let $start_api_conn_count = $api_conn_count |
| 608 |
--enable_query_log |
| 609 |
select count(1) as ops from ndbinfo.cluster_operations; |
| 610 |
|
| 611 |
|
| 612 |
|
| 613 |
SET SESSION debug=@save_debug; |
| 614 |
|
| 615 |
# Show that after all of the above, with error insertions disabled, |
| 616 |
# we can process requests like normal (e.g. nothing is broken) |
| 617 |
--echo Normal requests |
| 618 |
--echo --------------- |
| 619 |
select * from test.t1 where a=3 for update; |
| 620 |
select * from test.t1 order by b; |
| 621 |
select * from test.t1 order by a; |
| 622 |
--sorted_result |
| 623 |
select t1.b, t2.b from test.t1 join test.t2 on t2.a = t1.b; |
| 624 |
|
| 625 |
update test.t1 set b=b+1; |
| 626 |
|
| 627 |
--echo Wait to show that subsequent actions do not cause reclamation |
| 628 |
--sleep 20 |
| 629 |
|
| 630 |
--source ndb_get_api_connect_count.inc |
| 631 |
--disable_query_log |
| 632 |
eval select $api_conn_count - $start_api_conn_count as Leaks; |
| 633 |
--let $start_api_conn_count = $api_conn_count |
| 634 |
--enable_query_log |
| 635 |
select count(1) as ops from ndbinfo.cluster_operations; |
| 636 |
#select * from ndbinfo.cluster_operations; |
| 637 |
|
| 638 |
drop table test.t1; |
| 639 |
drop table test.t2; |
| 640 |
|
| 641 |
|
| 642 |
|
| 643 |
# Cause reduced API timeout |
| 644 |
set @save_debug = @@session.debug; |
| 645 |
SET SESSION debug="+d,ndb_reduced_api_protocol_timeout"; |
| 646 |
|
| 647 |
--echo Determine our NdbApi connection id |
| 648 |
--source suite/ndb/include/get_ndb_connection_id.inc |
| 649 |
#--echo My cluster connection is $ndb_connection_id; |
| 650 |
|
| 651 |
--echo Determine row ids used to control data nodes involved |
| 652 |
|
| 653 |
# Put 100 rows into a table |
| 654 |
--disable_query_log |
| 655 |
--disable_result_log |
| 656 |
--let $rows = 100 |
| 657 |
create table test.t1 (a int primary key, nodeid int) engine=ndb comment="NDB_TABLE=READ_BACKUP=0"; |
| 658 |
|
| 659 |
while ($rows) |
| 660 |
{ |
| 661 |
--eval insert into test.t1 values ($rows, 0) |
| 662 |
--dec $rows |
| 663 |
} |
| 664 |
|
| 665 |
# Iterate over all rows, determining which data node holds |
| 666 |
# the primary replica + storing that in the row's nodeid column |
| 667 |
# |
| 668 |
--let $rows = query_get_value('select count(1) as c from test.t1', c, 1) |
| 669 |
while ($rows) |
| 670 |
{ |
| 671 |
begin; |
| 672 |
--eval select * from test.t1 where a = $rows lock in share mode; |
| 673 |
|
| 674 |
let $nodeid = query_get_value(select node_id from ndbinfo.cluster_operations where tableid = (select id from ndbinfo.dict_obj_info where fq_name like '%t1%') limit 1, node_id, 1); |
| 675 |
--eval update test.t1 set nodeid = $nodeid where a=$rows; |
| 676 |
commit; |
| 677 |
--dec $rows |
| 678 |
} |
| 679 |
--enable_result_log |
| 680 |
--enable_query_log |
| 681 |
|
| 682 |
# Choose two semi-arbitrary key values, one on each data node |
| 683 |
|
| 684 |
let $node1_row_key = query_get_value('select a from test.t1 where nodeid=1 limit 1', a, 1); |
| 685 |
let $node2_row_key = query_get_value('select a from test.t1 where nodeid=2 limit 1', a, 1); |
| 686 |
|
| 687 |
#--echo Node1 row : $node1_row_key |
| 688 |
#--echo Node2 row : $node2_row_key |
| 689 |
|
| 690 |
--echo Drop down to just the row on node 1 |
| 691 |
--disable_query_log |
| 692 |
--eval delete from test.t1 where a != $node1_row_key |
| 693 |
--enable_query_log |
| 694 |
|
| 695 |
--echo Block send from node 1 to our API |
| 696 |
|
| 697 |
--exec $NDB_MGM -e "1 DUMP 9988 $ndb_connection_id" > /dev/null |
| 698 |
|
| 699 |
--echo Hint transaction to node 2 |
| 700 |
--disable_query_log |
| 701 |
begin; |
| 702 |
--eval select * from test.t1 where a = $node2_row_key; |
| 703 |
|
| 704 |
--echo Send select of all - will hang |
| 705 |
--send select * from test.t1; |
| 706 |
|
| 707 |
--echo Now cause restart of node 1 |
| 708 |
|
| 709 |
--exec $NDB_MGM -e "1 RESTART -a -f" |
| 710 |
|
| 711 |
--echo Wait for data node to restart |
| 712 |
--exec $NDB_WAITER > /dev/null |
| 713 |
|
| 714 |
--echo Reap query - will get timeout error |
| 715 |
--error 1296 |
| 716 |
--reap |
| 717 |
--enable_query_log |
| 718 |
|
| 719 |
--echo Issue more queries to check all is well |
| 720 |
--disable_result_log |
| 721 |
select * from test.t1; |
| 722 |
select * from test.t1; |
| 723 |
select * from test.t1; |
| 724 |
--enable_result_log |
| 725 |
|
| 726 |
--echo Cleanup |
| 727 |
|
| 728 |
drop table test.t1; |
| 729 |
|
| 730 |
SET SESSION debug=@save_debug; |
| 731 |
|