diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2022-04-21 15:33:50 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2022-04-21 15:33:50 +0300 |
commit | 620c55e708b9ea94ef8ba309267a6f2f32ed8104 (patch) | |
tree | 434f8bbb36626d16e8438b82da1618bd8313f6a2 /storage | |
parent | fdec842fd7f82b6ed9aec54f82ac50b5eea925b3 (diff) | |
parent | aec856073df12e95b68667587bfd8e469b60e7d4 (diff) | |
download | mariadb-git-620c55e708b9ea94ef8ba309267a6f2f32ed8104.tar.gz |
Merge 10.4 into 10.5
Diffstat (limited to 'storage')
-rw-r--r-- | storage/innobase/handler/ha_innodb.cc | 11 | ||||
-rw-r--r-- | storage/innobase/ibuf/ibuf0ibuf.cc | 35 | ||||
-rw-r--r-- | storage/innobase/include/sync0sync.h | 3 | ||||
-rw-r--r-- | storage/innobase/include/sync0types.h | 4 | ||||
-rw-r--r-- | storage/innobase/sync/sync0debug.cc | 18 | ||||
-rw-r--r-- | storage/innobase/sync/sync0sync.cc | 3 | ||||
-rw-r--r-- | storage/maria/ma_write.c | 3 | ||||
-rw-r--r-- | storage/maria/maria_def.h | 3 | ||||
-rw-r--r-- | storage/spider/mysql-test/spider/bugfix/r/mdev_25116.result | 33 | ||||
-rw-r--r-- | storage/spider/mysql-test/spider/bugfix/t/mdev_25116.cnf | 3 | ||||
-rw-r--r-- | storage/spider/mysql-test/spider/bugfix/t/mdev_25116.test | 37 | ||||
-rw-r--r-- | storage/spider/mysql-test/spider/r/spider3_fixes.result | 8 | ||||
-rw-r--r-- | storage/spider/mysql-test/spider/t/spider3_fixes.test | 10 | ||||
-rw-r--r-- | storage/spider/spd_db_conn.cc | 3 | ||||
-rw-r--r-- | storage/spider/spd_table.cc | 2 |
15 files changed, 119 insertions, 57 deletions
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 042999d33cb..b30940967b3 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -522,7 +522,6 @@ static PSI_mutex_info all_innodb_mutexes[] = { PSI_KEY(fts_delete_mutex), PSI_KEY(fts_doc_id_mutex), PSI_KEY(log_flush_order_mutex), - PSI_KEY(ibuf_bitmap_mutex), PSI_KEY(ibuf_mutex), PSI_KEY(ibuf_pessimistic_insert_mutex), PSI_KEY(index_online_log), @@ -1659,7 +1658,9 @@ static void sst_enable_innodb_writes() dict_stats_start(); purge_sys.resume(); wsrep_sst_disable_writes= false; - fil_crypt_set_thread_cnt(srv_n_fil_crypt_threads); + const uint old_count= srv_n_fil_crypt_threads; + srv_n_fil_crypt_threads= 0; + fil_crypt_set_thread_cnt(old_count); } static void innodb_disable_internal_writes(bool disable) @@ -12713,7 +12714,6 @@ bool create_table_info_t::row_size_is_acceptable( return true; } -/* FIXME: row size check has some flaws and should be improved */ dict_index_t::record_size_info_t dict_index_t::record_size_info() const { ut_ad(!(type & DICT_FTS)); @@ -12803,6 +12803,8 @@ dict_index_t::record_size_info_t dict_index_t::record_size_info() const { /* dict_index_add_col() should guarantee this */ ut_ad(!f.prefix_len || f.fixed_len == f.prefix_len); + if (f.prefix_len) + field_max_size= f.prefix_len; /* Fixed lengths are not encoded in ROW_FORMAT=COMPACT. */ goto add_field_size; @@ -12856,7 +12858,8 @@ dict_index_t::record_size_info_t dict_index_t::record_size_info() const unique columns, result.shortest_size equals the size of the node pointer record minus the node pointer column. */ if (i + 1 == dict_index_get_n_unique_in_tree(this) && - result.shortest_size + REC_NODE_PTR_SIZE >= page_ptr_max) + result.shortest_size + REC_NODE_PTR_SIZE + (comp ? 0 : 2) >= + page_ptr_max) { result.set_too_big(i); } diff --git a/storage/innobase/ibuf/ibuf0ibuf.cc b/storage/innobase/ibuf/ibuf0ibuf.cc index 9e2e75ed6dd..53d27eeaacd 100644 --- a/storage/innobase/ibuf/ibuf0ibuf.cc +++ b/storage/innobase/ibuf/ibuf0ibuf.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1997, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2016, 2021, MariaDB Corporation. +Copyright (c) 2016, 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 @@ -240,9 +240,6 @@ static ib_mutex_t ibuf_pessimistic_insert_mutex; /** The mutex protecting the insert buffer structs */ static ib_mutex_t ibuf_mutex; -/** The mutex protecting the insert buffer bitmaps */ -static ib_mutex_t ibuf_bitmap_mutex; - /** The area in pages from which contract looks for page numbers for merge */ const ulint IBUF_MERGE_AREA = 8; @@ -372,8 +369,6 @@ ibuf_close(void) mutex_free(&ibuf_mutex); - mutex_free(&ibuf_bitmap_mutex); - dict_table_t* ibuf_table = ibuf.index->table; rw_lock_free(&ibuf.index->lock); dict_mem_index_free(ibuf.index); @@ -437,8 +432,6 @@ ibuf_init_at_db_start(void) mutex_create(LATCH_ID_IBUF, &ibuf_mutex); - mutex_create(LATCH_ID_IBUF_BITMAP, &ibuf_bitmap_mutex); - mutex_create(LATCH_ID_IBUF_PESSIMISTIC_INSERT, &ibuf_pessimistic_insert_mutex); @@ -909,26 +902,16 @@ ibuf_update_free_bits_for_two_pages_low( buf_block_t* block2, /*!< in: index page */ mtr_t* mtr) /*!< in: mtr */ { - ulint state; - - ut_ad(mtr->is_named_space(block1->page.id().space())); - ut_ad(block1->page.id().space() == block2->page.id().space()); - - /* As we have to x-latch two random bitmap pages, we have to acquire - the bitmap mutex to prevent a deadlock with a similar operation - performed by another OS thread. */ - - mutex_enter(&ibuf_bitmap_mutex); - - state = ibuf_index_page_calc_free(block1); - - ibuf_set_free_bits_low(block1, state, mtr); - - state = ibuf_index_page_calc_free(block2); + ut_ad(mtr->is_named_space(block1->page.id().space())); + ut_ad(block1->page.id().space() == block2->page.id().space()); - ibuf_set_free_bits_low(block2, state, mtr); + /* Avoid deadlocks by acquiring multiple bitmap page latches in + a consistent order (smaller pointer first). */ + if (block1 > block2) + std::swap(block1, block2); - mutex_exit(&ibuf_bitmap_mutex); + ibuf_set_free_bits_low(block1, ibuf_index_page_calc_free(block1), mtr); + ibuf_set_free_bits_low(block2, ibuf_index_page_calc_free(block2), mtr); } /** Returns TRUE if the page is one of the fixed address ibuf pages. diff --git a/storage/innobase/include/sync0sync.h b/storage/innobase/include/sync0sync.h index b7f3cff2925..868b47fc2f9 100644 --- a/storage/innobase/include/sync0sync.h +++ b/storage/innobase/include/sync0sync.h @@ -3,7 +3,7 @@ Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2008, Google Inc. Copyright (c) 2012, Facebook Inc. -Copyright (c) 2020, MariaDB Corporation. +Copyright (c) 2020, 2022, MariaDB Corporation. Portions of this file contain modifications contributed and copyrighted by Google, Inc. Those modifications are gratefully acknowledged and are described @@ -47,7 +47,6 @@ extern mysql_pfs_key_t flush_list_mutex_key; extern mysql_pfs_key_t fts_delete_mutex_key; extern mysql_pfs_key_t fts_doc_id_mutex_key; extern mysql_pfs_key_t fts_pll_tokenize_mutex_key; -extern mysql_pfs_key_t ibuf_bitmap_mutex_key; extern mysql_pfs_key_t ibuf_mutex_key; extern mysql_pfs_key_t ibuf_pessimistic_insert_mutex_key; extern mysql_pfs_key_t log_sys_mutex_key; diff --git a/storage/innobase/include/sync0types.h b/storage/innobase/include/sync0types.h index feb1e3b45ef..8ad99700fa5 100644 --- a/storage/innobase/include/sync0types.h +++ b/storage/innobase/include/sync0types.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2020, 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 @@ -211,7 +211,6 @@ enum latch_level_t { SYNC_INDEX_ONLINE_LOG, SYNC_IBUF_BITMAP, - SYNC_IBUF_BITMAP_MUTEX, SYNC_IBUF_TREE_NODE, SYNC_IBUF_TREE_NODE_NEW, SYNC_IBUF_INDEX_TREE, @@ -266,7 +265,6 @@ enum latch_id_t { LATCH_ID_FTS_DELETE, LATCH_ID_FTS_DOC_ID, LATCH_ID_FTS_PLL_TOKENIZE, - LATCH_ID_IBUF_BITMAP, LATCH_ID_IBUF, LATCH_ID_IBUF_PESSIMISTIC_INSERT, LATCH_ID_PURGE_SYS_PQ, diff --git a/storage/innobase/sync/sync0debug.cc b/storage/innobase/sync/sync0debug.cc index 99d13b7b171..dd40e95dd50 100644 --- a/storage/innobase/sync/sync0debug.cc +++ b/storage/innobase/sync/sync0debug.cc @@ -463,7 +463,6 @@ LatchDebug::LatchDebug() LEVEL_MAP_INSERT(SYNC_LOCK_WAIT_SYS); LEVEL_MAP_INSERT(SYNC_INDEX_ONLINE_LOG); LEVEL_MAP_INSERT(SYNC_IBUF_BITMAP); - LEVEL_MAP_INSERT(SYNC_IBUF_BITMAP_MUTEX); LEVEL_MAP_INSERT(SYNC_IBUF_TREE_NODE); LEVEL_MAP_INSERT(SYNC_IBUF_TREE_NODE_NEW); LEVEL_MAP_INSERT(SYNC_IBUF_INDEX_TREE); @@ -730,7 +729,6 @@ LatchDebug::check_order( case SYNC_RW_TRX_HASH_ELEMENT: case SYNC_READ_VIEW: case SYNC_TRX_SYS: - case SYNC_IBUF_BITMAP_MUTEX: case SYNC_REDO_RSEG: case SYNC_NOREDO_RSEG: case SYNC_PURGE_LATCH: @@ -782,22 +780,13 @@ LatchDebug::check_order( break; case SYNC_IBUF_BITMAP: - - /* Either the thread must own the master mutex to all - the bitmap pages, or it is allowed to latch only ONE - bitmap page. */ - - if (find(latches, SYNC_IBUF_BITMAP_MUTEX) != 0) { - - basic_check(latches, level, SYNC_IBUF_BITMAP - 1); - - } else if (!srv_is_being_started) { + if (!srv_is_being_started) { /* This is violated during trx_sys_create_rsegs() when creating additional rollback segments during upgrade. */ - basic_check(latches, level, SYNC_IBUF_BITMAP); + basic_check(latches, level, SYNC_IBUF_BITMAP - 1); } break; @@ -1217,9 +1206,6 @@ sync_latch_meta_init() LATCH_ADD_MUTEX(FTS_PLL_TOKENIZE, SYNC_FTS_TOKENIZE, fts_pll_tokenize_mutex_key); - LATCH_ADD_MUTEX(IBUF_BITMAP, SYNC_IBUF_BITMAP_MUTEX, - ibuf_bitmap_mutex_key); - LATCH_ADD_MUTEX(IBUF, SYNC_IBUF_MUTEX, ibuf_mutex_key); LATCH_ADD_MUTEX(IBUF_PESSIMISTIC_INSERT, SYNC_IBUF_PESS_INSERT_MUTEX, diff --git a/storage/innobase/sync/sync0sync.cc b/storage/innobase/sync/sync0sync.cc index 0a6f8bfbebd..dd93f295f50 100644 --- a/storage/innobase/sync/sync0sync.cc +++ b/storage/innobase/sync/sync0sync.cc @@ -3,7 +3,7 @@ Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2020, MariaDB Corporation. Copyright (c) 2008, Google Inc. -Copyright (c) 2020, MariaDB Corporation. +Copyright (c) 2020, 2022, MariaDB Corporation. Portions of this file contain modifications contributed and copyrighted by Google, Inc. Those modifications are gratefully acknowledged and are described @@ -44,7 +44,6 @@ mysql_pfs_key_t flush_list_mutex_key; mysql_pfs_key_t fts_delete_mutex_key; mysql_pfs_key_t fts_doc_id_mutex_key; mysql_pfs_key_t fts_pll_tokenize_mutex_key; -mysql_pfs_key_t ibuf_bitmap_mutex_key; mysql_pfs_key_t ibuf_mutex_key; mysql_pfs_key_t ibuf_pessimistic_insert_mutex_key; mysql_pfs_key_t log_sys_mutex_key; diff --git a/storage/maria/ma_write.c b/storage/maria/ma_write.c index 58e6d5e083b..392f0bf6d0e 100644 --- a/storage/maria/ma_write.c +++ b/storage/maria/ma_write.c @@ -731,7 +731,10 @@ static int w_search(register MARIA_HA *info, uint32 comp_flag, MARIA_KEY *key, } } if (flag == MARIA_FOUND_WRONG_KEY) + { + my_errno= HA_ERR_CRASHED; goto err; + } if (!was_last_key) insert_last=0; next_page= _ma_kpos(page.node, keypos); diff --git a/storage/maria/maria_def.h b/storage/maria/maria_def.h index 2107444940d..59f92dd91b1 100644 --- a/storage/maria/maria_def.h +++ b/storage/maria/maria_def.h @@ -1203,7 +1203,8 @@ struct ha_table_option_struct #define PACK_TYPE_SELECTED 1U /* Bits in field->pack_type */ #define PACK_TYPE_SPACE_FIELDS 2U #define PACK_TYPE_ZERO_FILL 4U -#define MARIA_FOUND_WRONG_KEY 32768U /* Impossible value from ha_key_cmp */ + +#define MARIA_FOUND_WRONG_KEY INT_MAX32 /* Impossible value from ha_key_cmp */ #define MARIA_BLOCK_SIZE(key_length,data_pointer,key_pointer,block_size) (((((key_length)+(data_pointer)+(key_pointer))*4+(key_pointer)+2)/(block_size)+1)*(block_size)) #define MARIA_MAX_KEYPTR_SIZE 5 /* For calculating block lengths */ diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_25116.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_25116.result new file mode 100644 index 00000000000..cd2ca4b1635 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_25116.result @@ -0,0 +1,33 @@ +# +# MDEV-25116 Spider: IF(COUNT( trigger SQL Error (1054)_ Unknown column '' in field list +# +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 +connection child2_1; +CREATE DATABASE auto_test_remote; +USE auto_test_remote; +CREATE TABLE tbl_a (id INT); +connection master_1; +CREATE DATABASE auto_test_local; +USE auto_test_local; +CREATE TABLE tbl_a ( +id INT +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='table "tbl_a", srv "s_2_1"'; +connection master_1; +SELECT IF(COUNT(id > 0),'Y','N') FROM tbl_a; +IF(COUNT(id > 0),'Y','N') +N +connection master_1; +DROP DATABASE IF EXISTS auto_test_local; +connection child2_1; +DROP DATABASE IF EXISTS auto_test_remote; +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_25116.cnf b/storage/spider/mysql-test/spider/bugfix/t/mdev_25116.cnf new file mode 100644 index 00000000000..05dfd8a0bce --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_25116.cnf @@ -0,0 +1,3 @@ +!include include/default_mysqld.cnf +!include ../my_1_1.cnf +!include ../my_2_1.cnf diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_25116.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_25116.test new file mode 100644 index 00000000000..70c2bcc51b7 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_25116.test @@ -0,0 +1,37 @@ +--echo # +--echo # MDEV-25116 Spider: IF(COUNT( trigger SQL Error (1054)_ Unknown column '' in field list +--echo # + +--disable_query_log +--disable_result_log +--source ../../t/test_init.inc +--enable_result_log +--enable_query_log + +--connection child2_1 +CREATE DATABASE auto_test_remote; +USE auto_test_remote; + +CREATE TABLE tbl_a (id INT); + +--connection master_1 +CREATE DATABASE auto_test_local; +USE auto_test_local; + +eval CREATE TABLE tbl_a ( + id INT +) $MASTER_1_ENGINE $MASTER_1_CHARSET COMMENT='table "tbl_a", srv "s_2_1"'; + +--connection master_1 +SELECT IF(COUNT(id > 0),'Y','N') FROM tbl_a; + +--connection master_1 +DROP DATABASE IF EXISTS auto_test_local; +--connection child2_1 +DROP DATABASE IF EXISTS auto_test_remote; + +--disable_query_log +--disable_result_log +--source ../t/test_deinit.inc +--enable_query_log +--enable_result_log diff --git a/storage/spider/mysql-test/spider/r/spider3_fixes.result b/storage/spider/mysql-test/spider/r/spider3_fixes.result index d6aec25bfc1..7a80e102462 100644 --- a/storage/spider/mysql-test/spider/r/spider3_fixes.result +++ b/storage/spider/mysql-test/spider/r/spider3_fixes.result @@ -200,6 +200,14 @@ id 5000 10000 connection master_1; +# +# MDEV-28225 Disallow user to create Spider temporary table +# +connection master_1; +CREATE TEMPORARY TABLE t1 ( +a INT +) ENGINE=Spider; +ERROR HY000: Table storage engine 'SPIDER' does not support the create option 'TEMPORARY' deinit connection master_1; diff --git a/storage/spider/mysql-test/spider/t/spider3_fixes.test b/storage/spider/mysql-test/spider/t/spider3_fixes.test index 13fa6f5fa39..73126d6d348 100644 --- a/storage/spider/mysql-test/spider/t/spider3_fixes.test +++ b/storage/spider/mysql-test/spider/t/spider3_fixes.test @@ -264,6 +264,16 @@ if ($USE_CHILD_GROUP2) } +--echo # +--echo # MDEV-28225 Disallow user to create Spider temporary table +--echo # +--connection master_1 +--error ER_ILLEGAL_HA_CREATE_OPTION +CREATE TEMPORARY TABLE t1 ( + a INT +) ENGINE=Spider; + + --echo --echo deinit --disable_warnings diff --git a/storage/spider/spd_db_conn.cc b/storage/spider/spd_db_conn.cc index d2cce0ba6d0..2a27b916394 100644 --- a/storage/spider/spd_db_conn.cc +++ b/storage/spider/spd_db_conn.cc @@ -10104,8 +10104,7 @@ int spider_db_open_item_ref( } DBUG_RETURN(0); } - DBUG_RETURN(spider_db_print_item_type(*(item_ref->ref), NULL, spider, str, - alias, alias_length, dbton_id, use_fields, fields)); + DBUG_RETURN(ER_SPIDER_COND_SKIP_NUM); // MDEV-25116 } DBUG_RETURN(spider_db_open_item_ident((Item_ident *) item_ref, spider, str, alias, alias_length, dbton_id, use_fields, fields)); diff --git a/storage/spider/spd_table.cc b/storage/spider/spd_table.cc index 608e0ca811e..00542f05f09 100644 --- a/storage/spider/spd_table.cc +++ b/storage/spider/spd_table.cc @@ -7195,7 +7195,7 @@ int spider_db_init( DBUG_ENTER("spider_db_init"); spider_hton_ptr = spider_hton; - spider_hton->flags = HTON_NO_FLAGS; + spider_hton->flags = HTON_TEMPORARY_NOT_SUPPORTED; #ifdef HTON_CAN_READ_CONNECT_STRING_IN_PARTITION spider_hton->flags |= HTON_CAN_READ_CONNECT_STRING_IN_PARTITION; #endif |