Merge branch '10.4' into 10.5

This commit is contained in:
Sergei Golubchik 2021-02-23 13:01:27 +01:00
commit f33e57a9e6
89 changed files with 1850 additions and 1359 deletions

View file

@ -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));

View file

@ -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;
}
}

View file

@ -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(*)

View file

@ -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

View file

@ -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