1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151
|
reset master;
create table t1 (a int primary key) engine=ndb;
insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
select max(epoch)-1 from mysql.ndb_binlog_index into @max_epoch;
select @max_epoch;
@max_epoch
#
delete from t1;
alter table t1 add (b_x int);
Warnings:
Warning 1478 Converted FIXED field 'b_x' to DYNAMIC to enable online ADD COLUMN
alter table t1 algorithm=inplace, rename column b_x to b;
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
binlog.000001 # Query # # use `test`; create table t1 (a int primary key) engine=ndb
binlog.000001 # Query # # BEGIN
binlog.000001 # Table_map # # table_id: # (test.t1)
binlog.000001 # Table_map # # table_id: # (mysql.ndb_apply_status)
binlog.000001 # Write_rows # # table_id: #
binlog.000001 # Write_rows # # table_id: # flags: STMT_END_F
binlog.000001 # Query # # COMMIT
binlog.000001 # Query # # BEGIN
binlog.000001 # Table_map # # table_id: # (test.t1)
binlog.000001 # Table_map # # table_id: # (mysql.ndb_apply_status)
binlog.000001 # Write_rows # # table_id: #
binlog.000001 # Delete_rows # # table_id: # flags: STMT_END_F
binlog.000001 # Query # # COMMIT
binlog.000001 # Query # # use `test`; alter table t1 add (b_x int)
binlog.000001 # Query # # use `test`; alter table t1 algorithm=inplace, rename column b_x to b
insert into t1 values (3,3),(4,4);
alter table t1 rename t2;
begin;
insert into t2 values (1,1),(2,2);
update t2 set b=1 where a=3;
delete from t2 where a=4;
commit;
drop table t2;
select inserts from mysql.ndb_binlog_index where epoch > @max_epoch and inserts > 5;
inserts
10
select deletes from mysql.ndb_binlog_index where epoch > @max_epoch and deletes > 5;
deletes
10
select inserts,updates,deletes from
mysql.ndb_binlog_index where epoch > @max_epoch and updates > 0;
inserts updates deletes
2 1 1
flush logs;
purge master logs before now();
Warnings:
Warning 1868 file ./binlog.000002 was not purged because it is the active log file.
select count(*) from mysql.ndb_binlog_index;
count(*)
0
create table t1 (a int primary key, b int) engine=ndb;
create database mysqltest;
use mysqltest;
create table t1 (c int, d int primary key) engine=ndb;
use test;
insert into mysqltest.t1 values (2,1),(2,2);
select max(epoch)-1 from mysql.ndb_binlog_index into @max_epoch;
select @max_epoch;
@max_epoch
#
drop table t1;
drop database mysqltest;
select inserts,updates,deletes from
mysql.ndb_binlog_index where epoch > @max_epoch and inserts > 0;
inserts updates deletes
2 0 0
create table t1 (c1 int not null primary key, c2 blob default null) engine=ndbcluster default charset=latin1;
insert into t1 values (1, null), (2, null), (3, null), (4, null);
insert into t1 select c1+4,c2 from t1;
insert into t1 select c1+8,c2 from t1;
insert into t1 select c1+16,c2 from t1;
insert into t1 select c1+32,c2 from t1;
insert into t1 select c1+64,c2 from t1;
insert into t1 select c1+128,c2 from t1;
insert into t1 select c1+256,c2 from t1;
insert into t1 select c1+512,c2 from t1;
optimize table t1;
Table Op Msg_type Msg_text
test.t1 optimize status OK
drop table t1;
SET GLOBAL ndb_log_empty_epochs=ON;
SHOW VARIABLES LIKE 'ndb_log_empty_epochs';
Variable_name Value
ndb_log_empty_epochs ON
create table t1 (c1 int not null primary key, c2 blob default null) engine=ndbcluster default charset=latin1;
insert into t1 values (1, null);
show binlog events;
update t1 set c2=null;
select * from t1;
c1 c2
1 NULL
show binlog events;
optimize table t1;
Table Op Msg_type Msg_text
test.t1 optimize status OK
select * from t1;
c1 c2
1 NULL
drop table t1;
create table t1 (c1 int not null primary key, c2 varchar(1024) default null) engine=ndbcluster default charset=latin1;
insert into t1 values (3, null);
select * from t1;
c1 c2
3 NULL
show binlog events;
optimize table t1;
Table Op Msg_type Msg_text
test.t1 optimize status OK
select * from t1;
c1 c2
3 NULL
drop table t1;
SET GLOBAL ndb_log_empty_epochs=OFF;
show binlog events;
SHOW VARIABLES LIKE 'ndb_log_empty_epochs';
Variable_name Value
ndb_log_empty_epochs OFF
create table t1 (c1 int not null primary key, c2 blob default null) engine=ndbcluster default charset=latin1;
insert into t1 values (1, null);
show binlog events;
update t1 set c2=null;
select * from t1;
c1 c2
1 NULL
show binlog events;
optimize table t1;
Table Op Msg_type Msg_text
test.t1 optimize status OK
select * from t1;
c1 c2
1 NULL
drop table t1;
create table t1 (c1 int not null primary key, c2 varchar(1024) default null) engine=ndbcluster default charset=latin1;
insert into t1 values (3, null);
select * from t1;
c1 c2
3 NULL
show binlog events;
optimize table t1;
Table Op Msg_type Msg_text
test.t1 optimize status OK
select * from t1;
c1 c2
3 NULL
drop table t1;
SET GLOBAL ndb_log_empty_epochs=OFF;
show binlog events;
|