File: get_table_share.result

package info (click to toggle)
mysql-8.0 8.0.43-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,273,924 kB
  • sloc: cpp: 4,684,605; ansic: 412,450; pascal: 108,398; java: 83,641; perl: 30,221; cs: 27,067; sql: 26,594; sh: 24,181; python: 21,816; yacc: 17,169; php: 11,522; xml: 7,388; javascript: 7,076; makefile: 2,194; lex: 1,075; awk: 670; asm: 520; objc: 183; ruby: 97; lisp: 86
file content (561 lines) | stat: -rw-r--r-- 21,415 bytes parent folder | download
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
###########################################################
#
# Test cases for wl#7593: Don't hold LOCK_open... and
# bug #19881395 "FREEZE OF SERVER, FLUSH TABLE VERSUS
# CONCURRENT DDL/DML".
#
# 1) The first basic scenario is based on concurrency and
# sequencing of three threads: Let thread TA1 open table ta,
# while thread TB1 and TB2 open table tb. Now, we have various
# possible situations that are considered in the three first
# test cases below, which are all based on this point of
# departure, referred to as (1) below.
#
# 2) The second basic scenario is based on three threads: Let
# thread TB1 and TB2 open table tb, while thread TA1 issues a
# FLUSH TABLES in order to flush the cache while a share is
# being initialized. The three last test cases are variants of
# this scenario, referred to as (2) below. One of them covers
# scenario in which bug #19881395 has occurred.
#
# 3) The third scenario is based on two threads: One thread
# doing CREATE TABLE while another issues LOCK TABLE on the
# same table. There is one test case based on this scenario.
#
# 4) The fourth scenario is based on two threads: One thread
# TB1 opening table tb, being paused while opening the share,
# while another thread TB2 issues the SQL command SHOW OPEN
# TABLES. Then, we verify that the table being opened is excluded
# from the list of open tables. A related test case is relevant
# in the context of the federated storage engine, and is located
# in suite/federated/federated_get_table_share.test.
#
###########################################################
#
# Test setup: Create three reusable connections:
#
connect  con_TA1, localhost, root;
connect  con_TB1, localhost, root;
connect  con_TB2, localhost, root;
###########################################################
#
# Test case 1.1: After 1), verify that if thread TA1
# broadcasts COND_open first, thread TB2 will wake up,
# re-fetch its share and see that m_open_in_progress is
# still true, and then continue waiting for COND_open.
#
#
connection default;
# Create two tables:
CREATE TABLE ta (pk integer primary key);
CREATE TABLE tb (pk integer primary key);
#
# Warm-up data-dictionary cache but keep Table Definition Cache intact.
#
#
connection con_TA1;
# Wait after releasing LOCK_open for ta, and make sure we never
# end up at the 'found_share' sync point:
SET DEBUG_SYNC= 'get_share_before_open SIGNAL open_TA1 WAIT_FOR cont_TA1';
SET DEBUG_SYNC= 'get_share_found_share HIT_LIMIT 1';
INSERT INTO ta VALUES(1);
#
connection con_TB1;
# Wait for open_TA1, then wait after releasing LOCK_open for tb,
# also make sure we never end up at the 'found_share' sync point:
SET DEBUG_SYNC= 'now WAIT_FOR open_TA1';
SET DEBUG_SYNC= 'get_share_before_open SIGNAL open_TB1 WAIT_FOR cont_TB1';
SET DEBUG_SYNC= 'get_share_found_share HIT_LIMIT 1';
INSERT INTO tb VALUES(1);
#
connection con_TB2;
# Wait for open_TB1, then wait after the tb share is found in the
# TDC. Wake up when TA1 broadcasts COND_open, then go back to wait
# since a different share (ta) was opened. Finally stop at the
# 'found_share' sync point to verify that the share being addressed
# is now available. Also make sure we never end up at the
# 'before_open' sync point:
SET DEBUG_SYNC= 'now WAIT_FOR open_TB1';
SET DEBUG_SYNC= 'get_share_found_share SIGNAL found_TB2';
SET DEBUG_SYNC= 'get_share_before_open HIT_LIMIT 1';
INSERT INTO tb VALUES(2);
#
connection default;
# Now, we know that TA1 and TB1 are about to open the shares
# for ta and tb concurrently. We also know that TB2 is about to
# wait for COND_open. First issue then is to make sure TB2 waits
# for COND_open (using P_S.events_waits_current, not logged here):
#
# Then we save the event id for later:
SET @first_wait_id= 0;
SELECT event_id FROM performance_schema.events_waits_current
WHERE event_name LIKE '%COND_open' INTO @first_wait_id;
#
# Next up is to make one of the opening threads read the definition.
# Here, we let TA1 read first:
SET DEBUG_SYNC= 'now SIGNAL cont_TA1';
#
# Then, we make sure TB2 leaves the wait for COND_open, and then
# waits for it once more. Verify this by waiting for the event_id
# to change:
#
# Then, we signal TB1 to make it open its def and do its things,
# this will also wake up TB2 (now waiting on the COND_open):
SET DEBUG_SYNC= 'now SIGNAL cont_TB1';
#
# And at last, we wait for TB2 to signal that it found its share:
SET DEBUG_SYNC= 'now WAIT_FOR found_TB2';
#
# Reap the connections, reset DEBUG_SYNC and drop tables:
connection con_TA1;
connection con_TB1;
connection con_TB2;
connection default;
SET DEBUG_SYNC= 'RESET';
DROP TABLE ta, tb;
###########################################################
#
# Test case 1.2: After 1), verify that if thread TB1
# broadcasts COND_open first, thread TB2 will wake up,
# re-fetch its share and see that m_open_in_progress is
# false, and then continue under the assumption that the
# expected share is found.
#
#
connection default;
# Create two tables:
CREATE TABLE ta (pk integer primary key);
CREATE TABLE tb (pk integer primary key);
#
# Warm-up data-dictionary cache but keep Table Definition Cache intact.
#
#
connection con_TA1;
# Wait after releasing LOCK_open for ta, and make sure we never
# end up at the 'found_share' sync point:
SET DEBUG_SYNC= 'get_share_before_open SIGNAL open_TA1 WAIT_FOR cont_TA1';
SET DEBUG_SYNC= 'get_share_found_share HIT_LIMIT 1';
INSERT INTO ta VALUES(1);
#
connection con_TB1;
# Wait for open_TA1, then wait after releasing LOCK_open for tb,
# also make sure we never end up at the 'found_share' sync point:
SET DEBUG_SYNC= 'now WAIT_FOR open_TA1';
SET DEBUG_SYNC= 'get_share_before_open SIGNAL open_TB1 WAIT_FOR cont_TB1';
SET DEBUG_SYNC= 'get_share_found_share HIT_LIMIT 1';
INSERT INTO tb VALUES(1);
#
connection con_TB2;
# Wait for open_TB1, then wait after the tb share is found in the
# TDC. Wake up when TB1 broadcasts COND_open, jump to 'found' since
# the awaited share (tb) was opened by TB1 before TA1 opened ta.
# Signal when at the 'found_share' sync point so we can verify that the
# thread is at the expected point. Also make sure we never end up
# at the 'before_open' sync point:
SET DEBUG_SYNC= 'now WAIT_FOR open_TB1';
SET DEBUG_SYNC= 'get_share_found_share SIGNAL found_TB2';
SET DEBUG_SYNC= 'get_share_before_open HIT_LIMIT 1';
INSERT INTO tb VALUES(2);
#
connection default;
# Now, we know that TA1 and TB1 are about to open the shares
# for ta and tb concurrently. We also know that TB2 is about to
# wait for COND_open. First issue then is to make sure TB2 waits
# for COND_open (using P_S.events_waits_current, not logged here):
#
# Next up is to make one of the opening threads read the def.
# Here, as opposed to the previous test case, we let TB1 read first:
SET DEBUG_SYNC= 'now SIGNAL cont_TB1';
#
# Then, we wait for TB2 to signal that it's at the 'found_share'
# sync point. This means it jumped out of the wait loop in the first
# attempt since a second loop would make it do cond_wait once more:
SET DEBUG_SYNC= 'now WAIT_FOR found_TB2';
#
# Then, we signal TA1 to make it open its def and do its things,
# and then we're done:
SET DEBUG_SYNC= 'now SIGNAL cont_TA1';
#
# Reap the connections, reset DEBUG_SYNC and drop tables:
connection con_TA1;
connection con_TB1;
connection con_TB2;
connection default;
SET DEBUG_SYNC= 'RESET';
DROP TABLE ta, tb;
###########################################################
#
# Test case 1.3: After 1), verify that if there is an error
# in open_table_def for TB1, the share is deleted from the
# hash table and destroyed. Then, verify that TB2 wakes up,
# discovers that the share is now missing, and then
# continues as if the share never existed in the hash table
# in the first place. This test case does not use connection
# TA1. 
#
#
connection default;
# Create one table:
CREATE TABLE tb (pk integer primary key);
#
# Warm-up data-dictionary cache but keep Table Definition Cache intact.
#
#
connection con_TB1;
# Wait after releasing LOCK_open when opening table tb.
# Set up a debug label to make the code simulate an error when
# opening the table definition, hence making TB1 delete the share
# from the hash table and destroy the share. Let TB1 signal at the
# 'after_destroy' sync point to verify this behavior. Also make
# sure we never end up at the 'found_share' sync point.
SET SESSION debug= '+d,set_open_table_err';
SET DEBUG_SYNC= 'get_share_before_open SIGNAL open_TB1 WAIT_FOR cont_TB1';
SET DEBUG_SYNC= 'get_share_after_destroy SIGNAL del_TB1';
SET DEBUG_SYNC= 'get_share_found_share HIT_LIMIT 1';
INSERT INTO tb VALUES(1);
#
connection con_TB2;
# Wait for open_TB1, then wait after the tb share is found in the
# TDC. Wake up when TB1 broadcasts COND_open, this happens after
# the share is destroyed by TB1. Then make sure TB2 gets to the
# 'before_open' sync point, and ensure it does not get to neither
# the 'after_destroy' nor 'found_share' sync points:
SET DEBUG_SYNC= 'now WAIT_FOR open_TB1';
SET DEBUG_SYNC= 'get_share_before_open SIGNAL open_TB2';
SET DEBUG_SYNC= 'get_share_after_destroy HIT_LIMIT 1';
SET DEBUG_SYNC= 'get_share_found_share HIT_LIMIT 1';
INSERT INTO tb VALUES(2);
#
connection default;
# Now, we know that TB1 is about to open the share for tb.
# We also know that TB2 is about to wait for COND_open. 
# First issue then is to make sure TB2 waits for COND_open
# (using P_S.events_waits_current, not logged here):
#
# Next up is to make TB1 continue and read the table definition.
# Then, TB1 will "see" an error from open_table_def (by means of
# debug instrumentation in the source code). Thus, we wait for TB1
# to delete the share, and then we can let it finish:
SET DEBUG_SYNC= 'now SIGNAL cont_TB1';
SET DEBUG_SYNC= 'now WAIT_FOR del_TB1';
#
# Then, we wait for TB2 to signal that it's at the 'before_open'
# sync point. This means it jumped out of the wait loop in the first
# attempt since a second loop would make it do another cond_wait, 
# and it also means it ended the loop because the share was NOT
# found in the TDC anymore. Then, we're done:
SET DEBUG_SYNC= 'now WAIT_FOR open_TB2';
#
# Reap the connections, reset DEBUG_SYNC and drop tables:
connection con_TB1;
ERROR 42S02: Table 'test.tb' doesn't exist
SET SESSION debug= '-d,set_open_table_err';
connection con_TB2;
connection default;
SET DEBUG_SYNC= 'RESET';
DROP TABLE tb;
###########################################################
#
# Test case 2.1: After 2), verify that if thread TB1 is
# stopped before open, and TA1 is starting its flushing,
# when TB1 continues, then TA1 will be able to complete.
# This test case has only one thread accessing table tb.
#
#
connection default;
# Create one table:
CREATE TABLE tb (pk integer primary key);
#
# Warm-up data-dictionary cache but keep Table Definition Cache intact.
#
#
connection con_TB1;
# Do an insert, wait after releasing LOCK_open for tb. Due to
# a concurrent pending FLUSH TABLES, the first share will be
# rejected due to wrong version number, and the share will be
# retrieved once more. Also, we make sure we never end up
# at the 'found_share' nor the 'after_destroy' sync point:
SET DEBUG_SYNC= 'get_share_before_open SIGNAL open_TB1 WAIT_FOR cont_TB1';
SET DEBUG_SYNC= 'get_share_after_destroy HIT_LIMIT 1';
SET DEBUG_SYNC= 'get_share_found_share HIT_LIMIT 1';
INSERT INTO tb VALUES(1);
#
connection con_TA1;
# Wait for TB1 to signal 'open_TB1', then issue a 'FLUSH TABLES'
# command:
SET DEBUG_SYNC= 'now WAIT_FOR open_TB1';
FLUSH TABLES;
#
connection default;
# Wait until the flush has started waiting for the share,
# use I_S.processlist for this purpose (not logged here):
#
# Then we know TA1 is waiting for TB1 to finish. Next, we signal
# TB1 to continue. This will make it retry getting the share:
SET DEBUG_SYNC= 'now SIGNAL cont_TB1';
#
# Reap the connections, reset DEBUG_SYNC and drop tables:
connection con_TA1;
connection con_TB1;
connection default;
SET DEBUG_SYNC= 'RESET';
DROP TABLE tb;
###########################################################
#
# Test case 2.2: After 2), verify that if thread TB1 is
# stopped before open, and TA1 is starting its flushing,
# when TB1 continues, then TA1 will be able to complete.
# This test case has only one thread accessing table tb.
# This case is similar to 2.1, but we simulate an error in
# open_table_def. We also do 'FLUSH TABLES tb' to test
# another variant of the FLUSH TABLES statement.
# This test also covers bug #19881395 "FREEZE OF SERVER,
# FLUSH TABLE VERSUS CONCURRENT DDL/DML".
#
connection default;
# Create one table:
CREATE TABLE tb (pk integer primary key);
#
# Warm-up data-dictionary cache but keep Table Definition Cache intact.
#
#
connection con_TB1;
# Do an insert, wait after releasing LOCK_open for tb. 
# Simulate a failing open_table_def to verify that a
# concurrent flush table operation handles this situation. Due
# to a concurrent pending FLUSH TABLES, the first share will be
# rejected due to wrong version number, but since it fails,
# anyway, it will not be retrieved once more. Make sure we don't
# end up more than once at the 'before_open' sync point. Also, make
# sure we never end up at the 'found_share' sync point:
SET SESSION debug= '+d,set_open_table_err';
SET DEBUG_SYNC= 'get_share_before_open SIGNAL open_TB1 \
                         WAIT_FOR cont_TB1 HIT_LIMIT 2';
