| 1 |
create table t1 (a int primary key, |
| 2 |
utf_t text character set utf8mb4, |
| 3 |
tb tinyblob, b blob, mb mediumblob, lb longblob, |
| 4 |
tt tinytext, t text, mt mediumtext, lt longtext) engine=ndb; |
| 5 |
insert into t1 values (1, REPEAT("A",5000), |
| 6 |
REPEAT("A",255), REPEAT("A",5000), REPEAT("A",65536), REPEAT("A", 30000), |
| 7 |
REPEAT("A",255), REPEAT("A",5000), REPEAT("A",65536), REPEAT("A", 30000)); |
| 8 |
insert into t1 values (2, NULL, |
| 9 |
NULL, NULL, NULL, NULL, |
| 10 |
NULL, NULL, NULL, NULL); |
| 11 |
insert into t1 values (3, "", |
| 12 |
"", "", "", "", |
| 13 |
"", "", "", ""); |
| 14 |
insert into t1 values (4, REPEAT("a%d4 ",51), |
| 15 |
REPEAT("a%d4 ",51), REPEAT("a%d4 ",1000), REPEAT("a%d4 ",2000), REPEAT("a%d4 ", 6000), |
| 16 |
REPEAT("a%d4 ",51), REPEAT("a%d4 ",1000), REPEAT("a%d4 ",2000), REPEAT("a%d4 ", 6000)); |
| 17 |
insert into t1 values (5, "less_than_inline_len", |
| 18 |
"less_than_inline_len", "less_than_inline_len", "less_than_inline_len", "less_than_inline_len", |
| 19 |
"less_than_inline_len", "less_than_inline_len", "less_than_inline_len", "less_than_inline_len"); |
| 20 |
insert into t1 values (6, REPEAT(" ",1000), |
| 21 |
REPEAT(" ",51), REPEAT(" ",1000), REPEAT(" ",2000), REPEAT(" ", 6000), |
| 22 |
REPEAT(" ",51), REPEAT(" ",1000), REPEAT(" ",2000), REPEAT(" ", 6000)); |
| 23 |
insert into t1 values (7, REPEAT(" -,.;",1000), |
| 24 |
REPEAT(" -,.;",51), REPEAT(" -,.;",1000), REPEAT(" -,.;",2000), REPEAT(" -,.;", 6000), |
| 25 |
REPEAT(" -,.;",51), REPEAT(" -,.;",1000), REPEAT(" -,.;",2001), REPEAT(" -,.;", 6000)); |
| 26 |
insert into t1 values (8, REPEAT("12345",1000), |
| 27 |
REPEAT("12345",51), REPEAT("12345",1000), REPEAT("12345",2000), REPEAT("12345", 6000), |
| 28 |
REPEAT("12345",51), REPEAT("12345",1000), REPEAT("12345",2001), REPEAT("12345", 6000)); |
| 29 |
insert into t1 values (9, REPEAT("abcde",1000), |
| 30 |
REPEAT("abcde",51), REPEAT("abcde",1000), REPEAT("abcde",2000), REPEAT("abcde", 6000), |
| 31 |
REPEAT("abcde",51), REPEAT("abcde",1000), REPEAT("abcde",2001), REPEAT("abcde", 6000)); |
| 32 |
insert into t1 values (10, REPEAT("ABCDE",1000), |
| 33 |
REPEAT("ABCDE",51), REPEAT("ABCDE",1000), REPEAT("ABCDE",2000), REPEAT("ABCDE", 6000), |
| 34 |
REPEAT("ABCDE",51), REPEAT("ABCDE",1000), REPEAT("ABCDE",2001), REPEAT("ABCDE", 6000)); |
| 35 |
insert into t1 select a+10, utf_t, tb, b, mb, lb, tt, t, mt, lt from t1; |
| 36 |
insert into t1 select a+20, utf_t, tb, b, mb, lb, tt, t, mt, lt from t1; |
| 37 |
# run backup |
| 38 |
truncate table t1; |
| 39 |
# run broken restore of data |
| 40 |
select count(1) into @count_parent_rows_before from t1; |
| 41 |
Observe "blob corruption error" failures on queries |
| 42 |
Fully ordered OI scan |
| 43 |
select * from test.t1 order by a; |
| 44 |
ERROR HY000: Got error 4267 'Corrupted blob value' from NDBCLUSTER |
| 45 |
show warnings limit 1; |
| 46 |
Level Code Message |
| 47 |
Warning 1296 Got error 4267 'Corrupted blob value' from NDB |
| 48 |
Fully ordered OI scan, different first tuple |
| 49 |
select * from test.t1 order by a desc; |
| 50 |
ERROR HY000: Got error 4267 'Corrupted blob value' from NDBCLUSTER |
| 51 |
show warnings limit 1; |
| 52 |
Level Code Message |
| 53 |
Warning 1296 Got error 4267 'Corrupted blob value' from NDB |
| 54 |
OI scan |
| 55 |
select * from test.t1 where a > 0; |
| 56 |
ERROR HY000: Got error 4267 'Corrupted blob value' from NDBCLUSTER |
| 57 |
show warnings limit 1; |
| 58 |
Level Code Message |
| 59 |
Warning 1296 Got error 4267 'Corrupted blob value' from NDB |
| 60 |
OI scan, different first tuple |
| 61 |
select * from test.t1 where a < 6; |
| 62 |
ERROR HY000: Got error 4267 'Corrupted blob value' from NDBCLUSTER |
| 63 |
show warnings limit 1; |
| 64 |
Level Code Message |
| 65 |
Warning 1296 Got error 4267 'Corrupted blob value' from NDB |
| 66 |
Table scan |
| 67 |
select * from test.t1; |
| 68 |
ERROR HY000: Got error 4267 'Corrupted blob value' from NDBCLUSTER |
| 69 |
show warnings limit 1; |
| 70 |
Level Code Message |
| 71 |
Warning 1296 Got error 4267 'Corrupted blob value' from NDB |
| 72 |
ndb_blob_tool errors out on finding missing blob parts |
| 73 |
Add in missing parts |
| 74 |
Verify that there are no missing parts or orphan rows |
| 75 |
Show that data read is not an empty set |
| 76 |
select count(1) into @count_parent_rows_after from t1; |
| 77 |
select sum(a) > 0, sum(utf_t) > 0, |
| 78 |
sum(tb) > 0, sum(b) > 0, sum(mb) > 0, sum(lb) > 0, |
| 79 |
sum(tt) > 0, sum(t) > 0, sum(mt) > 0, sum(lt) > 0 from t1; |
| 80 |
sum(a) > 0 sum(utf_t) > 0 sum(tb) > 0 sum(b) > 0 sum(mb) > 0 sum(lb) > 0 sum(tt) > 0 sum(t) > 0 sum(mt) > 0 sum(lt) > 0 |
| 81 |
1 1 1 1 1 1 1 1 1 1 |
| 82 |
select @count_parent_rows_before >= @count_parent_rows_after; |
| 83 |
@count_parent_rows_before >= @count_parent_rows_after |
| 84 |
1 |
| 85 |
select @count_parent_rows_after > 0; |
| 86 |
@count_parent_rows_after > 0 |
| 87 |
1 |
| 88 |
drop table t1; |
| 89 |
Verify that blob deletes with scans handle pending blob writes correctly |
| 90 |
create table t1 (pk bigint unsigned auto_increment primary key , blob_col TEXT)engine=ndbcluster; |
| 91 |
create table t2 (pk bigint unsigned auto_increment primary key , varchar_col varchar(100), virtual_blob_col TEXT as (REPEAT(varchar_col,40)) VIRTUAL)engine=ndbcluster; |
| 92 |
insert into t1 (pk, blob_col) values(NULL,NULL); |
| 93 |
insert into t1 select NULL, NULL from t1; |
| 94 |
insert into t1 select NULL, NULL from t1; |
| 95 |
insert into t1 select NULL, NULL from t1; |
| 96 |
insert into t1 select NULL, NULL from t1; |
| 97 |
insert into t2 (pk, varchar_col) select pk, blob_col from t1; |
| 98 |
update t1 set blob_col = repeat('mysql', 2000) limit 8; |
| 99 |
update t2 set varchar_col = repeat('mysql', 20) limit 8; |
| 100 |
set ndb_blob_write_batch_bytes=0; |
| 101 |
set ndb_blob_read_batch_bytes=0; |
| 102 |
create table ndb_blob_corrupt_temp_table(pk varchar(10) primary key, exec_count_serialised int, exec_count_batched int)engine=ndb; |
| 103 |
insert into ndb_blob_corrupt_temp_table values |
| 104 |
("DELETE", 0, 0), ("UPDATE", 0, 0); |
| 105 |
update with blob column in WHERE clause |
| 106 |
update t1 set blob_col = repeat('mysql', 400) where blob_col like '%mysql%'; |
| 107 |
update with virtual blob column in WHERE clause |
| 108 |
update t2 set varchar_col = repeat('mysql', 10) where virtual_blob_col like '%mysql%'; |
| 109 |
delete with blob column in WHERE clause |
| 110 |
delete from t1 where blob_col is NOT NULL; |
| 111 |
delete with virtual blob column in WHERE clause |
| 112 |
delete from t2 where virtual_blob_col is NOT NULL; |
| 113 |
select exec_count_serialised > exec_count_batched from ndb_blob_corrupt_temp_table; |
| 114 |
exec_count_serialised > exec_count_batched |
| 115 |
1 |
| 116 |
1 |
| 117 |
drop table ndb_blob_corrupt_temp_table; |
| 118 |
drop table t1; |
| 119 |
drop table t2; |