mirror of
https://github.com/MariaDB/server.git
synced 2026-10-23 18:49:29 +03:00
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.
This commit is contained in:
@@ -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;
|
||||
ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY.
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# End of MDEV-8948 ALTER ... INPLACE does work for BINARY, BLOB
|
||||
#
|
||||
select @@global.delay_key_write;
|
||||
@@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);
|
||||
ALTER TABLE t1 MODIFY a LONGTEXT COLLATE latin1_swedish_ci, ALGORITHM=INPLACE;
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo #
|
||||
--echo # End of MDEV-8948 ALTER ... INPLACE does work for BINARY, BLOB
|
||||
--echo #
|
||||
#
|
||||
# MDEV-11335 Changing delay_key_write option for MyISAM table should not copy rows
|
||||
#
|
||||
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)
|
||||
/* Count statistics of usage for newly open normal files */
|
||||
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)
|
||||
feature_files_opened_with_delayed_keys++;
|
||||
}
|
||||
@@ -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
|
||||
return COMPATIBLE_DATA_NO;
|
||||
|
||||
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 |
|
||||
HA_OPTION_DELAY_KEY_WRITE)))
|
||||
if ((options & (HA_OPTION_PACK_RECORD | HA_OPTION_CHECKSUM)) !=
|
||||
(create_info->table_options & (HA_OPTION_PACK_RECORD | HA_OPTION_CHECKSUM)))
|
||||
return COMPATIBLE_DATA_NO;
|
||||
return COMPATIBLE_DATA_YES;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user