diff options
author | Sergei Golubchik <serg@mariadb.org> | 2021-02-23 13:01:27 +0100 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2021-02-23 13:06:22 +0100 |
commit | f33e57a9e66f7e1790cb84b141381bb668e281a0 (patch) | |
tree | 31bb1c5bd8e0addc9e994a1bb42b4703c37f7ed8 /storage | |
parent | 1a0526e2f294acdcac829672794ee1fe708eb2b3 (diff) | |
parent | 245d33db4e0586df4fe28362fb002cef0151a1c9 (diff) | |
download | mariadb-git-f33e57a9e66f7e1790cb84b141381bb668e281a0.tar.gz |
Merge branch '10.4' into 10.5
Diffstat (limited to 'storage')
-rw-r--r-- | storage/innobase/btr/btr0sea.cc | 35 | ||||
-rw-r--r-- | storage/innobase/handler/handler0alter.cc | 34 | ||||
-rw-r--r-- | storage/rocksdb/mysql-test/rocksdb/r/issue896.result | 2 | ||||
-rw-r--r-- | storage/rocksdb/mysql-test/rocksdb/r/rocksdb.result | 6 | ||||
-rw-r--r-- | storage/tokudb/mysql-test/tokudb/r/type_decimal.result | 5 |
5 files changed, 72 insertions, 10 deletions
diff --git a/storage/innobase/btr/btr0sea.cc b/storage/innobase/btr/btr0sea.cc index 68d946aa79d..5c8f97b7bcf 100644 --- a/storage/innobase/btr/btr0sea.cc +++ b/storage/innobase/btr/btr0sea.cc @@ -2,7 +2,7 @@ Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2008, Google Inc. -Copyright (c) 2017, 2020, MariaDB Corporation. +Copyright (c) 2017, 2021, MariaDB Corporation. Portions of this file contain modifications contributed and copyrighted by Google, Inc. Those modifications are gratefully acknowledged and are described @@ -707,6 +707,12 @@ btr_search_update_hash_ref( return; } + if (index != cursor->index) { + ut_ad(index->id == cursor->index->id); + btr_search_drop_page_hash_index(block); + return; + } + ut_ad(block->page.id().space() == index->table->space_id); ut_ad(index == cursor->index); ut_ad(!dict_index_is_ibuf(index)); @@ -1276,12 +1282,13 @@ retry: rw_lock_s_lock(&part->latch); assert_block_ahi_valid(block); - if (!block->index || !btr_search_enabled) { + dict_index_t* index = block->index; + + if (!index || !btr_search_enabled) { rw_lock_s_unlock(&part->latch); return; } - dict_index_t* index = block->index; #ifdef MYSQL_INDEX_DISABLE_AHI ut_ad(!index->disable_ahi); #endif @@ -1732,6 +1739,7 @@ btr_search_move_or_delete_hash_entries( : nullptr; if (new_block->index) { +drop_exit: btr_search_drop_page_hash_index(block); return; } @@ -1740,6 +1748,10 @@ btr_search_move_or_delete_hash_entries( return; } + if (index->freed()) { + goto drop_exit; + } + rw_lock_s_lock(ahi_latch); if (block->index) { @@ -1801,6 +1813,11 @@ void btr_search_update_hash_on_delete(btr_cur_t* cursor) return; } + if (index != cursor->index) { + btr_search_drop_page_hash_index(block); + return; + } + ut_ad(block->page.id().space() == index->table->space_id); ut_a(index == cursor->index); ut_a(block->curr_n_fields > 0 || block->curr_n_bytes > 0); @@ -1871,6 +1888,12 @@ btr_search_update_hash_node_on_insert(btr_cur_t* cursor, rw_lock_t* ahi_latch) return; } + if (index != cursor->index) { + ut_ad(index->id == cursor->index->id); + btr_search_drop_page_hash_index(block); + return; + } + ut_a(cursor->index == index); ut_ad(!dict_index_is_ibuf(index)); rw_lock_x_lock(ahi_latch); @@ -1959,6 +1982,12 @@ btr_search_update_hash_on_insert(btr_cur_t* cursor, rw_lock_t* ahi_latch) #ifdef MYSQL_INDEX_DISABLE_AHI ut_a(!index->disable_ahi); #endif + if (index != cursor->index) { + ut_ad(index->id == cursor->index->id); + btr_search_drop_page_hash_index(block); + return; + } + ut_a(index == cursor->index); ut_ad(!dict_index_is_ibuf(index)); diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc index ac17a7a8a3f..44e45e19550 100644 --- a/storage/innobase/handler/handler0alter.cc +++ b/storage/innobase/handler/handler0alter.cc @@ -8903,6 +8903,7 @@ innobase_rename_column_try( const char* to) { dberr_t error; + bool clust_has_prefixes = false; DBUG_ENTER("innobase_rename_column_try"); @@ -8962,6 +8963,39 @@ innobase_rename_column_try( if (error != DB_SUCCESS) { goto err_exit; } + + if (!has_prefixes || !clust_has_prefixes + || f.prefix_len) { + continue; + } + + /* For secondary indexes, the + has_prefixes check can be 'polluted' + by PRIMARY KEY column prefix. Try also + the simpler encoding of SYS_FIELDS.POS. */ + info = pars_info_create(); + + pars_info_add_ull_literal(info, "indexid", index->id); + pars_info_add_int4_literal(info, "nth", i); + pars_info_add_str_literal(info, "new", to); + + error = que_eval_sql( + info, + "PROCEDURE RENAME_SYS_FIELDS_PROC () IS\n" + "BEGIN\n" + "UPDATE SYS_FIELDS SET COL_NAME=:new\n" + "WHERE INDEX_ID=:indexid\n" + "AND POS=:nth;\n" + "END;\n", + FALSE, trx); + + if (error != DB_SUCCESS) { + goto err_exit; + } + } + + if (index == dict_table_get_first_index(ctx.old_table)) { + clust_has_prefixes = has_prefixes; } } diff --git a/storage/rocksdb/mysql-test/rocksdb/r/issue896.result b/storage/rocksdb/mysql-test/rocksdb/r/issue896.result index 917c95733f7..6b742ebaf0c 100644 --- a/storage/rocksdb/mysql-test/rocksdb/r/issue896.result +++ b/storage/rocksdb/mysql-test/rocksdb/r/issue896.result @@ -9,7 +9,7 @@ KEY `d` (`d`) INSERT INTO t1 VALUES (100, 'aaabbb', UNIX_TIMESTAMP(), 200); EXPLAIN SELECT COUNT(*) FROM t1 FORCE INDEX(d); id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL d 11 NULL # Using index +1 SIMPLE t1 index NULL d 9 NULL # Using index # segfault here without the fix SELECT COUNT(*) FROM t1 FORCE INDEX(d); COUNT(*) diff --git a/storage/rocksdb/mysql-test/rocksdb/r/rocksdb.result b/storage/rocksdb/mysql-test/rocksdb/r/rocksdb.result index 53d59650cd2..95cbc3e7026 100644 --- a/storage/rocksdb/mysql-test/rocksdb/r/rocksdb.result +++ b/storage/rocksdb/mysql-test/rocksdb/r/rocksdb.result @@ -546,7 +546,7 @@ pk key1 col1 explain select key1 from t30; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t30 index NULL key1 20 NULL # Using index +1 SIMPLE t30 index NULL key1 18 NULL # Using index select key1 from t30; key1 row1-key @@ -618,7 +618,7 @@ row3 row3-key row3-data explain select * from t30 order by key1 limit 3; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t30 index NULL key1 20 NULL # +1 SIMPLE t30 index NULL key1 18 NULL # select * from t30 order by key1 limit 3; pk key1 col1 row1 row1-key row1-data @@ -627,7 +627,7 @@ row3 row3-key row3-data explain select * from t30 order by key1 desc limit 3; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t30 index NULL key1 20 NULL # +1 SIMPLE t30 index NULL key1 18 NULL # select * from t30 order by key1 desc limit 3; pk key1 col1 row5 row5-key row5-data diff --git a/storage/tokudb/mysql-test/tokudb/r/type_decimal.result b/storage/tokudb/mysql-test/tokudb/r/type_decimal.result index 3b82bbcef4f..c01edef283e 100644 --- a/storage/tokudb/mysql-test/tokudb/r/type_decimal.result +++ b/storage/tokudb/mysql-test/tokudb/r/type_decimal.result @@ -177,9 +177,8 @@ Note 1265 Data truncated for column 'a' at row 2 insert into t1 values ("1e+18446744073709551615"),("1e+18446744073709551616"),("1e-9223372036854775807"),("1e-9223372036854775809"); Warnings: Warning 1264 Out of range value for column 'a' at row 1 -Warning 1366 Incorrect decimal value: '1e+18446744073709551616' for column `test`.`t1`.`a` at row 2 +Warning 1264 Out of range value for column 'a' at row 2 Note 1265 Data truncated for column 'a' at row 3 -Warning 1366 Incorrect decimal value: '1e-9223372036854775809' for column `test`.`t1`.`a` at row 4 insert into t1 values ("123.4e"),("123.4e+2"),("123.4e-2"),("123e1"),("123e+0"); Warnings: Warning 1265 Data truncated for column 'a' at row 1 @@ -210,7 +209,7 @@ a 99999999.99 0.00 99999999.99 -0.00 +99999999.99 0.00 0.00 123.40 |