File: rpl_drop_multiple_tables.inc

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 (128 lines) | stat: -rw-r--r-- 3,080 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
# ==== Purpose ====
#
# Auxiliary test script used in rpl_gtid_split_statements.
#
# The purpose is to test DROP TABLE with multiple tables, each of
# different type. 
#
# ==== Usage ====
#
# CREATE PROCEDURE create_tables () BEGIN ... END;
# CREATE PROCEDURE drop_tables () BEGIN ... END;
# --let $table_list= TABLE_LIST
# --let $remaining_table_list= TABLE_LIST
# --let $automatic= [0|1]
# --let $transaction_count= N
# --source include/rpl_gtid_drop_multiple_tables.inc
#
# Context:
#
#   create_tables
#     This stored procedure will be called in the beginning of the
#     execution. The purpose is to create the tables that will later
#     be dropped.
#
#   drop_tables
#     This stored procedure will be called in the end of the
#     execution.  The purpose is to drop any remaining tables.  This
#     is useful in the case where tables fail to be dropped on the
#     slave.
# 
# Parameters:
#
#   $table_list
#     Comma-separated list of tables to drop. The tables should be
#     created by create_tables; their names should be base, temp_t, or
#     temp_n.
#
#   $remaining_table_list
#     Comma-separated list of tables that were created by
#     create_tables, which are not included in $table_list.
#
#   $automatic
#     If this is 1, uses GTID_NEXT='AUTOMATIC'.  Otherwise, sets
#     GTID_NEXT='UUID:NUMBER' (if gtid_mode=on) or
#     GTID_NEXT='ANONYMOUS' (if gtid_mode=off).
#
#   $transaction_count
#     The number of transactions that the DROP statement is expected
#     to generate.

# Create all tables
CALL create_tables();

# Reset gtid_step_* state.
--source include/gtid_step_reset.inc

# Get offset of events
--let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1)
--let $binlog_position= query_get_value(SHOW MASTER STATUS, Position, 1)

# Set GTID_NEXT.
--let $expect_error= 0
if (!$automatic)
{
  --source include/set_gtid_next_gtid_mode_agnostic.inc
  if ($gtid_mode_on)
  {
    --let $expect_error= 1
    --let $transaction_count= 0
  }
}

# Execute DROP
if ($expect_error)
{
  --error ER_GTID_UNSAFE_BINLOG_SPLITTABLE_STATEMENT_AND_ASSIGNED_GTID
  eval DROP TABLE $table_list;
}
if (!$expect_error)
{
  eval DROP TABLE $table_list;
}

# Revert GTID_NEXT.
if (!$automatic)
{
  SET GTID_NEXT = 'AUTOMATIC';
}

# Assert that gtid_executed was stepped.
--let $gtid_step_count= $transaction_count
--source include/gtid_step_assert.inc

# Assert that events were written to binlog
if (!$expect_error)
{
  if ($gtid_mode_on)
  {
    --let $event_sequence= (Gtid # !Q(DROP.*) # ){$transaction_count}
  }
  if (!$gtid_mode_on)
  {
    --let $event_sequence= (Anonymous_Gtid # !Q(DROP.*) # ){$transaction_count}
  }
}
if ($expect_error)
{
  --let $event_sequence= ()
}
--let $position= $binlog_position
--let $file= $binlog_file
--let $dont_print_pattern= 1
--source include/assert_binlog_events.inc

# Drop remaining tables.
if ($remaining_table_list)
{
  eval DROP TABLE $remaining_table_list; 
}
if ($expect_error)
{
  eval DROP TABLE $table_list;
}

--source include/rpl_sync.inc

#CALL drop_tables();
--source include/rpl_reset.inc