Debian Codegraph @

mysql-test/suite/ndb_binlog/t/log_trans_dependency_on.test

raw
1 --source include/have_ndb.inc
2 --source include/have_binlog_format_mixed_or_row.inc
3
4 --echo #
5 --echo # Check behaviour of logical clock timestamps in binlog generated
6 --echo # by ndb_binlog thread with transaction dependcy calculations turned on.
7 --echo # The timestamps should indicate that each epoch transaction depends on
8 --echo # the previous transaction that modified same row.
9 --echo #
10
11 --echo # Test requires that binlog transaction dependency has been turned on
12 --source suite/ndb/include/ndb_log_transaction_dependency_enabled.inc
13 select @@ndb_log_transaction_dependency;
14
15 --echo #
16 --echo # Check that the --ndb-log-transaction-dependency=[ON|OFF] is a readonly
17 --echo # variable and thus not possible to change at runtime.
18 --echo #
19 --error ER_INCORRECT_GLOBAL_LOCAL_VAR
20 set @@ndb_log_transaction_dependency=ON;
21
22 --echo # Test assumes that WRITESET is used for dependency tracking as otherwise
23 --echo # the hash values calculated by ndb_binlog thread will not be used
24 select @@binlog_transaction_dependency_tracking;
25
26 CREATE TABLE t1 (
27 a INT PRIMARY KEY,
28 b CHAR(10)
29 ) engine=ndb;
30
31 --let $binlog_file= binlog.000001
32
33 --let $logical_timestamps= 0 1
34 --source include/assert_logical_timestamps.inc
35
36 INSERT INTO t1 VALUES (1, 'a');
37
38 --echo # Wait for changes to be injected, then check timestamps
39 --source suite/ndb/include/ndb_binlog_wait_own_changes.inc
40 --let $logical_timestamps= 1 2
41 --source include/assert_logical_timestamps.inc
42
43 INSERT INTO t1 VALUES (2, 'b');
44
45 --echo # Wait for changes to be injected, then check timestamps
46 --source suite/ndb/include/ndb_binlog_wait_own_changes.inc
47 --let $logical_timestamps= 1 3
48 --source include/assert_logical_timestamps.inc
49
50 CREATE TABLE t2 (
51 a INT PRIMARY KEY,
52 b CHAR(10)
53 ) engine=ndb;
54
55 BEGIN;
56 INSERT INTO t1 VALUES (3, 'c');
57 INSERT INTO t2 VALUES (23, 'bc');
58 COMMIT;
59
60 --echo # Wait for changes to be injected, then check timestamps
61 --source suite/ndb/include/ndb_binlog_wait_own_changes.inc
62 --let $logical_timestamps= 4 5
63 --source include/assert_logical_timestamps.inc
64
65 BEGIN;
66 INSERT INTO t1 VALUES (4, 'd');
67 INSERT INTO t2 VALUES (24, 'bd');
68 COMMIT;
69
70 --echo # Wait for changes to be injected, then check timestamps
71 --source suite/ndb/include/ndb_binlog_wait_own_changes.inc
72 --let $logical_timestamps= 4 6
73 --source include/assert_logical_timestamps.inc
74
75 --echo #
76 --echo # Do a longer sequence of transactions that does not
77 --echo # have dependencies
78
79 BEGIN;
80 INSERT INTO t1 VALUES (5, 'e');
81 INSERT INTO t2 VALUES (25, 'be');
82 COMMIT;
83
84 --echo # Wait for changes to be injected, then check timestamps
85 --source suite/ndb/include/ndb_binlog_wait_own_changes.inc
86 --let $logical_timestamps= 4 7
87 --source include/assert_logical_timestamps.inc
88
89 BEGIN;
90 INSERT INTO t1 VALUES (6, 'f');
91 INSERT INTO t2 VALUES (26, 'bf');
92 COMMIT;
93
94 --echo # Wait for changes to be injected, then check timestamps
95 --source suite/ndb/include/ndb_binlog_wait_own_changes.inc
96 --let $logical_timestamps= 4 8
97 --source include/assert_logical_timestamps.inc
98
99 --echo #
100 --echo # Do update values dependent on previous transactions
101
102 UPDATE t1 SET b = 'updated' WHERE a in (4,5);
103
104 --echo # Wait for changes to be injected, then check timestamps
105 --source suite/ndb/include/ndb_binlog_wait_own_changes.inc
106 --let $logical_timestamps= 7 9
107 --source include/assert_logical_timestamps.inc
108
109 UPDATE t2 SET b = 'updated' WHERE a in (24, 26);
110
111 --echo # Wait for changes to be injected, then check timestamps
112 --source suite/ndb/include/ndb_binlog_wait_own_changes.inc
113 --let $logical_timestamps= 8 10
114 --source include/assert_logical_timestamps.inc
115
116 --echo # Cleanup
117 DROP TABLE t1;
118 DROP TABLE t2;