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