diff --git a/mysql-test/suite/s3/alter2.result b/mysql-test/suite/s3/alter2.result new file mode 100644 index 00000000000..d2849905c67 --- /dev/null +++ b/mysql-test/suite/s3/alter2.result @@ -0,0 +1,22 @@ +# +# MDEV-19575 Assertion `page_st == 1' failed upon SELECT from S3 +# table which is being converted into Aria +# +CREATE TABLE t1 (f INT); +insert into t1 values (1),(2); +ALTER TABLE t1 ENGINE=S3; +select * from t1; +f +1 +2 +connect con1,localhost,root,,$database; +ALTER TABLE t1 ENGINE=Aria; +connection default; +SELECT * FROM t1; +f +1 +2 +connection con1; +disconnect con1; +connection default; +DROP TABLE t1; diff --git a/mysql-test/suite/s3/alter2.test b/mysql-test/suite/s3/alter2.test new file mode 100644 index 00000000000..de2bc001298 --- /dev/null +++ b/mysql-test/suite/s3/alter2.test @@ -0,0 +1,32 @@ +--source include/have_s3.inc +--source create_database.inc + +--echo # +--echo # MDEV-19575 Assertion `page_st == 1' failed upon SELECT from S3 +--echo # table which is being converted into Aria +--echo # + +CREATE TABLE t1 (f INT); +insert into t1 values (1),(2); + +ALTER TABLE t1 ENGINE=S3; +select * from t1; +--connect (con1,localhost,root,,$database) +--send + ALTER TABLE t1 ENGINE=Aria; + +--connection default +SELECT * FROM t1; + +# Cleanup + +--connection con1 +--reap +--disconnect con1 +--connection default +DROP TABLE t1; + +# +# clean up +# +--source drop_database.inc diff --git a/storage/maria/ma_pagecache.c b/storage/maria/ma_pagecache.c index 7bd85b7db02..13a2f18cc94 100644 --- a/storage/maria/ma_pagecache.c +++ b/storage/maria/ma_pagecache.c @@ -2867,6 +2867,9 @@ static my_bool read_big_block(PAGECACHE *pagecache, remove_reader(block_to_read); unreg_request(pagecache, block_to_read, 1); } + /* Signal that all pending requests for this page now can be processed */ + if (block->wqueue[COND_FOR_REQUESTED].last_thread) + wqueue_release_queue(&block->wqueue[COND_FOR_REQUESTED]); DBUG_RETURN(FALSE); // no retry } @@ -2940,6 +2943,8 @@ static my_bool read_big_block(PAGECACHE *pagecache, } if (block->wqueue[COND_FOR_BIG_BLOCK].last_thread) wqueue_release_queue(&block->wqueue[COND_FOR_BIG_BLOCK]); + if (block->wqueue[COND_FOR_REQUESTED].last_thread) + wqueue_release_queue(&block->wqueue[COND_FOR_REQUESTED]); DBUG_RETURN(FALSE); } @@ -3684,7 +3689,7 @@ restart: if (((block->status & PCBLOCK_ERROR) == 0) && (page_st != PAGE_READ)) { #ifdef WITH_S3_STORAGE_ENGINE - if (!pagecache->big_block_read) + if (!pagecache->big_block_read || page_st == PAGE_WAIT_TO_BE_READ) #endif /* WITH_S3_STORAGE_ENGINE */ { /* The requested page is to be read into the block buffer */