| 1 |
# |
| 2 |
# Check behaviour of logical clock timestamps in binlog generated |
| 3 |
# by ndb_binlog thread with transaction dependcy calculations turned on. |
| 4 |
# The timestamps should indicate that each epoch transaction depends on |
| 5 |
# the previous transaction that modified same row. |
| 6 |
# |
| 7 |
# Test requires that binlog transaction dependency has been turned on |
| 8 |
select @@ndb_log_transaction_dependency; |
| 9 |
@@ndb_log_transaction_dependency |
| 10 |
1 |
| 11 |
# |
| 12 |
# Check that the --ndb-log-transaction-dependency=[ON|OFF] is a readonly |
| 13 |
# variable and thus not possible to change at runtime. |
| 14 |
# |
| 15 |
set @@ndb_log_transaction_dependency=ON; |
| 16 |
ERROR HY000: Variable 'ndb_log_transaction_dependency' is a read only variable |
| 17 |
# Test assumes that WRITESET is used for dependency tracking as otherwise |
| 18 |
# the hash values calculated by ndb_binlog thread will not be used |
| 19 |
select @@binlog_transaction_dependency_tracking; |
| 20 |
@@binlog_transaction_dependency_tracking |
| 21 |
WRITESET |
| 22 |
Warnings: |
| 23 |
Warning 1287 '@@binlog_transaction_dependency_tracking' is deprecated and will be removed in a future release. |
| 24 |
CREATE TABLE t1 ( |
| 25 |
a INT PRIMARY KEY, |
| 26 |
b CHAR(10) |
| 27 |
) engine=ndb; |
| 28 |
include/include/assert_logical_timestamps.inc [0 1] |
| 29 |
INSERT INTO t1 VALUES (1, 'a'); |
| 30 |
# Wait for changes to be injected, then check timestamps |
| 31 |
# Wait for ndb_binlog thread... |
| 32 |
include/include/assert_logical_timestamps.inc [1 2] |
| 33 |
INSERT INTO t1 VALUES (2, 'b'); |
| 34 |
# Wait for changes to be injected, then check timestamps |
| 35 |
# Wait for ndb_binlog thread... |
| 36 |
include/include/assert_logical_timestamps.inc [1 3] |
| 37 |
CREATE TABLE t2 ( |
| 38 |
a INT PRIMARY KEY, |
| 39 |
b CHAR(10) |
| 40 |
) engine=ndb; |
| 41 |
BEGIN; |
| 42 |
INSERT INTO t1 VALUES (3, 'c'); |
| 43 |
INSERT INTO t2 VALUES (23, 'bc'); |
| 44 |
COMMIT; |
| 45 |
# Wait for changes to be injected, then check timestamps |
| 46 |
# Wait for ndb_binlog thread... |
| 47 |
include/include/assert_logical_timestamps.inc [4 5] |
| 48 |
BEGIN; |
| 49 |
INSERT INTO t1 VALUES (4, 'd'); |
| 50 |
INSERT INTO t2 VALUES (24, 'bd'); |
| 51 |
COMMIT; |
| 52 |
# Wait for changes to be injected, then check timestamps |
| 53 |
# Wait for ndb_binlog thread... |
| 54 |
include/include/assert_logical_timestamps.inc [4 6] |
| 55 |
# |
| 56 |
# Do a longer sequence of transactions that does not |
| 57 |
# have dependencies |
| 58 |
BEGIN; |
| 59 |
INSERT INTO t1 VALUES (5, 'e'); |
| 60 |
INSERT INTO t2 VALUES (25, 'be'); |
| 61 |
COMMIT; |
| 62 |
# Wait for changes to be injected, then check timestamps |
| 63 |
# Wait for ndb_binlog thread... |
| 64 |
include/include/assert_logical_timestamps.inc [4 7] |
| 65 |
BEGIN; |
| 66 |
INSERT INTO t1 VALUES (6, 'f'); |
| 67 |
INSERT INTO t2 VALUES (26, 'bf'); |
| 68 |
COMMIT; |
| 69 |
# Wait for changes to be injected, then check timestamps |
| 70 |
# Wait for ndb_binlog thread... |
| 71 |
include/include/assert_logical_timestamps.inc [4 8] |
| 72 |
# |
| 73 |
# Do update values dependent on previous transactions |
| 74 |
UPDATE t1 SET b = 'updated' WHERE a in (4,5); |
| 75 |
# Wait for changes to be injected, then check timestamps |
| 76 |
# Wait for ndb_binlog thread... |
| 77 |
include/include/assert_logical_timestamps.inc [7 9] |
| 78 |
UPDATE t2 SET b = 'updated' WHERE a in (24, 26); |
| 79 |
# Wait for changes to be injected, then check timestamps |
| 80 |
# Wait for ndb_binlog thread... |
| 81 |
include/include/assert_logical_timestamps.inc [8 10] |
| 82 |
# Cleanup |
| 83 |
DROP TABLE t1; |
| 84 |
DROP TABLE t2; |