diff --git a/mysql-test/suite/maria/alter.result b/mysql-test/suite/maria/alter.result index c79c86e8ba0..e1a57ed654f 100644 --- a/mysql-test/suite/maria/alter.result +++ b/mysql-test/suite/maria/alter.result @@ -162,5 +162,25 @@ COUNT(*) 500 DROP TABLE t1,t2; # +# MDEV-23296 Assertion `block->type == PAGECACHE_EMPTY_PAGE || +# block->type == PAGECACHE_READ_UNKNOWN_PAGE || block->type == type || +# (block->type == PAGECACHE_PLAIN_PAGE && type == PAGECACHE_LSN_PAGE)' +# with aria_max_sort_file_size +# +SET @max_size.save= @@aria_max_sort_file_size; +SET GLOBAL aria_max_sort_file_size= 0; +CREATE TABLE t1 (pk INT PRIMARY KEY, a CHAR(255), KEY(a)) ENGINE=Aria; +ALTER TABLE t1 DISABLE KEYS; +INSERT INTO t1 VALUES (1,'foo'),(2,'bar'); +ALTER TABLE t1 ENABLE KEYS; +INSERT INTO t1 VALUES (3,'nice try'); +SELECT * FROM t1; +pk a +1 foo +2 bar +3 nice try +DROP TABLE t1; +SET GLOBAL aria_max_sort_file_size= @max_size.save; +# # End of 10.4 test # diff --git a/mysql-test/suite/maria/alter.test b/mysql-test/suite/maria/alter.test index 17a270f2a90..f2950f0a6d3 100644 --- a/mysql-test/suite/maria/alter.test +++ b/mysql-test/suite/maria/alter.test @@ -171,6 +171,24 @@ INSERT INTO t1 SELECT a FROM t2; SELECT COUNT(*) FROM t1; DROP TABLE t1,t2; +--echo # +--echo # MDEV-23296 Assertion `block->type == PAGECACHE_EMPTY_PAGE || +--echo # block->type == PAGECACHE_READ_UNKNOWN_PAGE || block->type == type || +--echo # (block->type == PAGECACHE_PLAIN_PAGE && type == PAGECACHE_LSN_PAGE)' +--echo # with aria_max_sort_file_size +--echo # + +SET @max_size.save= @@aria_max_sort_file_size; +SET GLOBAL aria_max_sort_file_size= 0; +CREATE TABLE t1 (pk INT PRIMARY KEY, a CHAR(255), KEY(a)) ENGINE=Aria; +ALTER TABLE t1 DISABLE KEYS; +INSERT INTO t1 VALUES (1,'foo'),(2,'bar'); +ALTER TABLE t1 ENABLE KEYS; +INSERT INTO t1 VALUES (3,'nice try'); +SELECT * FROM t1; +DROP TABLE t1; +SET GLOBAL aria_max_sort_file_size= @max_size.save; + --echo # --echo # End of 10.4 test --echo # diff --git a/storage/maria/ma_check.c b/storage/maria/ma_check.c index 37c2712b143..9670daa9104 100644 --- a/storage/maria/ma_check.c +++ b/storage/maria/ma_check.c @@ -2550,6 +2550,9 @@ static int maria_drop_all_indexes(HA_CHECK *param, MARIA_HA *info, DBUG_PRINT("repair", ("declared all indexes disabled")); } + /* Flush obsolete index data from key cache */ + _ma_flush_table_files(info, MARIA_FLUSH_INDEX, + FLUSH_IGNORE_CHANGED, FLUSH_IGNORE_CHANGED); /* Clear index root block pointers. */ for (i= 0; i < share->base.keys; i++) state->key_root[i]= HA_OFFSET_ERROR;