Commit bb2c9581 authored by Monty's avatar Monty

MDEV-23296 Assertion `block->type == PAGECACHE_EMPTY_PAGE.. with aria_max_sort_file_size=0

When maria_drop_all_indexes() reset the key files, it didn't flush
the page cache. This confused the cache as there where old key blocks
marked with LSN in it and repair tried to overwrite these with PLAIN
blocks which is not allowed.
parent 92b5a8bb
...@@ -162,5 +162,25 @@ COUNT(*) ...@@ -162,5 +162,25 @@ COUNT(*)
500 500
DROP TABLE t1,t2; 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 # End of 10.4 test
# #
...@@ -171,6 +171,24 @@ INSERT INTO t1 SELECT a FROM t2; ...@@ -171,6 +171,24 @@ INSERT INTO t1 SELECT a FROM t2;
SELECT COUNT(*) FROM t1; SELECT COUNT(*) FROM t1;
DROP TABLE t1,t2; 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 #
--echo # End of 10.4 test --echo # End of 10.4 test
--echo # --echo #
...@@ -2550,6 +2550,9 @@ static int maria_drop_all_indexes(HA_CHECK *param, MARIA_HA *info, ...@@ -2550,6 +2550,9 @@ static int maria_drop_all_indexes(HA_CHECK *param, MARIA_HA *info,
DBUG_PRINT("repair", ("declared all indexes disabled")); 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. */ /* Clear index root block pointers. */
for (i= 0; i < share->base.keys; i++) for (i= 0; i < share->base.keys; i++)
state->key_root[i]= HA_OFFSET_ERROR; state->key_root[i]= HA_OFFSET_ERROR;
......
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