summaryrefslogtreecommitdiffstats
path: root/mysql-test/main/backup_syntax.test
blob: 8aaef824f89d719f6dcffcbb6303b6f6959ab86f (plain)
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
########################################################################
# Tests things related to syntax of BACKUP STAGE (MDEV-5336)
########################################################################

--source include/have_innodb.inc
--source include/have_metadata_lock_info.inc

--echo #-----------------------------------------------------------------------
--echo # Basic syntax checks
--echo #-----------------------------------------------------------------------

--echo # Check existing BACKUP STAGE statements in the sequence to be used.
BACKUP STAGE START;
BACKUP STAGE FLUSH;
BACKUP STAGE BLOCK_DDL;
BACKUP STAGE BLOCK_COMMIT;
BACKUP STAGE END;

--echo # Check invalid variants of BACKUP .... syntax.
--error ER_PARSE_ERROR
BACKUP LOG;
--error ER_PARSE_ERROR
BACKUP LOCK;
--error ER_PARSE_ERROR
BACKUP STAGE;
--error ER_PARSE_ERROR
BACKUP STAGE LOCK;
--error ER_BACKUP_UNKNOWN_STAGE
BACKUP STAGE not_existing;

--echo #-----------------------------------------------------------------------
--echo # BACKUP STAGE statements in various orders.
--echo #-----------------------------------------------------------------------
--echo # All BACKUP STAGE statements != 'BACKUP STAGE START' expect that a
--echo # backup lock (generated by BACKUP STAGE START) already exists.
--echo #

backup stage start;
backup stage flush;
--error ER_BACKUP_WRONG_STAGE
backup stage start;
--error ER_BACKUP_WRONG_STAGE
backup stage start;
backup stage block_commit;
--error ER_BACKUP_WRONG_STAGE
backup stage flush;
--error ER_BACKUP_WRONG_STAGE
backup stage flush;
backup stage end;
--error ER_BACKUP_NOT_RUNNING
backup stage flush;
--error ER_BACKUP_NOT_RUNNING
BACKUP STAGE END;
--error ER_BACKUP_NOT_RUNNING
BACKUP STAGE BLOCK_COMMIT;
--error ER_BACKUP_NOT_RUNNING
BACKUP STAGE BLOCK_DDL;
--error ER_BACKUP_NOT_RUNNING
BACKUP STAGE FLUSH;

--echo # Ordered "give up" with 'BACKUP STAGE END' because of whatever reason.
--echo # Some existing backup lock assumed a 'BACKUP STAGE END' is allowed in
--echo # every situation.

BACKUP STAGE START;
BACKUP STAGE END;
--echo #----
BACKUP STAGE START;
BACKUP STAGE FLUSH;
BACKUP STAGE END;
--echo #----
BACKUP STAGE START;
BACKUP STAGE FLUSH;
BACKUP STAGE BLOCK_DDL;
BACKUP STAGE END;
--echo # Orders with BACKUP STAGE FLUSH omitted.
BACKUP STAGE START;
BACKUP STAGE BLOCK_DDL;
BACKUP STAGE END;
--echo #----
BACKUP STAGE START;
BACKUP STAGE BLOCK_DDL;
BACKUP STAGE BLOCK_COMMIT;
BACKUP STAGE END;
--echo # Orders with BACKUP STAGE BLOCK_DDL omitted.
BACKUP STAGE START;
BACKUP STAGE FLUSH;
BACKUP STAGE BLOCK_COMMIT;
BACKUP STAGE END;
--echo # Orders with BACKUP STAGE BLOCK_COMMIT omitted.
BACKUP STAGE START;
BACKUP STAGE FLUSH;
BACKUP STAGE BLOCK_DDL;
BACKUP STAGE END;

--echo # Orders with doubled BACKUP STAGE statements.
--echo # We get an error but that seems to have no bad impact on the state.
--echo # And so we are allowed to go on with BACKUP STAGE statements.

BACKUP STAGE START;
--error ER_BACKUP_WRONG_STAGE
BACKUP STAGE START;
BACKUP STAGE FLUSH;
BACKUP STAGE BLOCK_DDL;
BACKUP STAGE BLOCK_COMMIT;
BACKUP STAGE END;
--echo #----
BACKUP STAGE START;
BACKUP STAGE FLUSH;
--error ER_BACKUP_WRONG_STAGE
BACKUP STAGE FLUSH;
BACKUP STAGE END;
--echo #----
BACKUP STAGE START;
BACKUP STAGE FLUSH;
BACKUP STAGE BLOCK_DDL;
--error ER_BACKUP_WRONG_STAGE
BACKUP STAGE BLOCK_DDL;
BACKUP STAGE END;
--echo #----
BACKUP STAGE START;
BACKUP STAGE FLUSH;
BACKUP STAGE BLOCK_DDL;
BACKUP STAGE BLOCK_COMMIT;
--error ER_BACKUP_WRONG_STAGE
BACKUP STAGE BLOCK_COMMIT;
BACKUP STAGE END;

--echo # Scrambled orders.
BACKUP STAGE START;
BACKUP STAGE FLUSH;
--error ER_BACKUP_WRONG_STAGE
BACKUP STAGE START;
BACKUP STAGE BLOCK_DDL;
--error ER_BACKUP_WRONG_STAGE
BACKUP STAGE START;
BACKUP STAGE BLOCK_COMMIT;
--error ER_BACKUP_WRONG_STAGE
BACKUP STAGE START;
BACKUP STAGE END;
--echo #----
BACKUP STAGE START;
BACKUP STAGE FLUSH;
BACKUP STAGE BLOCK_DDL;
--error ER_BACKUP_WRONG_STAGE
BACKUP STAGE FLUSH;
BACKUP STAGE BLOCK_COMMIT;
--error ER_BACKUP_WRONG_STAGE
BACKUP STAGE FLUSH;
BACKUP STAGE END;
--echo #----
BACKUP STAGE START;
BACKUP STAGE FLUSH;
BACKUP STAGE BLOCK_DDL;
BACKUP STAGE BLOCK_COMMIT;
--error ER_BACKUP_WRONG_STAGE
BACKUP STAGE BLOCK_DDL;
BACKUP STAGE END;
--echo #----
BACKUP STAGE START;
BACKUP STAGE BLOCK_DDL;
--error ER_BACKUP_WRONG_STAGE
BACKUP STAGE FLUSH;
BACKUP STAGE BLOCK_COMMIT;
BACKUP STAGE END;
--echo #----
BACKUP STAGE START;
BACKUP STAGE FLUSH;
BACKUP STAGE BLOCK_COMMIT;
--error ER_BACKUP_WRONG_STAGE
BACKUP STAGE BLOCK_DDL;
BACKUP STAGE END;

--echo #
--echo # Check Oracle syntax
--echo #

set SQL_MODE=Oracle;
backup stage start;
backup stage end;
set SQL_MODE=default;