Skip to content
Permalink
Browse files
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.
  • Loading branch information
montywi committed Sep 25, 2020
1 parent 92b5a8b commit bb2c958
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 0 deletions.
@@ -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
#
@@ -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 #
@@ -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;

0 comments on commit bb2c958

Please sign in to comment.