From c8b5fa4afc6c233101b8163ef19c1abc1be0373d Mon Sep 17 00:00:00 2001 From: Michael Widenius Date: Mon, 17 Jun 2019 17:50:08 +0300 Subject: MDEV-19055 Failures with temporary tables and Aria There was two separate problems: - Aria pagecache didn't properly handle re-reading of blocks that have given errors before (this triggered an assert) - temporary tables that where opened several times where not properly closed in ALTER, REPAIR or OPTIMIZE table Other things - Added a couple of asserts that will make it easier to find problems like this in the future. --- storage/maria/ma_blockrec.c | 2 ++ storage/maria/ma_pagecache.c | 3 +-- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'storage/maria') diff --git a/storage/maria/ma_blockrec.c b/storage/maria/ma_blockrec.c index c38b27d0f6c..13323dcae55 100644 --- a/storage/maria/ma_blockrec.c +++ b/storage/maria/ma_blockrec.c @@ -5244,6 +5244,8 @@ my_bool _ma_scan_init_block_record(MARIA_HA *info) { MARIA_SHARE *share= info->s; DBUG_ENTER("_ma_scan_init_block_record"); + DBUG_ASSERT(info->dfile.file == share->bitmap.file.file); + /* bitmap_buff may already be allocated if this is the second call to rnd_init() without a rnd_end() in between, see sql/handler.h diff --git a/storage/maria/ma_pagecache.c b/storage/maria/ma_pagecache.c index 7b0f395f926..f8c83e12a18 100644 --- a/storage/maria/ma_pagecache.c +++ b/storage/maria/ma_pagecache.c @@ -3464,8 +3464,6 @@ restart: pagecache_pthread_mutex_lock(&pagecache->cache_lock); #endif } - if (status & PCBLOCK_ERROR) - my_errno= block->error; } remove_reader(block); @@ -3497,6 +3495,7 @@ restart: if (status & PCBLOCK_ERROR) { + my_errno= block->error; DBUG_ASSERT(my_errno != 0); DBUG_PRINT("error", ("Got error %d when doing page read", my_errno)); DBUG_RETURN((uchar *) 0); -- cgit v1.2.1