Commit 33aec68a authored by Marko Mäkelä's avatar Marko Mäkelä

Merge 10.5 into 10.6

parents 18535a40 01b44c05
...@@ -2207,6 +2207,10 @@ Variable_name Value ...@@ -2207,6 +2207,10 @@ Variable_name Value
Qcache_queries_in_cache 0 Qcache_queries_in_cache 0
DROP FUNCTION foo; DROP FUNCTION foo;
drop table t1; drop table t1;
#
# MDEV-24858 SIGABRT in DbugExit from my_malloc in Query_cache::init_cache Regression
#
set global Query_cache_size=18446744073709547520;
restore defaults restore defaults
SET GLOBAL query_cache_type= default; SET GLOBAL query_cache_type= default;
SET GLOBAL query_cache_size=@save_query_cache_size; SET GLOBAL query_cache_size=@save_query_cache_size;
...@@ -1800,6 +1800,13 @@ show status like "Qcache_queries_in_cache"; ...@@ -1800,6 +1800,13 @@ show status like "Qcache_queries_in_cache";
DROP FUNCTION foo; DROP FUNCTION foo;
drop table t1; drop table t1;
--echo #
--echo # MDEV-24858 SIGABRT in DbugExit from my_malloc in Query_cache::init_cache Regression
--echo #
--disable_warnings
set global Query_cache_size=18446744073709547520;
--enable_warnings
--echo restore defaults --echo restore defaults
SET GLOBAL query_cache_type= default; SET GLOBAL query_cache_type= default;
SET GLOBAL query_cache_size=@save_query_cache_size; SET GLOBAL query_cache_size=@save_query_cache_size;
...@@ -79,7 +79,7 @@ void *my_malloc(PSI_memory_key key, size_t size, myf my_flags) ...@@ -79,7 +79,7 @@ void *my_malloc(PSI_memory_key key, size_t size, myf my_flags)
if (!size) if (!size)
size=1; size=1;
if (size > SIZE_T_MAX - 1024L*1024L*16L) /* Wrong call */ if (size > SIZE_T_MAX - 1024L*1024L*16L) /* Wrong call */
return 0; DBUG_RETURN(0);
/* We have to align size as we store MY_THREAD_SPECIFIC flag in the LSB */ /* We have to align size as we store MY_THREAD_SPECIFIC flag in the LSB */
size= ALIGN_SIZE(size); size= ALIGN_SIZE(size);
......
...@@ -803,11 +803,13 @@ btr_cur_optimistic_latch_leaves( ...@@ -803,11 +803,13 @@ btr_cur_optimistic_latch_leaves(
mode, nullptr, BUF_GET_POSSIBLY_FREED, mode, nullptr, BUF_GET_POSSIBLY_FREED,
mtr, &err); mtr, &err);
if (err == DB_DECRYPTION_FAILED) { if (!cursor->left_block) {
cursor->index->table->file_unreadable = true; cursor->index->table->file_unreadable = true;
} }
if (btr_page_get_next(cursor->left_block->frame) if (cursor->left_block->page.status
== buf_page_t::FREED
|| btr_page_get_next(cursor->left_block->frame)
!= curr_page_no) { != curr_page_no) {
/* release the left block */ /* release the left block */
btr_leaf_page_release( btr_leaf_page_release(
...@@ -6067,7 +6069,7 @@ btr_estimate_n_rows_in_range_on_level( ...@@ -6067,7 +6069,7 @@ btr_estimate_n_rows_in_range_on_level(
ut_ad((block != NULL) == (err == DB_SUCCESS)); ut_ad((block != NULL) == (err == DB_SUCCESS));
if (err != DB_SUCCESS) { if (!block) {
if (err == DB_DECRYPTION_FAILED) { if (err == DB_DECRYPTION_FAILED) {
ib_push_warning((void *)NULL, ib_push_warning((void *)NULL,
DB_DECRYPTION_FAILED, DB_DECRYPTION_FAILED,
......
...@@ -1000,6 +1000,9 @@ fil_crypt_read_crypt_data(fil_space_t* space) ...@@ -1000,6 +1000,9 @@ fil_crypt_read_crypt_data(fil_space_t* space)
nullptr, nullptr,
BUF_GET_POSSIBLY_FREED, BUF_GET_POSSIBLY_FREED,
&mtr)) { &mtr)) {
if (block->page.status == buf_page_t::FREED) {
goto func_exit;
}
mysql_mutex_lock(&fil_system.mutex); mysql_mutex_lock(&fil_system.mutex);
if (!space->crypt_data && !space->is_stopping()) { if (!space->crypt_data && !space->is_stopping()) {
space->crypt_data = fil_space_read_crypt_data( space->crypt_data = fil_space_read_crypt_data(
...@@ -1007,6 +1010,7 @@ fil_crypt_read_crypt_data(fil_space_t* space) ...@@ -1007,6 +1010,7 @@ fil_crypt_read_crypt_data(fil_space_t* space)
} }
mysql_mutex_unlock(&fil_system.mutex); mysql_mutex_unlock(&fil_system.mutex);
} }
func_exit:
mtr.commit(); mtr.commit();
} }
...@@ -1059,6 +1063,9 @@ static bool fil_crypt_start_encrypting_space(fil_space_t* space) ...@@ -1059,6 +1063,9 @@ static bool fil_crypt_start_encrypting_space(fil_space_t* space)
page_id_t(space->id, 0), space->zip_size(), page_id_t(space->id, 0), space->zip_size(),
RW_X_LATCH, NULL, BUF_GET_POSSIBLY_FREED, RW_X_LATCH, NULL, BUF_GET_POSSIBLY_FREED,
&mtr, &err)) { &mtr, &err)) {
if (block->page.status == buf_page_t::FREED) {
goto abort;
}
crypt_data->type = CRYPT_SCHEME_1; crypt_data->type = CRYPT_SCHEME_1;
crypt_data->min_key_version = 0; // all pages are unencrypted crypt_data->min_key_version = 0; // all pages are unencrypted
...@@ -1798,7 +1805,10 @@ fil_crypt_rotate_page( ...@@ -1798,7 +1805,10 @@ fil_crypt_rotate_page(
const lsn_t block_lsn = mach_read_from_8(FIL_PAGE_LSN + frame); const lsn_t block_lsn = mach_read_from_8(FIL_PAGE_LSN + frame);
uint kv = buf_page_get_key_version(frame, space->flags); uint kv = buf_page_get_key_version(frame, space->flags);
if (space->is_stopping()) { if (block->page.status == buf_page_t::FREED) {
/* Do not modify freed pages to avoid an assertion
failure on recovery.*/
} else if (space->is_stopping()) {
/* The tablespace is closing (in DROP TABLE or /* The tablespace is closing (in DROP TABLE or
TRUNCATE TABLE or similar): avoid further access */ TRUNCATE TABLE or similar): avoid further access */
} else if (!kv && !*reinterpret_cast<uint16_t*> } else if (!kv && !*reinterpret_cast<uint16_t*>
...@@ -1827,9 +1837,6 @@ fil_crypt_rotate_page( ...@@ -1827,9 +1837,6 @@ fil_crypt_rotate_page(
some dummy pages will be allocated, with 0 in some dummy pages will be allocated, with 0 in
the FIL_PAGE_TYPE. Those pages should be the FIL_PAGE_TYPE. Those pages should be
skipped from key rotation forever. */ skipped from key rotation forever. */
} else if (block->page.status == buf_page_t::FREED) {
/* Do not modify freed pages to avoid an assertion
failure on recovery.*/
} else if (fil_crypt_needs_rotation( } else if (fil_crypt_needs_rotation(
crypt_data, crypt_data,
kv, kv,
...@@ -1982,9 +1989,11 @@ fil_crypt_flush_space( ...@@ -1982,9 +1989,11 @@ fil_crypt_flush_space(
if (buf_block_t* block = buf_page_get_gen( if (buf_block_t* block = buf_page_get_gen(
page_id_t(space->id, 0), space->zip_size(), page_id_t(space->id, 0), space->zip_size(),
RW_X_LATCH, NULL, BUF_GET_POSSIBLY_FREED, &mtr)) { RW_X_LATCH, NULL, BUF_GET_POSSIBLY_FREED, &mtr)) {
if (block->page.status != buf_page_t::FREED) {
mtr.set_named_space(space); mtr.set_named_space(space);
crypt_data->write_page0(block, &mtr); crypt_data->write_page0(block, &mtr);
} }
}
mtr.commit(); mtr.commit();
} }
......
...@@ -411,6 +411,10 @@ xdes_get_descriptor_const( ...@@ -411,6 +411,10 @@ xdes_get_descriptor_const(
nullptr, nullptr,
BUF_GET_POSSIBLY_FREED, BUF_GET_POSSIBLY_FREED,
mtr)) { mtr)) {
if (block->page.status == buf_page_t::FREED) {
return nullptr;
}
ut_ad(page != 0 || space->free_limit == mach_read_from_4( ut_ad(page != 0 || space->free_limit == mach_read_from_4(
FSP_FREE_LIMIT + FSP_HEADER_OFFSET FSP_FREE_LIMIT + FSP_HEADER_OFFSET
+ block->frame)); + block->frame));
......
...@@ -4195,6 +4195,7 @@ void ibuf_merge_or_delete_for_page(buf_block_t *block, const page_id_t page_id, ...@@ -4195,6 +4195,7 @@ void ibuf_merge_or_delete_for_page(buf_block_t *block, const page_id_t page_id,
if (bitmap_bits && fseg_page_is_free( if (bitmap_bits && fseg_page_is_free(
space, page_id.page_no())) { space, page_id.page_no())) {
ibuf_mtr_start(&mtr); ibuf_mtr_start(&mtr);
mtr.set_named_space(space);
ibuf_reset_bitmap(block, page_id, zip_size, &mtr); ibuf_reset_bitmap(block, page_id, zip_size, &mtr);
ibuf_mtr_commit(&mtr); ibuf_mtr_commit(&mtr);
bitmap_bits = 0; bitmap_bits = 0;
......
...@@ -4631,8 +4631,8 @@ static void lock_rec_block_validate(const page_id_t page_id) ...@@ -4631,8 +4631,8 @@ static void lock_rec_block_validate(const page_id_t page_id)
<< page_id << " err " << err; << page_id << " err " << err;
} }
ut_ad(!block || lock_rec_validate_page(block, ut_ad(!block || block->page.status == buf_page_t::FREED
space->is_latched())); || lock_rec_validate_page(block, space->is_latched()));
mtr_commit(&mtr); mtr_commit(&mtr);
......
...@@ -2425,6 +2425,7 @@ static void recv_recover_page(buf_block_t* block, mtr_t& mtr, ...@@ -2425,6 +2425,7 @@ static void recv_recover_page(buf_block_t* block, mtr_t& mtr,
any buffered changes. */ any buffered changes. */
init->created = false; init->created = false;
ut_ad(!mtr.has_modifications()); ut_ad(!mtr.has_modifications());
block->page.status = buf_page_t::FREED;
} }
/* Make sure that committing mtr does not change the modification /* Make sure that committing mtr does not change the modification
......
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