mirror of
https://github.com/MariaDB/server.git
synced 2025-01-19 21:42:35 +01:00
6cd218cc56
binlog coordinates corresponding to the dump". The good news is that now mysqldump can be used to get an online backup of InnoDB *which works for point-in-time recovery and replication slave creation*. Formerly, mysqldump --master-data --single-transaction used to call in fact mysqldump --master-data, so the dump was not an online dump (took big lock all time of dump). The only lock which is now taken in this patch is at the beginning of the dump: mysqldump does: FLUSH TABLES WITH READ LOCK; START TRANSACTION WITH CONSISTENT SNAPSHOT; SHOW MASTER STATUS; UNLOCK TABLES; so the lock time is in fact the time FLUSH TABLES WITH READ LOCK takes to return (can be 0 or very long, if a table is undergoing a huge update). I have done some more minor changes listed in the paragraph of mysqldump.c. WL#2237 "WITH CONSISTENT SNAPSHOT clause for START TRANSACTION": it's a START TRANSACTION which additionally starts a consistent read on all capable storage engine (i.e. InnoDB). So, can serve as a replacement for BEGIN; SELECT * FROM some_innodb_table LIMIT 1; which starts a consistent read too.
41 lines
944 B
Text
41 lines
944 B
Text
-- source include/have_innodb.inc
|
|
|
|
--disable_warnings
|
|
drop table if exists t1;
|
|
--enable_warnings
|
|
|
|
connect (con1,localhost,root,,);
|
|
connect (con2,localhost,root,,);
|
|
|
|
### Test 1:
|
|
### - While a consistent snapshot transaction is executed,
|
|
### no external inserts should be visible to the transaction.
|
|
|
|
connection con1;
|
|
create table t1 (a int) engine=innodb;
|
|
start transaction with consistent snapshot;
|
|
|
|
connection con2;
|
|
insert into t1 values(1);
|
|
|
|
connection con1;
|
|
select * from t1; # if consistent snapshot was set as expected, we
|
|
# should see nothing.
|
|
commit;
|
|
|
|
### Test 2:
|
|
### - For any non-consistent snapshot transaction, external
|
|
### committed inserts should be visible to the transaction.
|
|
|
|
delete from t1;
|
|
start transaction; # Now we omit WITH CONSISTENT SNAPSHOT
|
|
|
|
connection con2;
|
|
insert into t1 values(1);
|
|
|
|
connection con1;
|
|
select * from t1; # if consistent snapshot was not set, as expected, we
|
|
# should see 1.
|
|
commit;
|
|
|
|
drop table t1;
|