SET DEBUG_SYNC= 'get_share_after_destroy SIGNAL del_TB1 HIT_LIMIT 2';
SET DEBUG_SYNC= 'get_share_found_share HIT_LIMIT 1';
INSERT INTO tb VALUES(1);
#
connection con_TA1;
# Wait for TB1 to signal 'open_TB1', then issue a 'FLUSH TABLES'
# command.
SET DEBUG_SYNC= 'now WAIT_FOR open_TB1';
FLUSH TABLES tb;
#
connection default;
# Wait until the flush has started waiting for the share,
# use I_S.processlist for this purpose (not logged here):
#
# Then we know TA1 is waiting for TB1 to finish. Next, we signal
# TB1 to continue. It should be able to do so because "FLUSH TABLE
# tb" is not supposed to hold any lock on table cache (as it did
# before bug#19881395 was fixed). Since we simulate a failing open,
# TB1 should end up signalling 'del_TB1'. We tell it to continue,
# and then we're done:
SET DEBUG_SYNC= 'now SIGNAL cont_TB1';
SET DEBUG_SYNC= 'now WAIT_FOR del_TB1';
#
# Reap the connections, reset DEBUG_SYNC and drop tables:
connection con_TA1;
connection con_TB1;
ERROR 42S02: Table 'test.tb' doesn't exist
SET SESSION debug= '-d,set_open_table_err';
connection default;
SET DEBUG_SYNC= 'RESET';
DROP TABLE tb;
###########################################################
#
# Test case 2.3: After 2), verify that if thread TB1 is
# stopped before open, and TA1 is starting its flushing,
# and TB2 has found a share and waits, then if we let
# TB1 continue, then TA1 will be able to complete, and TB2
# gets to open the table def because the "first" share is
# flushed due to wrong version number. Also, verify that
# TB1 finds the share to exist (since TB2 opened it) when it
# retries. 
#
#
connection default;
# Create one table:
CREATE TABLE tb (pk integer primary key);
#
# Warm-up data-dictionary cache but keep Table Definition Cache intact.
#
#
connection con_TB1;
# Do an insert, wait after releasing LOCK_open for tb. After
# being signaled to continue, stop again before
# retrying. After TB2 has opened the share, continue, and signal
# when the share is found:
SET DEBUG_SYNC= 'get_share_before_open SIGNAL open_TB1
                                       WAIT_FOR cont_open_TB1 HIT_LIMIT 2';
