File: rpl_create_drop_temp_table.test

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 (74 lines) | stat: -rw-r--r-- 3,144 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
###############################################################################
# Bug#18364070  BACKPORT BUG#18236612 TO MYSQL-5.6
# Problem & Analysis : When Slave SQL thread detects that Master was restarted
#  with the help of information sent by Master through 'FormatDescription'
#  event, slave SQL drops all the opened temporary tables in order to have
#  proper cleanup. While slave SQL thread is dropping the temporary tables, it
#  is not decrementing Replica_open_temp_tables count.
#  Fix: Decrement Replica_open_temp_tables count in this case.
# Steps to test:
#  1) Create a temporary table
#  2) Sync it with slave
#  3) Stop slave io thread
#  4) Kill Master which generates Format Description event
#  5) Restart Master again
#  6) Start slave io thread
#  7) Wait till SQL thread applies all events
#     (which includes newly generated Format Description event)
#  8) Now verify that Replica_open_temp_tables has '0' value

# This same test steps with gtid enabled mode, works to test the following
# bug as well.
# Bug#18069107 SLAVE CRASHES WITH GTIDS,TEMP TABLE, STOP IO_THREAD, START SLAVE
# Problem & Analysis : When Slave SQL thread detects that Master was restarted
#  with the help of information sent by Master through 'FormatDescription'
#  event, slave SQL drops all the opened temporary tables in order to have
#  proper cleanup. When Gtid mode is on and while slave SQL thread is
#  generating DROP TEMPORARY statement for all these temporary tables,
#  server is hitting an assert DEBUG_ASSERT(gtid.spec_type != UNDEF_GROUP)
###############################################################################

# Statement mode is enough (row based temporary
# tables are not replicated)
--source include/have_binlog_format_statement.inc
--source include/master-slave.inc

# 1. Create a temporary table
CREATE TEMPORARY TABLE temp (i INT);

# 2. Sync it with slave
--sync_slave_with_master

# 3. Stop slave io thread
--source include/stop_slave_io.inc

# 4. Kill Master so that it does not go through THD::cleanup logic. Hence it does
# not generate "drop temporary" query for 'temp' table.
--let $rpl_server_number= 1
--let $rpl_force_stop=1
--source include/rpl_stop_server.inc

# 5. Restart Master (generates Format Description event which tells slave to
# drop all temporary tables)
--source include/rpl_start_server.inc

# 6. Start slave io_thread
--connection slave
--source include/start_slave_io.inc
--connection master
--source include/sync_slave_io_with_master.inc

# 7. Wait for slave thread to apply all events (including the newly generated
# FormatDescription event which tells slave SQL thread to drop all temporary
--let $show_statement= SHOW PROCESSLIST
--let $field= State
--let $condition= = 'Replica has read all relay log; waiting for more updates';
--source include/wait_show_condition.inc

# 8.Now if we verify replica_open_temp_tables, it should be '0'
--let $var_value= query_get_value(SHOW STATUS LIKE 'Replica_open_temp_tables', Value, 1)
--let $assert_text= Replica_open_temp_tables should be 0
--let $assert_cond= $var_value = 0
--source include/assert.inc

--source include/rpl_end.inc