| 1 |
-- source include/have_multi_ndb.inc |
| 2 |
-- source include/have_binlog_format_mixed_or_row.inc |
| 3 |
|
| 4 |
|
| 5 |
--connection server1 |
| 6 |
|
| 7 |
show variables like 'log_bin'; |
| 8 |
show variables like 'ndb_log_bin'; |
| 9 |
|
| 10 |
--echo Test 1 : Show that reorg of table being Binlogged does not result |
| 11 |
--echo in any Binlog content |
| 12 |
|
| 13 |
create table t1 (a int primary key, b varchar(100), c int, unique(c)) engine=ndb; |
| 14 |
|
| 15 |
--echo Insert 8192 rows |
| 16 |
--disable_query_log |
| 17 |
insert into t1 values (1, repeat('C', 90),2); |
| 18 |
insert into t1 select a+1, b, c+1 from t1; |
| 19 |
insert into t1 select a+2, b, c+2 from t1; |
| 20 |
insert into t1 select a+4, b, c+4 from t1; |
| 21 |
insert into t1 select a+8, b, c+8 from t1; |
| 22 |
insert into t1 select a+16, b, c+16 from t1; |
| 23 |
insert into t1 select a+32, b, c+32 from t1; |
| 24 |
insert into t1 select a+64, b, c+64 from t1; |
| 25 |
insert into t1 select a+128, b, c+128 from t1; |
| 26 |
insert into t1 select a+256, b, c+256 from t1; |
| 27 |
insert into t1 select a+512, b, c+512 from t1; |
| 28 |
insert into t1 select a+1024, b, c+1024 from t1; |
| 29 |
insert into t1 select a+2048, b, c+2048 from t1; |
| 30 |
insert into t1 select a+4096, b, c+4096 from t1; |
| 31 |
--enable_query_log |
| 32 |
|
| 33 |
--echo Show t1 distribution prior to reorg |
| 34 |
let ndb_table=t1; |
| 35 |
--source show_partition_info.inc |
| 36 |
|
| 37 |
--echo Add new nodes |
| 38 |
--exec $NDB_MGM -e "create nodegroup 3,4" |
| 39 |
|
| 40 |
--echo Show empty binlog prior to reorg |
| 41 |
# Sync binlog |
| 42 |
--disable_query_log |
| 43 |
--disable_result_log |
| 44 |
show binlog events; |
| 45 |
--enable_result_log |
| 46 |
--enable_query_log |
| 47 |
reset master; |
| 48 |
#--source include/show_binlog_events.inc |
| 49 |
select count(1), sum(inserts), sum(updates), sum(deletes) from mysql.ndb_binlog_index; |
| 50 |
|
| 51 |
--echo Reorg table to use new nodes |
| 52 |
alter table t1 reorganize partition; |
| 53 |
|
| 54 |
--echo Show t1 distribution after reorg |
| 55 |
let ndb_table=t1; |
| 56 |
--source show_partition_info.inc |
| 57 |
|
| 58 |
--echo Show empty binlog after reorg |
| 59 |
# Sync binlog |
| 60 |
--disable_query_log |
| 61 |
--disable_result_log |
| 62 |
show binlog events; |
| 63 |
--enable_result_log |
| 64 |
--enable_query_log |
| 65 |
#--source include/show_binlog_events.inc |
| 66 |
select count(1), sum(inserts), sum(updates), sum(deletes) from mysql.ndb_binlog_index; |
| 67 |
|
| 68 |
--echo Cleanup |
| 69 |
drop table t1; |
| 70 |
|
| 71 |
--exec $NDB_MGM -e "drop nodegroup 1" |
| 72 |
|
| 73 |
|
| 74 |
--echo Test 2 : Show that reorg of table with concurrent writes |
| 75 |
--echo Results in Binlog content |
| 76 |
|
| 77 |
--echo Create table including Blobs for interest |
| 78 |
create table test.t1 (a int auto_increment primary key, |
| 79 |
b text, |
| 80 |
c text, |
| 81 |
d int, unique(d)) engine=ndb; |
| 82 |
|
| 83 |
--echo Load 100 rows first |
| 84 |
|
| 85 |
--disable_query_log |
| 86 |
--let $val=1 |
| 87 |
|
| 88 |
while($val < 100) |
| 89 |
{ |
| 90 |
--eval insert into test.t1 values ($val, repeat('$val', 1000), repeat('$val', 1000), $val+1); |
| 91 |
--inc $val |
| 92 |
} |
| 93 |
|
| 94 |
--enable_query_log |
| 95 |
|
| 96 |
--echo Show t1 distribution prior to reorg |
| 97 |
let ndb_table=t1; |
| 98 |
--source show_partition_info.inc |
| 99 |
#select * from ndbinfo.memory_per_fragment where fq_name like '%t1'; |
| 100 |
|
| 101 |
--echo Add new nodes |
| 102 |
--exec $NDB_MGM -e "create nodegroup 3,4" |
| 103 |
|
| 104 |
# Sync binlog |
| 105 |
--disable_query_log |
| 106 |
--disable_result_log |
| 107 |
show binlog events; |
| 108 |
--enable_result_log |
| 109 |
--enable_query_log |
| 110 |
|
| 111 |
reset master; |
| 112 |
--echo Show empty binlog prior to test |
| 113 |
#--source include/show_binlog_events.inc |
| 114 |
select count(1), sum(inserts), sum(updates), sum(deletes) from mysql.ndb_binlog_index; |
| 115 |
|
| 116 |
--echo Request reorg starting in 2 seconds |
| 117 |
--connection server2 |
| 118 |
--send select sleep(2); alter table test.t1 reorganize partition; |
| 119 |
|
| 120 |
--echo Start I/U/D load on table |
| 121 |
--connection server1 |
| 122 |
--disable_query_log |
| 123 |
while ($val < 10000) |
| 124 |
{ |
| 125 |
--error 0,1297,1412,1205 |
| 126 |
--eval insert into test.t1 values ($val, repeat('$val', 1000), repeat('$val', 1000), $val+1); |
| 127 |
if ($val > 200) |
| 128 |
{ |
| 129 |
# Use double update in transaction for variety |
| 130 |
BEGIN; |
| 131 |
--error 0,1297,1412,1205 |
| 132 |
--eval update test.t1 set b=repeat('$val', 1000), c= repeat('$val', 1000) where a=($val - 100); |
| 133 |
--error 0,1297,1412,1205 |
| 134 |
--eval update test.t1 set b=repeat('$val', 333), c=repeat('$val', 1111) where a=($val - 100); |
| 135 |
COMMIT; |
| 136 |
} |
| 137 |
if ($val > 300) |
| 138 |
{ |
| 139 |
--error 0,1297,1412,1205 |
| 140 |
--eval delete from test.t1 where a=($val-200); |
| 141 |
} |
| 142 |
--inc $val |
| 143 |
} |
| 144 |
--enable_query_log |
| 145 |
|
| 146 |
--echo Wait for reorg to complete |
| 147 |
--connection server2 |
| 148 |
--reap |
| 149 |
|
| 150 |
--connection server1 |
| 151 |
|
| 152 |
--echo Show t1 distribution after reorg |
| 153 |
let ndb_table=t1; |
| 154 |
--source show_partition_info.inc |
| 155 |
# select * from ndbinfo.memory_per_fragment where fq_name like '%t1'; |
| 156 |
|
| 157 |
--echo Show Binlog content after reorg |
| 158 |
--echo Expect to see content |
| 159 |
# Sync binlog |
| 160 |
--disable_query_log |
| 161 |
--disable_result_log |
| 162 |
show binlog events; |
| 163 |
--enable_result_log |
| 164 |
--enable_query_log |
| 165 |
|
| 166 |
#--source include/show_binlog_events.inc |
| 167 |
select count(epoch) > 100, |
| 168 |
sum(inserts) > 1000, |
| 169 |
sum(updates) > 1000, |
| 170 |
sum(deletes) > 1000 |
| 171 |
from mysql.ndb_binlog_index; |
| 172 |
|
| 173 |
--echo cleanup |
| 174 |
drop table test.t1; |
| 175 |
|
| 176 |
--exec $NDB_MGM -e "drop nodegroup 1" |