Merge lp:~akopytov/percona-server/snapshot-cloning into lp:percona-server/5.6
- snapshot-cloning
- Merge into 5.6
Status: | Superseded |
---|---|
Proposed branch: | lp:~akopytov/percona-server/snapshot-cloning |
Merge into: | lp:percona-server/5.6 |
Diff against target: |
2833 lines (+1908/-48) (has conflicts) 32 files modified
build-ps/debian/control (+17/-0) client/mysqldump.c (+107/-22) doc/source/upstream-bug-fixes.rst (+135/-0) mysql-test/r/backup_locks_mysqldump.result (+146/-0) mysql-test/r/clone_consistent_snapshot.result (+145/-0) mysql-test/r/mysqldump-max.result (+57/-0) mysql-test/suite/binlog/r/binlog_consistent.result (+178/-0) mysql-test/suite/binlog/t/binlog_consistent.test (+144/-0) mysql-test/suite/perfschema/r/dml_setup_instruments.result (+1/-1) mysql-test/suite/sys_vars/r/have_snapshot_cloning_basic.result (+11/-0) mysql-test/suite/sys_vars/t/have_snapshot_cloning_basic.test (+7/-0) mysql-test/t/backup_locks_mysqldump.test (+61/-0) mysql-test/t/clone_consistent_snapshot.test (+167/-0) mysql-test/t/mysqldump-max.test (+83/-0) sql/binlog.cc (+245/-6) sql/binlog.h (+13/-1) sql/handler.cc (+106/-3) sql/handler.h (+1/-0) sql/log.cc (+11/-1) sql/log.h (+28/-0) sql/mysqld.cc (+23/-6) sql/mysqld.h (+2/-1) sql/set_var.h (+6/-1) sql/share/errmsg-utf8.txt (+7/-0) sql/sql_yacc.yy (+6/-0) sql/sys_vars.cc (+15/-4) storage/innobase/buf/buf0flu.cc (+7/-0) storage/innobase/handler/ha_innodb.cc (+114/-0) storage/innobase/include/read0read.h (+21/-0) storage/innobase/include/trx0trx.h (+10/-0) storage/innobase/read/read0read.cc (+2/-2) storage/innobase/trx/trx0trx.cc (+32/-0) Text conflict in build-ps/debian/control Text conflict in client/mysqldump.c Text conflict in doc/source/upstream-bug-fixes.rst Text conflict in mysql-test/r/backup_locks_mysqldump.result Text conflict in mysql-test/t/backup_locks_mysqldump.test Text conflict in sql/mysqld.cc Text conflict in sql/set_var.h Text conflict in sql/share/errmsg-utf8.txt Text conflict in sql/sys_vars.cc Text conflict in storage/innobase/buf/buf0flu.cc |
To merge this branch: | bzr merge lp:~akopytov/percona-server/snapshot-cloning |
Related bugs: | |
Related blueprints: |
Snapshot cloning
(High)
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Registry Administrators | Pending | ||
Review via email: mp+211192@code.launchpad.net |
This proposal has been superseded by a proposal from 2014-03-16.
Commit message
Description of the change
The patch extends START TRANSACTION WITH CONSISTENT SNAPSHOT with the
optional FROM SESSION clause:
START TRANSACTION WITH CONSISTENT SNAPSHOT FROM SESSION <session_id>;
When specified, all participating storage engines and binary log instead
of creating a new snapshot of data (or binary log coordinates), create a
copy of the snapshot which has been created by an active transaction in
the specified session. session_id is the session identifier reported in
the Id column of SHOW PROCESSLIST. The CONNECTION_ID() function returns
the identifier of the current session.
Currently snapshot cloning is only supported by XtraDB and the binary
log.
For XtraDB, a transaction with a cloned snapshot will only see data
visible by the donor transaction at the time it was started. That is,
the cloned transaction will see no changes made between the donor and
cloned transactions were started. It will also see no changes made by
both the donor transaction and even itself.
For binary log, cloning means that Binlog_
Binlog_
https:/
will always have the same values for both the cloned and the donor
transaction.
New server variables
-------
have_snapshot_
This is a server variable implemented to help other utilities detect
if the server supports the FROM SESSION extention. When available, the
snapshot cloning feature and the syntax extension to START TRANSACTION
WITH CONSISTENT SNAPSHOT are supported by the server, and the variable
value is always YES.
http://
Preview Diff
1 | === modified file 'CMakeLists.txt' |
2 | === modified file 'build-ps/debian/control' |
3 | --- build-ps/debian/control 2014-03-03 17:51:33 +0000 |
4 | +++ build-ps/debian/control 2014-03-16 07:05:06 +0000 |
5 | @@ -2,6 +2,7 @@ |
6 | Section: database |
7 | Priority: extra |
8 | Maintainer: Percona Server Development Team <mysql-dev@percona.com> |
9 | +<<<<<<< TREE |
10 | Uploaders: George Lorch <george.lorch@percona.com>, |
11 | Alexey Bychko <alexey.bychko@percona.com> |
12 | Build-Depends: libtool (>= 1.4.2-7), |
13 | @@ -26,6 +27,10 @@ |
14 | libaio-dev[linux-any], |
15 | libpam-dev, |
16 | libssl-dev |
17 | +======= |
18 | +Uploaders: Stewart Smith <stewart.smith@percona.com>, Alexey Bychko <alexey.bychko@percona.com> |
19 | +Build-Depends: libtool (>= 1.4.2-7), procps, debhelper (>= 7.0.50~), file (>= 3.28), libncurses5-dev (>= 5.0-6), perl (>= 5.6.0), libwrap0-dev (>= 7.6-8.3), zlib1g-dev (>= 1:1.1.3-5), libreadline-dev, psmisc, po-debconf, chrpath, ghostscript, gawk, bison, lsb-release, cmake, gcc (>= 4.4), g++ (>= 4.4), libaio-dev[linux-any], libpam-dev, libssl-dev |
20 | +>>>>>>> MERGE-SOURCE |
21 | Standards-Version: 3.9.4 |
22 | Homepage: http://www.percona.com/software/percona-server/ |
23 | Vcs-Bzr: lp:percona-server/5.6 |
24 | @@ -141,6 +146,7 @@ |
25 | Package: percona-server-server-5.6 |
26 | Architecture: any |
27 | Suggests: tinyca |
28 | +<<<<<<< TREE |
29 | Pre-Depends: percona-server-common-5.6 (>= ${source:Version}), |
30 | adduser (>= 3.4.0), |
31 | debconf |
32 | @@ -176,6 +182,13 @@ |
33 | mariadb-server, |
34 | mariadb-server-core-5.5, |
35 | mariadb-server-5.5 |
36 | +======= |
37 | +Pre-Depends: percona-server-common-5.6 (>= ${source:Version}), adduser (>= 3.4.0), debconf |
38 | +Depends: percona-server-client-5.6 (>= ${source:Version}), libdbi-perl, libdbd-mysql-perl, perl (>= 5.6), ${shlibs:Depends}, ${misc:Depends}, psmisc, passwd, lsb-base (>= 3.0-10) |
39 | +Conflicts: mysql-server, mysql-server-4.1, mysql-server-core-5.1, percona-xtradb-server-5.0, percona-server-server-5.1, percona-server-server-5.5 |
40 | +Provides: mysql-server |
41 | +Replaces: mysql-server, mysql-server-5.0, mysql-server-core-5.1, percona-xtradb-server-5.0, percona-server-server-5.1, percona-server-server-5.5 |
42 | +>>>>>>> MERGE-SOURCE |
43 | Description: Percona Server database server binaries |
44 | Percona Server is a fast, stable and true multi-user, multi-threaded SQL |
45 | database server. SQL (Structured Query Language) is the most popular database |
46 | @@ -215,10 +228,14 @@ |
47 | |
48 | Package: percona-server-test-5.6 |
49 | Architecture: any |
50 | +<<<<<<< TREE |
51 | Depends: percona-server-client-5.6 (>= ${source:Version}), |
52 | percona-server-server-5.6 (>= ${source:Version}), |
53 | ${misc:Depends}, |
54 | ${shlibs:Depends} |
55 | +======= |
56 | +Depends: percona-server-client-5.6 (>= ${source:Version}), percona-server-server-5.6 (>= ${source:Version}), ${misc:Depends}, ${shlibs:Depends} |
57 | +>>>>>>> MERGE-SOURCE |
58 | Description: Percona Server database test suite |
59 | Percona Server is a fast, stable and true multi-user, multi-threaded SQL |
60 | database server. SQL (Structured Query Language) is the most popular database |
61 | |
62 | === modified file 'build-ps/debian/rules' |
63 | === modified file 'build-ps/percona-server.spec' |
64 | === modified file 'client/mysqldump.c' |
65 | --- client/mysqldump.c 2014-03-03 17:51:33 +0000 |
66 | +++ client/mysqldump.c 2014-03-16 07:05:06 +0000 |
67 | @@ -85,6 +85,9 @@ |
68 | #define IGNORE_DATA 0x01 /* don't dump data for this table */ |
69 | #define IGNORE_INSERT_DELAYED 0x02 /* table doesn't support INSERT DELAYED */ |
70 | |
71 | +/* Chars needed to store LONGLONG, excluding trailing '\0'. */ |
72 | +#define LONGLONG_LEN 20 |
73 | + |
74 | typedef enum { |
75 | KEY_TYPE_NONE, |
76 | KEY_TYPE_PRIMARY, |
77 | @@ -418,9 +421,10 @@ |
78 | "This causes the binary log position and filename to be appended to the " |
79 | "output. If equal to 1, will print it as a CHANGE MASTER command; if equal" |
80 | " to 2, that command will be prefixed with a comment symbol. " |
81 | - "This option will turn --lock-all-tables on, unless " |
82 | - "--single-transaction is specified too (in which case a " |
83 | - "global read lock is only taken a short time at the beginning of the dump; " |
84 | + "This option will turn --lock-all-tables on, unless --single-transaction " |
85 | + "is specified too (on servers that don't provide Binlog_snapshot_file and " |
86 | + "Binlog_snapshot_position status variables this will still take a " |
87 | + "global read lock for a short time at the beginning of the dump; " |
88 | "don't forget to read about --single-transaction below). In all cases, " |
89 | "any action on logs will happen at the exact moment of the dump. " |
90 | "Option automatically turns --lock-tables off.", |
91 | @@ -1222,6 +1226,44 @@ |
92 | } |
93 | |
94 | |
95 | +/* |
96 | + Check if server supports non-blocking binlog position using the |
97 | + binlog_snapshot_file and binlog_snapshot_position status variables. If it |
98 | + does, also return the position obtained if output pointers are non-NULL. |
99 | + Returns 1 if position available, 0 if not. |
100 | +*/ |
101 | +static int |
102 | +check_consistent_binlog_pos(char *binlog_pos_file, char *binlog_pos_offset) |
103 | +{ |
104 | + MYSQL_RES *res; |
105 | + MYSQL_ROW row; |
106 | + int found; |
107 | + |
108 | + if (mysql_query_with_error_report(mysql, &res, |
109 | + "SHOW STATUS LIKE 'binlog_snapshot_%'")) |
110 | + return 1; |
111 | + |
112 | + found= 0; |
113 | + while ((row= mysql_fetch_row(res))) |
114 | + { |
115 | + if (0 == strcmp(row[0], "Binlog_snapshot_file")) |
116 | + { |
117 | + if (binlog_pos_file) |
118 | + strmake(binlog_pos_file, row[1], FN_REFLEN-1); |
119 | + found++; |
120 | + } |
121 | + else if (0 == strcmp(row[0], "Binlog_snapshot_position")) |
122 | + { |
123 | + if (binlog_pos_offset) |
124 | + strmake(binlog_pos_offset, row[1], LONGLONG_LEN); |
125 | + found++; |
126 | + } |
127 | + } |
128 | + mysql_free_result(res); |
129 | + |
130 | + return (found == 2); |
131 | +} |
132 | + |
133 | static char *my_case_str(const char *str, |
134 | uint str_len, |
135 | const char *token, |
136 | @@ -5296,41 +5338,64 @@ |
137 | } /* dump_selected_tables */ |
138 | |
139 | |
140 | -static int do_show_master_status(MYSQL *mysql_con) |
141 | +static int do_show_master_status(MYSQL *mysql_con, int consistent_binlog_pos) |
142 | { |
143 | MYSQL_ROW row; |
144 | MYSQL_RES *master; |
145 | + char binlog_pos_file[FN_REFLEN]; |
146 | + char binlog_pos_offset[LONGLONG_LEN+1]; |
147 | + char *file, *offset; |
148 | const char *comment_prefix= |
149 | (opt_master_data == MYSQL_OPT_MASTER_DATA_COMMENTED_SQL) ? "-- " : ""; |
150 | - if (mysql_query_with_error_report(mysql_con, &master, "SHOW MASTER STATUS")) |
151 | + |
152 | + if (consistent_binlog_pos) |
153 | { |
154 | - return 1; |
155 | + if (!check_consistent_binlog_pos(binlog_pos_file, binlog_pos_offset)) |
156 | + return 1; |
157 | + |
158 | + file= binlog_pos_file; |
159 | + offset= binlog_pos_offset; |
160 | } |
161 | else |
162 | { |
163 | + if (mysql_query_with_error_report(mysql_con, &master, "SHOW MASTER STATUS")) |
164 | + return 1; |
165 | + |
166 | row= mysql_fetch_row(master); |
167 | if (row && row[0] && row[1]) |
168 | { |
169 | - /* SHOW MASTER STATUS reports file and position */ |
170 | - print_comment(md_result_file, 0, |
171 | - "\n--\n-- Position to start replication or point-in-time " |
172 | - "recovery from\n--\n\n"); |
173 | - fprintf(md_result_file, |
174 | - "%sCHANGE MASTER TO MASTER_LOG_FILE='%s', MASTER_LOG_POS=%s;\n", |
175 | - comment_prefix, row[0], row[1]); |
176 | - check_io(md_result_file); |
177 | + file= row[0]; |
178 | + offset= row[1]; |
179 | } |
180 | - else if (!ignore_errors) |
181 | + else |
182 | { |
183 | - /* SHOW MASTER STATUS reports nothing and --force is not enabled */ |
184 | - my_printf_error(0, "Error: Binlogging on server not active", |
185 | - MYF(0)); |
186 | mysql_free_result(master); |
187 | - maybe_exit(EX_MYSQLERR); |
188 | - return 1; |
189 | + if (!ignore_errors) |
190 | + { |
191 | + /* SHOW MASTER STATUS reports nothing and --force is not enabled */ |
192 | + my_printf_error(0, "Error: Binlogging on server not active", MYF(0)); |
193 | + maybe_exit(EX_MYSQLERR); |
194 | + return 1; |
195 | + } |
196 | + else |
197 | + { |
198 | + return 0; |
199 | + } |
200 | } |
201 | + } |
202 | + |
203 | + /* SHOW MASTER STATUS reports file and position */ |
204 | + print_comment(md_result_file, 0, |
205 | + "\n--\n-- Position to start replication or point-in-time " |
206 | + "recovery from\n--\n\n"); |
207 | + fprintf(md_result_file, |
208 | + "%sCHANGE MASTER TO MASTER_LOG_FILE='%s', MASTER_LOG_POS=%s;\n", |
209 | + comment_prefix, file, offset); |
210 | + check_io(md_result_file); |
211 | + |
212 | + if (!consistent_binlog_pos) |
213 | mysql_free_result(master); |
214 | - } |
215 | + |
216 | return 0; |
217 | } |
218 | |
219 | @@ -6289,6 +6354,7 @@ |
220 | { |
221 | char bin_log_name[FN_REFLEN]; |
222 | int exit_code; |
223 | + int consistent_binlog_pos= 0; |
224 | MY_INIT("mysqldump"); |
225 | |
226 | compatible_mode_normal_str[0]= 0; |
227 | @@ -6337,6 +6403,7 @@ |
228 | if (opt_slave_data && do_stop_slave_sql(mysql)) |
229 | goto err; |
230 | |
231 | +<<<<<<< TREE |
232 | if ((opt_lock_all_tables || opt_master_data || |
233 | (opt_single_transaction && flush_logs))) |
234 | { |
235 | @@ -6344,6 +6411,24 @@ |
236 | goto err; |
237 | } |
238 | else if (opt_lock_for_backup && do_lock_tables_for_backup(mysql)) |
239 | +======= |
240 | + if (opt_single_transaction && opt_master_data) |
241 | + { |
242 | + /* |
243 | + See if we can avoid FLUSH TABLES WITH READ LOCK with Binlog_snapshot_* |
244 | + variables. |
245 | + */ |
246 | + consistent_binlog_pos= check_consistent_binlog_pos(NULL, NULL); |
247 | + } |
248 | + |
249 | + if ((opt_lock_all_tables || (opt_master_data && !consistent_binlog_pos) || |
250 | + (opt_single_transaction && flush_logs))) |
251 | + { |
252 | + if (do_flush_tables_read_lock(mysql)) |
253 | + goto err; |
254 | + } |
255 | + else if (opt_lock_for_backup && do_lock_tables_for_backup(mysql)) |
256 | +>>>>>>> MERGE-SOURCE |
257 | goto err; |
258 | |
259 | /* |
260 | @@ -6384,7 +6469,7 @@ |
261 | goto err; |
262 | |
263 | |
264 | - if (opt_master_data && do_show_master_status(mysql)) |
265 | + if (opt_master_data && do_show_master_status(mysql, consistent_binlog_pos)) |
266 | goto err; |
267 | if (opt_slave_data && do_show_slave_status(mysql)) |
268 | goto err; |
269 | |
270 | === modified file 'doc/source/index.rst' |
271 | === modified file 'doc/source/upstream-bug-fixes.rst' |
272 | --- doc/source/upstream-bug-fixes.rst 2014-03-10 15:05:00 +0000 |
273 | +++ doc/source/upstream-bug-fixes.rst 2014-03-16 07:05:06 +0000 |
274 | @@ -5,6 +5,7 @@ |
275 | ============================================================= |
276 | |
277 | +-------------------------------------------------------------------------------------------------------------+ |
278 | +<<<<<<< TREE |
279 | |:Upstream bug: :mysqlbug:`71988` - page_cleaner: aggressive background flushing | |
280 | |:Launchpad bug: :bug:`1238039` | |
281 | |:Upstream state: Verified (checked on 2014-03-10) | |
282 | @@ -65,6 +66,14 @@ |
283 | |:Fix Released: :rn:`5.6.15-63.0` | |
284 | |:Upstream fix: N/A | |
285 | +-------------------------------------------------------------------------------------------------------------+ |
286 | +======= |
287 | +|:Upstream bug: :mysqlbug:`71217` - Threadpool - add thd_wait_begin/thd_wait_end to the network IO functions | |
288 | +|:Launchpad bug: :bug:`1159743` | |
289 | +|:Upstream state: Open (checked on 2014-02-05) | |
290 | +|:Fix Released: :rn:`5.6.15-63.0` | |
291 | +|:Upstream fix: N/A | |
292 | ++-------------------------------------------------------------------------------------------------------------+ |
293 | +>>>>>>> MERGE-SOURCE |
294 | |:Upstream bug: :mysqlbug:`41975` - Support for SSL options not included in mysqlbinlog | |
295 | |:Launchpad bug: :bug:`1258154` | |
296 | |:Upstream state: Closed | |
297 | @@ -75,12 +84,21 @@ |
298 | |:Launchpad bug: :bug:`1258154` | |
299 | |:Upstream state: Closed | |
300 | |:Fix Released: :rn:`5.6.15-63.0` | |
301 | +<<<<<<< TREE |
302 | |:Upstream fix: 5.6.12 | |
303 | +-------------------------------------------------------------------------------------------------------------+ |
304 | |:Upstream bug: :mysqlbug:`71411` - buf_flush_LRU() does not return correct number in case of compressed pages| |
305 | |:Launchpad bug: :bug:`1231918` | |
306 | |:Upstream state: Verified (checked on 2014-03-07) | |
307 | |:Fix Released: :rn:`5.6.13-61.0` | |
308 | +======= |
309 | +|:Upstream fix: 5.6.12 | |
310 | ++-------------------------------------------------------------------------------------------------------------+ |
311 | +|:Upstream bug: :mysqlbug:`71411` - buf_flush_LRU() does not return correct number in case of compressed pages| |
312 | +|:Launchpad bug: :bug:`1231918` | |
313 | +|:Upstream state: Verified (checked on 2014-02-05) | |
314 | +|:Fix Released: :rn:`5.6.13-61.0` | |
315 | +>>>>>>> MERGE-SOURCE |
316 | |:Upstream fix: N/A | |
317 | +-------------------------------------------------------------------------------------------------------------+ |
318 | |:Upstream bug: :mysqlbug:`70417` - rw_lock_x_lock_func_nowait() calls os_thread_get_curr_id() mostly ... | |
319 | @@ -91,7 +109,11 @@ |
320 | +-------------------------------------------------------------------------------------------------------------+ |
321 | |:Upstream bug: :mysqlbug:`70490` - Suppression is too strict on some systems | |
322 | |:Launchpad bug: :bug:`1205196` | |
323 | +<<<<<<< TREE |
324 | |:Upstream state: No Feedback (checked on 2014-03-07) | |
325 | +======= |
326 | +|:Upstream state: No Feedback (checked on 2014-02-05) | |
327 | +>>>>>>> MERGE-SOURCE |
328 | |:Fix Released: :rn:`5.6.13-61.0` | |
329 | |:Upstream fix: N/A | |
330 | +-------------------------------------------------------------------------------------------------------------+ |
331 | @@ -103,7 +125,11 @@ |
332 | +-------------------------------------------------------------------------------------------------------------+ |
333 | |:Upstream bug: :mysqlbug:`70500` - Page cleaner should perform LRU flushing regardless of server activity | |
334 | |:Launchpad bug: :bug:`1234562` | |
335 | +<<<<<<< TREE |
336 | |:Upstream state: Open (checked on 2014-03-07) | |
337 | +======= |
338 | +|:Upstream state: Open (checked on 2014-02-05) | |
339 | +>>>>>>> MERGE-SOURCE |
340 | |:Fix Released: :rn:`5.6.13-61.0` | |
341 | |:Upstream fix: N/A | |
342 | +-------------------------------------------------------------------------------------------------------------+ |
343 | @@ -121,31 +147,51 @@ |
344 | +-------------------------------------------------------------------------------------------------------------+ |
345 | |:Upstream bug: :mysqlbug:`68481` - InnoDB LRU flushing for MySQL 5.6 needs work | |
346 | |:Launchpad bug: :bug:`1232406` | |
347 | +<<<<<<< TREE |
348 | |:Upstream state: Verified (checked on 2014-03-07) | |
349 | +======= |
350 | +|:Upstream state: Verified (checked on 2014-02-05) | |
351 | +>>>>>>> MERGE-SOURCE |
352 | |:Fix Released: :rn:`5.6.13-61.0` | |
353 | |:Upstream fix: N/A | |
354 | +-------------------------------------------------------------------------------------------------------------+ |
355 | |:Upstream bug: :mysqlbug:`70453` - Add hard timeouts to page cleaner flushes | |
356 | |:Launchpad bug: :bug:`1232101` | |
357 | +<<<<<<< TREE |
358 | |:Upstream state: Verified (checked on 2014-03-07) | |
359 | +======= |
360 | +|:Upstream state: Verified (checked on 2014-02-05) | |
361 | +>>>>>>> MERGE-SOURCE |
362 | |:Fix Released: :rn:`5.6.13-61.0` | |
363 | |:Upstream fix: N/A | |
364 | +-------------------------------------------------------------------------------------------------------------+ |
365 | |:Upstream bug: :mysqlbug:`69170` - buf_flush_LRU is lazy | |
366 | |:Launchpad bug: :bug:`1231918` | |
367 | +<<<<<<< TREE |
368 | |:Upstream state: Verified (checked on 2014-03-07) | |
369 | +======= |
370 | +|:Upstream state: Verified (checked on 2014-02-05) | |
371 | +>>>>>>> MERGE-SOURCE |
372 | |:Fix Released: :rn:`5.6.13-61.0` | |
373 | |:Upstream fix: N/A | |
374 | +-------------------------------------------------------------------------------------------------------------+ |
375 | |:Upstream bug: :mysqlbug:`68555` - thread convoys from log_checkpoint_margin with innodb_buffer_pool_inst... | |
376 | |:Launchpad bug: :bug:`1236884` | |
377 | +<<<<<<< TREE |
378 | |:Upstream state: Verified (checked on 2014-03-07) | |
379 | +======= |
380 | +|:Upstream state: Verified (checked on 2014-02-05) | |
381 | +>>>>>>> MERGE-SOURCE |
382 | |:Fix Released: :rn:`5.6.13-61.0` | |
383 | |:Upstream fix: N/A | |
384 | +-------------------------------------------------------------------------------------------------------------+ |
385 | |:Upstream bug: :mysqlbug:`70228` - Is buf_LRU_free_page() really supposed to make non-zip block sticky at ...| |
386 | |:Launchpad bug: :bug:`1220544` | |
387 | +<<<<<<< TREE |
388 | |:Upstream state: Verified (checked on 2014-03-07) | |
389 | +======= |
390 | +|:Upstream state: Verified (checked on 2014-02-05) | |
391 | +>>>>>>> MERGE-SOURCE |
392 | |:Fix Released: :rn:`5.6.13-60.6` | |
393 | |:Upstream fix: N/A | |
394 | +-------------------------------------------------------------------------------------------------------------+ |
395 | @@ -163,13 +209,21 @@ |
396 | +-------------------------------------------------------------------------------------------------------------+ |
397 | |:Upstream bug: :mysqlbug:`70216` - Unnecessary overhead from persistent adaptive hash index latches | |
398 | |:Launchpad bug: :bug:`1218347` | |
399 | +<<<<<<< TREE |
400 | |:Upstream state: Verified (checked on 2014-03-07) | |
401 | +======= |
402 | +|:Upstream state: Verified (checked on 2014-02-05) | |
403 | +>>>>>>> MERGE-SOURCE |
404 | |:Fix Released: :rn:`5.6.13-60.6` | |
405 | |:Upstream fix: N/A | |
406 | +-------------------------------------------------------------------------------------------------------------+ |
407 | |:Upstream bug: :mysqlbug:`62018` - innodb adaptive hash index mutex contention | |
408 | |:Launchpad bug: :bug:`1216804` | |
409 | +<<<<<<< TREE |
410 | |:Upstream state: Verified (checked on 2014-03-07) | |
411 | +======= |
412 | +|:Upstream state: Verified (checked on 2014-02-05) | |
413 | +>>>>>>> MERGE-SOURCE |
414 | |:Fix Released: :rn:`5.6.13-60.6` | |
415 | |:Upstream fix: N/A | |
416 | +-------------------------------------------------------------------------------------------------------------+ |
417 | @@ -187,13 +241,21 @@ |
418 | +-------------------------------------------------------------------------------------------------------------+ |
419 | |:Upstream bug: :mysqlbug:`42415` - UPDATE/DELETE with LIMIT clause unsafe for SBL even with ORDER BY PK ... | |
420 | |:Launchpad bug: :bug:`1132194` | |
421 | +<<<<<<< TREE |
422 | |:Upstream state: Verified (checked on 2014-03-07) | |
423 | +======= |
424 | +|:Upstream state: Verified (checked on 2014-02-05) | |
425 | +>>>>>>> MERGE-SOURCE |
426 | |:Fix Released: :rn:`5.6.13-60.5` | |
427 | |:Upstream fix: N/A | |
428 | +-------------------------------------------------------------------------------------------------------------+ |
429 | |:Upstream bug: :mysqlbug:`69639` - mysql failed to build with dtrace Sun D 1.11 | |
430 | |:Launchpad bug: :bug:`1196460` | |
431 | +<<<<<<< TREE |
432 | |:Upstream state: Open (checked on 2014-03-07) | |
433 | +======= |
434 | +|:Upstream state: Open (checked on 2014-02-05) | |
435 | +>>>>>>> MERGE-SOURCE |
436 | |:Fix Released: :rn:`5.6.13-60.5` | |
437 | |:Upstream fix: N/A | |
438 | +-------------------------------------------------------------------------------------------------------------+ |
439 | @@ -211,10 +273,15 @@ |
440 | +-------------------------------------------------------------------------------------------------------------+ |
441 | |:Upstream bug: :mysqlbug:`69856` - mysql_install_db does not function properly in 5.6 for debug builds | |
442 | |:Launchpad bug: :bug:`1179359` | |
443 | +<<<<<<< TREE |
444 | |:Upstream state: Verified (checked on 2014-03-07) | |
445 | +======= |
446 | +|:Upstream state: Verified (checked on 2014-02-05) | |
447 | +>>>>>>> MERGE-SOURCE |
448 | |:Fix Released: :rn:`5.6.12-60.4` | |
449 | |:Upstream fix: N/A | |
450 | +-------------------------------------------------------------------------------------------------------------+ |
451 | +<<<<<<< TREE |
452 | |:Upstream bug: :mysqlbug:`71603` - file name is not escaped in binlog for LOAD DATA INFILE statement | |
453 | |:Launchpad bug: :bug:`1277351` | |
454 | |:Upstream state: N/A | |
455 | @@ -227,6 +294,14 @@ |
456 | |:Fix Released: :rn:`5.6.11-60.3` | |
457 | |:Upstream fix: N/A | |
458 | +-------------------------------------------------------------------------------------------------------------+ |
459 | +======= |
460 | +|:Upstream bug: :mysqlbug:`71183` - os_file_fsync() should handle fsync() returning EINTR | |
461 | +|:Launchpad bug: :bug:`1262651` | |
462 | +|:Upstream state: Verified (checked on 2014-02-05) | |
463 | +|:Fix Released: :rn:`5.6.11-60.3` | |
464 | +|:Upstream fix: N/A | |
465 | ++-------------------------------------------------------------------------------------------------------------+ |
466 | +>>>>>>> MERGE-SOURCE |
467 | |:Upstream bug: :mysqlbug:`63451` - atomic/x86-gcc.h:make_atomic_cas_body64 potential miscompilation bug | |
468 | |:Launchpad bug: :bug:`878022` | |
469 | |:Upstream state: Closed | |
470 | @@ -241,7 +316,11 @@ |
471 | +-------------------------------------------------------------------------------------------------------------+ |
472 | |:Upstream bug: :mysqlbug:`69252` - All the parts.partition_max* tests are broken with MTR --parallel | |
473 | |:Launchpad bug: :bug:`1180481` | |
474 | +<<<<<<< TREE |
475 | |:Upstream state: Verified (checked on 2014-03-07) | |
476 | +======= |
477 | +|:Upstream state: Verified (checked on 2014-02-05) | |
478 | +>>>>>>> MERGE-SOURCE |
479 | |:Fix Released: :rn:`5.6.11-60.3` | |
480 | |:Upstream fix: N/A | |
481 | +-------------------------------------------------------------------------------------------------------------+ |
482 | @@ -253,7 +332,11 @@ |
483 | +-------------------------------------------------------------------------------------------------------------+ |
484 | |:Upstream bug: :mysqlbug:`68714` - Remove literal statement digest values from perfschema tests | |
485 | |:Launchpad bug: :bug:`1157078` | |
486 | +<<<<<<< TREE |
487 | |:Upstream state: Verified (checked on 2014-03-07) | |
488 | +======= |
489 | +|:Upstream state: Verified (checked on 2014-02-05) | |
490 | +>>>>>>> MERGE-SOURCE |
491 | |:Fix Released: :rn:`5.6.11-60.3` | |
492 | |:Upstream fix: N/A | |
493 | +-------------------------------------------------------------------------------------------------------------+ |
494 | @@ -277,13 +360,21 @@ |
495 | +-------------------------------------------------------------------------------------------------------------+ |
496 | |:Upstream bug: :mysqlbug:`68970` - fsp_reserve_free_extents switches from small to big tblspace handling ... | |
497 | |:Launchpad bug: :bug:`1169494` | |
498 | +<<<<<<< TREE |
499 | |:Upstream state: Verified (checked on 2014-03-07) | |
500 | +======= |
501 | +|:Upstream state: Verified (checked on 2014-02-05) | |
502 | +>>>>>>> MERGE-SOURCE |
503 | |:Fix Released: :rn:`5.6.11-60.3` | |
504 | |:Upstream fix: N/A | |
505 | +-------------------------------------------------------------------------------------------------------------+ |
506 | |:Upstream bug: :mysqlbug:`68713` - create_duplicate_weedout_tmp_table() leaves key_part_flag uninitialized | |
507 | |:Launchpad bug: :bug:`1157037` | |
508 | +<<<<<<< TREE |
509 | |:Upstream state: Verified (checked on 2014-03-07) | |
510 | +======= |
511 | +|:Upstream state: Verified (checked on 2014-02-05) | |
512 | +>>>>>>> MERGE-SOURCE |
513 | |:Fix Released: :rn:`5.6.11-60.3` | |
514 | |:Upstream fix: N/A | |
515 | +-------------------------------------------------------------------------------------------------------------+ |
516 | @@ -295,13 +386,21 @@ |
517 | +-------------------------------------------------------------------------------------------------------------+ |
518 | |:Upstream bug: :mysqlbug:`68999` - SSL_OP_NO_COMPRESSION not defined | |
519 | |:Launchpad bug: :bug:`1183610` | |
520 | +<<<<<<< TREE |
521 | |:Upstream state: No Feedback (checked on 2014-03-07) | |
522 | +======= |
523 | +|:Upstream state: No Feedback (checked on 2014-02-05) | |
524 | +>>>>>>> MERGE-SOURCE |
525 | |:Fix Released: :rn:`5.6.11-60.3` | |
526 | |:Upstream fix: N/A | |
527 | +-------------------------------------------------------------------------------------------------------------+ |
528 | |:Upstream bug: :mysqlbug:`68845` - Unnecessary log_sys->mutex reacquisition in mtr_log_reserve_and_write() | |
529 | |:Launchpad bug: :bug:`1163439` | |
530 | +<<<<<<< TREE |
531 | |:Upstream state: Verified (checked on 2014-03-07) | |
532 | +======= |
533 | +|:Upstream state: Verified (checked on 2014-02-05) | |
534 | +>>>>>>> MERGE-SOURCE |
535 | |:Fix Released: :rn:`5.6.11-60.3` | |
536 | |:Upstream fix: N/A | |
537 | +-------------------------------------------------------------------------------------------------------------+ |
538 | @@ -331,7 +430,11 @@ |
539 | +-------------------------------------------------------------------------------------------------------------+ |
540 | |:Upstream bug: :mysqlbug:`68476` - Suboptimal code in my_strnxfrm_simple() | |
541 | |:Launchpad bug: :bug:`1132350` | |
542 | +<<<<<<< TREE |
543 | |:Upstream state: Verified (checked on 2014-03-07) | |
544 | +======= |
545 | +|:Upstream state: Verified (checked on 2014-02-05) | |
546 | +>>>>>>> MERGE-SOURCE |
547 | |:Fix Released: :rn:`5.6.11-60.3` | |
548 | |:Upstream fix: N/A | |
549 | +-------------------------------------------------------------------------------------------------------------+ |
550 | @@ -385,13 +488,21 @@ |
551 | +-------------------------------------------------------------------------------------------------------------+ |
552 | |:Upstream bug: :mysqlbug:`61180` - korr/store macros in my_global.h assume the argument to be a char pointer | |
553 | |:Launchpad bug: :bug:`1042517` | |
554 | +<<<<<<< TREE |
555 | |:Upstream state: Closed | |
556 | +======= |
557 | +|:Upstream state: Verified (checked on 2014-02-05) | |
558 | +>>>>>>> MERGE-SOURCE |
559 | |:Fix Released: :rn:`5.6.11-60.3` | |
560 | |:Upstream fix: N/A | |
561 | +-------------------------------------------------------------------------------------------------------------+ |
562 | |:Upstream bug: :mysqlbug:`61178` - Incorrect implementation of intersect(ulonglong) in non-optimized Bitmap..| |
563 | |:Launchpad bug: :bug:`1042517` | |
564 | +<<<<<<< TREE |
565 | |:Upstream state: Verified (checked on 2014-03-07) | |
566 | +======= |
567 | +|:Upstream state: Verified (checked on 2014-02-05) | |
568 | +>>>>>>> MERGE-SOURCE |
569 | |:Fix Released: :rn:`5.6.11-60.3` | |
570 | |:Upstream fix: N/A | |
571 | +-------------------------------------------------------------------------------------------------------------+ |
572 | @@ -403,7 +514,11 @@ |
573 | +-------------------------------------------------------------------------------------------------------------+ |
574 | |:Upstream bug: :mysqlbug:`64800` - mysqldump with --include-master-host-port putting quotes around port no. | |
575 | |:Launchpad bug: :bug:`1013432` | |
576 | +<<<<<<< TREE |
577 | |:Upstream state: Verified (checked on 2014-03-07) | |
578 | +======= |
579 | +|:Upstream state: Verified (checked on 2014-02-05) | |
580 | +>>>>>>> MERGE-SOURCE |
581 | |:Fix Released: :rn:`5.6.11-60.3` | |
582 | |:Upstream fix: N/A | |
583 | +-------------------------------------------------------------------------------------------------------------+ |
584 | @@ -433,13 +548,21 @@ |
585 | +-------------------------------------------------------------------------------------------------------------+ |
586 | |:Upstream bug: :mysqlbug:`25007` - memory tables with dynamic rows format | |
587 | |:Launchpad bug: N/A | |
588 | +<<<<<<< TREE |
589 | |:Upstream state: Verified (checked on 2014-03-07) | |
590 | +======= |
591 | +|:Upstream state: Verified (checked on 2014-02-05) | |
592 | +>>>>>>> MERGE-SOURCE |
593 | |:Fix Released: :rn:`5.6.11-60.3` | |
594 | |:Upstream fix: N/A | |
595 | +-------------------------------------------------------------------------------------------------------------+ |
596 | |:Upstream bug: :mysqlbug:`61595` - mysql-test/include/wait_for_slave_param.inc timeout logic is incorrect | |
597 | |:Launchpad bug: :bug:`800035` | |
598 | +<<<<<<< TREE |
599 | |:Upstream state: Verified (checked on 2014-03-07) | |
600 | +======= |
601 | +|:Upstream state: Verified (checked on 2014-02-05) | |
602 | +>>>>>>> MERGE-SOURCE |
603 | |:Fix Released: :rn:`5.6.11-60.3` | |
604 | |:Upstream fix: N/A | |
605 | +-------------------------------------------------------------------------------------------------------------+ |
606 | @@ -451,7 +574,11 @@ |
607 | +-------------------------------------------------------------------------------------------------------------+ |
608 | |:Upstream bug: :mysqlbug:`68116` - InnoDB monitor may hit an assertion error in buf_page_get_gen in debug ...| |
609 | |:Launchpad bug: :bug:`1100178` | |
610 | +<<<<<<< TREE |
611 | |:Upstream state: Verified (checked on 2014-03-07) | |
612 | +======= |
613 | +|:Upstream state: Verified (checked on 2014-02-05) | |
614 | +>>>>>>> MERGE-SOURCE |
615 | |:Fix Released: :rn:`5.6.10-60.2` | |
616 | |:Upstream fix: N/A | |
617 | +-------------------------------------------------------------------------------------------------------------+ |
618 | @@ -463,13 +590,21 @@ |
619 | +-------------------------------------------------------------------------------------------------------------+ |
620 | |:Upstream bug: :mysqlbug:`20001` - Support for temp-tables in INFORMATION_SCHEMA | |
621 | |:Launchpad bug: N/A | |
622 | +<<<<<<< TREE |
623 | |:Upstream state: Verified (checked on 2014-03-07) | |
624 | +======= |
625 | +|:Upstream state: Verified (checked on 2014-02-05) | |
626 | +>>>>>>> MERGE-SOURCE |
627 | |:Fix Released: :rn:`5.6.5-60.0` | |
628 | |:Upstream fix: N/A | |
629 | +-------------------------------------------------------------------------------------------------------------+ |
630 | |:Upstream bug: :mysqlbug:`69146` - Optimization in buf_pool_get_oldest_modification if srv_buf_pool_instances| |
631 | |:Launchpad bug: :bug:`1176496` | |
632 | +<<<<<<< TREE |
633 | |:Upstream state: Open (checked on 2014-03-07) | |
634 | +======= |
635 | +|:Upstream state: Open (checked on 2014-02-05) | |
636 | +>>>>>>> MERGE-SOURCE |
637 | |:Fix Released: :rn:`5.6.5-60.0` | |
638 | |:Upstream fix: N/A | |
639 | +-------------------------------------------------------------------------------------------------------------+ |
640 | |
641 | === modified file 'mysql-test/r/backup_locks_mysqldump.result' |
642 | --- mysql-test/r/backup_locks_mysqldump.result 2014-02-27 12:29:47 +0000 |
643 | +++ mysql-test/r/backup_locks_mysqldump.result 2014-03-16 07:05:06 +0000 |
644 | @@ -1,3 +1,4 @@ |
645 | +<<<<<<< TREE |
646 | SHOW VARIABLES LIKE 'have_backup_locks'; |
647 | Variable_name Value |
648 | have_backup_locks YES |
649 | @@ -149,3 +150,148 @@ |
650 | SET GLOBAL log_output = @old_log_output; |
651 | SET GLOBAL general_log = @old_general_log; |
652 | DROP TABLE t1, t2; |
653 | +======= |
654 | +SHOW VARIABLES LIKE 'have_backup_locks'; |
655 | +Variable_name Value |
656 | +have_backup_locks YES |
657 | +CREATE TABLE t1 (a INT) ENGINE=InnoDB; |
658 | +CREATE TABLE t2 (a INT) ENGINE=MyISAM; |
659 | +SET @old_general_log = @@general_log; |
660 | +SET @old_log_output = @@log_output; |
661 | +TRUNCATE TABLE mysql.general_log; |
662 | +SET GLOBAL log_output = 'TABLE'; |
663 | +SET GLOBAL general_log = ON; |
664 | +# Check that --lock-for-backup is converted to --lock-all-tables if |
665 | +# --single-transaction is not specified |
666 | +SELECT argument FROM mysql.general_log WHERE argument != ''; |
667 | +argument |
668 | +SET GLOBAL general_log = ON |
669 | +root@localhost on |
670 | +/*!40100 SET @@SQL_MODE='' */ |
671 | +/*!40103 SET TIME_ZONE='+00:00' */ |
672 | +FLUSH TABLES |
673 | +FLUSH TABLES WITH READ LOCK |
674 | +SHOW VARIABLES LIKE 'gtid\_mode' |
675 | +SELECT LOGFILE_GROUP_NAME, FILE_NAME, TOTAL_EXTENTS, INITIAL_SIZE, ENGINE, EXTRA FROM INFORMATION_SCHEMA.FILES WHERE FILE_TYPE = 'UNDO LOG' AND FILE_NAME IS NOT NULL AND LOGFILE_GROUP_NAME IN (SELECT DISTINCT LOGFILE_GROUP_NAME FROM INFORMATION_SCHEMA.FILES WHERE FILE_TYPE = 'DATAFILE' AND TABLESPACE_NAME IN (SELECT DISTINCT TABLESPACE_NAME FROM INFORMATION_SCHEMA.PARTITIONS WHERE TABLE_SCHEMA IN ('test'))) GROUP BY LOGFILE_GROUP_NAME, FILE_NAME, ENGINE ORDER BY LOGFILE_GROUP_NAME |
676 | +SELECT DISTINCT TABLESPACE_NAME, FILE_NAME, LOGFILE_GROUP_NAME, EXTENT_SIZE, INITIAL_SIZE, ENGINE FROM INFORMATION_SCHEMA.FILES WHERE FILE_TYPE = 'DATAFILE' AND TABLESPACE_NAME IN (SELECT DISTINCT TABLESPACE_NAME FROM INFORMATION_SCHEMA.PARTITIONS WHERE TABLE_SCHEMA IN ('test')) ORDER BY TABLESPACE_NAME, LOGFILE_GROUP_NAME |
677 | +SHOW VARIABLES LIKE 'ndbinfo\_version' |
678 | +test |
679 | +show tables |
680 | +show table status like 't1' |
681 | +SET SQL_QUOTE_SHOW_CREATE=1 |
682 | +SET SESSION character_set_results = 'binary' |
683 | +show create table `t1` |
684 | +SET SESSION character_set_results = 'utf8' |
685 | +show fields from `t1` |
686 | +SELECT /*!40001 SQL_NO_CACHE */ * FROM `t1` |
687 | +SET SESSION character_set_results = 'binary' |
688 | +use `test` |
689 | +select @@collation_database |
690 | +SHOW TRIGGERS LIKE 't1' |
691 | +SET SESSION character_set_results = 'utf8' |
692 | +show table status like 't2' |
693 | +SET SQL_QUOTE_SHOW_CREATE=1 |
694 | +SET SESSION character_set_results = 'binary' |
695 | +show create table `t2` |
696 | +SET SESSION character_set_results = 'utf8' |
697 | +show fields from `t2` |
698 | +SELECT /*!40001 SQL_NO_CACHE */ * FROM `t2` |
699 | +SET SESSION character_set_results = 'binary' |
700 | +use `test` |
701 | +select @@collation_database |
702 | +SHOW TRIGGERS LIKE 't2' |
703 | +SET SESSION character_set_results = 'utf8' |
704 | +SELECT argument FROM mysql.general_log WHERE argument != '' |
705 | +TRUNCATE TABLE mysql.general_log; |
706 | +# Check that --lock-for-backup --single-transaction uses LOCK TABLES FOR |
707 | +# BACKUP |
708 | +SELECT argument FROM mysql.general_log WHERE argument != ''; |
709 | +argument |
710 | +root@localhost on |
711 | +/*!40100 SET @@SQL_MODE='' */ |
712 | +/*!40103 SET TIME_ZONE='+00:00' */ |
713 | +SHOW VARIABLES LIKE 'have_backup_locks' |
714 | +LOCK TABLES FOR BACKUP |
715 | +SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ |
716 | +START TRANSACTION /*!40100 WITH CONSISTENT SNAPSHOT */ |
717 | +SHOW VARIABLES LIKE 'gtid\_mode' |
718 | +SELECT LOGFILE_GROUP_NAME, FILE_NAME, TOTAL_EXTENTS, INITIAL_SIZE, ENGINE, EXTRA FROM INFORMATION_SCHEMA.FILES WHERE FILE_TYPE = 'UNDO LOG' AND FILE_NAME IS NOT NULL AND LOGFILE_GROUP_NAME IN (SELECT DISTINCT LOGFILE_GROUP_NAME FROM INFORMATION_SCHEMA.FILES WHERE FILE_TYPE = 'DATAFILE' AND TABLESPACE_NAME IN (SELECT DISTINCT TABLESPACE_NAME FROM INFORMATION_SCHEMA.PARTITIONS WHERE TABLE_SCHEMA IN ('test'))) GROUP BY LOGFILE_GROUP_NAME, FILE_NAME, ENGINE ORDER BY LOGFILE_GROUP_NAME |
719 | +SELECT DISTINCT TABLESPACE_NAME, FILE_NAME, LOGFILE_GROUP_NAME, EXTENT_SIZE, INITIAL_SIZE, ENGINE FROM INFORMATION_SCHEMA.FILES WHERE FILE_TYPE = 'DATAFILE' AND TABLESPACE_NAME IN (SELECT DISTINCT TABLESPACE_NAME FROM INFORMATION_SCHEMA.PARTITIONS WHERE TABLE_SCHEMA IN ('test')) ORDER BY TABLESPACE_NAME, LOGFILE_GROUP_NAME |
720 | +SHOW VARIABLES LIKE 'ndbinfo\_version' |
721 | +test |
722 | +show tables |
723 | +show table status like 't1' |
724 | +SET SQL_QUOTE_SHOW_CREATE=1 |
725 | +SET SESSION character_set_results = 'binary' |
726 | +show create table `t1` |
727 | +SET SESSION character_set_results = 'utf8' |
728 | +show fields from `t1` |
729 | +SELECT /*!40001 SQL_NO_CACHE */ * FROM `t1` |
730 | +SET SESSION character_set_results = 'binary' |
731 | +use `test` |
732 | +select @@collation_database |
733 | +SHOW TRIGGERS LIKE 't1' |
734 | +SET SESSION character_set_results = 'utf8' |
735 | +show table status like 't2' |
736 | +SET SQL_QUOTE_SHOW_CREATE=1 |
737 | +SET SESSION character_set_results = 'binary' |
738 | +show create table `t2` |
739 | +SET SESSION character_set_results = 'utf8' |
740 | +show fields from `t2` |
741 | +SELECT /*!40001 SQL_NO_CACHE */ * FROM `t2` |
742 | +SET SESSION character_set_results = 'binary' |
743 | +use `test` |
744 | +select @@collation_database |
745 | +SHOW TRIGGERS LIKE 't2' |
746 | +SET SESSION character_set_results = 'utf8' |
747 | +SELECT argument FROM mysql.general_log WHERE argument != '' |
748 | +TRUNCATE TABLE mysql.general_log; |
749 | +# Check that --master-data does not disable --lock-for-backup |
750 | +SELECT argument FROM mysql.general_log WHERE argument != ''; |
751 | +argument |
752 | +root@localhost on |
753 | +/*!40100 SET @@SQL_MODE='' */ |
754 | +/*!40103 SET TIME_ZONE='+00:00' */ |
755 | +SHOW VARIABLES LIKE 'have_backup_locks' |
756 | +SHOW STATUS LIKE 'binlog_snapshot_%' |
757 | +LOCK TABLES FOR BACKUP |
758 | +SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ |
759 | +START TRANSACTION /*!40100 WITH CONSISTENT SNAPSHOT */ |
760 | +SHOW VARIABLES LIKE 'gtid\_mode' |
761 | +SHOW STATUS LIKE 'binlog_snapshot_%' |
762 | +UNLOCK TABLES |
763 | +SELECT LOGFILE_GROUP_NAME, FILE_NAME, TOTAL_EXTENTS, INITIAL_SIZE, ENGINE, EXTRA FROM INFORMATION_SCHEMA.FILES WHERE FILE_TYPE = 'UNDO LOG' AND FILE_NAME IS NOT NULL AND LOGFILE_GROUP_NAME IN (SELECT DISTINCT LOGFILE_GROUP_NAME FROM INFORMATION_SCHEMA.FILES WHERE FILE_TYPE = 'DATAFILE' AND TABLESPACE_NAME IN (SELECT DISTINCT TABLESPACE_NAME FROM INFORMATION_SCHEMA.PARTITIONS WHERE TABLE_SCHEMA IN ('test'))) GROUP BY LOGFILE_GROUP_NAME, FILE_NAME, ENGINE ORDER BY LOGFILE_GROUP_NAME |
764 | +SELECT DISTINCT TABLESPACE_NAME, FILE_NAME, LOGFILE_GROUP_NAME, EXTENT_SIZE, INITIAL_SIZE, ENGINE FROM INFORMATION_SCHEMA.FILES WHERE FILE_TYPE = 'DATAFILE' AND TABLESPACE_NAME IN (SELECT DISTINCT TABLESPACE_NAME FROM INFORMATION_SCHEMA.PARTITIONS WHERE TABLE_SCHEMA IN ('test')) ORDER BY TABLESPACE_NAME, LOGFILE_GROUP_NAME |
765 | +SHOW VARIABLES LIKE 'ndbinfo\_version' |
766 | +test |
767 | +show tables |
768 | +show table status like 't1' |
769 | +SET SQL_QUOTE_SHOW_CREATE=1 |
770 | +SET SESSION character_set_results = 'binary' |
771 | +show create table `t1` |
772 | +SET SESSION character_set_results = 'utf8' |
773 | +show fields from `t1` |
774 | +SELECT /*!40001 SQL_NO_CACHE */ * FROM `t1` |
775 | +SET SESSION character_set_results = 'binary' |
776 | +use `test` |
777 | +select @@collation_database |
778 | +SHOW TRIGGERS LIKE 't1' |
779 | +SET SESSION character_set_results = 'utf8' |
780 | +show table status like 't2' |
781 | +SET SQL_QUOTE_SHOW_CREATE=1 |
782 | +SET SESSION character_set_results = 'binary' |
783 | +show create table `t2` |
784 | +SET SESSION character_set_results = 'utf8' |
785 | +show fields from `t2` |
786 | +SELECT /*!40001 SQL_NO_CACHE */ * FROM `t2` |
787 | +SET SESSION character_set_results = 'binary' |
788 | +use `test` |
789 | +select @@collation_database |
790 | +SHOW TRIGGERS LIKE 't2' |
791 | +SET SESSION character_set_results = 'utf8' |
792 | +SELECT argument FROM mysql.general_log WHERE argument != '' |
793 | +TRUNCATE TABLE mysql.general_log; |
794 | +SET GLOBAL log_output = @old_log_output; |
795 | +SET GLOBAL general_log = @old_general_log; |
796 | +DROP TABLE t1, t2; |
797 | +>>>>>>> MERGE-SOURCE |
798 | |
799 | === added file 'mysql-test/r/clone_consistent_snapshot.result' |
800 | --- mysql-test/r/clone_consistent_snapshot.result 1970-01-01 00:00:00 +0000 |
801 | +++ mysql-test/r/clone_consistent_snapshot.result 2014-03-16 07:05:06 +0000 |
802 | @@ -0,0 +1,145 @@ |
803 | +# connection con1 |
804 | +CREATE TABLE t1 (a INT) ENGINE=InnoDB; |
805 | +INSERT INTO t1 VALUES(1); |
806 | +START TRANSACTION WITH CONSISTENT SNAPSHOT; |
807 | +# connection con2 |
808 | +INSERT INTO t1 VALUES(2); |
809 | +# connection con3 |
810 | +SELECT * FROM t1; |
811 | +a |
812 | +1 |
813 | +2 |
814 | +# Basic syntax tests |
815 | +START TRANSACTION WITH CONSISTENT SNAPSHOT FROM SESSION; |
816 | +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 |
817 | +START TRANSACTION WITH CONSISTENT SNAPSHOT FROM SESSION CONNECTION_ID(); |
818 | +ERROR HY000: Unknown thread id: ID |
819 | +START TRANSACTION WITH CONSISTENT SNAPSHOT FROM SESSION |
820 | +(SELECT MAX(a) FROM t1); |
821 | +ERROR 42000: This version of MySQL doesn't yet support 'Usage of subqueries or stored function calls as part of this statement' |
822 | +START TRANSACTION WITH CONSISTENT SNAPSHOT FROM SESSION (1,1); |
823 | +ERROR 21000: Operand should contain 1 column(s) |
824 | +START TRANSACTION WITH CONSISTENT SNAPSHOT FROM SESSION "foo"; |
825 | +ERROR HY000: Unknown thread id: 0 |
826 | +START TRANSACTION WITH CONSISTENT SNAPSHOT FROM SESSION NULL; |
827 | +ERROR HY000: Unknown thread id: 0 |
828 | +# Functional tests |
829 | +START TRANSACTION WITH CONSISTENT SNAPSHOT FROM SESSION $con1_id; |
830 | +SELECT * FROM t1; |
831 | +a |
832 | +1 |
833 | +# connection con2 |
834 | +INSERT INTO t1 VALUES(3); |
835 | +SELECT * FROM t1; |
836 | +a |
837 | +1 |
838 | +2 |
839 | +3 |
840 | +# connection con3 |
841 | +SELECT * FROM t1; |
842 | +a |
843 | +1 |
844 | +INSERT INTO t1 VALUES(4); |
845 | +SELECT * FROM t1; |
846 | +a |
847 | +1 |
848 | +# connection con1 |
849 | +INSERT INTO t1 VALUES(5); |
850 | +SELECT * FROM t1; |
851 | +a |
852 | +1 |
853 | +5 |
854 | +# connection con3 |
855 | +SELECT * FROM t1; |
856 | +a |
857 | +1 |
858 | +5 |
859 | +# connection con1 |
860 | +COMMIT; |
861 | +# Test cascading snapshot cloning |
862 | +# connection con2 |
863 | +START TRANSACTION WITH CONSISTENT SNAPSHOT FROM SESSION $con3_id; |
864 | +SELECT * FROM t1; |
865 | +a |
866 | +1 |
867 | +5 |
868 | +COMMIT; |
869 | +SELECT * FROM t1; |
870 | +a |
871 | +1 |
872 | +2 |
873 | +3 |
874 | +5 |
875 | +# connection con3 |
876 | +SELECT * FROM t1; |
877 | +a |
878 | +1 |
879 | +5 |
880 | +COMMIT; |
881 | +SELECT * FROM t1; |
882 | +a |
883 | +1 |
884 | +2 |
885 | +3 |
886 | +4 |
887 | +5 |
888 | +# The following should fail to clone a read view as con1 does not have an |
889 | +# active transaction |
890 | +START TRANSACTION WITH CONSISTENT SNAPSHOT FROM SESSION $con1_id; |
891 | +Warnings: |
892 | +Warning 138 InnoDB: WITH CONSISTENT SNAPSHOT FROM SESSION was ignored because the target transaction has not been assigned a read view. |
893 | +# connection con1 |
894 | +INSERT INTO t1 VALUES(6); |
895 | +# connection con3 |
896 | +SELECT * FROM t1; |
897 | +a |
898 | +1 |
899 | +2 |
900 | +3 |
901 | +4 |
902 | +5 |
903 | +6 |
904 | +# connection con3 |
905 | +COMMIT; |
906 | +# Now test cloning read view from a regular transaction |
907 | +# connection con1 |
908 | +START TRANSACTION; |
909 | +INSERT INTO t1 VALUES(7); |
910 | +# connection con3 |
911 | +# The following should fail to clone a read view as con1 does not yet have an |
912 | +# active transaction |
913 | +START TRANSACTION WITH CONSISTENT SNAPSHOT FROM SESSION $con1_id; |
914 | +Warnings: |
915 | +Warning 138 InnoDB: WITH CONSISTENT SNAPSHOT FROM SESSION was ignored because the target transaction has not been assigned a read view. |
916 | +SELECT * FROM t1; |
917 | +a |
918 | +1 |
919 | +2 |
920 | +3 |
921 | +4 |
922 | +5 |
923 | +6 |
924 | +# connection con1 |
925 | +SELECT * FROM t1; |
926 | +a |
927 | +1 |
928 | +2 |
929 | +3 |
930 | +4 |
931 | +5 |
932 | +6 |
933 | +7 |
934 | +INSERT INTO t1 VALUES(8); |
935 | +# connection con3 |
936 | +START TRANSACTION WITH CONSISTENT SNAPSHOT FROM SESSION $con1_id; |
937 | +SELECT * FROM t1; |
938 | +a |
939 | +1 |
940 | +2 |
941 | +3 |
942 | +4 |
943 | +5 |
944 | +6 |
945 | +7 |
946 | +8 |
947 | +DROP TABLE t1; |
948 | |
949 | === modified file 'mysql-test/r/mysqldump-max.result' |
950 | --- mysql-test/r/mysqldump-max.result 2010-10-25 09:20:53 +0000 |
951 | +++ mysql-test/r/mysqldump-max.result 2014-03-16 07:05:06 +0000 |
952 | @@ -290,3 +290,60 @@ |
953 | DROP VIEW v1; |
954 | DROP TABLE t1; |
955 | SET GLOBAL default_storage_engine=@old_engine; |
956 | +# Connection default |
957 | +SET binlog_format= mixed; |
958 | +RESET MASTER; |
959 | +CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB; |
960 | +INSERT INTO t1 VALUES (1),(2); |
961 | +CREATE TABLE t2 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB; |
962 | +INSERT INTO t2 VALUES (1,0), (2,0); |
963 | +SELECT GET_LOCK("block_queries_1", 120); |
964 | +GET_LOCK("block_queries_1", 120) |
965 | +1 |
966 | +# Connection c3 |
967 | +SELECT GET_LOCK("block_queries_2", 120); |
968 | +GET_LOCK("block_queries_2", 120) |
969 | +1 |
970 | +# Connection c1 |
971 | +SET @c= 0; |
972 | +SELECT IF(@c<1, @c:=@c+1, GET_LOCK("block_queries_1", 120)) FROM t1 ORDER BY a; |
973 | +# Connection c2 |
974 | +SET binlog_format="row"; |
975 | +SET @d= 10; |
976 | +UPDATE t2 SET b=IF(@d<=10, @d:=@d+1, GET_LOCK("block_queries_2", 120)) ORDER BY a; |
977 | +# Connection default |
978 | +# Make sure other queries are running (and waiting). |
979 | +SELECT RELEASE_LOCK("block_queries_1"); |
980 | +RELEASE_LOCK("block_queries_1") |
981 | +1 |
982 | +# Connection c3 |
983 | +SELECT RELEASE_LOCK("block_queries_2"); |
984 | +RELEASE_LOCK("block_queries_2") |
985 | +1 |
986 | +# Connection c1 |
987 | +IF(@c<1, @c:=@c+1, GET_LOCK("block_queries_1", 120)) |
988 | +1 |
989 | +1 |
990 | +# Connection c2 |
991 | +# Connection default |
992 | +SELECT * FROM t2 ORDER BY a; |
993 | +a b |
994 | +1 11 |
995 | +2 1 |
996 | +DROP TABLE t1; |
997 | +DROP TABLE t2; |
998 | +SHOW BINLOG EVENTS LIMIT 7,3; |
999 | +Log_name Pos Event_type Server_id End_log_pos Info |
1000 | +master-bin.000001 665 Query 1 773 use `test`; INSERT INTO t2 VALUES (1,0), (2,0) |
1001 | +master-bin.000001 773 Xid 1 804 COMMIT /* XID */ |
1002 | +master-bin.000001 804 Query 1 876 BEGIN |
1003 | +-- CHANGE MASTER TO MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=804; |
1004 | +SELECT * FROM t1 ORDER BY a; |
1005 | +a |
1006 | +1 |
1007 | +2 |
1008 | +SELECT * FROM t2 ORDER BY a; |
1009 | +a b |
1010 | +1 0 |
1011 | +2 0 |
1012 | +DROP TABLE t1,t2; |
1013 | |
1014 | === added file 'mysql-test/suite/binlog/r/binlog_consistent.result' |
1015 | --- mysql-test/suite/binlog/r/binlog_consistent.result 1970-01-01 00:00:00 +0000 |
1016 | +++ mysql-test/suite/binlog/r/binlog_consistent.result 2014-03-16 07:05:06 +0000 |
1017 | @@ -0,0 +1,178 @@ |
1018 | +RESET MASTER; |
1019 | +# Connection default |
1020 | +CREATE TABLE t1 (a INT, b VARCHAR(100), PRIMARY KEY (a,b)) ENGINE=innodb; |
1021 | +SHOW MASTER STATUS; |
1022 | +File Position Binlog_Do_DB Binlog_Ignore_DB Executed_Gtid_Set |
1023 | +master-bin.000001 266 |
1024 | +SHOW STATUS LIKE 'binlog_snapshot_%'; |
1025 | +Variable_name Value |
1026 | +Binlog_snapshot_file master-bin.000001 |
1027 | +Binlog_snapshot_position 266 |
1028 | +BEGIN; |
1029 | +INSERT INTO t1 VALUES (0, ""); |
1030 | +# Connection con1 |
1031 | +BEGIN; |
1032 | +INSERT INTO t1 VALUES (1, ""); |
1033 | +# Connection con2 |
1034 | +CREATE TABLE t2 (a INT PRIMARY KEY) ENGINE=myisam; |
1035 | +BEGIN; |
1036 | +INSERT INTO t1 VALUES (2, "first"); |
1037 | +INSERT INTO t2 VALUES (2); |
1038 | +INSERT INTO t1 VALUES (2, "second"); |
1039 | +# Connection default |
1040 | +COMMIT; |
1041 | +SET TRANSACTION ISOLATION LEVEL REPEATABLE READ; |
1042 | +START TRANSACTION WITH CONSISTENT SNAPSHOT; |
1043 | +# Connection con3 |
1044 | +BEGIN; |
1045 | +INSERT INTO t1 VALUES (3, ""); |
1046 | +INSERT INTO t2 VALUES (3); |
1047 | +# Connection con4 |
1048 | +BEGIN; |
1049 | +INSERT INTO t1 VALUES (4, ""); |
1050 | +COMMIT; |
1051 | +# Connection default |
1052 | +SELECT * FROM t1 ORDER BY a,b; |
1053 | +a b |
1054 | +0 |
1055 | +SHOW STATUS LIKE 'binlog_snapshot_%'; |
1056 | +Variable_name Value |
1057 | +Binlog_snapshot_file master-bin.000001 |
1058 | +Binlog_snapshot_position 860 |
1059 | +SHOW MASTER STATUS; |
1060 | +File Position Binlog_Do_DB Binlog_Ignore_DB Executed_Gtid_Set |
1061 | +master-bin.000001 1331 |
1062 | +SELECT * FROM t2 ORDER BY a; |
1063 | +a |
1064 | +2 |
1065 | +3 |
1066 | +# Connection con1 |
1067 | +COMMIT; |
1068 | +# Connection con2 |
1069 | +COMMIT; |
1070 | +# Connection con3 |
1071 | +COMMIT; |
1072 | +FLUSH LOGS; |
1073 | +# Connection default |
1074 | +SELECT * FROM t1 ORDER BY a,b; |
1075 | +a b |
1076 | +0 |
1077 | +SHOW STATUS LIKE 'binlog_snapshot_%'; |
1078 | +Variable_name Value |
1079 | +Binlog_snapshot_file master-bin.000001 |
1080 | +Binlog_snapshot_position 860 |
1081 | +SHOW MASTER STATUS; |
1082 | +File Position Binlog_Do_DB Binlog_Ignore_DB Executed_Gtid_Set |
1083 | +master-bin.000002 120 |
1084 | +COMMIT; |
1085 | +SHOW STATUS LIKE 'binlog_snapshot_%'; |
1086 | +Variable_name Value |
1087 | +Binlog_snapshot_file master-bin.000002 |
1088 | +Binlog_snapshot_position 120 |
1089 | +SHOW MASTER STATUS; |
1090 | +File Position Binlog_Do_DB Binlog_Ignore_DB Executed_Gtid_Set |
1091 | +master-bin.000002 120 |
1092 | +# Test START TRANSACTION WITH CONSISTENT SNAPSHOT FROM SESSION |
1093 | +DELETE FROM t1; |
1094 | +START TRANSACTION WITH CONSISTENT SNAPSHOT; |
1095 | +SHOW STATUS LIKE 'binlog_snapshot_%'; |
1096 | +Variable_name Value |
1097 | +Binlog_snapshot_file master-bin.000002 |
1098 | +Binlog_snapshot_position 318 |
1099 | +SHOW MASTER STATUS; |
1100 | +File Position Binlog_Do_DB Binlog_Ignore_DB Executed_Gtid_Set |
1101 | +master-bin.000002 318 |
1102 | +INSERT INTO t1 VALUES (1, "first"); |
1103 | +SELECT * FROM t1; |
1104 | +a b |
1105 | +1 first |
1106 | +# Connection con3 |
1107 | +INSERT INTO t1 VALUES (3, "third"); |
1108 | +SELECT * FROM t1; |
1109 | +a b |
1110 | +3 third |
1111 | +SHOW STATUS LIKE 'binlog_snapshot_%'; |
1112 | +Variable_name Value |
1113 | +Binlog_snapshot_file master-bin.000002 |
1114 | +Binlog_snapshot_position 536 |
1115 | +SHOW MASTER STATUS; |
1116 | +File Position Binlog_Do_DB Binlog_Ignore_DB Executed_Gtid_Set |
1117 | +master-bin.000002 536 |
1118 | +# Connection con2 |
1119 | +SELECT * FROM t1; |
1120 | +a b |
1121 | +3 third |
1122 | +SHOW STATUS LIKE 'binlog_snapshot_%'; |
1123 | +Variable_name Value |
1124 | +Binlog_snapshot_file master-bin.000002 |
1125 | +Binlog_snapshot_position 536 |
1126 | +SHOW MASTER STATUS; |
1127 | +File Position Binlog_Do_DB Binlog_Ignore_DB Executed_Gtid_Set |
1128 | +master-bin.000002 536 |
1129 | +START TRANSACTION WITH CONSISTENT SNAPSHOT FROM SESSION $donor_id; |
1130 | +SELECT * FROM t1; |
1131 | +a b |
1132 | +1 first |
1133 | +SHOW STATUS LIKE 'binlog_snapshot_%'; |
1134 | +Variable_name Value |
1135 | +Binlog_snapshot_file master-bin.000002 |
1136 | +Binlog_snapshot_position 318 |
1137 | +SHOW MASTER STATUS; |
1138 | +File Position Binlog_Do_DB Binlog_Ignore_DB Executed_Gtid_Set |
1139 | +master-bin.000002 536 |
1140 | +# Connection con3 |
1141 | +FLUSH LOGS; |
1142 | +SHOW STATUS LIKE 'binlog_snapshot_%'; |
1143 | +Variable_name Value |
1144 | +Binlog_snapshot_file master-bin.000003 |
1145 | +Binlog_snapshot_position 120 |
1146 | +SHOW MASTER STATUS; |
1147 | +File Position Binlog_Do_DB Binlog_Ignore_DB Executed_Gtid_Set |
1148 | +master-bin.000003 120 |
1149 | +# Connection con2 |
1150 | +SHOW STATUS LIKE 'binlog_snapshot_%'; |
1151 | +Variable_name Value |
1152 | +Binlog_snapshot_file master-bin.000002 |
1153 | +Binlog_snapshot_position 318 |
1154 | +SHOW MASTER STATUS; |
1155 | +File Position Binlog_Do_DB Binlog_Ignore_DB Executed_Gtid_Set |
1156 | +master-bin.000003 120 |
1157 | +COMMIT; |
1158 | +# Connection default |
1159 | +SHOW STATUS LIKE 'binlog_snapshot_%'; |
1160 | +Variable_name Value |
1161 | +Binlog_snapshot_file master-bin.000002 |
1162 | +Binlog_snapshot_position 318 |
1163 | +SHOW MASTER STATUS; |
1164 | +File Position Binlog_Do_DB Binlog_Ignore_DB Executed_Gtid_Set |
1165 | +master-bin.000003 120 |
1166 | +COMMIT; |
1167 | +SHOW BINLOG EVENTS; |
1168 | +Log_name Pos Event_type Server_id End_log_pos Info |
1169 | +master-bin.000001 4 Format_desc 1 120 Server ver: #, Binlog ver: # |
1170 | +master-bin.000001 120 Query 1 266 use `test`; CREATE TABLE t1 (a INT, b VARCHAR(100), PRIMARY KEY (a,b)) ENGINE=innodb |
1171 | +master-bin.000001 266 Query 1 389 use `test`; CREATE TABLE t2 (a INT PRIMARY KEY) ENGINE=myisam |
1172 | +master-bin.000001 389 Query 1 468 BEGIN |
1173 | +master-bin.000001 468 Query 1 567 use `test`; INSERT INTO t2 VALUES (2) |
1174 | +master-bin.000001 567 Query 1 647 COMMIT |
1175 | +master-bin.000001 647 Query 1 726 BEGIN |
1176 | +master-bin.000001 726 Query 1 829 use `test`; INSERT INTO t1 VALUES (0, "") |
1177 | +master-bin.000001 829 Xid 1 860 COMMIT /* XID */ |
1178 | +master-bin.000001 860 Query 1 939 BEGIN |
1179 | +master-bin.000001 939 Query 1 1038 use `test`; INSERT INTO t2 VALUES (3) |
1180 | +master-bin.000001 1038 Query 1 1118 COMMIT |
1181 | +master-bin.000001 1118 Query 1 1197 BEGIN |
1182 | +master-bin.000001 1197 Query 1 1300 use `test`; INSERT INTO t1 VALUES (4, "") |
1183 | +master-bin.000001 1300 Xid 1 1331 COMMIT /* XID */ |
1184 | +master-bin.000001 1331 Query 1 1410 BEGIN |
1185 | +master-bin.000001 1410 Query 1 1513 use `test`; INSERT INTO t1 VALUES (1, "") |
1186 | +master-bin.000001 1513 Xid 1 1544 COMMIT /* XID */ |
1187 | +master-bin.000001 1544 Query 1 1623 BEGIN |
1188 | +master-bin.000001 1623 Query 1 1731 use `test`; INSERT INTO t1 VALUES (2, "first") |
1189 | +master-bin.000001 1731 Query 1 1840 use `test`; INSERT INTO t1 VALUES (2, "second") |
1190 | +master-bin.000001 1840 Xid 1 1871 COMMIT /* XID */ |
1191 | +master-bin.000001 1871 Query 1 1950 BEGIN |
1192 | +master-bin.000001 1950 Query 1 2053 use `test`; INSERT INTO t1 VALUES (3, "") |
1193 | +master-bin.000001 2053 Xid 1 2084 COMMIT /* XID */ |
1194 | +master-bin.000001 2084 Rotate 1 2132 master-bin.000002;pos=4 |
1195 | +DROP TABLE t1,t2; |
1196 | |
1197 | === added file 'mysql-test/suite/binlog/t/binlog_consistent.test' |
1198 | --- mysql-test/suite/binlog/t/binlog_consistent.test 1970-01-01 00:00:00 +0000 |
1199 | +++ mysql-test/suite/binlog/t/binlog_consistent.test 2014-03-16 07:05:06 +0000 |
1200 | @@ -0,0 +1,144 @@ |
1201 | +--source include/have_innodb.inc |
1202 | +--source include/have_log_bin.inc |
1203 | +--source include/have_binlog_format_mixed_or_statement.inc |
1204 | + |
1205 | +RESET MASTER; |
1206 | + |
1207 | +# Test that we get the correct binlog position from START TRANSACTION WITH |
1208 | +# CONSISTENT SNAPSHOT even when other transactions are active. |
1209 | + |
1210 | +connect(con1,localhost,root,,); |
1211 | +connect(con2,localhost,root,,); |
1212 | +connect(con3,localhost,root,,); |
1213 | +connect(con4,localhost,root,,); |
1214 | + |
1215 | +connection default; |
1216 | +--echo # Connection default |
1217 | + |
1218 | +CREATE TABLE t1 (a INT, b VARCHAR(100), PRIMARY KEY (a,b)) ENGINE=innodb; |
1219 | +SHOW MASTER STATUS; |
1220 | +SHOW STATUS LIKE 'binlog_snapshot_%'; |
1221 | +BEGIN; |
1222 | +INSERT INTO t1 VALUES (0, ""); |
1223 | + |
1224 | +connection con1; |
1225 | +--echo # Connection con1 |
1226 | +BEGIN; |
1227 | +INSERT INTO t1 VALUES (1, ""); |
1228 | + |
1229 | +connection con2; |
1230 | +--echo # Connection con2 |
1231 | +CREATE TABLE t2 (a INT PRIMARY KEY) ENGINE=myisam; |
1232 | +BEGIN; |
1233 | +INSERT INTO t1 VALUES (2, "first"); |
1234 | +INSERT INTO t2 VALUES (2); |
1235 | +INSERT INTO t1 VALUES (2, "second"); |
1236 | + |
1237 | +connection default; |
1238 | +--echo # Connection default |
1239 | +COMMIT; |
1240 | + |
1241 | +SET TRANSACTION ISOLATION LEVEL REPEATABLE READ; |
1242 | +START TRANSACTION WITH CONSISTENT SNAPSHOT; |
1243 | + |
1244 | +connection con3; |
1245 | +--echo # Connection con3 |
1246 | +BEGIN; |
1247 | +INSERT INTO t1 VALUES (3, ""); |
1248 | +INSERT INTO t2 VALUES (3); |
1249 | + |
1250 | +connection con4; |
1251 | +--echo # Connection con4 |
1252 | +BEGIN; |
1253 | +INSERT INTO t1 VALUES (4, ""); |
1254 | +COMMIT; |
1255 | + |
1256 | +connection default; |
1257 | +--echo # Connection default |
1258 | +SELECT * FROM t1 ORDER BY a,b; |
1259 | +SHOW STATUS LIKE 'binlog_snapshot_%'; |
1260 | +SHOW MASTER STATUS; |
1261 | +SELECT * FROM t2 ORDER BY a; |
1262 | + |
1263 | +connection con1; |
1264 | +--echo # Connection con1 |
1265 | +COMMIT; |
1266 | + |
1267 | +connection con2; |
1268 | +--echo # Connection con2 |
1269 | +COMMIT; |
1270 | + |
1271 | +connection con3; |
1272 | +--echo # Connection con3 |
1273 | +COMMIT; |
1274 | +FLUSH LOGS; |
1275 | + |
1276 | +connection default; |
1277 | +--echo # Connection default |
1278 | +SELECT * FROM t1 ORDER BY a,b; |
1279 | +SHOW STATUS LIKE 'binlog_snapshot_%'; |
1280 | +SHOW MASTER STATUS; |
1281 | +COMMIT; |
1282 | +SHOW STATUS LIKE 'binlog_snapshot_%'; |
1283 | +SHOW MASTER STATUS; |
1284 | + |
1285 | +--echo # Test START TRANSACTION WITH CONSISTENT SNAPSHOT FROM SESSION |
1286 | + |
1287 | +DELETE FROM t1; |
1288 | + |
1289 | +--let $donor_id=`SELECT CONNECTION_ID()` |
1290 | + |
1291 | +START TRANSACTION WITH CONSISTENT SNAPSHOT; |
1292 | +SHOW STATUS LIKE 'binlog_snapshot_%'; |
1293 | +SHOW MASTER STATUS; |
1294 | + |
1295 | +INSERT INTO t1 VALUES (1, "first"); |
1296 | +SELECT * FROM t1; |
1297 | + |
1298 | +--connection con3 |
1299 | +--echo # Connection con3 |
1300 | +INSERT INTO t1 VALUES (3, "third"); |
1301 | +SELECT * FROM t1; |
1302 | +SHOW STATUS LIKE 'binlog_snapshot_%'; |
1303 | +SHOW MASTER STATUS; |
1304 | + |
1305 | +--connection con2 |
1306 | +--echo # Connection con2 |
1307 | +SELECT * FROM t1; |
1308 | + |
1309 | +SHOW STATUS LIKE 'binlog_snapshot_%'; |
1310 | +SHOW MASTER STATUS; |
1311 | + |
1312 | +--disable_query_log |
1313 | +--eval START TRANSACTION WITH CONSISTENT SNAPSHOT FROM SESSION $donor_id |
1314 | +--echo START TRANSACTION WITH CONSISTENT SNAPSHOT FROM SESSION \$donor_id; |
1315 | +--enable_query_log |
1316 | +SELECT * FROM t1; |
1317 | + |
1318 | +SHOW STATUS LIKE 'binlog_snapshot_%'; |
1319 | +SHOW MASTER STATUS; |
1320 | + |
1321 | +--connection con3 |
1322 | +--echo # Connection con3 |
1323 | +FLUSH LOGS; |
1324 | +SHOW STATUS LIKE 'binlog_snapshot_%'; |
1325 | +SHOW MASTER STATUS; |
1326 | + |
1327 | +--connection con2 |
1328 | +--echo # Connection con2 |
1329 | +SHOW STATUS LIKE 'binlog_snapshot_%'; |
1330 | +SHOW MASTER STATUS; |
1331 | + |
1332 | +COMMIT; |
1333 | + |
1334 | +--connection default |
1335 | +--echo # Connection default |
1336 | +SHOW STATUS LIKE 'binlog_snapshot_%'; |
1337 | +SHOW MASTER STATUS; |
1338 | + |
1339 | +COMMIT; |
1340 | + |
1341 | +--replace_regex /\/\* xid=.* \*\//\/* XID *\// /Server ver: .*, Binlog ver: .*/Server ver: #, Binlog ver: #/ /table_id: [0-9]+/table_id: #/ |
1342 | +SHOW BINLOG EVENTS; |
1343 | + |
1344 | +DROP TABLE t1,t2; |
1345 | |
1346 | === modified file 'mysql-test/suite/perfschema/r/dml_setup_instruments.result' |
1347 | --- mysql-test/suite/perfschema/r/dml_setup_instruments.result 2013-12-05 17:23:10 +0000 |
1348 | +++ mysql-test/suite/perfschema/r/dml_setup_instruments.result 2014-03-16 07:05:06 +0000 |
1349 | @@ -23,12 +23,12 @@ |
1350 | wait/synch/rwlock/sql/Binlog_storage_delegate::lock YES YES |
1351 | wait/synch/rwlock/sql/Binlog_transmit_delegate::lock YES YES |
1352 | wait/synch/rwlock/sql/gtid_commit_rollback YES YES |
1353 | +wait/synch/rwlock/sql/LOCK_consistent_snapshot YES YES |
1354 | wait/synch/rwlock/sql/LOCK_dboptions YES YES |
1355 | wait/synch/rwlock/sql/LOCK_grant YES YES |
1356 | wait/synch/rwlock/sql/LOCK_system_variables_hash YES YES |
1357 | wait/synch/rwlock/sql/LOCK_sys_init_connect YES YES |
1358 | wait/synch/rwlock/sql/LOCK_sys_init_slave YES YES |
1359 | -wait/synch/rwlock/sql/LOGGER::LOCK_logger YES YES |
1360 | select * from performance_schema.setup_instruments |
1361 | where name like 'Wait/Synch/Cond/sql/%' |
1362 | and name not in ( |
1363 | |
1364 | === added file 'mysql-test/suite/sys_vars/r/have_snapshot_cloning_basic.result' |
1365 | --- mysql-test/suite/sys_vars/r/have_snapshot_cloning_basic.result 1970-01-01 00:00:00 +0000 |
1366 | +++ mysql-test/suite/sys_vars/r/have_snapshot_cloning_basic.result 2014-03-16 07:05:06 +0000 |
1367 | @@ -0,0 +1,11 @@ |
1368 | +SELECT @@GLOBAL.have_snapshot_cloning="YES"; |
1369 | +@@GLOBAL.have_snapshot_cloning="YES" |
1370 | +1 |
1371 | +SELECT @@SESSION.have_snapshot_cloning; |
1372 | +ERROR HY000: Variable 'have_snapshot_cloning' is a GLOBAL variable |
1373 | +SHOW GLOBAL VARIABLES LIKE 'have_snapshot_cloning'; |
1374 | +Variable_name Value |
1375 | +have_snapshot_cloning YES |
1376 | +SHOW SESSION VARIABLES LIKE 'have_snapshot_cloning'; |
1377 | +Variable_name Value |
1378 | +have_snapshot_cloning YES |
1379 | |
1380 | === added file 'mysql-test/suite/sys_vars/t/have_snapshot_cloning_basic.test' |
1381 | --- mysql-test/suite/sys_vars/t/have_snapshot_cloning_basic.test 1970-01-01 00:00:00 +0000 |
1382 | +++ mysql-test/suite/sys_vars/t/have_snapshot_cloning_basic.test 2014-03-16 07:05:06 +0000 |
1383 | @@ -0,0 +1,7 @@ |
1384 | +SELECT @@GLOBAL.have_snapshot_cloning="YES"; |
1385 | +--error ER_INCORRECT_GLOBAL_LOCAL_VAR |
1386 | +SELECT @@SESSION.have_snapshot_cloning; |
1387 | + |
1388 | +SHOW GLOBAL VARIABLES LIKE 'have_snapshot_cloning'; |
1389 | + |
1390 | +SHOW SESSION VARIABLES LIKE 'have_snapshot_cloning'; |
1391 | |
1392 | === modified file 'mysql-test/t/backup_locks_mysqldump.test' |
1393 | --- mysql-test/t/backup_locks_mysqldump.test 2014-02-25 07:30:22 +0000 |
1394 | +++ mysql-test/t/backup_locks_mysqldump.test 2014-03-16 07:05:06 +0000 |
1395 | @@ -1,3 +1,4 @@ |
1396 | +<<<<<<< TREE |
1397 | ######################################################################## |
1398 | # mysqldump --lock-for-backup tests |
1399 | ######################################################################## |
1400 | @@ -56,3 +57,63 @@ |
1401 | SET GLOBAL general_log = @old_general_log; |
1402 | |
1403 | DROP TABLE t1, t2; |
1404 | +======= |
1405 | +######################################################################## |
1406 | +# mysqldump --lock-for-backup tests |
1407 | +######################################################################## |
1408 | + |
1409 | +--source include/have_log_bin.inc |
1410 | +--source include/have_innodb.inc |
1411 | +--source include/not_embedded.inc |
1412 | + |
1413 | +SHOW VARIABLES LIKE 'have_backup_locks'; |
1414 | + |
1415 | +CREATE TABLE t1 (a INT) ENGINE=InnoDB; |
1416 | +CREATE TABLE t2 (a INT) ENGINE=MyISAM; |
1417 | + |
1418 | +SET @old_general_log = @@general_log; |
1419 | +SET @old_log_output = @@log_output; |
1420 | + |
1421 | +TRUNCATE TABLE mysql.general_log; |
1422 | + |
1423 | +SET GLOBAL log_output = 'TABLE'; |
1424 | +SET GLOBAL general_log = ON; |
1425 | + |
1426 | +--let $file=$MYSQLTEST_VARDIR/tmp/dump.sql |
1427 | + |
1428 | +--error 1 |
1429 | +--exec $MYSQL_DUMP --lock-for-backup --lock-all-tables >$file |
1430 | + |
1431 | +--echo # Check that --lock-for-backup is converted to --lock-all-tables if |
1432 | +--echo # --single-transaction is not specified |
1433 | + |
1434 | +--exec $MYSQL_DUMP --lock-for-backup test >$file |
1435 | + |
1436 | +SELECT argument FROM mysql.general_log WHERE argument != ''; |
1437 | + |
1438 | +TRUNCATE TABLE mysql.general_log; |
1439 | + |
1440 | +--echo # Check that --lock-for-backup --single-transaction uses LOCK TABLES FOR |
1441 | +--echo # BACKUP |
1442 | + |
1443 | +--exec $MYSQL_DUMP --lock-for-backup --single-transaction test >$file |
1444 | + |
1445 | +SELECT argument FROM mysql.general_log WHERE argument != ''; |
1446 | + |
1447 | +TRUNCATE TABLE mysql.general_log; |
1448 | + |
1449 | +--echo # Check that --master-data does not disable --lock-for-backup |
1450 | + |
1451 | +--exec $MYSQL_DUMP --lock-for-backup --single-transaction --master-data test >$file |
1452 | + |
1453 | +SELECT argument FROM mysql.general_log WHERE argument != ''; |
1454 | + |
1455 | +TRUNCATE TABLE mysql.general_log; |
1456 | + |
1457 | +--remove_file $file |
1458 | + |
1459 | +SET GLOBAL log_output = @old_log_output; |
1460 | +SET GLOBAL general_log = @old_general_log; |
1461 | + |
1462 | +DROP TABLE t1, t2; |
1463 | +>>>>>>> MERGE-SOURCE |
1464 | |
1465 | === added file 'mysql-test/t/clone_consistent_snapshot.test' |
1466 | --- mysql-test/t/clone_consistent_snapshot.test 1970-01-01 00:00:00 +0000 |
1467 | +++ mysql-test/t/clone_consistent_snapshot.test 2014-03-16 07:05:06 +0000 |
1468 | @@ -0,0 +1,167 @@ |
1469 | +######################################################################## |
1470 | +# Tests for START TRANSACTION WITH CONSISTENT SNAPSHOT FROM SESSION |
1471 | +######################################################################## |
1472 | + |
1473 | +--source include/have_innodb.inc |
1474 | +--source include/count_sessions.inc |
1475 | + |
1476 | +--connect (con1,localhost,root,,) |
1477 | +--connect (con2,localhost,root,,) |
1478 | +--connect (con3,localhost,root,,) |
1479 | + |
1480 | +--connection con1 |
1481 | +--echo # connection con1 |
1482 | + |
1483 | +--let $con1_id=`SELECT CONNECTION_ID()` |
1484 | +CREATE TABLE t1 (a INT) ENGINE=InnoDB; |
1485 | +INSERT INTO t1 VALUES(1); |
1486 | +START TRANSACTION WITH CONSISTENT SNAPSHOT; |
1487 | + |
1488 | +--connection con2 |
1489 | +--echo # connection con2 |
1490 | + |
1491 | +INSERT INTO t1 VALUES(2); |
1492 | + |
1493 | +--connection con3 |
1494 | +--echo # connection con3 |
1495 | + |
1496 | +SELECT * FROM t1; |
1497 | + |
1498 | +--echo # Basic syntax tests |
1499 | + |
1500 | +--error ER_PARSE_ERROR |
1501 | +START TRANSACTION WITH CONSISTENT SNAPSHOT FROM SESSION; |
1502 | +--replace_regex /id: [0-9]+/id: ID/ |
1503 | +--error ER_NO_SUCH_THREAD |
1504 | +START TRANSACTION WITH CONSISTENT SNAPSHOT FROM SESSION CONNECTION_ID(); |
1505 | +--error ER_NOT_SUPPORTED_YET |
1506 | +START TRANSACTION WITH CONSISTENT SNAPSHOT FROM SESSION |
1507 | + (SELECT MAX(a) FROM t1); |
1508 | +--error ER_OPERAND_COLUMNS |
1509 | +START TRANSACTION WITH CONSISTENT SNAPSHOT FROM SESSION (1,1); |
1510 | +--error ER_NO_SUCH_THREAD |
1511 | +START TRANSACTION WITH CONSISTENT SNAPSHOT FROM SESSION "foo"; |
1512 | +--error ER_NO_SUCH_THREAD |
1513 | +START TRANSACTION WITH CONSISTENT SNAPSHOT FROM SESSION NULL; |
1514 | + |
1515 | +--echo # Functional tests |
1516 | +--disable_query_log |
1517 | +--echo START TRANSACTION WITH CONSISTENT SNAPSHOT FROM SESSION \$con1_id; |
1518 | +--eval START TRANSACTION WITH CONSISTENT SNAPSHOT FROM SESSION $con1_id |
1519 | +--enable_query_log |
1520 | +SELECT * FROM t1; |
1521 | + |
1522 | +--connection con2 |
1523 | +--echo # connection con2 |
1524 | + |
1525 | +INSERT INTO t1 VALUES(3); |
1526 | +SELECT * FROM t1; |
1527 | + |
1528 | +--connection con3 |
1529 | +--echo # connection con3 |
1530 | + |
1531 | +SELECT * FROM t1; |
1532 | +INSERT INTO t1 VALUES(4); |
1533 | +SELECT * FROM t1; |
1534 | + |
1535 | +--connection con1 |
1536 | +--echo # connection con1 |
1537 | + |
1538 | +INSERT INTO t1 VALUES(5); |
1539 | +SELECT * FROM t1; |
1540 | + |
1541 | +--connection con3 |
1542 | +--echo # connection con3 |
1543 | + |
1544 | +--let $con3_id=`SELECT CONNECTION_ID()` |
1545 | + |
1546 | +SELECT * FROM t1; |
1547 | + |
1548 | +--connection con1 |
1549 | +--echo # connection con1 |
1550 | + |
1551 | +COMMIT; |
1552 | + |
1553 | +--echo # Test cascading snapshot cloning |
1554 | +--connection con2 |
1555 | +--echo # connection con2 |
1556 | +--disable_query_log |
1557 | +--echo START TRANSACTION WITH CONSISTENT SNAPSHOT FROM SESSION \$con3_id; |
1558 | +--eval START TRANSACTION WITH CONSISTENT SNAPSHOT FROM SESSION $con3_id |
1559 | +--enable_query_log |
1560 | + |
1561 | +SELECT * FROM t1; |
1562 | + |
1563 | +COMMIT; |
1564 | + |
1565 | +SELECT * FROM t1; |
1566 | + |
1567 | +--connection con3 |
1568 | +--echo # connection con3 |
1569 | + |
1570 | +SELECT * FROM t1; |
1571 | + |
1572 | +COMMIT; |
1573 | + |
1574 | +SELECT * FROM t1; |
1575 | + |
1576 | +--echo # The following should fail to clone a read view as con1 does not have an |
1577 | +--echo # active transaction |
1578 | +--disable_query_log |
1579 | +--echo START TRANSACTION WITH CONSISTENT SNAPSHOT FROM SESSION \$con1_id; |
1580 | +--eval START TRANSACTION WITH CONSISTENT SNAPSHOT FROM SESSION $con1_id |
1581 | +--enable_query_log |
1582 | + |
1583 | +--connection con1 |
1584 | +--echo # connection con1 |
1585 | + |
1586 | +INSERT INTO t1 VALUES(6); |
1587 | + |
1588 | +--connection con3 |
1589 | +--echo # connection con3 |
1590 | +SELECT * FROM t1; |
1591 | + |
1592 | +--connection con3 |
1593 | +--echo # connection con3 |
1594 | + |
1595 | +COMMIT; |
1596 | + |
1597 | +--echo # Now test cloning read view from a regular transaction |
1598 | + |
1599 | +--connection con1 |
1600 | +--echo # connection con1 |
1601 | + |
1602 | +START TRANSACTION; |
1603 | +INSERT INTO t1 VALUES(7); |
1604 | + |
1605 | +--connection con3 |
1606 | +--echo # connection con3 |
1607 | +--echo # The following should fail to clone a read view as con1 does not yet have an |
1608 | +--echo # active transaction |
1609 | +--disable_query_log |
1610 | +--echo START TRANSACTION WITH CONSISTENT SNAPSHOT FROM SESSION \$con1_id; |
1611 | +--eval START TRANSACTION WITH CONSISTENT SNAPSHOT FROM SESSION $con1_id |
1612 | +--enable_query_log |
1613 | +SELECT * FROM t1; |
1614 | + |
1615 | +--connection con1 |
1616 | +--echo # connection con1 |
1617 | +SELECT * FROM t1; |
1618 | +INSERT INTO t1 VALUES(8); |
1619 | + |
1620 | +--connection con3 |
1621 | +--echo # connection con3 |
1622 | +--disable_query_log |
1623 | +--echo START TRANSACTION WITH CONSISTENT SNAPSHOT FROM SESSION \$con1_id; |
1624 | +--eval START TRANSACTION WITH CONSISTENT SNAPSHOT FROM SESSION $con1_id |
1625 | +--enable_query_log |
1626 | +SELECT * FROM t1; |
1627 | + |
1628 | +--connection default |
1629 | +--disconnect con1 |
1630 | +--disconnect con2 |
1631 | +--disconnect con3 |
1632 | + |
1633 | +DROP TABLE t1; |
1634 | + |
1635 | +--source include/wait_until_count_sessions.inc |
1636 | |
1637 | === modified file 'mysql-test/t/mysqldump-max.test' |
1638 | --- mysql-test/t/mysqldump-max.test 2010-10-25 09:20:53 +0000 |
1639 | +++ mysql-test/t/mysqldump-max.test 2014-03-16 07:05:06 +0000 |
1640 | @@ -2,6 +2,7 @@ |
1641 | --source include/not_embedded.inc |
1642 | --source include/have_innodb.inc |
1643 | --source include/have_archive.inc |
1644 | +--source include/have_log_bin.inc |
1645 | |
1646 | --disable_warnings |
1647 | drop table if exists t1, t2, t3, t4, t5, t6; |
1648 | @@ -1124,3 +1125,85 @@ |
1649 | DROP TABLE t1; |
1650 | |
1651 | SET GLOBAL default_storage_engine=@old_engine; |
1652 | + |
1653 | +# Test fully non-locking mysqldump with consistent binlog position (MWL#136). |
1654 | + |
1655 | +connect(c1,127.0.0.1,root,,test,$MASTER_MYPORT,); |
1656 | +connect(c2,127.0.0.1,root,,test,$MASTER_MYPORT,); |
1657 | +connect(c3,127.0.0.1,root,,test,$MASTER_MYPORT,); |
1658 | + |
1659 | +connection default; |
1660 | +--echo # Connection default |
1661 | +SET binlog_format= mixed; |
1662 | +RESET MASTER; |
1663 | +CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB; |
1664 | +INSERT INTO t1 VALUES (1),(2); |
1665 | +CREATE TABLE t2 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB; |
1666 | +INSERT INTO t2 VALUES (1,0), (2,0); |
1667 | +SELECT GET_LOCK("block_queries_1", 120); |
1668 | + |
1669 | +connection c3; |
1670 | +--echo # Connection c3 |
1671 | +SELECT GET_LOCK("block_queries_2", 120); |
1672 | + |
1673 | +# Start two queries that will be running on the tables during mysqldump |
1674 | +connection c1; |
1675 | +--echo # Connection c1 |
1676 | +SET @c= 0; |
1677 | +send SELECT IF(@c<1, @c:=@c+1, GET_LOCK("block_queries_1", 120)) FROM t1 ORDER BY a; |
1678 | + |
1679 | +connection c2; |
1680 | +--echo # Connection c2 |
1681 | +SET binlog_format="row"; |
1682 | +SET @d= 10; |
1683 | +send UPDATE t2 SET b=IF(@d<=10, @d:=@d+1, GET_LOCK("block_queries_2", 120)) ORDER BY a; |
1684 | + |
1685 | +connection default; |
1686 | +--echo # Connection default |
1687 | +--echo # Make sure other queries are running (and waiting). |
1688 | +let $wait_condition= |
1689 | + SELECT COUNT(*) FROM information_schema.processlist |
1690 | + WHERE state = "User lock" AND info LIKE 'SELECT%block_queries_1%'; |
1691 | +--source include/wait_condition.inc |
1692 | +let $wait_condition= |
1693 | + SELECT COUNT(*) FROM information_schema.processlist |
1694 | + WHERE state = "User lock" AND info LIKE 'UPDATE%block_queries_2%'; |
1695 | +--source include/wait_condition.inc |
1696 | + |
1697 | +--exec $MYSQL_DUMP --master-data=2 --single-transaction test t1 t2 > $MYSQLTEST_VARDIR/tmp/mwl136.sql |
1698 | + |
1699 | +SELECT RELEASE_LOCK("block_queries_1"); |
1700 | + |
1701 | +connection c3; |
1702 | +--echo # Connection c3 |
1703 | +SELECT RELEASE_LOCK("block_queries_2"); |
1704 | + |
1705 | +connection c1; |
1706 | +--echo # Connection c1 |
1707 | +reap; |
1708 | + |
1709 | +connection c2; |
1710 | +--echo # Connection c2 |
1711 | +reap; |
1712 | + |
1713 | +connection default; |
1714 | +--echo # Connection default |
1715 | +SELECT * FROM t2 ORDER BY a; |
1716 | +DROP TABLE t1; |
1717 | +DROP TABLE t2; |
1718 | +--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/mwl136.sql |
1719 | + |
1720 | +--replace_regex /\/\* xid=.* \*\//\/* XID *\// /Server ver: .*, Binlog ver: .*/Server ver: #, Binlog ver: #/ /table_id: [0-9]+/table_id: #/ |
1721 | +SHOW BINLOG EVENTS LIMIT 7,3; |
1722 | + |
1723 | +--perl |
1724 | +my $f= "$ENV{MYSQLTEST_VARDIR}/tmp/mwl136.sql"; |
1725 | +open F, '<', $f or die "Failed to open $f: $!\n"; |
1726 | +while (<F>) { |
1727 | + print if /CHANGE MASTER TO/; |
1728 | +} |
1729 | +EOF |
1730 | +SELECT * FROM t1 ORDER BY a; |
1731 | +SELECT * FROM t2 ORDER BY a; |
1732 | + |
1733 | +DROP TABLE t1,t2; |
1734 | |
1735 | === modified file 'sql/binlog.cc' |
1736 | --- sql/binlog.cc 2014-02-27 12:29:47 +0000 |
1737 | +++ sql/binlog.cc 2014-03-16 07:05:06 +0000 |
1738 | @@ -79,7 +79,21 @@ |
1739 | static int binlog_commit(handlerton *hton, THD *thd, bool all); |
1740 | static int binlog_rollback(handlerton *hton, THD *thd, bool all); |
1741 | static int binlog_prepare(handlerton *hton, THD *thd, bool all); |
1742 | - |
1743 | +static int binlog_start_consistent_snapshot(handlerton *hton, THD *thd); |
1744 | +static int binlog_clone_consistent_snapshot(handlerton *hton, THD *thd, |
1745 | + THD *from_thd); |
1746 | + |
1747 | +static char binlog_snapshot_file[FN_REFLEN]; |
1748 | +static ulonglong binlog_snapshot_position; |
1749 | + |
1750 | +static SHOW_VAR binlog_status_vars_detail[]= |
1751 | +{ |
1752 | + {"snapshot_file", |
1753 | + (char *)&binlog_snapshot_file, SHOW_CHAR}, |
1754 | + {"snapshot_position", |
1755 | + (char *)&binlog_snapshot_position, SHOW_LONGLONG}, |
1756 | + {NullS, NullS, SHOW_LONG} |
1757 | +}; |
1758 | |
1759 | /** |
1760 | Helper class to hold a mutex for the duration of the |
1761 | @@ -768,6 +782,8 @@ |
1762 | binlog_stmt_cache_data stmt_cache; |
1763 | binlog_trx_cache_data trx_cache; |
1764 | |
1765 | + LOG_INFO binlog_info; |
1766 | + |
1767 | private: |
1768 | |
1769 | binlog_cache_mngr& operator=(const binlog_cache_mngr& info); |
1770 | @@ -894,6 +910,8 @@ |
1771 | binlog_hton->commit= binlog_commit; |
1772 | binlog_hton->rollback= binlog_rollback; |
1773 | binlog_hton->prepare= binlog_prepare; |
1774 | + binlog_hton->start_consistent_snapshot= binlog_start_consistent_snapshot; |
1775 | + binlog_hton->clone_consistent_snapshot= binlog_clone_consistent_snapshot; |
1776 | binlog_hton->flags= HTON_NOT_USER_SELECTABLE | HTON_HIDDEN; |
1777 | return 0; |
1778 | } |
1779 | @@ -1305,6 +1323,76 @@ |
1780 | return 0; |
1781 | } |
1782 | |
1783 | +static int binlog_start_consistent_snapshot(handlerton *hton, THD *thd) |
1784 | +{ |
1785 | + int err= 0; |
1786 | + LOG_INFO li; |
1787 | + DBUG_ENTER("binlog_start_consistent_snapshot"); |
1788 | + |
1789 | + if ((err= thd->binlog_setup_trx_data())) |
1790 | + DBUG_RETURN(err); |
1791 | + |
1792 | + binlog_cache_mngr * const cache_mngr= thd_get_cache_mngr(thd); |
1793 | + |
1794 | + /* Server layer calls us with LOCK_log locked, so this is safe. */ |
1795 | + mysql_bin_log.raw_get_current_log(&cache_mngr->binlog_info); |
1796 | + |
1797 | + trans_register_ha(thd, TRUE, hton); |
1798 | + |
1799 | + DBUG_RETURN(err); |
1800 | +} |
1801 | + |
1802 | +static int binlog_clone_consistent_snapshot(handlerton *hton, THD *thd, |
1803 | + THD *from_thd) |
1804 | +{ |
1805 | + binlog_cache_mngr *from_cache_mngr; |
1806 | + binlog_cache_mngr *cache_mngr; |
1807 | + int err= 0; |
1808 | + char log_file_name[FN_REFLEN]; |
1809 | + my_off_t pos; |
1810 | + |
1811 | + DBUG_ENTER("binlog_start_consistent_snapshot"); |
1812 | + |
1813 | + from_cache_mngr= opt_bin_log ? |
1814 | + (binlog_cache_mngr *) thd_get_cache_mngr(from_thd) : NULL; |
1815 | + |
1816 | + if (from_cache_mngr == NULL) |
1817 | + { |
1818 | + push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, |
1819 | + HA_ERR_UNSUPPORTED, |
1820 | + "WITH CONSISTENT SNAPSHOT FROM SESSION was ignored for " |
1821 | + "binary log, because the specified session does not " |
1822 | + "have a consistent snapshot of binary log " |
1823 | + "coordinates."); |
1824 | + DBUG_RETURN(0); |
1825 | + } |
1826 | + |
1827 | + if ((err= thd->binlog_setup_trx_data())) |
1828 | + DBUG_RETURN(err); |
1829 | + |
1830 | + cache_mngr= thd_get_cache_mngr(thd); |
1831 | + |
1832 | + mysql_mutex_lock(&from_cache_mngr->binlog_info.lock); |
1833 | + |
1834 | + pos= from_cache_mngr->binlog_info.pos; |
1835 | + strmake(log_file_name, from_cache_mngr->binlog_info.log_file_name, |
1836 | + sizeof(log_file_name) - 1); |
1837 | + |
1838 | + mysql_mutex_unlock(&from_cache_mngr->binlog_info.lock); |
1839 | + |
1840 | + mysql_mutex_lock(&cache_mngr->binlog_info.lock); |
1841 | + |
1842 | + cache_mngr->binlog_info.pos = pos; |
1843 | + strmake(cache_mngr->binlog_info.log_file_name, log_file_name, |
1844 | + sizeof(cache_mngr->binlog_info.log_file_name) - 1); |
1845 | + |
1846 | + mysql_mutex_unlock(&cache_mngr->binlog_info.lock); |
1847 | + |
1848 | + trans_register_ha(thd, TRUE, hton); |
1849 | + |
1850 | + DBUG_RETURN(err); |
1851 | +} |
1852 | + |
1853 | /** |
1854 | This function is called once after each statement. |
1855 | |
1856 | @@ -1547,8 +1635,22 @@ |
1857 | rollback. |
1858 | */ |
1859 | if (thd->lex->sql_command != SQLCOM_ROLLBACK_TO_SAVEPOINT) |
1860 | + { |
1861 | + /* |
1862 | + Reset binlog_snapshot_% variables for the current connection so that the |
1863 | + current coordinates are shown after committing a consistent snapshot |
1864 | + transaction. |
1865 | + */ |
1866 | + if (cache_mngr != NULL) |
1867 | + { |
1868 | + mysql_mutex_lock(&cache_mngr->binlog_info.lock); |
1869 | + cache_mngr->binlog_info.log_file_name[0]= '\0'; |
1870 | + mysql_mutex_unlock(&cache_mngr->binlog_info.lock); |
1871 | + } |
1872 | + |
1873 | if ((error= ha_rollback_low(thd, all))) |
1874 | goto end; |
1875 | + } |
1876 | |
1877 | /* |
1878 | If there is no cache manager, or if there is nothing in the |
1879 | @@ -2416,7 +2518,7 @@ |
1880 | is_relay_log(0), signal_cnt(0), |
1881 | checksum_alg_reset(BINLOG_CHECKSUM_ALG_UNDEF), |
1882 | relay_log_checksum_alg(BINLOG_CHECKSUM_ALG_UNDEF), |
1883 | - previous_gtid_set(0) |
1884 | + previous_gtid_set(0), snapshot_lock_acquired(false) |
1885 | { |
1886 | /* |
1887 | We don't want to initialize locks here as such initialization depends on |
1888 | @@ -6293,6 +6395,18 @@ |
1889 | DBUG_RETURN(RESULT_SUCCESS); |
1890 | } |
1891 | |
1892 | + /* |
1893 | + Reset binlog_snapshot_% variables for the current connection so that the |
1894 | + current coordinates are shown after committing a consistent snapshot |
1895 | + transaction. |
1896 | + */ |
1897 | + if (all) |
1898 | + { |
1899 | + mysql_mutex_lock(&cache_mngr->binlog_info.lock); |
1900 | + cache_mngr->binlog_info.log_file_name[0]= '\0'; |
1901 | + mysql_mutex_unlock(&cache_mngr->binlog_info.lock); |
1902 | + } |
1903 | + |
1904 | THD_TRANS *trans= all ? &thd->transaction.all : &thd->transaction.stmt; |
1905 | |
1906 | DBUG_PRINT("debug", ("in_transaction: %s, no_2pc: %s, rw_ha_count: %d", |
1907 | @@ -6790,9 +6904,22 @@ |
1908 | /* |
1909 | storage engine commit |
1910 | */ |
1911 | - if (thd->commit_error == THD::CE_NONE && |
1912 | - ha_commit_low(thd, all, false)) |
1913 | - thd->commit_error= THD::CE_COMMIT_ERROR; |
1914 | + if (thd->commit_error == THD::CE_NONE) |
1915 | + { |
1916 | + /* |
1917 | + Acquire a shared lock to block commits until START TRANSACTION WITH |
1918 | + CONSISTENT SNAPSHOT completes snapshot creation for all storage |
1919 | + engines. We only reach this code if binlog_order_commits=0. |
1920 | + */ |
1921 | + DBUG_ASSERT(opt_binlog_order_commits == 0); |
1922 | + |
1923 | + slock(); |
1924 | + |
1925 | + if (ha_commit_low(thd, all, false)) |
1926 | + thd->commit_error= THD::CE_COMMIT_ERROR; |
1927 | + |
1928 | + sunlock(); |
1929 | + } |
1930 | /* |
1931 | Decrement the prepared XID counter after storage engine commit |
1932 | */ |
1933 | @@ -7171,6 +7298,99 @@ |
1934 | return 1; |
1935 | } |
1936 | |
1937 | +/* |
1938 | + Copy out the non-directory part of binlog position filename for the |
1939 | + `binlog_snapshot_file' status variable, same way as it is done for |
1940 | + SHOW MASTER STATUS. |
1941 | +*/ |
1942 | +static void set_binlog_snapshot_file(const char *src) |
1943 | +{ |
1944 | + int dir_len = dirname_length(src); |
1945 | + strmake(binlog_snapshot_file, src + dir_len, |
1946 | + sizeof(binlog_snapshot_file) - 1); |
1947 | +} |
1948 | + |
1949 | +/* |
1950 | + Copy out current values of status variables, for SHOW STATUS or |
1951 | + information_schema.global_status. |
1952 | + |
1953 | + This is called only under LOCK_status, so we can fill in a static array. |
1954 | +*/ |
1955 | +void MYSQL_BIN_LOG::set_status_variables(THD *thd) |
1956 | +{ |
1957 | + binlog_cache_mngr *cache_mngr; |
1958 | + |
1959 | + if (thd && opt_bin_log) |
1960 | + cache_mngr= (binlog_cache_mngr*) thd_get_ha_data(thd, binlog_hton); |
1961 | + else |
1962 | + cache_mngr= 0; |
1963 | + |
1964 | + bool have_snapshot= (cache_mngr && |
1965 | + cache_mngr->binlog_info.log_file_name[0] != '\0'); |
1966 | + mysql_mutex_lock(&LOCK_log); |
1967 | + if (!have_snapshot) |
1968 | + { |
1969 | + set_binlog_snapshot_file(log_file_name); |
1970 | + binlog_snapshot_position= my_b_tell(&log_file); |
1971 | + } |
1972 | + mysql_mutex_unlock(&LOCK_log); |
1973 | + |
1974 | + if (have_snapshot) |
1975 | + { |
1976 | + set_binlog_snapshot_file(cache_mngr->binlog_info.log_file_name); |
1977 | + binlog_snapshot_position= cache_mngr->binlog_info.pos; |
1978 | + } |
1979 | +} |
1980 | + |
1981 | + |
1982 | +void MYSQL_BIN_LOG::xlock(void) |
1983 | +{ |
1984 | + DBUG_ASSERT(!snapshot_lock_acquired); |
1985 | + |
1986 | + mysql_mutex_lock(&LOCK_log); |
1987 | + |
1988 | + /* |
1989 | + We must ensure that no writes to binlog and no commits to storage engines |
1990 | + occur after function is called for START TRANSACTION FOR CONSISTENT |
1991 | + SNAPSHOT. With binlog_order_commits=1 (the default) flushing to binlog is |
1992 | + performed under the LOCK_log mutex and commits are done under the |
1993 | + LOCK_commit mutex, both in the stage leader thread. So acquiring those 2 |
1994 | + mutexes is sufficient to guarantee atomicity. |
1995 | + |
1996 | + With binlog_order_commits=0 commits are performed in parallel by separate |
1997 | + threads with each acquiring a shared lock on LOCK_consistent_snapshot. |
1998 | + |
1999 | + binlog_order_commits is a dynamic variable, so we have to keep track what |
2000 | + primitives should be used in unlock_for_snapshot(). |
2001 | + */ |
2002 | + if (opt_binlog_order_commits) |
2003 | + { |
2004 | + mysql_mutex_lock(&LOCK_commit); |
2005 | + } |
2006 | + else |
2007 | + { |
2008 | + snapshot_lock_acquired= true; |
2009 | + mysql_rwlock_wrlock(&LOCK_consistent_snapshot); |
2010 | + } |
2011 | +} |
2012 | + |
2013 | + |
2014 | +void MYSQL_BIN_LOG::xunlock(void) |
2015 | +{ |
2016 | + if (!snapshot_lock_acquired) |
2017 | + { |
2018 | + mysql_mutex_unlock(&LOCK_commit); |
2019 | + } |
2020 | + else |
2021 | + { |
2022 | + mysql_rwlock_unlock(&LOCK_consistent_snapshot); |
2023 | + snapshot_lock_acquired= false; |
2024 | + } |
2025 | + |
2026 | + mysql_mutex_unlock(&LOCK_log); |
2027 | +} |
2028 | + |
2029 | + |
2030 | Group_cache *THD::get_group_cache(bool is_transactional) |
2031 | { |
2032 | DBUG_ENTER("THD::get_group_cache(bool)"); |
2033 | @@ -9022,6 +9242,25 @@ |
2034 | |
2035 | #endif /* !defined(MYSQL_CLIENT) */ |
2036 | |
2037 | +static int show_binlog_vars(THD *thd, SHOW_VAR *var, char *buff) |
2038 | +{ |
2039 | + if (mysql_bin_log.is_open()) |
2040 | + mysql_bin_log.set_status_variables(thd); |
2041 | + else |
2042 | + { |
2043 | + binlog_snapshot_file[0]= '\0'; |
2044 | + binlog_snapshot_position= 0; |
2045 | + } |
2046 | + var->type= SHOW_ARRAY; |
2047 | + var->value= (char *)&binlog_status_vars_detail; |
2048 | + return 0; |
2049 | +} |
2050 | + |
2051 | +static SHOW_VAR binlog_status_vars_top[]= { |
2052 | + {"Binlog", (char *) &show_binlog_vars, SHOW_FUNC}, |
2053 | + {NullS, NullS, SHOW_LONG} |
2054 | +}; |
2055 | + |
2056 | struct st_mysql_storage_engine binlog_storage_engine= |
2057 | { MYSQL_HANDLERTON_INTERFACE_VERSION }; |
2058 | |
2059 | @@ -9038,7 +9277,7 @@ |
2060 | binlog_init, /* Plugin Init */ |
2061 | NULL, /* Plugin Deinit */ |
2062 | 0x0100 /* 1.0 */, |
2063 | - NULL, /* status variables */ |
2064 | + binlog_status_vars_top, /* status variables */ |
2065 | NULL, /* system variables */ |
2066 | NULL, /* config options */ |
2067 | 0, |
2068 | |
2069 | === modified file 'sql/binlog.h' |
2070 | --- sql/binlog.h 2014-02-17 11:12:40 +0000 |
2071 | +++ sql/binlog.h 2014-03-16 07:05:06 +0000 |
2072 | @@ -501,6 +501,8 @@ |
2073 | private: |
2074 | Gtid_set* previous_gtid_set; |
2075 | |
2076 | + bool snapshot_lock_acquired; |
2077 | + |
2078 | int open(const char *opt_name) { return open_binlog(opt_name); } |
2079 | bool change_stage(THD *thd, Stage_manager::StageID stage, |
2080 | THD* queue, mysql_mutex_t *leave, |
2081 | @@ -528,7 +530,15 @@ |
2082 | void update_thd_next_event_pos(THD *thd); |
2083 | int flush_and_set_pending_rows_event(THD *thd, Rows_log_event* event, |
2084 | bool is_transactional); |
2085 | - |
2086 | + void xlock(void); |
2087 | + void xunlock(void); |
2088 | + void slock(void) { mysql_rwlock_rdlock(&LOCK_consistent_snapshot); } |
2089 | + void sunlock(void) { mysql_rwlock_unlock(&LOCK_consistent_snapshot); } |
2090 | +#else |
2091 | + void xlock(void) { } |
2092 | + void xunlock(void) { } |
2093 | + void slock(void) { } |
2094 | + void sunlock(void) { } |
2095 | #endif /* !defined(MYSQL_CLIENT) */ |
2096 | void add_bytes_written(ulonglong inc) |
2097 | { |
2098 | @@ -667,6 +677,7 @@ |
2099 | inline char* get_log_fname() { return log_file_name; } |
2100 | inline char* get_name() { return name; } |
2101 | inline mysql_mutex_t* get_log_lock() { return &LOCK_log; } |
2102 | + inline mysql_mutex_t* get_commit_lock() { return &LOCK_commit; } |
2103 | inline mysql_cond_t* get_log_cond() { return &update_cond; } |
2104 | inline IO_CACHE* get_log_file() { return &log_file; } |
2105 | |
2106 | @@ -674,6 +685,7 @@ |
2107 | inline void unlock_index() { mysql_mutex_unlock(&LOCK_index);} |
2108 | inline IO_CACHE *get_index_file() { return &index_file;} |
2109 | inline uint32 get_open_count() { return open_count; } |
2110 | + void set_status_variables(THD *thd); |
2111 | }; |
2112 | |
2113 | typedef struct st_load_file_info |
2114 | |
2115 | === modified file 'sql/handler.cc' |
2116 | --- sql/handler.cc 2014-03-03 17:51:33 +0000 |
2117 | +++ sql/handler.cc 2014-03-16 07:05:06 +0000 |
2118 | @@ -40,6 +40,7 @@ |
2119 | #include "debug_sync.h" // DEBUG_SYNC |
2120 | #include <my_bit.h> |
2121 | #include <list> |
2122 | +#include "global_threads.h" |
2123 | |
2124 | #ifdef WITH_PARTITION_STORAGE_ENGINE |
2125 | #include "ha_partition.h" |
2126 | @@ -2252,8 +2253,95 @@ |
2127 | } |
2128 | |
2129 | |
2130 | -static my_bool snapshot_handlerton(THD *thd, plugin_ref plugin, |
2131 | - void *arg) |
2132 | +static my_bool clone_snapshot_handlerton(THD *thd, plugin_ref plugin, |
2133 | + void *arg) |
2134 | +{ |
2135 | + handlerton *hton= plugin_data(plugin, handlerton *); |
2136 | + |
2137 | + if (hton->state == SHOW_OPTION_YES && |
2138 | + hton->clone_consistent_snapshot) |
2139 | + hton->clone_consistent_snapshot(hton, thd, (THD *) arg); |
2140 | + |
2141 | + return FALSE; |
2142 | +} |
2143 | + |
2144 | + |
2145 | +static int ha_clone_consistent_snapshot(THD *thd) |
2146 | +{ |
2147 | + THD *from_thd; |
2148 | + ulong id; |
2149 | + Item *val; |
2150 | + Thread_iterator it; |
2151 | + Thread_iterator end; |
2152 | + |
2153 | + DBUG_ASSERT(!thd->lex->value_list.is_empty()); |
2154 | + |
2155 | + val= (Item *) thd->lex->value_list.head(); |
2156 | + |
2157 | + if (thd->lex->table_or_sp_used()) |
2158 | + { |
2159 | + my_error(ER_NOT_SUPPORTED_YET, MYF(0), "Usage of subqueries or stored " |
2160 | + "function calls as part of this statement"); |
2161 | + goto error; |
2162 | + } |
2163 | + |
2164 | + if ((!val->fixed && val->fix_fields(thd, &val)) || val->check_cols(1)) |
2165 | + { |
2166 | + my_error(ER_SET_CONSTANTS_ONLY, MYF(0)); |
2167 | + goto error; |
2168 | + } |
2169 | + |
2170 | + id= val->val_int(); |
2171 | + |
2172 | + mysql_mutex_lock(&LOCK_thread_count); |
2173 | + |
2174 | + it= global_thread_list_begin(); |
2175 | + end= global_thread_list_end(); |
2176 | + from_thd= NULL; |
2177 | + |
2178 | + for (; it != end; ++it) |
2179 | + { |
2180 | + if ((*it)->thread_id == id && *it != thd) |
2181 | + { |
2182 | + from_thd= *it; |
2183 | + mysql_mutex_lock(&from_thd->LOCK_thd_data); |
2184 | + break; |
2185 | + } |
2186 | + } |
2187 | + |
2188 | + mysql_mutex_unlock(&LOCK_thread_count); |
2189 | + |
2190 | + if (!from_thd) |
2191 | + { |
2192 | + my_error(ER_NO_SUCH_THREAD, MYF(0), id); |
2193 | + goto error; |
2194 | + } |
2195 | + |
2196 | + /* |
2197 | + Blocking commits and binlog updates ensures that we get the same snapshot |
2198 | + for all engines (including the binary log). This allows us among other |
2199 | + things to do backups with START TRANSACTION WITH CONSISTENT SNAPSHOT and |
2200 | + have a consistent binlog position. |
2201 | + */ |
2202 | + tc_log->xlock(); |
2203 | + |
2204 | + plugin_foreach(thd, clone_snapshot_handlerton, MYSQL_STORAGE_ENGINE_PLUGIN, |
2205 | + from_thd); |
2206 | + |
2207 | + tc_log->xunlock(); |
2208 | + |
2209 | + mysql_mutex_unlock(&from_thd->LOCK_thd_data); |
2210 | + |
2211 | + return 0; |
2212 | + |
2213 | +error: |
2214 | + |
2215 | + return 1; |
2216 | +} |
2217 | + |
2218 | + |
2219 | +static my_bool start_snapshot_handlerton(THD *thd, plugin_ref plugin, |
2220 | + void *arg) |
2221 | { |
2222 | handlerton *hton= plugin_data(plugin, handlerton *); |
2223 | if (hton->state == SHOW_OPTION_YES && |
2224 | @@ -2267,9 +2355,24 @@ |
2225 | |
2226 | int ha_start_consistent_snapshot(THD *thd) |
2227 | { |
2228 | + |
2229 | + if (!thd->lex->value_list.is_empty()) |
2230 | + return ha_clone_consistent_snapshot(thd); |
2231 | + |
2232 | bool warn= true; |
2233 | |
2234 | - plugin_foreach(thd, snapshot_handlerton, MYSQL_STORAGE_ENGINE_PLUGIN, &warn); |
2235 | + /* |
2236 | + Blocking commits and binlog updates ensures that we get the same snapshot |
2237 | + for all engines (including the binary log). This allows us among other |
2238 | + things to do backups with START TRANSACTION WITH CONSISTENT SNAPSHOT and |
2239 | + have a consistent binlog position. |
2240 | + */ |
2241 | + tc_log->xlock(); |
2242 | + |
2243 | + plugin_foreach(thd, start_snapshot_handlerton, MYSQL_STORAGE_ENGINE_PLUGIN, |
2244 | + &warn); |
2245 | + |
2246 | + tc_log->xunlock(); |
2247 | |
2248 | /* |
2249 | Same idea as when one wants to CREATE TABLE in one engine which does not |
2250 | |
2251 | === modified file 'sql/handler.h' |
2252 | --- sql/handler.h 2014-02-27 12:29:47 +0000 |
2253 | +++ sql/handler.h 2014-03-16 07:05:06 +0000 |
2254 | @@ -892,6 +892,7 @@ |
2255 | void (*drop_database)(handlerton *hton, char* path); |
2256 | int (*panic)(handlerton *hton, enum ha_panic_function flag); |
2257 | int (*start_consistent_snapshot)(handlerton *hton, THD *thd); |
2258 | + int (*clone_consistent_snapshot)(handlerton *hton, THD *thd, THD *from_thd); |
2259 | bool (*flush_logs)(handlerton *hton); |
2260 | bool (*show_status)(handlerton *hton, THD *thd, stat_print_fn *print, enum ha_stat_type stat); |
2261 | uint (*partition_flags)(); |
2262 | |
2263 | === modified file 'sql/log.cc' |
2264 | --- sql/log.cc 2014-03-03 17:51:33 +0000 |
2265 | +++ sql/log.cc 2014-03-16 07:05:06 +0000 |
2266 | @@ -53,6 +53,7 @@ |
2267 | #include "rpl_handler.h" |
2268 | #include "debug_sync.h" |
2269 | #include "sql_show.h" |
2270 | +#include "mysqld.h" |
2271 | |
2272 | /* max size of the log message */ |
2273 | #define MAX_LOG_BUFFER_SIZE 1024 |
2274 | @@ -2901,12 +2902,21 @@ |
2275 | DBUG_ENTER("TC_LOG_MMAP::commit"); |
2276 | unsigned long cookie= 0; |
2277 | my_xid xid= thd->transaction.xid_state.xid.get_my_xid(); |
2278 | + int rc; |
2279 | |
2280 | if (all && xid) |
2281 | if (!(cookie= log_xid(thd, xid))) |
2282 | DBUG_RETURN(RESULT_ABORTED); // Failed to log the transaction |
2283 | |
2284 | - if (ha_commit_low(thd, all)) |
2285 | + /* |
2286 | + Acquire a shared lock to block commits until START TRANSACTION WITH |
2287 | + CONSISTENT SNAPSHOT completes snapshot creation for all storage engines. |
2288 | + */ |
2289 | + slock(); |
2290 | + rc= ha_commit_low(thd, all); |
2291 | + sunlock(); |
2292 | + |
2293 | + if (rc) |
2294 | DBUG_RETURN(RESULT_INCONSISTENT); // Transaction logged, but not committed |
2295 | |
2296 | /* If cookie is non-zero, something was logged */ |
2297 | |
2298 | === modified file 'sql/log.h' |
2299 | --- sql/log.h 2014-02-17 11:12:40 +0000 |
2300 | +++ sql/log.h 2014-03-16 07:05:06 +0000 |
2301 | @@ -102,6 +102,26 @@ |
2302 | @return Error code on failure, zero on success. |
2303 | */ |
2304 | virtual int prepare(THD *thd, bool all) = 0; |
2305 | + |
2306 | + /** |
2307 | + Acquire an exclusive lock to block binary log updates and commits. This is |
2308 | + used by START TRANSACTION WITH CONSISTENT SNAPSHOT to create an atomic |
2309 | + snapshot. |
2310 | + */ |
2311 | + virtual void xlock(void) = 0; |
2312 | + |
2313 | + /** Release lock acquired with xlock(). */ |
2314 | + virtual void xunlock(void) = 0; |
2315 | + |
2316 | + /** |
2317 | + Acquire a shared lock to block commits. This is used when calling |
2318 | + ha_commit_low() to block commits if there's an exclusive lock acquired by |
2319 | + START TRANSACTION WITH CONSISTENT SNAPSHOT. |
2320 | + */ |
2321 | + virtual void slock(void) = 0; |
2322 | + |
2323 | + /** Release lock acquired with slock(). */ |
2324 | + virtual void sunlock(void) = 0; |
2325 | }; |
2326 | |
2327 | |
2328 | @@ -120,6 +140,10 @@ |
2329 | int prepare(THD *thd, bool all) { |
2330 | return ha_prepare_low(thd, all); |
2331 | } |
2332 | + void xlock(void) {} |
2333 | + void xunlock(void) {} |
2334 | + void slock(void) {} |
2335 | + void sunlock(void) {} |
2336 | }; |
2337 | |
2338 | #ifdef HAVE_MMAP |
2339 | @@ -166,6 +190,10 @@ |
2340 | enum_result commit(THD *thd, bool all); |
2341 | int rollback(THD *thd, bool all) { return ha_rollback_low(thd, all); } |
2342 | int prepare(THD *thd, bool all) { return ha_prepare_low(thd, all); } |
2343 | + void xlock(void) { mysql_rwlock_wrlock(&LOCK_consistent_snapshot); } |
2344 | + void xunlock(void) { mysql_rwlock_unlock(&LOCK_consistent_snapshot); } |
2345 | + void slock(void) { mysql_rwlock_rdlock(&LOCK_consistent_snapshot); } |
2346 | + void sunlock(void) { mysql_rwlock_unlock(&LOCK_consistent_snapshot); } |
2347 | int recover(); |
2348 | uint size() const; |
2349 | |
2350 | |
2351 | === modified file 'sql/log_event.cc' |
2352 | === modified file 'sql/log_event.h' |
2353 | === modified file 'sql/mdl.cc' |
2354 | === modified file 'sql/mysqld.cc' |
2355 | --- sql/mysqld.cc 2014-02-27 12:29:47 +0000 |
2356 | +++ sql/mysqld.cc 2014-03-16 07:05:06 +0000 |
2357 | @@ -717,7 +717,12 @@ |
2358 | SHOW_COMP_OPTION have_geometry, have_rtree_keys; |
2359 | SHOW_COMP_OPTION have_crypt, have_compress; |
2360 | SHOW_COMP_OPTION have_profiling; |
2361 | -SHOW_COMP_OPTION have_backup_locks; |
2362 | +<<<<<<< TREE |
2363 | +SHOW_COMP_OPTION have_backup_locks; |
2364 | +======= |
2365 | +SHOW_COMP_OPTION have_backup_locks; |
2366 | +SHOW_COMP_OPTION have_snapshot_cloning; |
2367 | +>>>>>>> MERGE-SOURCE |
2368 | |
2369 | ulonglong opt_log_warnings_suppress= 0; |
2370 | |
2371 | @@ -780,6 +785,8 @@ |
2372 | mysql_mutex_t LOCK_server_started; |
2373 | mysql_cond_t COND_server_started; |
2374 | |
2375 | +mysql_rwlock_t LOCK_consistent_snapshot; |
2376 | + |
2377 | int mysqld_server_started= 0; |
2378 | |
2379 | File_parser_dummy_hook file_parser_dummy_hook; |
2380 | @@ -2061,6 +2068,7 @@ |
2381 | mysql_mutex_destroy(&LOCK_global_user_client_stats); |
2382 | mysql_mutex_destroy(&LOCK_global_table_stats); |
2383 | mysql_mutex_destroy(&LOCK_global_index_stats); |
2384 | + mysql_rwlock_destroy(&LOCK_consistent_snapshot); |
2385 | } |
2386 | #endif /*EMBEDDED_LIBRARY*/ |
2387 | |
2388 | @@ -4321,6 +4329,8 @@ |
2389 | mysql_rwlock_init(key_rwlock_LOCK_sys_init_connect, &LOCK_sys_init_connect); |
2390 | mysql_rwlock_init(key_rwlock_LOCK_sys_init_slave, &LOCK_sys_init_slave); |
2391 | mysql_rwlock_init(key_rwlock_LOCK_grant, &LOCK_grant); |
2392 | + mysql_rwlock_init(key_rwlock_LOCK_consistent_snapshot, |
2393 | + &LOCK_consistent_snapshot); |
2394 | mysql_cond_init(key_COND_thread_count, &COND_thread_count, NULL); |
2395 | mysql_cond_init(key_COND_thread_cache, &COND_thread_cache, NULL); |
2396 | mysql_cond_init(key_COND_flush_thread_cache, &COND_flush_thread_cache, NULL); |
2397 | @@ -8540,8 +8550,14 @@ |
2398 | shared_memory_base_name= default_shared_memory_base_name; |
2399 | #endif |
2400 | |
2401 | - have_backup_locks= SHOW_OPTION_YES; |
2402 | - |
2403 | +<<<<<<< TREE |
2404 | + have_backup_locks= SHOW_OPTION_YES; |
2405 | + |
2406 | +======= |
2407 | + have_backup_locks= SHOW_OPTION_YES; |
2408 | + have_snapshot_cloning= SHOW_OPTION_YES; |
2409 | + |
2410 | +>>>>>>> MERGE-SOURCE |
2411 | #if defined(__WIN__) |
2412 | /* Allow Win32 users to move MySQL anywhere */ |
2413 | { |
2414 | @@ -9720,13 +9736,13 @@ |
2415 | { &key_LOCK_thread_count, "LOCK_thread_count", PSI_FLAG_GLOBAL}, |
2416 | { &key_LOCK_log_throttle_qni, "LOCK_log_throttle_qni", PSI_FLAG_GLOBAL}, |
2417 | { &key_gtid_ensure_index_mutex, "Gtid_state", PSI_FLAG_GLOBAL}, |
2418 | - { &key_LOCK_thread_created, "LOCK_thread_created", PSI_FLAG_GLOBAL } |
2419 | + { &key_LOCK_thread_created, "LOCK_thread_created", PSI_FLAG_GLOBAL }, |
2420 | }; |
2421 | |
2422 | PSI_rwlock_key key_rwlock_LOCK_grant, key_rwlock_LOCK_logger, |
2423 | key_rwlock_LOCK_sys_init_connect, key_rwlock_LOCK_sys_init_slave, |
2424 | key_rwlock_LOCK_system_variables_hash, key_rwlock_query_cache_query_lock, |
2425 | - key_rwlock_global_sid_lock; |
2426 | + key_rwlock_global_sid_lock, key_rwlock_LOCK_consistent_snapshot; |
2427 | |
2428 | PSI_rwlock_key key_rwlock_Trans_delegate_lock; |
2429 | PSI_rwlock_key key_rwlock_Binlog_storage_delegate_lock; |
2430 | @@ -9752,7 +9768,8 @@ |
2431 | { &key_rwlock_query_cache_query_lock, "Query_cache_query::lock", 0}, |
2432 | { &key_rwlock_global_sid_lock, "gtid_commit_rollback", PSI_FLAG_GLOBAL}, |
2433 | { &key_rwlock_Trans_delegate_lock, "Trans_delegate::lock", PSI_FLAG_GLOBAL}, |
2434 | - { &key_rwlock_Binlog_storage_delegate_lock, "Binlog_storage_delegate::lock", PSI_FLAG_GLOBAL} |
2435 | + { &key_rwlock_Binlog_storage_delegate_lock, "Binlog_storage_delegate::lock", PSI_FLAG_GLOBAL}, |
2436 | + { &key_rwlock_LOCK_consistent_snapshot, "LOCK_consistent_snapshot", PSI_FLAG_GLOBAL} |
2437 | }; |
2438 | |
2439 | #ifdef HAVE_MMAP |
2440 | |
2441 | === modified file 'sql/mysqld.h' |
2442 | --- sql/mysqld.h 2014-03-03 17:51:33 +0000 |
2443 | +++ sql/mysqld.h 2014-03-16 07:05:06 +0000 |
2444 | @@ -386,7 +386,7 @@ |
2445 | extern PSI_rwlock_key key_rwlock_LOCK_grant, key_rwlock_LOCK_logger, |
2446 | key_rwlock_LOCK_sys_init_connect, key_rwlock_LOCK_sys_init_slave, |
2447 | key_rwlock_LOCK_system_variables_hash, key_rwlock_query_cache_query_lock, |
2448 | - key_rwlock_global_sid_lock; |
2449 | + key_rwlock_global_sid_lock, key_rwlock_LOCK_consistent_snapshot; |
2450 | |
2451 | #ifdef HAVE_MMAP |
2452 | extern PSI_cond_key key_PAGE_cond, key_COND_active, key_COND_pool; |
2453 | @@ -620,6 +620,7 @@ |
2454 | extern mysql_cond_t COND_server_started; |
2455 | extern mysql_rwlock_t LOCK_grant, LOCK_sys_init_connect, LOCK_sys_init_slave; |
2456 | extern mysql_rwlock_t LOCK_system_variables_hash; |
2457 | +extern mysql_rwlock_t LOCK_consistent_snapshot; |
2458 | extern mysql_cond_t COND_manager; |
2459 | extern int32 thread_running; |
2460 | extern my_atomic_rwlock_t thread_running_lock; |
2461 | |
2462 | === modified file 'sql/rpl_rli.cc' |
2463 | === modified file 'sql/set_var.h' |
2464 | --- sql/set_var.h 2014-03-03 17:51:33 +0000 |
2465 | +++ sql/set_var.h 2014-03-16 07:05:06 +0000 |
2466 | @@ -344,7 +344,12 @@ |
2467 | extern SHOW_COMP_OPTION have_crypt; |
2468 | extern SHOW_COMP_OPTION have_compress; |
2469 | extern SHOW_COMP_OPTION have_statement_timeout; |
2470 | -extern SHOW_COMP_OPTION have_backup_locks; |
2471 | +<<<<<<< TREE |
2472 | +extern SHOW_COMP_OPTION have_backup_locks; |
2473 | +======= |
2474 | +extern SHOW_COMP_OPTION have_backup_locks; |
2475 | +extern SHOW_COMP_OPTION have_snapshot_cloning; |
2476 | +>>>>>>> MERGE-SOURCE |
2477 | |
2478 | /* |
2479 | Prototypes for helper functions |
2480 | |
2481 | === modified file 'sql/share/errmsg-utf8.txt' |
2482 | --- sql/share/errmsg-utf8.txt 2014-02-27 12:29:47 +0000 |
2483 | +++ sql/share/errmsg-utf8.txt 2014-03-16 07:05:06 +0000 |
2484 | @@ -7088,6 +7088,7 @@ |
2485 | ER_TEMP_FILE_WRITE_FAILURE |
2486 | eng "Temporary file write failure." |
2487 | |
2488 | +<<<<<<< TREE |
2489 | ER_INNODB_FT_AUX_NOT_HEX_ID |
2490 | eng "Upgrade index name failed, please use create index(alter table) algorithm copy to rebuild index." |
2491 | |
2492 | @@ -7104,6 +7105,12 @@ |
2493 | eng "Can’t execute the query because you have a conflicting backup lock" |
2494 | rus "Запрос не может быть выполнен из-за конфликтующей блокировки резервного копирования" |
2495 | |
2496 | +======= |
2497 | +ER_CANT_EXECUTE_WITH_BACKUP_LOCK |
2498 | + eng "Can’t execute the query because you have a conflicting backup lock" |
2499 | + rus "Запрос не может быть выполнен из-за конфликтующей блокировки резервного копирования" |
2500 | + |
2501 | +>>>>>>> MERGE-SOURCE |
2502 | # |
2503 | # End of 5.6 error messages. |
2504 | # |
2505 | |
2506 | === modified file 'sql/sql_yacc.yy' |
2507 | --- sql/sql_yacc.yy 2014-02-25 07:30:22 +0000 |
2508 | +++ sql/sql_yacc.yy 2014-03-16 07:05:06 +0000 |
2509 | @@ -8149,6 +8149,12 @@ |
2510 | { |
2511 | $$= MYSQL_START_TRANS_OPT_WITH_CONS_SNAPSHOT; |
2512 | } |
2513 | + | WITH CONSISTENT_SYM SNAPSHOT_SYM FROM SESSION_SYM expr |
2514 | + { |
2515 | + $$= MYSQL_START_TRANS_OPT_WITH_CONS_SNAPSHOT; |
2516 | + Lex->value_list.empty(); |
2517 | + Lex->value_list.push_front($6); |
2518 | + } |
2519 | | READ_SYM ONLY_SYM |
2520 | { |
2521 | $$= MYSQL_START_TRANS_OPT_READ_ONLY; |
2522 | |
2523 | === modified file 'sql/sys_vars.cc' |
2524 | --- sql/sys_vars.cc 2014-03-03 17:51:33 +0000 |
2525 | +++ sql/sys_vars.cc 2014-03-16 07:05:06 +0000 |
2526 | @@ -4017,10 +4017,21 @@ |
2527 | READ_ONLY GLOBAL_VAR(have_profiling), NO_CMD_LINE, NO_MUTEX_GUARD, |
2528 | NOT_IN_BINLOG, ON_CHECK(0), ON_UPDATE(0), DEPRECATED("")); |
2529 | |
2530 | -static Sys_var_have Sys_have_backup_locks( |
2531 | - "have_backup_locks", "have_backup_locks", |
2532 | - READ_ONLY GLOBAL_VAR(have_backup_locks), NO_CMD_LINE); |
2533 | - |
2534 | +<<<<<<< TREE |
2535 | +static Sys_var_have Sys_have_backup_locks( |
2536 | + "have_backup_locks", "have_backup_locks", |
2537 | + READ_ONLY GLOBAL_VAR(have_backup_locks), NO_CMD_LINE); |
2538 | + |
2539 | +======= |
2540 | +static Sys_var_have Sys_have_backup_locks( |
2541 | + "have_backup_locks", "have_backup_locks", |
2542 | + READ_ONLY GLOBAL_VAR(have_backup_locks), NO_CMD_LINE); |
2543 | + |
2544 | +static Sys_var_have Sys_have_snapshot_cloning( |
2545 | + "have_snapshot_cloning", "have_snapshot_cloning", |
2546 | + READ_ONLY GLOBAL_VAR(have_snapshot_cloning), NO_CMD_LINE); |
2547 | + |
2548 | +>>>>>>> MERGE-SOURCE |
2549 | static Sys_var_have Sys_have_query_cache( |
2550 | "have_query_cache", "have_query_cache", |
2551 | READ_ONLY GLOBAL_VAR(have_query_cache), NO_CMD_LINE); |
2552 | |
2553 | === modified file 'storage/federated/ha_federated.cc' |
2554 | === modified file 'storage/innobase/buf/buf0flu.cc' |
2555 | --- storage/innobase/buf/buf0flu.cc 2014-02-17 11:12:40 +0000 |
2556 | +++ storage/innobase/buf/buf0flu.cc 2014-03-16 07:05:06 +0000 |
2557 | @@ -1371,10 +1371,17 @@ |
2558 | |
2559 | /* These fields are protected by the buf_page_get_mutex() |
2560 | mutex. */ |
2561 | +<<<<<<< TREE |
2562 | /* Read the fields directly in order to avoid asserting on |
2563 | BUF_BLOCK_REMOVE_HASH pages. */ |
2564 | ulint space = bpage->space; |
2565 | ulint offset = bpage->offset; |
2566 | +======= |
2567 | + /* Read the fields directly in order to avoid asserting on |
2568 | + BUF_BLOCK_REMOVE_HASH pages. */ |
2569 | + space = bpage->space; |
2570 | + offset = bpage->offset; |
2571 | +>>>>>>> MERGE-SOURCE |
2572 | |
2573 | if (flush_type == BUF_FLUSH_LRU) { |
2574 | mutex_exit(block_mutex); |
2575 | |
2576 | === modified file 'storage/innobase/handler/ha_innodb.cc' |
2577 | --- storage/innobase/handler/ha_innodb.cc 2014-03-03 17:51:33 +0000 |
2578 | +++ storage/innobase/handler/ha_innodb.cc 2014-03-16 07:05:06 +0000 |
2579 | @@ -1148,6 +1148,22 @@ |
2580 | THD* thd); /* in: MySQL thread handle of the |
2581 | user for whom the transaction should |
2582 | be committed */ |
2583 | +/*****************************************************************//** |
2584 | +Creates an InnoDB transaction struct for the thd if it does not yet have one. |
2585 | +Starts a new InnoDB transaction if a transaction is not yet started. And |
2586 | +clones snapshot for a consistent read from another session, if it has one. |
2587 | +@return 0 */ |
2588 | +static |
2589 | +int |
2590 | +innobase_start_trx_and_clone_read_view( |
2591 | +/*====================================*/ |
2592 | + handlerton* hton, /* in: Innodb handlerton */ |
2593 | + THD* thd, /* in: MySQL thread handle of the |
2594 | + user for whom the transaction should |
2595 | + be committed */ |
2596 | + THD* from_thd); /* in: MySQL thread handle of the |
2597 | + user session from which the consistent |
2598 | + read should be cloned */ |
2599 | /****************************************************************//** |
2600 | Flushes InnoDB logs to disk and makes a checkpoint. Really, a commit flushes |
2601 | the logs, and the name of this function should be innobase_checkpoint. |
2602 | @@ -3166,6 +3182,8 @@ |
2603 | |
2604 | innobase_hton->start_consistent_snapshot = |
2605 | innobase_start_trx_and_assign_read_view; |
2606 | + innobase_hton->clone_consistent_snapshot = |
2607 | + innobase_start_trx_and_clone_read_view; |
2608 | |
2609 | innobase_hton->flush_logs = innobase_flush_logs; |
2610 | innobase_hton->show_status = innobase_show_status; |
2611 | @@ -3928,6 +3946,102 @@ |
2612 | |
2613 | |
2614 | /*****************************************************************//** |
2615 | +Creates an InnoDB transaction struct for the thd if it does not yet have one. |
2616 | +Starts a new InnoDB transaction if a transaction is not yet started. And |
2617 | +clones snapshot for a consistent read from another session, if it has one. |
2618 | +@return 0 */ |
2619 | +static |
2620 | +int |
2621 | +innobase_start_trx_and_clone_read_view( |
2622 | +/*====================================*/ |
2623 | + handlerton* hton, /* in: Innodb handlerton */ |
2624 | + THD* thd, /* in: MySQL thread handle of the |
2625 | + user for whom the transaction should |
2626 | + be committed */ |
2627 | + THD* from_thd) /* in: MySQL thread handle of the |
2628 | + user session from which the consistent |
2629 | + read should be cloned */ |
2630 | +{ |
2631 | + trx_t* trx; |
2632 | + trx_t* from_trx; |
2633 | + |
2634 | + DBUG_ENTER("innobase_start_trx_and_clone_read_view"); |
2635 | + DBUG_ASSERT(hton == innodb_hton_ptr); |
2636 | + |
2637 | + /* Get transaction handle from the donor session */ |
2638 | + |
2639 | + from_trx = thd_to_trx(from_thd); |
2640 | + |
2641 | + if (!from_trx) { |
2642 | + push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, |
2643 | + HA_ERR_UNSUPPORTED, |
2644 | + "InnoDB: WITH CONSISTENT SNAPSHOT " |
2645 | + "FROM SESSION was ignored because the " |
2646 | + "specified session does not have an open " |
2647 | + "transaction inside InnoDB."); |
2648 | + |
2649 | + DBUG_RETURN(0); |
2650 | + } |
2651 | + |
2652 | + /* Create a new trx struct for thd, if it does not yet have one */ |
2653 | + |
2654 | + trx = check_trx_exists(thd); |
2655 | + |
2656 | + /* This is just to play safe: release a possible FIFO ticket and |
2657 | + search latch. Since we can potentially reserve the trx_sys->mutex, |
2658 | + we have to release the search system latch first to obey the latching |
2659 | + order. */ |
2660 | + |
2661 | + trx_search_latch_release_if_reserved(trx); |
2662 | + |
2663 | + innobase_srv_conc_force_exit_innodb(trx); |
2664 | + |
2665 | + /* If the transaction is not started yet, start it */ |
2666 | + |
2667 | + trx_start_if_not_started_xa(trx); |
2668 | + |
2669 | + /* Clone the read view from the donor transaction. Do this only if |
2670 | + transaction is using REPEATABLE READ isolation level. */ |
2671 | + trx->isolation_level = innobase_map_isolation_level( |
2672 | + thd_get_trx_isolation(thd)); |
2673 | + |
2674 | + if (trx->isolation_level != TRX_ISO_REPEATABLE_READ) { |
2675 | + |
2676 | + push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, |
2677 | + HA_ERR_UNSUPPORTED, |
2678 | + "InnoDB: WITH CONSISTENT SNAPSHOT " |
2679 | + "was ignored because this phrase " |
2680 | + "can only be used with " |
2681 | + "REPEATABLE READ isolation level."); |
2682 | + } else { |
2683 | + |
2684 | + lock_mutex_enter(); |
2685 | + mutex_enter(&trx_sys->mutex); |
2686 | + trx_mutex_enter(from_trx); |
2687 | + |
2688 | + if (!trx_clone_read_view(trx, from_trx)) { |
2689 | + |
2690 | + push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, |
2691 | + HA_ERR_UNSUPPORTED, |
2692 | + "InnoDB: WITH CONSISTENT SNAPSHOT " |
2693 | + "FROM SESSION was ignored because " |
2694 | + "the target transaction has not been " |
2695 | + "assigned a read view."); |
2696 | + } |
2697 | + |
2698 | + trx_mutex_exit(from_trx); |
2699 | + mutex_exit(&trx_sys->mutex); |
2700 | + lock_mutex_exit(); |
2701 | + } |
2702 | + |
2703 | + /* Set the MySQL flag to mark that there is an active transaction */ |
2704 | + |
2705 | + innobase_register_trx(hton, current_thd, trx); |
2706 | + |
2707 | + DBUG_RETURN(0); |
2708 | +} |
2709 | + |
2710 | +/*****************************************************************//** |
2711 | Commits a transaction in an InnoDB database or marks an SQL statement |
2712 | ended. |
2713 | @return 0 */ |
2714 | |
2715 | === modified file 'storage/innobase/include/read0read.h' |
2716 | --- storage/innobase/include/read0read.h 2013-10-23 08:48:28 +0000 |
2717 | +++ storage/innobase/include/read0read.h 2014-03-16 07:05:06 +0000 |
2718 | @@ -50,6 +50,27 @@ |
2719 | NULL if a new one needs to be created */ |
2720 | |
2721 | /*********************************************************************//** |
2722 | +Clones a read view object. This function will allocate space for two read |
2723 | +views contiguously, one identical in size and content as @param view (starting |
2724 | +at returned pointer) and another view immediately following the trx_ids array. |
2725 | +The second view will have space for an extra trx_id_t element. |
2726 | +@return read view struct */ |
2727 | +UNIV_INTERN |
2728 | +read_view_t* |
2729 | +read_view_clone( |
2730 | +/*============*/ |
2731 | + const read_view_t* view, /*!< in: view to clone */ |
2732 | + read_view_t*& prebuilt_clone);/*!< in,out: prebuilt view or |
2733 | + NULL */ |
2734 | +/*********************************************************************//** |
2735 | +Insert the view in the proper order into the trx_sys->view_list. The |
2736 | +read view list is ordered by read_view_t::low_limit_no in descending order. */ |
2737 | +UNIV_INTERN |
2738 | +void |
2739 | +read_view_add( |
2740 | +/*==========*/ |
2741 | + read_view_t* view); /*!< in: view to add to */ |
2742 | +/*********************************************************************//** |
2743 | Makes a copy of the oldest existing read view, or opens a new. The view |
2744 | must be closed with ..._close. |
2745 | @return own: read view struct */ |
2746 | |
2747 | === modified file 'storage/innobase/include/trx0trx.h' |
2748 | --- storage/innobase/include/trx0trx.h 2014-02-17 11:12:40 +0000 |
2749 | +++ storage/innobase/include/trx0trx.h 2014-03-16 07:05:06 +0000 |
2750 | @@ -275,6 +275,16 @@ |
2751 | trx_assign_read_view( |
2752 | /*=================*/ |
2753 | trx_t* trx); /*!< in: active transaction */ |
2754 | +/********************************************************************//** |
2755 | +Clones the read view from another transaction. All the consistent reads within |
2756 | +the receiver transaction will get the same read view as the donor transaction |
2757 | +@return read view clone */ |
2758 | +UNIV_INTERN |
2759 | +read_view_t* |
2760 | +trx_clone_read_view( |
2761 | +/*================*/ |
2762 | + trx_t* trx, /*!< in: receiver transaction */ |
2763 | + trx_t* from_trx); /*!< in: donor transaction */ |
2764 | /****************************************************************//** |
2765 | Prepares a transaction for commit/rollback. */ |
2766 | UNIV_INTERN |
2767 | |
2768 | === modified file 'storage/innobase/read/read0read.cc' |
2769 | --- storage/innobase/read/read0read.cc 2013-10-23 08:48:28 +0000 |
2770 | +++ storage/innobase/read/read0read.cc 2014-03-16 07:05:06 +0000 |
2771 | @@ -221,7 +221,7 @@ |
2772 | at returned pointer) and another view immediately following the trx_ids array. |
2773 | The second view will have space for an extra trx_id_t element. |
2774 | @return read view struct */ |
2775 | -UNIV_INLINE |
2776 | +UNIV_INTERN |
2777 | read_view_t* |
2778 | read_view_clone( |
2779 | /*============*/ |
2780 | @@ -256,7 +256,7 @@ |
2781 | /*********************************************************************//** |
2782 | Insert the view in the proper order into the trx_sys->view_list. The |
2783 | read view list is ordered by read_view_t::low_limit_no in descending order. */ |
2784 | -static |
2785 | +UNIV_INTERN |
2786 | void |
2787 | read_view_add( |
2788 | /*==========*/ |
2789 | |
2790 | === modified file 'storage/innobase/trx/trx0trx.cc' |
2791 | --- storage/innobase/trx/trx0trx.cc 2014-02-17 11:12:40 +0000 |
2792 | +++ storage/innobase/trx/trx0trx.cc 2014-03-16 07:05:06 +0000 |
2793 | @@ -1692,6 +1692,38 @@ |
2794 | return(trx->read_view); |
2795 | } |
2796 | |
2797 | +/********************************************************************//** |
2798 | +Clones the read view from another transaction. All consistent reads within |
2799 | +the receiver transaction will get the same read view as the donor transaction |
2800 | +@return read view clone */ |
2801 | +UNIV_INTERN |
2802 | +read_view_t* |
2803 | +trx_clone_read_view( |
2804 | +/*================*/ |
2805 | + trx_t* trx, /*!< in: receiver transaction */ |
2806 | + trx_t* from_trx) /*!< in: donor transaction */ |
2807 | +{ |
2808 | + ut_ad(lock_mutex_own()); |
2809 | + ut_ad(mutex_own(&trx_sys->mutex)); |
2810 | + ut_ad(trx_mutex_own(from_trx)); |
2811 | + ut_ad(trx->read_view == NULL); |
2812 | + |
2813 | + if (from_trx->state != TRX_STATE_ACTIVE || |
2814 | + from_trx->read_view == NULL) { |
2815 | + |
2816 | + return(NULL); |
2817 | + } |
2818 | + |
2819 | + trx->read_view = read_view_clone(from_trx->read_view, |
2820 | + trx->prebuilt_view); |
2821 | + |
2822 | + read_view_add(trx->read_view); |
2823 | + |
2824 | + trx->global_read_view = trx->read_view; |
2825 | + |
2826 | + return(trx->read_view); |
2827 | +} |
2828 | + |
2829 | /****************************************************************//** |
2830 | Prepares a transaction for commit/rollback. */ |
2831 | UNIV_INTERN |
2832 | |
2833 | === modified file 'storage/perfschema/ha_perfschema.cc' |