1
-- source include/have_ndb.inc
2
-- source include/have_binlog_format_mixed_or_row.inc
5
drop table if exists t1, t2;
6
drop database if exists mysqltest;
7
create database mysqltest;
9
drop database mysqltest;
14
# basic insert, update, delete test, alter, rename, drop
15
# check that ndb_binlog_index gets the right info
19
create table t1 (a int primary key) engine=ndb;
20
insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
23
select @max_epoch:=max(epoch)-1 from mysql.ndb_binlog_index;
26
alter table t1 add (b int);
27
insert into t1 values (3,3),(4,4);
28
alter table t1 rename t2;
30
# get all in one epoch
32
insert into t2 values (1,1),(2,2);
33
update t2 set b=1 where a=3;
34
delete from t2 where a=4;
38
# check that above is ok
39
# (save_master_pos waits for last gcp to complete, ensuring that we have
40
# the expected data in the binlog)
42
select inserts from mysql.ndb_binlog_index where epoch > @max_epoch and inserts > 5;
43
select deletes from mysql.ndb_binlog_index where epoch > @max_epoch and deletes > 5;
44
select inserts,updates,deletes from
45
mysql.ndb_binlog_index where epoch > @max_epoch and updates > 0;
48
# check that purge clears the ndb_binlog_index
50
# TODO: make this deterministic
51
# This test is disabled until we can make this determistic under load.
52
# The problem is that in some cases, the binlog writing thread gets
53
# scheduled after the purge, writes pending things, then the select
58
purge master logs before now();
60
select count(*) from mysql.ndb_binlog_index;
64
# several tables in different databases
65
# check that same table name in different databases don't mix up
67
create table t1 (a int primary key, b int) engine=ndb;
68
create database mysqltest;
70
create table t1 (c int, d int primary key) engine=ndb;
73
insert into mysqltest.t1 values (2,1),(2,2);
76
select @max_epoch:=max(epoch)-1 from mysql.ndb_binlog_index;
79
drop database mysqltest;
80
select inserts,updates,deletes from
81
mysql.ndb_binlog_index where epoch > @max_epoch and inserts > 0;