Merge 10.2 into 10.3

This commit is contained in:
Marko Mäkelä 2021-03-05 10:06:42 +02:00
commit bcd160753c
7 changed files with 42 additions and 61 deletions

View file

@ -13326,17 +13326,10 @@ innobase_drop_database(
@param[in,out] trx InnoDB data dictionary transaction
@param[in] from old table name
@param[in] to new table name
@param[in] commit whether to commit trx
@param[in] use_fk whether to parse and enforce FOREIGN KEY constraints
@param[in] commit whether to commit trx (and to enforce FOREIGN KEY)
@return DB_SUCCESS or error code */
inline
dberr_t
innobase_rename_table(
trx_t* trx,
const char* from,
const char* to,
bool commit,
bool use_fk)
inline dberr_t innobase_rename_table(trx_t *trx, const char *from,
const char *to, bool commit)
{
dberr_t error;
char norm_to[FN_REFLEN];
@ -13369,6 +13362,9 @@ innobase_rename_table(
Convert lock_wait_timeout unit from second to 250 milliseconds */
long int lock_wait_timeout = thd_lock_wait_timeout(trx->mysql_thd) * 4;
if (table != NULL) {
if (commit) {
dict_stats_wait_bg_to_stop_using_table(table, trx);
}
for (dict_index_t* index = dict_table_get_first_index(table);
index != NULL;
index = dict_table_get_next_index(index)) {
@ -13382,7 +13378,9 @@ innobase_rename_table(
}
}
}
dict_table_close(table, TRUE, FALSE);
if (!commit) {
dict_table_close(table, TRUE, FALSE);
}
}
/* FTS sync is in progress. We shall timeout this operation */
@ -13392,7 +13390,7 @@ innobase_rename_table(
}
error = row_rename_table_for_mysql(norm_from, norm_to, trx, commit,
use_fk);
commit);
if (error != DB_SUCCESS) {
if (error == DB_TABLE_NOT_FOUND
@ -13444,6 +13442,10 @@ innobase_rename_table(
func_exit:
if (commit) {
if (table) {
table->stats_bg_flag &= ~BG_STAT_SHOULD_QUIT;
dict_table_close(table, TRUE, FALSE);
}
row_mysql_unlock_data_dictionary(trx);
}
@ -13498,9 +13500,11 @@ int ha_innobase::truncate()
++trx->will_lock;
trx_set_dict_operation(trx, TRX_DICT_OP_TABLE);
row_mysql_lock_data_dictionary(trx);
dict_stats_wait_bg_to_stop_using_table(ib_table, trx);
int err = convert_error_code_to_mysql(
innobase_rename_table(trx, ib_table->name.m_name, temp_name,
false, false),
false),
ib_table->flags, m_user_thd);
if (err) {
trx_rollback_for_mysql(trx);
@ -13583,7 +13587,7 @@ ha_innobase::rename_table(
++trx->will_lock;
trx_set_dict_operation(trx, TRX_DICT_OP_INDEX);
dberr_t error = innobase_rename_table(trx, from, to, true, true);
dberr_t error = innobase_rename_table(trx, from, to, true);
DEBUG_SYNC(thd, "after_innobase_rename_table");

View file

@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2000, 2017, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, 2019, MariaDB Corporation.
Copyright (c) 2017, 2021, 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
@ -799,12 +799,6 @@ struct row_prebuilt_t {
search key values from MySQL format
to InnoDB format.*/
uint srch_key_val_len; /*!< Size of search key */
/** Disable prefetch. */
bool m_no_prefetch;
/** Return materialized key for secondary index scan */
bool m_read_virtual_key;
/** The MySQL table object */
TABLE* m_mysql_table;

View file

@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2000, 2018, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2015, 2020, MariaDB Corporation.
Copyright (c) 2015, 2021, 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
@ -963,9 +963,6 @@ row_create_prebuilt(
prebuilt->fts_doc_id_in_read_set = 0;
prebuilt->blob_heap = NULL;
prebuilt->m_no_prefetch = false;
prebuilt->m_read_virtual_key = false;
DBUG_RETURN(prebuilt);
}

View file

@ -2,7 +2,7 @@
Copyright (c) 1997, 2017, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, Google Inc.
Copyright (c) 2015, 2020, MariaDB Corporation.
Copyright (c) 2015, 2021, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described
@ -3081,8 +3081,7 @@ static bool row_sel_store_mysql_rec(
search or virtual key read is not requested. */
if (!rec_clust
|| !prebuilt->index->has_virtual()
|| (!prebuilt->read_just_key
&& !prebuilt->m_read_virtual_key)) {
|| !prebuilt->read_just_key) {
/* Initialize the NULL bit. */
mysql_rec[templ->mysql_null_byte_offset]
|= (byte) templ->mysql_null_bit_mask;
@ -3098,23 +3097,8 @@ static bool row_sel_store_mysql_rec(
const dfield_t* dfield = dtuple_get_nth_v_field(
vrow, col->v_pos);
/* If this is a partitioned table, it might request
InnoDB to fill out virtual column data for serach
index key values while other non key columns are also
getting selected. The non-key virtual columns may
not be materialized and we should skip them. */
if (dfield_get_type(dfield)->mtype == DATA_MISSING) {
#ifdef UNIV_DEBUG
ulint prefix;
#endif /* UNIV_DEBUG */
ut_ad(prebuilt->m_read_virtual_key);
/* If it is part of index key the data should
have been materialized. */
ut_ad(dict_index_get_nth_col_or_prefix_pos(
prebuilt->index, col->v_pos, false,
true, &prefix) == ULINT_UNDEFINED);
ut_ad("no ha_innopart in MariaDB" == 0);
continue;
}
@ -4298,8 +4282,7 @@ row_search_mvcc(
index key, if this is covered index scan or virtual key read is
requested. */
bool need_vrow = dict_index_has_virtual(prebuilt->index)
&& (prebuilt->read_just_key
|| prebuilt->m_read_virtual_key);
&& prebuilt->read_just_key;
/* Reset the new record lock info if srv_locks_unsafe_for_binlog
is set or session is using a READ COMMITTED isolation level. Then
@ -5437,7 +5420,6 @@ use_covering_index:
if ((match_mode == ROW_SEL_EXACT
|| prebuilt->n_rows_fetched >= MYSQL_FETCH_CACHE_THRESHOLD)
&& prebuilt->select_lock_type == LOCK_NONE
&& !prebuilt->m_no_prefetch
&& !prebuilt->templ_contains_blob
&& !prebuilt->clust_index_was_generated
&& !prebuilt->used_in_HANDLER