Commit fc89f5fd authored by Sergei Golubchik's avatar Sergei Golubchik

MDEV-11335 Changing delay_key_write option for MyISAM table should not copy rows

Don't rebuild the table for ALTER TABLE delay_key_write changes.

After that, delay_key_write value in .frm may differ from the
value in .MYI. We'll do what .frm says.
parent c65dd366
...@@ -184,6 +184,35 @@ CREATE TABLE t1 (a LONGTEXT COLLATE latin1_general_ci); ...@@ -184,6 +184,35 @@ CREATE TABLE t1 (a LONGTEXT COLLATE latin1_general_ci);
ALTER TABLE t1 MODIFY a LONGTEXT COLLATE latin1_swedish_ci, ALGORITHM=INPLACE; ALTER TABLE t1 MODIFY a LONGTEXT COLLATE latin1_swedish_ci, ALGORITHM=INPLACE;
ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY. ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY.
DROP TABLE t1; DROP TABLE t1;
# select @@global.delay_key_write;
# End of MDEV-8948 ALTER ... INPLACE does work for BINARY, BLOB @@global.delay_key_write
# ON
create table t1 (a int, b int, key(b));
flush tables;
flush status;
show status like 'Feature_delay_key_write';
Variable_name Value
Feature_delay_key_write 0
insert t1 values (1,2),(2,3),(3,4);
show status like 'Feature_delay_key_write';
Variable_name Value
Feature_delay_key_write 0
alter online table t1 delay_key_write=1;
show status like 'Feature_delay_key_write';
Variable_name Value
Feature_delay_key_write 1
flush tables;
insert t1 values (1,2),(2,3),(3,4);
show status like 'Feature_delay_key_write';
Variable_name Value
Feature_delay_key_write 2
alter online table t1 delay_key_write=0;
show status like 'Feature_delay_key_write';
Variable_name Value
Feature_delay_key_write 2
flush tables;
insert t1 values (1,2),(2,3),(3,4);
show status like 'Feature_delay_key_write';
Variable_name Value
Feature_delay_key_write 2
drop table t1;
...@@ -285,6 +285,24 @@ CREATE TABLE t1 (a LONGTEXT COLLATE latin1_general_ci); ...@@ -285,6 +285,24 @@ CREATE TABLE t1 (a LONGTEXT COLLATE latin1_general_ci);
ALTER TABLE t1 MODIFY a LONGTEXT COLLATE latin1_swedish_ci, ALGORITHM=INPLACE; ALTER TABLE t1 MODIFY a LONGTEXT COLLATE latin1_swedish_ci, ALGORITHM=INPLACE;
DROP TABLE t1; DROP TABLE t1;
--echo # #
--echo # End of MDEV-8948 ALTER ... INPLACE does work for BINARY, BLOB # MDEV-11335 Changing delay_key_write option for MyISAM table should not copy rows
--echo # #
select @@global.delay_key_write;
create table t1 (a int, b int, key(b));
flush tables;
flush status;
show status like 'Feature_delay_key_write';
insert t1 values (1,2),(2,3),(3,4);
show status like 'Feature_delay_key_write';
alter online table t1 delay_key_write=1;
show status like 'Feature_delay_key_write';
flush tables;
insert t1 values (1,2),(2,3),(3,4);
show status like 'Feature_delay_key_write';
alter online table t1 delay_key_write=0;
show status like 'Feature_delay_key_write';
flush tables;
insert t1 values (1,2),(2,3),(3,4);
show status like 'Feature_delay_key_write';
drop table t1;
...@@ -825,6 +825,10 @@ int ha_myisam::open(const char *name, int mode, uint test_if_locked) ...@@ -825,6 +825,10 @@ int ha_myisam::open(const char *name, int mode, uint test_if_locked)
/* Count statistics of usage for newly open normal files */ /* Count statistics of usage for newly open normal files */
if (file->s->reopen == 1 && ! (test_if_locked & HA_OPEN_TMP_TABLE)) if (file->s->reopen == 1 && ! (test_if_locked & HA_OPEN_TMP_TABLE))
{ {
/* use delay_key_write from .frm, not .MYI */
file->s->delay_key_write= delay_key_write_options == DELAY_KEY_WRITE_ALL ||
(delay_key_write_options == DELAY_KEY_WRITE_ON &&
table->s->db_create_options & HA_OPTION_DELAY_KEY_WRITE);
if (file->s->delay_key_write) if (file->s->delay_key_write)
feature_files_opened_with_delayed_keys++; feature_files_opened_with_delayed_keys++;
} }
...@@ -2269,10 +2273,8 @@ bool ha_myisam::check_if_incompatible_data(HA_CREATE_INFO *create_info, ...@@ -2269,10 +2273,8 @@ bool ha_myisam::check_if_incompatible_data(HA_CREATE_INFO *create_info,
table_changes & IS_EQUAL_PACK_LENGTH) // Not implemented yet table_changes & IS_EQUAL_PACK_LENGTH) // Not implemented yet
return COMPATIBLE_DATA_NO; return COMPATIBLE_DATA_NO;
if ((options & (HA_OPTION_PACK_RECORD | HA_OPTION_CHECKSUM | if ((options & (HA_OPTION_PACK_RECORD | HA_OPTION_CHECKSUM)) !=
HA_OPTION_DELAY_KEY_WRITE)) != (create_info->table_options & (HA_OPTION_PACK_RECORD | HA_OPTION_CHECKSUM)))
(create_info->table_options & (HA_OPTION_PACK_RECORD | HA_OPTION_CHECKSUM |
HA_OPTION_DELAY_KEY_WRITE)))
return COMPATIBLE_DATA_NO; return COMPATIBLE_DATA_NO;
return COMPATIBLE_DATA_YES; return COMPATIBLE_DATA_YES;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment