|
| 1 | +-- source include/have_ndb.inc |
| 2 | +-- source include/have_binlog_format_mixed_or_row.inc |
| 3 | + |
| 4 | +--echo Reset binlog and show no state held |
| 5 | +reset master; |
| 6 | +select count(1) from mysql.ndb_binlog_index; |
| 7 | + |
| 8 | +--echo Create table for experiments |
| 9 | +use test; |
| 10 | +create table test.t1 (a int primary key, b varchar(1000), c text) engine=ndb; |
| 11 | + |
| 12 | +--echo Basic test that an insert affects Server + Session epochs |
| 13 | +--source ndb_binlog_init_epoch_vals.inc |
| 14 | +insert into test.t1 values (1, repeat("B", 1000), repeat("E", 500)); |
| 15 | +--source ndb_binlog_cmp_epoch_vals.inc |
| 16 | + |
| 17 | +--echo Basic test that a read with exclusive lock has no effect |
| 18 | +--source ndb_binlog_init_epoch_vals.inc |
| 19 | +begin; |
| 20 | +select count(1) from test.t1 where a=1 for update; |
| 21 | +commit; |
| 22 | +--source ndb_binlog_cmp_epoch_vals.inc |
| 23 | + |
| 24 | +--echo Basic test that a read with shared lock has no effect |
| 25 | +--source ndb_binlog_init_epoch_vals.inc |
| 26 | +begin; |
| 27 | +select count(1) from test.t1 where a=1 lock in share mode; |
| 28 | +commit; |
| 29 | +--source ndb_binlog_cmp_epoch_vals.inc |
| 30 | + |
| 31 | +--echo Basic test that a committedread has no effect |
| 32 | +--source ndb_binlog_init_epoch_vals.inc |
| 33 | +begin; |
| 34 | +select count(1) from test.t1 where a=1; |
| 35 | +commit; |
| 36 | +--source ndb_binlog_cmp_epoch_vals.inc |
| 37 | + |
| 38 | +--echo Basic test that an update affects Server + Session epochs |
| 39 | +--source ndb_binlog_init_epoch_vals.inc |
| 40 | +update test.t1 set b=repeat("E", 1000), c=repeat("A", 5000) where a=1; |
| 41 | +--source ndb_binlog_cmp_epoch_vals.inc |
| 42 | + |
| 43 | +--echo Basic test that a delete affects Server + Session epochs |
| 44 | +--source ndb_binlog_init_epoch_vals.inc |
| 45 | +delete from test.t1 where a=1; |
| 46 | +--source ndb_binlog_cmp_epoch_vals.inc |
| 47 | + |
| 48 | +--echo Show that server epoch is preserved across connections |
| 49 | +--echo but session epoch is not |
| 50 | + |
| 51 | +--source ndb_binlog_init_epoch_vals.inc |
| 52 | +let $server_epoch= query_get_value(select @init_server_epoch as e, e, 1); |
| 53 | +let $session_epoch= query_get_value(select @init_session_epoch as e, e, 1); |
| 54 | +connect('ExtraConn', '127.0.0.1', 'root',,,$MASTER_MYPORT); |
| 55 | +--source ndb_binlog_init_epoch_vals.inc |
| 56 | +let $new_server_epoch= query_get_value(select @init_server_epoch as e, e, 1); |
| 57 | +let $new_session_epoch= query_get_value(select @init_session_epoch as e, e, 1); |
| 58 | + |
| 59 | +--disable_query_log |
| 60 | +eval select $new_server_epoch >= $server_epoch as server_epoch_preserved; |
| 61 | +eval select $new_session_epoch < $session_epoch as session_epoch_reset; |
| 62 | +--enable_query_log |
| 63 | + |
| 64 | +drop table test.t1; |
| 65 | + |
0 commit comments