Skip to content

Commit bb2c958

Browse files
committed
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.
1 parent 92b5a8b commit bb2c958

File tree

3 files changed

+41
-0
lines changed

3 files changed

+41
-0
lines changed

mysql-test/suite/maria/alter.result

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,5 +162,25 @@ COUNT(*)
162162
500
163163
DROP TABLE t1,t2;
164164
#
165+
# MDEV-23296 Assertion `block->type == PAGECACHE_EMPTY_PAGE ||
166+
# block->type == PAGECACHE_READ_UNKNOWN_PAGE || block->type == type ||
167+
# (block->type == PAGECACHE_PLAIN_PAGE && type == PAGECACHE_LSN_PAGE)'
168+
# with aria_max_sort_file_size
169+
#
170+
SET @max_size.save= @@aria_max_sort_file_size;
171+
SET GLOBAL aria_max_sort_file_size= 0;
172+
CREATE TABLE t1 (pk INT PRIMARY KEY, a CHAR(255), KEY(a)) ENGINE=Aria;
173+
ALTER TABLE t1 DISABLE KEYS;
174+
INSERT INTO t1 VALUES (1,'foo'),(2,'bar');
175+
ALTER TABLE t1 ENABLE KEYS;
176+
INSERT INTO t1 VALUES (3,'nice try');
177+
SELECT * FROM t1;
178+
pk a
179+
1 foo
180+
2 bar
181+
3 nice try
182+
DROP TABLE t1;
183+
SET GLOBAL aria_max_sort_file_size= @max_size.save;
184+
#
165185
# End of 10.4 test
166186
#

mysql-test/suite/maria/alter.test

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,24 @@ INSERT INTO t1 SELECT a FROM t2;
171171
SELECT COUNT(*) FROM t1;
172172
DROP TABLE t1,t2;
173173

174+
--echo #
175+
--echo # MDEV-23296 Assertion `block->type == PAGECACHE_EMPTY_PAGE ||
176+
--echo # block->type == PAGECACHE_READ_UNKNOWN_PAGE || block->type == type ||
177+
--echo # (block->type == PAGECACHE_PLAIN_PAGE && type == PAGECACHE_LSN_PAGE)'
178+
--echo # with aria_max_sort_file_size
179+
--echo #
180+
181+
SET @max_size.save= @@aria_max_sort_file_size;
182+
SET GLOBAL aria_max_sort_file_size= 0;
183+
CREATE TABLE t1 (pk INT PRIMARY KEY, a CHAR(255), KEY(a)) ENGINE=Aria;
184+
ALTER TABLE t1 DISABLE KEYS;
185+
INSERT INTO t1 VALUES (1,'foo'),(2,'bar');
186+
ALTER TABLE t1 ENABLE KEYS;
187+
INSERT INTO t1 VALUES (3,'nice try');
188+
SELECT * FROM t1;
189+
DROP TABLE t1;
190+
SET GLOBAL aria_max_sort_file_size= @max_size.save;
191+
174192
--echo #
175193
--echo # End of 10.4 test
176194
--echo #

storage/maria/ma_check.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2550,6 +2550,9 @@ static int maria_drop_all_indexes(HA_CHECK *param, MARIA_HA *info,
25502550
DBUG_PRINT("repair", ("declared all indexes disabled"));
25512551
}
25522552

2553+
/* Flush obsolete index data from key cache */
2554+
_ma_flush_table_files(info, MARIA_FLUSH_INDEX,
2555+
FLUSH_IGNORE_CHANGED, FLUSH_IGNORE_CHANGED);
25532556
/* Clear index root block pointers. */
25542557
for (i= 0; i < share->base.keys; i++)
25552558
state->key_root[i]= HA_OFFSET_ERROR;

0 commit comments

Comments
 (0)