| 1 |
--source include/have_ndb.inc |
| 2 |
--source include/have_binlog_format_mixed_or_row.inc |
| 3 |
|
| 4 |
--echo # |
| 5 |
--echo # Check default behaviour of logical clock timestamps in binlog generated |
| 6 |
--echo # by ndb_binlog thread. The timestamps will indicate that each epoch |
| 7 |
--echo # transaction depends on the previous. |
| 8 |
--echo # |
| 9 |
|
| 10 |
--echo # Test requires that transaction dependency calculations are turned off |
| 11 |
--echo # for the ndb_binlog thread |
| 12 |
select @@global.ndb_log_transaction_dependency; |
| 13 |
if (`select @@global.ndb_log_transaction_dependency != '0'`) { |
| 14 |
--skip Test requires ndb_log_transaction_dependency enabled |
| 15 |
} |
| 16 |
|
| 17 |
--echo # Test assumes that COMMIT_ORDER is used for dependency tracking (this |
| 18 |
--echo # is the default setting for MySQL Server) |
| 19 |
select @@binlog_transaction_dependency_tracking; |
| 20 |
|
| 21 |
CREATE TABLE t1 ( |
| 22 |
a INT PRIMARY KEY |
| 23 |
) engine=ndb; |
| 24 |
|
| 25 |
--let $binlog_file= binlog.000001 |
| 26 |
|
| 27 |
--let $logical_timestamps= 0 1 |
| 28 |
--source include/assert_logical_timestamps.inc |
| 29 |
|
| 30 |
INSERT INTO t1 VALUES (1); |
| 31 |
|
| 32 |
--echo # Wait for changes to be injected, then check timestamps |
| 33 |
--source suite/ndb/include/ndb_binlog_wait_own_changes.inc |
| 34 |
--let $logical_timestamps= 1 2 |
| 35 |
--source include/assert_logical_timestamps.inc |
| 36 |
|
| 37 |
INSERT INTO t1 VALUES (2); |
| 38 |
|
| 39 |
--echo # Wait for changes to be injected, then check timestamps |
| 40 |
--source suite/ndb/include/ndb_binlog_wait_own_changes.inc |
| 41 |
--let $logical_timestamps= 2 3 |
| 42 |
--source include/assert_logical_timestamps.inc |
| 43 |
|
| 44 |
CREATE TABLE t2 ( |
| 45 |
a INT PRIMARY KEY |
| 46 |
) engine=ndb; |
| 47 |
|
| 48 |
BEGIN; |
| 49 |
INSERT INTO t1 VALUES (3); |
| 50 |
INSERT INTO t2 VALUES (23); |
| 51 |
COMMIT; |
| 52 |
|
| 53 |
--echo # Wait for changes to be injected, then check timestamps |
| 54 |
--source suite/ndb/include/ndb_binlog_wait_own_changes.inc |
| 55 |
--let $logical_timestamps= 4 5 |
| 56 |
--source include/assert_logical_timestamps.inc |
| 57 |
|
| 58 |
# Inspect binlog contents |
| 59 |
#--let $datadir= `SELECT @@datadir` |
| 60 |
#--exec $MYSQL_BINLOG --force-if-open $datadir/binlog.000001 |
| 61 |
|
| 62 |
--echo # Create new binlog, timestamps will start over |
| 63 |
FLUSH LOGS; |
| 64 |
|
| 65 |
INSERT INTO t1 VALUES (4); |
| 66 |
|
| 67 |
--echo # Wait for changes to be injected, then check timestamps |
| 68 |
--source suite/ndb/include/ndb_binlog_wait_own_changes.inc |
| 69 |
--let $logical_timestamps= 0 1 |
| 70 |
--source include/assert_logical_timestamps.inc |
| 71 |
|
| 72 |
BEGIN; |
| 73 |
INSERT INTO t1 VALUES (5); |
| 74 |
INSERT INTO t2 VALUES (25); |
| 75 |
COMMIT; |
| 76 |
|
| 77 |
--echo # Wait for changes to be injected, then check timestamps |
| 78 |
--source suite/ndb/include/ndb_binlog_wait_own_changes.inc |
| 79 |
--let $logical_timestamps= 1 2 |
| 80 |
--source include/assert_logical_timestamps.inc |
| 81 |
|
| 82 |
--echo # Cleanup |
| 83 |
DROP TABLE t1; |
| 84 |
DROP TABLE t2; |