SET DEBUG_SYNC= 'open_table_before_retry SIGNAL retry_TB1
                                         WAIT_FOR cont_retry_TB1';
SET DEBUG_SYNC= 'get_share_found_share SIGNAL found_TB1';
INSERT INTO tb VALUES(1);
#
connection con_TB2;
# Wait for TB1 to start opening, then do an insert, and wait for
# COND_open after finding the share. After TB1 broadcasts COND_open,
# the share will be missing, so TB2 will open it. Stop after opening
# the share to make sure TB1 will also call get_table_share() when
# retrying (to get predictable behavior):
SET DEBUG_SYNC= 'now WAIT_FOR open_TB1';
SET DEBUG_SYNC= 'get_share_found_share HIT_LIMIT 1';
SET DEBUG_SYNC= 'open_table_found_share SIGNAL found_TB2 WAIT_FOR finish_TB2';
INSERT INTO tb VALUES(2);
#
connection con_TA1;
# Issue a 'FLUSH TABLES' command:
FLUSH TABLES;
#
connection default;
# Wait until the flush has started waiting for the share,
# use I_S.processlist for this purpose (not logged here):
#
# Next issue then is to make sure TB2 waits for COND_open
# (using P_S.events_waits_current, not logged here):
#
# Then we know TA1 is waiting for the tb share, and we know TB2
# is waiting for COND_open. Now, we signal TB1 to continue opening
# the table:
SET DEBUG_SYNC= 'now SIGNAL cont_open_TB1';
# 
# Then we wait for the flush to complete (by an I_S wait condition,
# not logged):
#
# When TB1 finished opening tb, we know that TB2 was signaled,
# and since TB1 has eventually unlocked LOCK_open, TB2 will be opening
# the table share (because the tb share is removed by TB1 since
# it has too old version), but we must stop TB1 before retrying to
# avoid the situation where TB1 manages to open tb before TB2
# (to make sure the test is deterministic):
SET DEBUG_SYNC= 'now WAIT_FOR retry_TB1';
SET DEBUG_SYNC= 'now WAIT_FOR found_TB2';
SET DEBUG_SYNC= 'now SIGNAL cont_retry_TB1';
# 
# Now, we know that TB2 has opened the "new" version of the share,
# and we know it's stopped at 'open_table_share_found'.
# The only issue left then is to make sure TB1 drops by the
# 'found_share' sync point, then signal TB2 to finish, and we're done:
SET DEBUG_SYNC= 'now SIGNAL finish_TB2';
SET DEBUG_SYNC= 'now WAIT_FOR found_TB1';
SET DEBUG_SYNC= 'now SIGNAL finish_TB2';
#
# Reap the connections, reset DEBUG_SYNC and drop tables:
connection con_TA1;
connection con_TB1;
connection con_TB2;
connection con_TB1;
SET DEBUG_SYNC= 'RESET';
connection con_TB2;
SET DEBUG_SYNC= 'RESET';
connection default;
SET DEBUG_SYNC= 'RESET';
DROP TABLE tb;
###########################################################
#
# Test case 3.1: Let thread TB1 issue LOCK TABLES tb
# while thread TB2 issues CREATE TABLE tb. Do LOCK TABLES
# first, and stop in get_share_before_open. Then run CREATE
# TABLE, which does check_if_table_exists. The latter called
# get_cached_table_share in the past, so could have been
# confused by presence of open-in-progress share.
#
# If the CREATE mistakenly does conclude that tb
# exists, it will bypass the MDL lock upgrade from S to X,
# and instead go ahead and open the table. Then, it will
# wait in get_table_share until TB1 is done, and finally,
# TB2 will attempt to open_table_def (since TB1 failed and
# destroyed the share). Thus, TB2 will fail while opening
# too, since tb doesn't exist, making TB2 return the
# error message "Table test.tb doesn't exist".
#
#
connection con_TB1;
# Issue 'LOCK TABLES tb', and stop after allocating a share
# for the table, before trying to actually open it:
SET DEBUG_SYNC= 'get_share_before_open SIGNAL open_TB1 WAIT_FOR cont_TB1';
LOCK TABLES tb WRITE;;
#
connection con_TB2;
# Create the table which is being locked by TB1. The execution
# will do check_if_table_exists() before create. This function
# should not be confused by share being opened by TB1. It should
# detect that able is absent and proceed to upgrading metadata
# lock on the table to X.
SET DEBUG_SYNC= 'now WAIT_FOR open_TB1';
CREATE TABLE tb (pk integer primary key);;
#
connection default;
# Wait until the CREATE TABLE execution is waiting for
# metadata lock upgrade.
SET DEBUG_SYNC='now SIGNAL cont_TB1';
#
# Reap the connections, reset DEBUG_SYNC and drop tables:
connection con_TB1;
ERROR 42S02: Table 'test.tb' doesn't exist
connection con_TB2;
connection default;
SET DEBUG_SYNC= 'RESET';
DROP TABLE tb;
###########################################################
#
# Test case 4.1: After 4), issue a SHOW OPEN TABLES command
# and verify that the table being opened is excluded from
# the list of open tables.
#
#
connection default;
# Create two tables:
CREATE TABLE ta (pk integer primary key);
CREATE TABLE tb (pk integer primary key);
#
# Warm-up data-dictionary cache but keep Table Definition Cache intact.
#
#
# Insert into ta to make sure it is open and in the cache:
INSERT INTO ta VALUES(0);
#
connection con_TB1;
# Wait after releasing LOCK_open for tb, and make sure we never
# end up at the 'found_share' sync point:
SET DEBUG_SYNC= 'get_share_before_open SIGNAL open_TB1 WAIT_FOR cont_TB1';
SET DEBUG_SYNC= 'get_share_found_share HIT_LIMIT 1';
INSERT INTO tb VALUES(1);
#
connection default;
# Wait for open_TB1, then issue a SHOW OPEN TABLES command
# where tb should not be included:
SET DEBUG_SYNC= 'now WAIT_FOR open_TB1';
SHOW OPEN TABLES FROM test;
Database	Table	In_use	Name_locked
test	ta	0	0
#
# Next up is to let TB1 read the share, and do the insert:
SET DEBUG_SYNC= 'now SIGNAL cont_TB1';
#
# Reap connection TB1, and do another SHOW OPEN TABLES
# where tb should now be included:
connection con_TB1;
connection default;
SHOW OPEN TABLES FROM test;
Database	Table	In_use	Name_locked
test	tb	0	0
test	ta	0	0
#
# Connection TB1 has already been reaped. Reset DEBUG_SYNC
# and drop tables:
connection default;
SET DEBUG_SYNC= 'RESET';
DROP TABLE ta, tb;
###########################################################
#
# Test teardown: Disconnect
#
connection con_TA1;
disconnect con_TA1;
connection con_TB1;
disconnect con_TB1;
connection con_TB2;
disconnect con_TB2;
connection default;