From 8535c260dd399ef07846878536833d9da30b9146 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Fri, 14 Jan 2022 20:27:51 +0200 Subject: Remove FIXME comments that refer to an early MDEV-14425 plan In MDEV-14425, an early plan was to introduce a separate log file for file-level records and checkpoint information. The reasoning was that fil_system.mutex contention would be reduced by not having to maintain fil_system.named_spaces. The mutex contention was actually fixed in MDEV-23855 by making some data fields in fil_space_t and fil_node_t use std::atomic. Using a single circular log file simplifies recovery and backup. --- storage/innobase/include/mtr0types.h | 16 ++++------------ storage/innobase/log/log0recv.cc | 6 ------ 2 files changed, 4 insertions(+), 18 deletions(-) (limited to 'storage') diff --git a/storage/innobase/include/mtr0types.h b/storage/innobase/include/mtr0types.h index 4a47819e8c8..9e59dc814d3 100644 --- a/storage/innobase/include/mtr0types.h +++ b/storage/innobase/include/mtr0types.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1995, 2015, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2021, MariaDB Corporation. +Copyright (c) 2017, 2022, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -115,13 +115,9 @@ If same_page=1 is set in a record that follows a same_page=0 record in a mini-transaction, the tablespace identifier and page number fields will be omitted. -(For some file-oriented records (if same_page=1 for the first records -of a mini-transaction), we will write tablespace identifier using the -same 1-to-5-byte encoding. TBD: describe the exact format of -file-oriented records. With MDEV-14425, we could write file-level log -records to a separate file, not interleaved with page-level redo log -at all. We could reserve the file ib_logfile0 for checkpoint information -and for file-level redo log records.) +For FILE_ records (if same_page=1 for the first record +of a mini-transaction), we will write a tablespace identifier and +a page number (always 0) using the same 1-to-5-byte encoding. For FREE_PAGE or INIT_PAGE, if same_page=1, the record will be treated as corrupted (or reserved for future extension). The type code must @@ -304,18 +300,14 @@ enum mfile_type_t FILE_RENAME = 0xa0, /** Modify a file. Followed by tablespace ID and the file name. */ FILE_MODIFY = 0xb0, -#if 1 /* MDEV-14425 FIXME: Remove this! */ /** End-of-checkpoint marker. Followed by 2 dummy bytes of page identifier, 8 bytes of LSN, and padded with a NUL; @see SIZE_OF_FILE_CHECKPOINT. */ FILE_CHECKPOINT = 0xf0 -#endif }; -#if 1 /* MDEV-14425 FIXME: Remove this! */ /** Size of a FILE_CHECKPOINT record, including the trailing byte to terminate the mini-transaction. */ constexpr byte SIZE_OF_FILE_CHECKPOINT= 3/*type,page_id*/ + 8/*LSN*/ + 1; -#endif #ifndef UNIV_INNOCHECKSUM /** Types for the mlock objects to store in the mtr_t::m_memo */ diff --git a/storage/innobase/log/log0recv.cc b/storage/innobase/log/log0recv.cc index fdd9314b9b8..8e79a9b7e87 100644 --- a/storage/innobase/log/log0recv.cc +++ b/storage/innobase/log/log0recv.cc @@ -1832,9 +1832,7 @@ eom_found: #endif uint32_t space_id= 0, page_no= 0, last_offset= 0; -#if 1 /* MDEV-14425 FIXME: remove this */ bool got_page_op= false; -#endif for (l= log; l < end; l+= rlen) { const byte *const recs= l; @@ -2104,11 +2102,9 @@ same_page: pages.erase(i); } } -#if 1 /* MDEV-14425 FIXME: this must be in the checkpoint file only! */ else if (rlen) { switch (b & 0xf0) { -# if 1 /* MDEV-14425 FIXME: Remove this! */ case FILE_CHECKPOINT: if (space_id == 0 && page_no == 0 && rlen == 8) { @@ -2139,7 +2135,6 @@ same_page: } continue; } -# endif /* fall through */ default: if (!srv_force_recovery) @@ -2217,7 +2212,6 @@ same_page: return true; } } -#endif else goto malformed; } -- cgit v1.2.1 From 2ecd39c983a232289b863ba2c7bf8f70ebaa261f Mon Sep 17 00:00:00 2001 From: Nayuta Yanagisawa Date: Tue, 11 Jan 2022 21:57:11 +0900 Subject: MDEV-27240 SIGSEGV in ha_spider::store_lock on LOCK TABLE The commit e954d9de gave different lifetime to wide_share and partition_handler_share. This introduced the possibility that partition_handler_share could be accessed even after it was freed. We stop sharing partitoiin_handler_share and make it belong to a single wide_handler to fix the problem. --- storage/spider/ha_spider.cc | 243 +++++++-------------- storage/spider/ha_spider.h | 5 +- .../mysql-test/spider/bugfix/r/mdev_27240.result | 16 ++ .../mysql-test/spider/bugfix/t/mdev_27240.cnf | 2 + .../mysql-test/spider/bugfix/t/mdev_27240.test | 28 +++ storage/spider/spd_include.h | 17 +- storage/spider/spd_table.cc | 78 ++----- storage/spider/spd_table.h | 4 +- 8 files changed, 150 insertions(+), 243 deletions(-) create mode 100644 storage/spider/mysql-test/spider/bugfix/r/mdev_27240.result create mode 100644 storage/spider/mysql-test/spider/bugfix/t/mdev_27240.cnf create mode 100644 storage/spider/mysql-test/spider/bugfix/t/mdev_27240.test (limited to 'storage') diff --git a/storage/spider/ha_spider.cc b/storage/spider/ha_spider.cc index bbbe76cec74..64d54fbaf9b 100644 --- a/storage/spider/ha_spider.cc +++ b/storage/spider/ha_spider.cc @@ -1,5 +1,5 @@ /* Copyright (C) 2008-2019 Kentoku Shiba - Copyright (C) 2019 MariaDB corp + Copyright (C) 2019-2022 MariaDB corp This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -88,8 +88,7 @@ ha_spider::ha_spider( #endif search_link_query_id = 0; #ifdef WITH_PARTITION_STORAGE_ENGINE - partition_handler_share = NULL; - pt_handler_share_owner = FALSE; + partition_handler = NULL; #endif #ifdef HA_MRR_USE_DEFAULT_IMPL multi_range_keys = NULL; @@ -192,8 +191,7 @@ ha_spider::ha_spider( #endif search_link_query_id = 0; #ifdef WITH_PARTITION_STORAGE_ENGINE - partition_handler_share = NULL; - pt_handler_share_owner = FALSE; + partition_handler = NULL; #endif #ifdef HA_MRR_USE_DEFAULT_IMPL multi_range_keys = NULL; @@ -280,12 +278,7 @@ ha_spider::~ha_spider() DBUG_ENTER("ha_spider::~ha_spider"); DBUG_PRINT("info",("spider this=%p", this)); #ifdef WITH_PARTITION_STORAGE_ENGINE - if (pt_handler_share_owner) - { - spider_free(spider_current_trx, partition_handler_share, MYF(0)); - pt_handler_share_owner = FALSE; - } - partition_handler_share = NULL; + partition_handler = NULL; #endif if (wide_handler_owner) { @@ -343,13 +336,8 @@ int ha_spider::open( #ifdef WITH_PARTITION_STORAGE_ENGINE uint part_num; bool pt_handler_share_alloc = FALSE; - bool pt_handler_mutex = FALSE; - ha_spider **pt_handler_share_handlers = NULL; + ha_spider **wide_handler_handlers = NULL; ha_partition *clone_source; - ha_spider *pt_handler_share_key; -#ifdef SPIDER_HAS_HASH_VALUE_TYPE - my_hash_value_type hash_value; -#endif #endif DBUG_ENTER("ha_spider::open"); DBUG_PRINT("info",("spider this=%p", this)); @@ -360,18 +348,14 @@ int ha_spider::open( table->file->get_no_parts("", &part_num); if (part_num) { - pt_handler_share_handlers = + wide_handler_handlers = (ha_spider **) ((ha_partition *) table->file)->get_child_handlers(); - spider = pt_handler_share_handlers[0]; - owner = pt_handler_share_handlers[part_num - 1]; + spider = wide_handler_handlers[0]; + owner = wide_handler_handlers[part_num - 1]; clone_source = ((ha_partition *) table->file)->get_clone_source(); if (clone_source) { - pt_handler_share_key = (ha_spider *) - clone_source->get_child_handlers()[0]; is_clone = TRUE; - } else { - pt_handler_share_key = spider; } } else { #endif @@ -379,7 +363,6 @@ int ha_spider::open( owner = this; #ifdef WITH_PARTITION_STORAGE_ENGINE clone_source = NULL; - pt_handler_share_key = this; } #endif if (!spider->wide_handler) @@ -408,6 +391,10 @@ int ha_spider::open( (uint) sizeof(uchar) * no_bytes_in_map(table->read_set), &rnd_write_bitmap, (uint) sizeof(uchar) * no_bytes_in_map(table->read_set), +#ifdef WITH_PARTITION_STORAGE_ENGINE + &partition_handler, + (uint) sizeof(SPIDER_PARTITION_HANDLER), +#endif NullS)) ) { error_num = HA_ERR_OUT_OF_MEM; @@ -422,6 +409,9 @@ int ha_spider::open( wide_handler->idx_write_bitmap = idx_write_bitmap; wide_handler->rnd_read_bitmap = rnd_read_bitmap; wide_handler->rnd_write_bitmap = rnd_write_bitmap; +#ifdef WITH_PARTITION_STORAGE_ENGINE + wide_handler->partition_handler = partition_handler; +#endif wide_handler->owner = owner; if (table_share->tmp_table == NO_TMP_TABLE) wide_handler->top_share = table->s; @@ -431,81 +421,37 @@ int ha_spider::open( memset(wide_handler->searched_bitmap, 0, no_bytes_in_map(table->read_set)); wide_handler_alloc = TRUE; - } else { - wide_handler = spider->wide_handler; - } + if (!share && !spider_get_share(name, table, thd, this, &error_num)) goto error_get_share; wide_share = share->wide_share; - if (wide_handler_alloc) - { - thr_lock_data_init(&wide_share->lock, &wide_handler->lock, NULL); - } #ifdef WITH_PARTITION_STORAGE_ENGINE - if (!wide_handler->partition_handler_share) - { - pt_handler_mutex = TRUE; - pthread_mutex_lock(&wide_share->pt_handler_mutex); -#ifdef SPIDER_HAS_HASH_VALUE_TYPE - hash_value = my_calc_hash(&wide_share->pt_handler_hash, - (uchar*) pt_handler_share_key, sizeof(ha_spider *)); - if (!(partition_handler_share = (SPIDER_PARTITION_HANDLER_SHARE*) - my_hash_search_using_hash_value(&wide_share->pt_handler_hash, - hash_value, (uchar*) pt_handler_share_key, sizeof(ha_spider *)))) -#else - if (!(partition_handler_share = (SPIDER_PARTITION_HANDLER_SHARE*) - my_hash_search(&wide_share->pt_handler_hash, - (uchar*) pt_handler_share_key, sizeof(ha_spider *)))) -#endif - { - if (!(partition_handler_share = (SPIDER_PARTITION_HANDLER_SHARE *) - spider_bulk_malloc(spider_current_trx, 15, MYF(MY_WME | MY_ZEROFILL), - &partition_handler_share, sizeof(SPIDER_PARTITION_HANDLER_SHARE), - NullS)) - ) { - error_num = HA_ERR_OUT_OF_MEM; - goto error_partition_handler_share_alloc; - } - DBUG_PRINT("info",("spider create partition_handler_share")); - DBUG_PRINT("info",("spider table=%p", table)); - partition_handler_share->table = table; - partition_handler_share->table_hash_value = hash_value; - partition_handler_share->no_parts = part_num; - partition_handler_share->owner = owner; - partition_handler_share->parallel_search_query_id = 0; - spider->partition_handler_share = partition_handler_share; - owner->partition_handler_share = partition_handler_share; - owner->pt_handler_share_owner = TRUE; - partition_handler_share->handlers = pt_handler_share_handlers; - uint old_elements = wide_share->pt_handler_hash.array.max_element; -#ifdef HASH_UPDATE_WITH_HASH_VALUE - if (my_hash_insert_with_hash_value(&wide_share->pt_handler_hash, - hash_value, (uchar*) partition_handler_share)) -#else - if (my_hash_insert(&wide_share->pt_handler_hash, - (uchar*) partition_handler_share)) -#endif - { - error_num = HA_ERR_OUT_OF_MEM; - goto error_hash_insert; - } - if (wide_share->pt_handler_hash.array.max_element > old_elements) - { - spider_alloc_calc_mem(spider_current_trx, - wide_share->pt_handler_hash, - (wide_share->pt_handler_hash.array.max_element - - old_elements) * - wide_share->pt_handler_hash.array.size_of_element); - } - } - pthread_mutex_unlock(&wide_share->pt_handler_mutex); - pt_handler_mutex = FALSE; + DBUG_PRINT("info",("spider create partition_handler")); + DBUG_PRINT("info",("spider table=%p", table)); + partition_handler->table = table; + partition_handler->no_parts = part_num; + partition_handler->owner = owner; + partition_handler->parallel_search_query_id = 0; + spider->partition_handler = partition_handler; + owner->partition_handler = partition_handler; + partition_handler->handlers = wide_handler_handlers; pt_handler_share_alloc = TRUE; } else { - partition_handler_share = wide_handler->partition_handler_share; + wide_handler = spider->wide_handler; + partition_handler = wide_handler->partition_handler; + + if (!share && !spider_get_share(name, table, thd, this, &error_num)) + goto error_get_share; + + wide_share= share->wide_share; } + if (wide_handler_alloc) + { + thr_lock_data_init(&wide_share->lock, &wide_handler->lock, NULL); + } + #endif init_sql_alloc_size = spider_param_init_sql_alloc_size(thd, share->init_sql_alloc_size); @@ -572,10 +518,10 @@ int ha_spider::open( { for (roop_count = 0; roop_count < (int) part_num; roop_count++) { - if (partition_handler_share->handlers[roop_count]->share == share) + if (partition_handler->handlers[roop_count]->share == share) { pt_clone_source_handler = - partition_handler_share->handlers[roop_count]; + partition_handler->handlers[roop_count]; break; } } @@ -589,10 +535,10 @@ int ha_spider::open( { wide_handler->lock_mode = pt_clone_source_handler->wide_handler->lock_mode; - if (!partition_handler_share->clone_bitmap_init) + if (!partition_handler->clone_bitmap_init) { pt_clone_source_handler->set_select_column_mode(); - partition_handler_share->clone_bitmap_init = TRUE; + partition_handler->clone_bitmap_init = TRUE; } set_clone_searched_bitmap(); wide_handler->position_bitmap_init = FALSE; @@ -623,31 +569,13 @@ error_reset: error_init_blob_buff: error_init_result_list: #ifdef WITH_PARTITION_STORAGE_ENGINE -error_hash_insert: if (pt_handler_share_alloc) { wide_share = share->wide_share; - if (!pt_handler_mutex) - pthread_mutex_lock(&wide_share->pt_handler_mutex); -#ifdef HASH_UPDATE_WITH_HASH_VALUE - my_hash_delete_with_hash_value(&wide_share->pt_handler_hash, - partition_handler_share->table_hash_value, - (uchar*) partition_handler_share); -#else - my_hash_delete(&wide_share->pt_handler_hash, - (uchar*) partition_handler_share); -#endif - pthread_mutex_unlock(&wide_share->pt_handler_mutex); - pt_handler_mutex = FALSE; - spider_free(spider_current_trx, partition_handler_share, MYF(0)); - spider->partition_handler_share = NULL; - owner->partition_handler_share = NULL; - owner->pt_handler_share_owner = FALSE; + spider->partition_handler = NULL; + owner->partition_handler = NULL; } -error_partition_handler_share_alloc: - if (pt_handler_mutex) - pthread_mutex_unlock(&wide_share->pt_handler_mutex); - partition_handler_share = NULL; + partition_handler = NULL; #endif spider_free_share(share); share = NULL; @@ -661,9 +589,9 @@ error_get_share: { spider_free(spider_current_trx, wide_handler, MYF(0)); #ifdef WITH_PARTITION_STORAGE_ENGINE - if (pt_handler_share_handlers) + if (wide_handler_handlers) { - pt_handler_share_handlers[0]->wide_handler = NULL; + wide_handler_handlers[0]->wide_handler = NULL; } #endif spider->wide_handler = NULL; @@ -679,7 +607,6 @@ int ha_spider::close() { int error_num = 0, roop_count, error_num2; THD *thd = ha_thd(); - SPIDER_WIDE_SHARE *wide_share; backup_error_status(); DBUG_ENTER("ha_spider::close"); DBUG_PRINT("info",("spider this=%p", this)); @@ -769,23 +696,7 @@ int ha_spider::close() conn_keys = NULL; } #ifdef WITH_PARTITION_STORAGE_ENGINE - if (pt_handler_share_owner) - { - wide_share = share->wide_share; - pthread_mutex_lock(&wide_share->pt_handler_mutex); -#ifdef HASH_UPDATE_WITH_HASH_VALUE - my_hash_delete_with_hash_value(&wide_share->pt_handler_hash, - partition_handler_share->table_hash_value, - (uchar*) partition_handler_share); -#else - my_hash_delete(&wide_share->pt_handler_hash, - (uchar*) partition_handler_share); -#endif - pthread_mutex_unlock(&wide_share->pt_handler_mutex); - spider_free(spider_current_trx, partition_handler_share, MYF(0)); - pt_handler_share_owner = FALSE; - } - partition_handler_share = NULL; + partition_handler = NULL; #endif if (wide_handler_owner) { @@ -1169,14 +1080,14 @@ THR_LOCK_DATA **ha_spider::store_lock( ) { wide_handler->lock_table_type = 1; #ifdef WITH_PARTITION_STORAGE_ENGINE - if (partition_handler_share && partition_handler_share->handlers) + if (partition_handler && partition_handler->handlers) { uint roop_count; - for (roop_count = 0; roop_count < partition_handler_share->no_parts; + for (roop_count = 0; roop_count < partition_handler->no_parts; ++roop_count) { if (unlikely((store_error_num = - partition_handler_share->handlers[roop_count]-> + partition_handler->handlers[roop_count]-> append_lock_tables_list()))) { break; @@ -1204,15 +1115,15 @@ THR_LOCK_DATA **ha_spider::store_lock( ) { wide_handler->lock_table_type = 2; #ifdef WITH_PARTITION_STORAGE_ENGINE - if (partition_handler_share && partition_handler_share->handlers) + if (partition_handler && partition_handler->handlers) { uint roop_count; for (roop_count = 0; - roop_count < partition_handler_share->no_parts; + roop_count < partition_handler->no_parts; ++roop_count) { if (unlikely((store_error_num = - partition_handler_share->handlers[roop_count]-> + partition_handler->handlers[roop_count]-> append_lock_tables_list()))) { break; @@ -1333,14 +1244,14 @@ int ha_spider::external_lock( /* lock/unlock tables */ #ifdef WITH_PARTITION_STORAGE_ENGINE - if (partition_handler_share && partition_handler_share->handlers) + if (partition_handler && partition_handler->handlers) { uint roop_count; - for (roop_count = 0; roop_count < partition_handler_share->no_parts; + for (roop_count = 0; roop_count < partition_handler->no_parts; ++roop_count) { if (unlikely((error_num = - partition_handler_share->handlers[roop_count]->lock_tables()))) + partition_handler->handlers[roop_count]->lock_tables()))) { DBUG_RETURN(error_num); } @@ -1574,7 +1485,7 @@ int ha_spider::reset() use_pre_action = FALSE; pre_bitmap_checked = FALSE; bulk_insert = FALSE; - partition_handler_share->clone_bitmap_init = FALSE; + partition_handler->clone_bitmap_init = FALSE; result_list.tmp_table_join = FALSE; result_list.use_union = FALSE; result_list.use_both_key = FALSE; @@ -7489,7 +7400,7 @@ int ha_spider::rnd_next_internal( ) { int error_num; ha_spider *direct_limit_offset_spider = - (ha_spider *) partition_handler_share->owner; + (ha_spider *) partition_handler->owner; backup_error_status(); DBUG_ENTER("ha_spider::rnd_next_internal"); DBUG_PRINT("info",("spider this=%p", this)); @@ -7529,7 +7440,7 @@ int ha_spider::rnd_next_internal( DBUG_RETURN(check_error_mode_eof(HA_ERR_END_OF_FILE)); } if ( - partition_handler_share->handlers && + partition_handler->handlers && direct_limit_offset_spider->direct_current_offset > 0 ) { longlong table_count = this->records(); @@ -12488,11 +12399,11 @@ int ha_spider::info_push( break; } wide_handler->hs_pushed_strref_num++; - if (partition_handler_share && partition_handler_share->handlers) + if (partition_handler && partition_handler->handlers) { size_t roop_count; - ha_spider **handlers = partition_handler_share->handlers; - for (roop_count = 0; roop_count < partition_handler_share->no_parts; + ha_spider **handlers = partition_handler->handlers; + for (roop_count = 0; roop_count < partition_handler->no_parts; ++roop_count) { if ((error_num = handlers[roop_count]->push_back_hs_upds( @@ -12512,11 +12423,11 @@ int ha_spider::info_push( case INFO_KIND_HS_CLEAR_STRING_REF: DBUG_PRINT("info",("spider INFO_KIND_HS_CLEAR_STRING_REF")); wide_handler->hs_pushed_strref_num = 0; - if (partition_handler_share && partition_handler_share->handlers) + if (partition_handler && partition_handler->handlers) { size_t roop_count; - ha_spider **handlers = partition_handler_share->handlers; - for (roop_count = 0; roop_count < partition_handler_share->no_parts; + ha_spider **handlers = partition_handler->handlers; + for (roop_count = 0; roop_count < partition_handler->no_parts; ++roop_count) { if ((error_num = handlers[roop_count]->reset_hs_upds( @@ -12580,11 +12491,11 @@ int ha_spider::info_push( #ifdef HA_CAN_BULK_ACCESS case INFO_KIND_BULK_ACCESS_BEGIN: DBUG_PRINT("info",("spider INFO_KIND_BULK_ACCESS_BEGIN")); - if (partition_handler_share && partition_handler_share->handlers) + if (partition_handler && partition_handler->handlers) { size_t roop_count; - ha_spider **handlers = partition_handler_share->handlers; - for (roop_count = 0; roop_count < partition_handler_share->no_parts; + ha_spider **handlers = partition_handler->handlers; + for (roop_count = 0; roop_count < partition_handler->no_parts; ++roop_count) { if ((error_num = handlers[roop_count]->bulk_access_begin(info))) @@ -12601,11 +12512,11 @@ int ha_spider::info_push( break; case INFO_KIND_BULK_ACCESS_CURRENT: DBUG_PRINT("info",("spider INFO_KIND_BULK_ACCESS_CURRENT")); - if (partition_handler_share && partition_handler_share->handlers) + if (partition_handler && partition_handler->handlers) { size_t roop_count; - ha_spider **handlers = partition_handler_share->handlers; - for (roop_count = 0; roop_count < partition_handler_share->no_parts; + ha_spider **handlers = partition_handler->handlers; + for (roop_count = 0; roop_count < partition_handler->no_parts; ++roop_count) { if ((error_num = handlers[roop_count]->bulk_access_current(info))) @@ -12622,11 +12533,11 @@ int ha_spider::info_push( break; case INFO_KIND_BULK_ACCESS_END: DBUG_PRINT("info",("spider INFO_KIND_BULK_ACCESS_END")); - if (partition_handler_share && partition_handler_share->handlers) + if (partition_handler && partition_handler->handlers) { size_t roop_count; - ha_spider **handlers = partition_handler_share->handlers; - for (roop_count = 0; roop_count < partition_handler_share->no_parts; + ha_spider **handlers = partition_handler->handlers; + for (roop_count = 0; roop_count < partition_handler->no_parts; ++roop_count) { handlers[roop_count]->bulk_access_end(); @@ -13123,7 +13034,7 @@ void ha_spider::check_distinct_key_query() { DBUG_ENTER( "ha_spider::check_distinct_key_query" ); - if ( result_list.direct_distinct && !partition_handler_share->handlers && + if ( result_list.direct_distinct && !partition_handler->handlers && result_list.keyread && result_list.check_direct_order_limit ) { // SELECT DISTINCT query using an index in a non-partitioned configuration @@ -13923,9 +13834,9 @@ void ha_spider::check_pre_call( } if ( use_parallel && - thd->query_id != partition_handler_share->parallel_search_query_id + thd->query_id != partition_handler->parallel_search_query_id ) { - partition_handler_share->parallel_search_query_id = thd->query_id; + partition_handler->parallel_search_query_id = thd->query_id; ++wide_handler->trx->parallel_search_count; } use_pre_call = use_parallel; diff --git a/storage/spider/ha_spider.h b/storage/spider/ha_spider.h index 5bc58397f28..3036f8d522a 100644 --- a/storage/spider/ha_spider.h +++ b/storage/spider/ha_spider.h @@ -1,5 +1,5 @@ /* Copyright (C) 2008-2019 Kentoku Shiba - Copyright (C) 2019 MariaDB corp + Copyright (C) 2019-2022 MariaDB corp This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -92,8 +92,7 @@ public: SPIDER_POSITION *pushed_pos; SPIDER_POSITION pushed_pos_buf; #ifdef WITH_PARTITION_STORAGE_ENGINE - bool pt_handler_share_owner = FALSE; - SPIDER_PARTITION_HANDLER_SHARE *partition_handler_share; + SPIDER_PARTITION_HANDLER *partition_handler; #endif bool wide_handler_owner = FALSE; SPIDER_WIDE_HANDLER *wide_handler = NULL; diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_27240.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_27240.result new file mode 100644 index 00000000000..9dd247337ee --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_27240.result @@ -0,0 +1,16 @@ +for master_1 +for child2 +for child3 +CREATE DATABASE auto_test_local; +USE auto_test_local; +CREATE TABLE tbl_a (a INT KEY) ENGINE=SPIDER; +SELECT a.z FROM tbl_a AS a,tbl_a b WHERE a.z=b.z; +ERROR 42S22: Unknown column 'a.z' in 'field list' +ALTER TABLE tbl_a CHANGE c c INT; +ERROR 42S22: Unknown column 'c' in 'tbl_a' +LOCK TABLE tbl_a READ; +ERROR HY000: Unable to connect to foreign data source: localhost +DROP DATABASE auto_test_local; +for master_1 +for child2 +for child3 diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_27240.cnf b/storage/spider/mysql-test/spider/bugfix/t/mdev_27240.cnf new file mode 100644 index 00000000000..b0853e32654 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_27240.cnf @@ -0,0 +1,2 @@ +!include include/default_mysqld.cnf +!include ../my_1_1.cnf diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_27240.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_27240.test new file mode 100644 index 00000000000..552ce3aa6de --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_27240.test @@ -0,0 +1,28 @@ +--disable_warnings +--disable_query_log +--disable_result_log +--source ../../t/test_init.inc +--enable_result_log +--enable_query_log +--enable_warnings + +CREATE DATABASE auto_test_local; +USE auto_test_local; + +CREATE TABLE tbl_a (a INT KEY) ENGINE=SPIDER; +--error ER_BAD_FIELD_ERROR +SELECT a.z FROM tbl_a AS a,tbl_a b WHERE a.z=b.z; +--error ER_BAD_FIELD_ERROR +ALTER TABLE tbl_a CHANGE c c INT; +--error ER_CONNECT_TO_FOREIGN_DATA_SOURCE +LOCK TABLE tbl_a READ; + +DROP DATABASE auto_test_local; + +--disable_warnings +--disable_query_log +--disable_result_log +--source ../../t/test_deinit.inc +--enable_result_log +--enable_query_log +--enable_warnings diff --git a/storage/spider/spd_include.h b/storage/spider/spd_include.h index bf6c415b745..46d0fb1ce96 100644 --- a/storage/spider/spd_include.h +++ b/storage/spider/spd_include.h @@ -1,5 +1,5 @@ /* Copyright (C) 2008-2020 Kentoku Shiba - Copyright (C) 2019-2020 MariaDB corp + Copyright (C) 2019-2022 MariaDB corp This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -676,18 +676,15 @@ typedef struct st_spider_lgtm_tblhnd_share } SPIDER_LGTM_TBLHND_SHARE; #ifdef WITH_PARTITION_STORAGE_ENGINE -typedef struct st_spider_patition_handler_share +typedef struct st_spider_patition_handler { bool clone_bitmap_init; -#ifdef SPIDER_HAS_HASH_VALUE_TYPE - my_hash_value_type table_hash_value; -#endif query_id_t parallel_search_query_id; uint no_parts; TABLE *table; ha_spider *owner; ha_spider **handlers; -} SPIDER_PARTITION_HANDLER_SHARE; +} SPIDER_PARTITION_HANDLER; #endif typedef struct st_spider_wide_share @@ -701,12 +698,6 @@ typedef struct st_spider_wide_share THR_LOCK lock; pthread_mutex_t sts_mutex; pthread_mutex_t crd_mutex; - pthread_mutex_t pt_handler_mutex; - HASH pt_handler_hash; - uint pt_handler_hash_id; - const char *pt_handler_hash_func_name; - const char *pt_handler_hash_file_name; - ulong pt_handler_hash_line_no; volatile bool sts_init; volatile bool crd_init; @@ -751,7 +742,7 @@ typedef struct st_spider_wide_handler #endif #endif #ifdef WITH_PARTITION_STORAGE_ENGINE - SPIDER_PARTITION_HANDLER_SHARE *partition_handler_share; + SPIDER_PARTITION_HANDLER *partition_handler; #endif #ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS List *direct_update_fields; diff --git a/storage/spider/spd_table.cc b/storage/spider/spd_table.cc index 8efa5d2551d..792a8a4ac12 100644 --- a/storage/spider/spd_table.cc +++ b/storage/spider/spd_table.cc @@ -1,5 +1,5 @@ /* Copyright (C) 2008-2020 Kentoku Shiba - Copyright (C) 2019-2020 MariaDB corp + Copyright (C) 2019-2022 MariaDB corp This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -432,7 +432,7 @@ uchar *spider_wide_share_get_key( #ifdef WITH_PARTITION_STORAGE_ENGINE uchar *spider_pt_handler_share_get_key( - SPIDER_PARTITION_HANDLER_SHARE *share, + SPIDER_PARTITION_HANDLER *share, size_t *length, my_bool not_used __attribute__ ((unused)) ) { @@ -6436,34 +6436,8 @@ SPIDER_WIDE_SHARE *spider_get_wide_share( goto error_init_crd_mutex; } -#if MYSQL_VERSION_ID < 50500 - if (pthread_mutex_init(&wide_share->pt_handler_mutex, - MY_MUTEX_INIT_FAST)) -#else - if (mysql_mutex_init(spd_key_mutex_pt_handler, - &wide_share->pt_handler_mutex, MY_MUTEX_INIT_FAST)) -#endif - { - *error_num = HA_ERR_OUT_OF_MEM; - goto error_init_pt_handler_mutex; - } - - if( - my_hash_init(PSI_INSTRUMENT_ME, &wide_share->pt_handler_hash, spd_charset_utf8mb3_bin, - 32, 0, 0, (my_hash_get_key) spider_pt_handler_share_get_key, 0, 0) - ) { - *error_num = HA_ERR_OUT_OF_MEM; - goto error_init_pt_handler_hash; - } - thr_lock_init(&wide_share->lock); - spider_alloc_calc_mem_init(wide_share->pt_handler_hash, 142); - spider_alloc_calc_mem(spider_current_trx, - wide_share->pt_handler_hash, - wide_share->pt_handler_hash.array.max_element * - wide_share->pt_handler_hash.array.size_of_element); - uint old_elements = spider_open_wide_share.array.max_element; #ifdef HASH_UPDATE_WITH_HASH_VALUE if (my_hash_insert_with_hash_value(&spider_open_wide_share, @@ -6491,14 +6465,6 @@ SPIDER_WIDE_SHARE *spider_get_wide_share( DBUG_RETURN(wide_share); error_hash_insert: - spider_free_mem_calc(spider_current_trx, - wide_share->pt_handler_hash_id, - wide_share->pt_handler_hash.array.max_element * - wide_share->pt_handler_hash.array.size_of_element); - my_hash_free(&wide_share->pt_handler_hash); -error_init_pt_handler_hash: - pthread_mutex_destroy(&wide_share->pt_handler_mutex); -error_init_pt_handler_mutex: pthread_mutex_destroy(&wide_share->crd_mutex); error_init_crd_mutex: pthread_mutex_destroy(&wide_share->sts_mutex); @@ -6523,12 +6489,6 @@ int spider_free_wide_share( #else my_hash_delete(&spider_open_wide_share, (uchar*) wide_share); #endif - spider_free_mem_calc(spider_current_trx, - wide_share->pt_handler_hash_id, - wide_share->pt_handler_hash.array.max_element * - wide_share->pt_handler_hash.array.size_of_element); - my_hash_free(&wide_share->pt_handler_hash); - pthread_mutex_destroy(&wide_share->pt_handler_mutex); pthread_mutex_destroy(&wide_share->crd_mutex); pthread_mutex_destroy(&wide_share->sts_mutex); spider_free(spider_current_trx, wide_share, MYF(0)); @@ -8036,15 +7996,15 @@ int spider_get_sts( if (error_num) { #ifdef WITH_PARTITION_STORAGE_ENGINE - SPIDER_PARTITION_HANDLER_SHARE *partition_handler_share = - spider->partition_handler_share; + SPIDER_PARTITION_HANDLER *partition_handler = + spider->partition_handler; if ( !share->wide_share->sts_init && sts_sync >= sts_sync_level && get_type > 1 && - partition_handler_share && - partition_handler_share->handlers && - partition_handler_share->handlers[0] == spider + partition_handler && + partition_handler->handlers && + partition_handler->handlers[0] == spider ) { int roop_count; ha_spider *tmp_spider; @@ -8054,11 +8014,11 @@ int spider_get_sts( int tmp_sts_sync; THD *thd = spider->wide_handler->trx->thd; for (roop_count = 1; - roop_count < (int) partition_handler_share->no_parts; + roop_count < (int) partition_handler->no_parts; roop_count++) { tmp_spider = - (ha_spider *) partition_handler_share->handlers[roop_count]; + (ha_spider *) partition_handler->handlers[roop_count]; tmp_share = tmp_spider->share; tmp_sts_interval = spider_param_sts_interval(thd, share->sts_interval); tmp_sts_mode = spider_param_sts_mode(thd, share->sts_mode); @@ -8187,15 +8147,15 @@ int spider_get_crd( if (error_num) { #ifdef WITH_PARTITION_STORAGE_ENGINE - SPIDER_PARTITION_HANDLER_SHARE *partition_handler_share = - spider->partition_handler_share; + SPIDER_PARTITION_HANDLER *partition_handler = + spider->partition_handler; if ( !share->wide_share->crd_init && crd_sync >= crd_sync_level && get_type > 1 && - partition_handler_share && - partition_handler_share->handlers && - partition_handler_share->handlers[0] == spider + partition_handler && + partition_handler->handlers && + partition_handler->handlers[0] == spider ) { int roop_count; ha_spider *tmp_spider; @@ -8205,11 +8165,11 @@ int spider_get_crd( int tmp_crd_sync; THD *thd = spider->wide_handler->trx->thd; for (roop_count = 1; - roop_count < (int) partition_handler_share->no_parts; + roop_count < (int) partition_handler->no_parts; roop_count++) { tmp_spider = - (ha_spider *) partition_handler_share->handlers[roop_count]; + (ha_spider *) partition_handler->handlers[roop_count]; tmp_share = tmp_spider->share; tmp_crd_interval = spider_param_crd_interval(thd, share->crd_interval); tmp_crd_mode = spider_param_crd_mode(thd, share->crd_mode); @@ -9348,10 +9308,10 @@ int spider_set_direct_limit_offset( DBUG_RETURN(TRUE); if ( - spider->partition_handler_share && - !spider->pt_handler_share_owner + spider->partition_handler && + !spider->wide_handler_owner ) { - if (spider->partition_handler_share->owner-> + if (spider->partition_handler->owner-> result_list.direct_limit_offset == TRUE) { spider->result_list.direct_limit_offset = TRUE; diff --git a/storage/spider/spd_table.h b/storage/spider/spd_table.h index 2b40fb33d5a..61f9f04d543 100644 --- a/storage/spider/spd_table.h +++ b/storage/spider/spd_table.h @@ -1,5 +1,5 @@ /* Copyright (C) 2008-2019 Kentoku Shiba - Copyright (C) 2019 MariaDB corp + Copyright (C) 2019-2022 MariaDB corp This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -321,7 +321,7 @@ uchar *spider_wide_share_get_key( #ifdef WITH_PARTITION_STORAGE_ENGINE uchar *spider_pt_handler_share_get_key( - SPIDER_PARTITION_HANDLER_SHARE *share, + SPIDER_PARTITION_HANDLER *share, size_t *length, my_bool not_used __attribute__ ((unused)) ); -- cgit v1.2.1 From 64f844b611d38f05303a88e4ab0aaa37062233b8 Mon Sep 17 00:00:00 2001 From: Nayuta Yanagisawa Date: Sat, 15 Jan 2022 17:28:06 +0900 Subject: MDEV-27240 fixup: remove #ifdef in macro call Windows builds failed due to the following error: '#': invalid character: possibly the result of a macro expansion --- storage/spider/ha_spider.cc | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'storage') diff --git a/storage/spider/ha_spider.cc b/storage/spider/ha_spider.cc index 64d54fbaf9b..1de57156dcf 100644 --- a/storage/spider/ha_spider.cc +++ b/storage/spider/ha_spider.cc @@ -375,6 +375,7 @@ int ha_spider::open( uchar *rnd_read_bitmap; uchar *rnd_write_bitmap; if (!(wide_handler = (SPIDER_WIDE_HANDLER *) +#ifdef WITH_PARTITION_STORAGE_ENGINE spider_bulk_malloc(spider_current_trx, 16, MYF(MY_WME | MY_ZEROFILL), &wide_handler, sizeof(SPIDER_WIDE_HANDLER), &searched_bitmap, @@ -391,11 +392,29 @@ int ha_spider::open( (uint) sizeof(uchar) * no_bytes_in_map(table->read_set), &rnd_write_bitmap, (uint) sizeof(uchar) * no_bytes_in_map(table->read_set), -#ifdef WITH_PARTITION_STORAGE_ENGINE &partition_handler, (uint) sizeof(SPIDER_PARTITION_HANDLER), + NullS) +#else + spider_bulk_malloc(spider_current_trx, 16, MYF(MY_WME | MY_ZEROFILL), + &wide_handler, sizeof(SPIDER_WIDE_HANDLER), + &searched_bitmap, + (uint) sizeof(uchar) * no_bytes_in_map(table->read_set), + &ft_discard_bitmap, + (uint) sizeof(uchar) * no_bytes_in_map(table->read_set), + &position_bitmap, + (uint) sizeof(uchar) * no_bytes_in_map(table->read_set), + &idx_read_bitmap, + (uint) sizeof(uchar) * no_bytes_in_map(table->read_set), + &idx_write_bitmap, + (uint) sizeof(uchar) * no_bytes_in_map(table->read_set), + &rnd_read_bitmap, + (uint) sizeof(uchar) * no_bytes_in_map(table->read_set), + &rnd_write_bitmap, + (uint) sizeof(uchar) * no_bytes_in_map(table->read_set), + NullS) #endif - NullS)) + ) ) { error_num = HA_ERR_OUT_OF_MEM; goto error_wide_handler_alloc; -- cgit v1.2.1 From b7e4dc121a99e7d38ce2d50ad8f9f948152d7e17 Mon Sep 17 00:00:00 2001 From: Nayuta Yanagisawa Date: Sat, 15 Jan 2022 21:24:25 +0900 Subject: MDEV-27240 fixup: remove dead code --- storage/spider/ha_spider.cc | 6 +++--- storage/spider/spd_table.cc | 14 -------------- storage/spider/spd_table.h | 8 -------- 3 files changed, 3 insertions(+), 25 deletions(-) (limited to 'storage') diff --git a/storage/spider/ha_spider.cc b/storage/spider/ha_spider.cc index 1de57156dcf..d139b2ecea0 100644 --- a/storage/spider/ha_spider.cc +++ b/storage/spider/ha_spider.cc @@ -335,7 +335,7 @@ int ha_spider::open( SPIDER_WIDE_SHARE *wide_share; #ifdef WITH_PARTITION_STORAGE_ENGINE uint part_num; - bool pt_handler_share_alloc = FALSE; + bool partition_handler_alloc = FALSE; ha_spider **wide_handler_handlers = NULL; ha_partition *clone_source; #endif @@ -456,7 +456,7 @@ int ha_spider::open( spider->partition_handler = partition_handler; owner->partition_handler = partition_handler; partition_handler->handlers = wide_handler_handlers; - pt_handler_share_alloc = TRUE; + partition_handler_alloc = TRUE; } else { wide_handler = spider->wide_handler; partition_handler = wide_handler->partition_handler; @@ -588,7 +588,7 @@ error_reset: error_init_blob_buff: error_init_result_list: #ifdef WITH_PARTITION_STORAGE_ENGINE - if (pt_handler_share_alloc) + if (partition_handler_alloc) { wide_share = share->wide_share; spider->partition_handler = NULL; diff --git a/storage/spider/spd_table.cc b/storage/spider/spd_table.cc index 792a8a4ac12..608e0ca811e 100644 --- a/storage/spider/spd_table.cc +++ b/storage/spider/spd_table.cc @@ -184,7 +184,6 @@ PSI_mutex_key spd_key_mutex_share_auto_increment; #ifdef WITH_PARTITION_STORAGE_ENGINE PSI_mutex_key spd_key_mutex_wide_share_sts; PSI_mutex_key spd_key_mutex_wide_share_crd; -PSI_mutex_key spd_key_mutex_pt_handler; #endif PSI_mutex_key spd_key_mutex_udf_table; PSI_mutex_key spd_key_mutex_mem_calc; @@ -244,7 +243,6 @@ static PSI_mutex_info all_spider_mutexes[]= #ifdef WITH_PARTITION_STORAGE_ENGINE { &spd_key_mutex_wide_share_sts, "wide_share_sts", 0}, { &spd_key_mutex_wide_share_crd, "wide_share_crd", 0}, - { &spd_key_mutex_pt_handler, "pt_handler", 0}, #endif { &spd_key_mutex_udf_table, "udf_table", 0}, { &spd_key_mutex_conn_loop_check, "conn_loop_check", 0}, @@ -430,18 +428,6 @@ uchar *spider_wide_share_get_key( DBUG_RETURN((uchar*) share->table_name); } -#ifdef WITH_PARTITION_STORAGE_ENGINE -uchar *spider_pt_handler_share_get_key( - SPIDER_PARTITION_HANDLER *share, - size_t *length, - my_bool not_used __attribute__ ((unused)) -) { - DBUG_ENTER("spider_pt_handler_share_get_key"); - *length = sizeof(ha_spider *); - DBUG_RETURN((uchar*) share->owner); -} -#endif - uchar *spider_lgtm_tblhnd_share_hash_get_key( SPIDER_LGTM_TBLHND_SHARE *share, size_t *length, diff --git a/storage/spider/spd_table.h b/storage/spider/spd_table.h index 61f9f04d543..dc351e73c61 100644 --- a/storage/spider/spd_table.h +++ b/storage/spider/spd_table.h @@ -319,14 +319,6 @@ uchar *spider_wide_share_get_key( my_bool not_used __attribute__ ((unused)) ); -#ifdef WITH_PARTITION_STORAGE_ENGINE -uchar *spider_pt_handler_share_get_key( - SPIDER_PARTITION_HANDLER *share, - size_t *length, - my_bool not_used __attribute__ ((unused)) -); -#endif - uchar *spider_link_get_key( SPIDER_LINK_FOR_HASH *link_for_hash, size_t *length, -- cgit v1.2.1 From f18e25649d32d20979ba16135afc501b85c0f040 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Mon, 17 Jan 2022 16:09:09 +0200 Subject: MDEV-27461: Buffer pool resize fails to wake up the page cleaner buf_pool_t::realloc(): Invoke page_cleaner_wakeup() if buf_LRU_get_free_only() returns a null pointer. Ever since commit 7b1252c03d7131754d9503560fe507b33ca1f8b4 (MDEV-24278) the page cleaner would remain in untimed sleep, expecting explicit calls to buf_pool_t::page_cleaner_wakeup() when the ratio of dirty pages could change. Failure to wake up the page cleaner will cause all page writes to be initiated by buf_flush_LRU_list_batch(). That might work too, provided that the buffer pool size is at least BUF_LRU_MIN_LEN (256) pages, but it would not advance the log checkpoint. --- storage/innobase/buf/buf0buf.cc | 3 +++ 1 file changed, 3 insertions(+) (limited to 'storage') diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc index 5a49757e857..f55f663a11d 100644 --- a/storage/innobase/buf/buf0buf.cc +++ b/storage/innobase/buf/buf0buf.cc @@ -1571,6 +1571,9 @@ inline bool buf_pool_t::realloc(buf_block_t *block) new_block = buf_LRU_get_free_only(); if (new_block == NULL) { + mysql_mutex_lock(&buf_pool.flush_list_mutex); + page_cleaner_wakeup(); + mysql_mutex_unlock(&buf_pool.flush_list_mutex); return(false); /* free list was not enough */ } -- cgit v1.2.1 From 5af6a13771db658d16b94b648563b37f5dbcab16 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Wed, 29 Dec 2021 13:53:19 +0100 Subject: MDEV-25373 DROP TABLE doesn't raise error while dropping non-existing table in MariaDB 10.5.9 when OQGraph SE is loaded to the server don't auto-succeed every DROP TABLE --- storage/example/ha_example.cc | 2 +- storage/oqgraph/ha_oqgraph.cc | 2 +- .../oqgraph/mysql-test/oqgraph/invalid_operations.result | 11 +++++++++++ storage/oqgraph/mysql-test/oqgraph/invalid_operations.test | 13 +++++++++++++ 4 files changed, 26 insertions(+), 2 deletions(-) (limited to 'storage') diff --git a/storage/example/ha_example.cc b/storage/example/ha_example.cc index 30484a41087..eaa3e51ca67 100644 --- a/storage/example/ha_example.cc +++ b/storage/example/ha_example.cc @@ -262,7 +262,7 @@ static int example_init_func(void *p) example_hton->table_options= example_table_option_list; example_hton->field_options= example_field_option_list; example_hton->tablefile_extensions= ha_example_exts; - example_hton->drop_table= [](handlerton *, const char*) { return 0; }; + example_hton->drop_table= [](handlerton *, const char*) { return -1; }; DBUG_RETURN(0); } diff --git a/storage/oqgraph/ha_oqgraph.cc b/storage/oqgraph/ha_oqgraph.cc index 79cec499a77..11bb139fd55 100644 --- a/storage/oqgraph/ha_oqgraph.cc +++ b/storage/oqgraph/ha_oqgraph.cc @@ -192,7 +192,7 @@ static int oqgraph_init(void *p) hton->discover_table_structure= oqgraph_discover_table_structure; hton->close_connection = oqgraph_close_connection; - hton->drop_table= [](handlerton *, const char*) { return 0; }; + hton->drop_table= [](handlerton *, const char*) { return -1; }; oqgraph_init_done= TRUE; return 0; diff --git a/storage/oqgraph/mysql-test/oqgraph/invalid_operations.result b/storage/oqgraph/mysql-test/oqgraph/invalid_operations.result index 49639c278d0..930d65afc53 100644 --- a/storage/oqgraph/mysql-test/oqgraph/invalid_operations.result +++ b/storage/oqgraph/mysql-test/oqgraph/invalid_operations.result @@ -30,3 +30,14 @@ update graph set origid=123; ERROR HY000: Table 'graph' is read only DROP TABLE graph_base; DROP TABLE graph; +# +# End of 10.0 tests +# +# +# MDEV-25373 DROP TABLE doesn't raise error while dropping non-existing table in MariaDB 10.5.9 when OQGraph SE is loaded to the server +# +drop table foobar; +ERROR 42S02: Unknown table 'test.foobar' +# +# End of 10.5 tests +# diff --git a/storage/oqgraph/mysql-test/oqgraph/invalid_operations.test b/storage/oqgraph/mysql-test/oqgraph/invalid_operations.test index cab99ec5018..24351cc9998 100644 --- a/storage/oqgraph/mysql-test/oqgraph/invalid_operations.test +++ b/storage/oqgraph/mysql-test/oqgraph/invalid_operations.test @@ -48,3 +48,16 @@ update graph set origid=123; DROP TABLE graph_base; DROP TABLE graph; +--echo # +--echo # End of 10.0 tests +--echo # + +--echo # +--echo # MDEV-25373 DROP TABLE doesn't raise error while dropping non-existing table in MariaDB 10.5.9 when OQGraph SE is loaded to the server +--echo # +--error 1051 +drop table foobar; + +--echo # +--echo # End of 10.5 tests +--echo # -- cgit v1.2.1 From e44439ab7354c5dff20707325694839e9346fb27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Mon, 17 Jan 2022 16:56:07 +0200 Subject: MDEV-27499 Performance regression in log_checkpoint_margin() In commit 4c3ad24413f234599eda27f4958dd3ff21df3203 (MDEV-27416) an unnecessarily strict wait condition was introduced in the function buf_flush_wait(). Most callers actually only care that the pages have been flushed, not that a checkpoint has completed. Only in the buf_flush_sync() call for log resizing, we might care about the log checkpoint. But, in fact, srv_prepare_to_delete_redo_log_file() is explicitly disabling checkpoints. So, we can simply remove the unnecessary wait loop. Thanks to Krunal Bauskar for reporting this performance regression that we failed to repeat in our testing. --- storage/innobase/buf/buf0flu.cc | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'storage') diff --git a/storage/innobase/buf/buf0flu.cc b/storage/innobase/buf/buf0flu.cc index 4b3e6e6e77e..c14b274645d 100644 --- a/storage/innobase/buf/buf0flu.cc +++ b/storage/innobase/buf/buf0flu.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2013, 2021, MariaDB Corporation. +Copyright (c) 2013, 2022, MariaDB Corporation. Copyright (c) 2013, 2014, Fusion-io This program is free software; you can redistribute it and/or modify it under @@ -1850,11 +1850,6 @@ static void buf_flush_wait(lsn_t lsn) my_cond_wait(&buf_pool.done_flush_list, &buf_pool.flush_list_mutex.m_mutex); } - - /* Wait for the checkpoint. */ - while (buf_flush_sync_lsn) - my_cond_wait(&buf_pool.done_flush_list, - &buf_pool.flush_list_mutex.m_mutex); } /** Wait until all persistent pages are flushed up to a limit. -- cgit v1.2.1