| 1 |
# |
| 2 |
# Bug#28714864: Running 'analyze' on table with unsupported index length crashes the data nodes |
| 3 |
# |
| 4 |
#setup |
| 5 |
create table t1( |
| 6 |
a int auto_increment primary key, |
| 7 |
b varchar(3053), |
| 8 |
c varchar(3056), |
| 9 |
d varchar(3072), |
| 10 |
col1 varchar(762) not null, |
| 11 |
col2 varchar(762) not null, |
| 12 |
col3 varchar(762) not null, |
| 13 |
col4 varchar(762) not null |
| 14 |
) engine ndb charset latin1; |
| 15 |
# populate enough rows to generate index stats |
| 16 |
# create index on b - it has the maximum key size supported by ndb index stat |
| 17 |
create index idxb on t1(b); |
| 18 |
# analyze should run fine and create statistics |
| 19 |
analyze table t1; |
| 20 |
Table Op Msg_type Msg_text |
| 21 |
test.t1 analyze status OK |
| 22 |
drop index idxb on t1; |
| 23 |
# create index on c - it has a key size unsupported by ndb index stat |
| 24 |
# a warning should be returned |
| 25 |
create index idxc on t1(c); |
| 26 |
Warnings: |
| 27 |
Warning 1296 Specified key 'idxc' was too long (max = 3056 bytes); statistics will not be generated |
| 28 |
# analyze should run fine but statistics aren't created |
| 29 |
analyze table t1; |
| 30 |
Table Op Msg_type Msg_text |
| 31 |
test.t1 analyze status OK |
| 32 |
drop index idxc on t1; |
| 33 |
# create index on d - it has the maximum key size allowed by mysql(3072) |
| 34 |
# but the key size is unsupported by ndb index stat |
| 35 |
# a warning should be returned |
| 36 |
create index idxd on t1(d); |
| 37 |
Warnings: |
| 38 |
Warning 1296 Specified key 'idxd' was too long (max = 3056 bytes); statistics will not be generated |
| 39 |
# analyze should run fine but statistics aren't created |
| 40 |
analyze table t1; |
| 41 |
Table Op Msg_type Msg_text |
| 42 |
test.t1 analyze status OK |
| 43 |
drop index idxd on t1; |
| 44 |
# create index on col1..col4 - it has the maximum key size supported by ndb index stat |
| 45 |
create index idxcol on t1(col1, col2, col3, col4); |
| 46 |
# analyze should run fine |
| 47 |
analyze table t1; |
| 48 |
Table Op Msg_type Msg_text |
| 49 |
test.t1 analyze status OK |
| 50 |
drop index idxcol on t1; |
| 51 |
#cleanup |
| 52 |
drop table t1; |