summaryrefslogtreecommitdiff
path: root/storage/innobase
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2018-10-10 10:36:51 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2018-10-10 10:36:51 +0300
commit2a955c7a834aca8ae966a2922cd289bf2f9d67d9 (patch)
treeab2d03766f65b2dffe4d1ac043395548f108f5ef /storage/innobase
parent5646c4315918c1e4127bfb68b70d1c5333bfc2c7 (diff)
parent61b32df93119635570f42a96d0b99c7ea398430b (diff)
downloadmariadb-git-2a955c7a834aca8ae966a2922cd289bf2f9d67d9.tar.gz
Merge 10.3 into 10.4
Diffstat (limited to 'storage/innobase')
-rw-r--r--storage/innobase/dict/dict0crea.cc117
-rw-r--r--storage/innobase/handler/ha_innodb.cc13
-rw-r--r--storage/innobase/include/row0mysql.h7
-rw-r--r--storage/innobase/log/log0recv.cc4
-rw-r--r--storage/innobase/row/row0purge.cc13
-rw-r--r--storage/innobase/sync/sync0rw.cc8
6 files changed, 25 insertions, 137 deletions
diff --git a/storage/innobase/dict/dict0crea.cc b/storage/innobase/dict/dict0crea.cc
index e145422c5bd..03446b18a8a 100644
--- a/storage/innobase/dict/dict0crea.cc
+++ b/storage/innobase/dict/dict0crea.cc
@@ -2012,86 +2012,6 @@ dict_create_add_foreign_to_dictionary(
DBUG_RETURN(error);
}
-/** Check whether a column is in an index by the column name
-@param[in] col_name column name for the column to be checked
-@param[in] index the index to be searched
-@return true if this column is in the index, otherwise, false */
-static
-bool
-dict_index_has_col_by_name(
-/*=======================*/
- const char* col_name,
- const dict_index_t* index)
-{
- for (ulint i = 0; i < index->n_fields; i++) {
- dict_field_t* field = dict_index_get_nth_field(index, i);
-
- if (strcmp(field->name, col_name) == 0) {
- return(true);
- }
- }
- return(false);
-}
-
-/** Check whether the foreign constraint could be on a column that is
-part of a virtual index (index contains virtual column) in the table
-@param[in] fk_col_name FK column name to be checked
-@param[in] table the table
-@return true if this column is indexed with other virtual columns */
-bool
-dict_foreign_has_col_in_v_index(
- const char* fk_col_name,
- const dict_table_t* table)
-{
- /* virtual column can't be Primary Key, so start with secondary index */
- for (dict_index_t* index = dict_table_get_next_index(
- dict_table_get_first_index(table));
- index;
- index = dict_table_get_next_index(index)) {
-
- if (dict_index_has_virtual(index)) {
- if (dict_index_has_col_by_name(fk_col_name, index)) {
- return(true);
- }
- }
- }
-
- return(false);
-}
-
-
-/** Check whether the foreign constraint could be on a column that is
-a base column of some indexed virtual columns.
-@param[in] col_name column name for the column to be checked
-@param[in] table the table
-@return true if this column is a base column, otherwise, false */
-bool
-dict_foreign_has_col_as_base_col(
- const char* col_name,
- const dict_table_t* table)
-{
- /* Loop through each virtual column and check if its base column has
- the same name as the column name being checked */
- for (ulint i = 0; i < table->n_v_cols; i++) {
- dict_v_col_t* v_col = dict_table_get_nth_v_col(table, i);
-
- /* Only check if the virtual column is indexed */
- if (!v_col->m_col.ord_part) {
- continue;
- }
-
- for (ulint j = 0; j < v_col->num_base; j++) {
- if (strcmp(col_name, dict_table_get_col_name(
- table,
- v_col->base_col[j]->ind)) == 0) {
- return(true);
- }
- }
- }
-
- return(false);
-}
-
/** Check if a foreign constraint is on the given column name.
@param[in] col_name column name to be searched for fk constraint
@param[in] table table to which foreign key constraint belongs
@@ -2166,43 +2086,6 @@ dict_foreigns_has_s_base_col(
return(false);
}
-/** Check if a column is in foreign constraint with CASCADE properties or
-SET NULL
-@param[in] table table
-@param[in] fk_col_name name for the column to be checked
-@return true if the column is in foreign constraint, otherwise, false */
-bool
-dict_foreigns_has_this_col(
- const dict_table_t* table,
- const char* col_name)
-{
- dict_foreign_t* foreign;
- const dict_foreign_set* local_fk_set = &table->foreign_set;
-
- for (dict_foreign_set::const_iterator it = local_fk_set->begin();
- it != local_fk_set->end();
- ++it) {
- foreign = *it;
- ut_ad(foreign->id != NULL);
- ulint type = foreign->type;
-
- type &= ~(DICT_FOREIGN_ON_DELETE_NO_ACTION
- | DICT_FOREIGN_ON_UPDATE_NO_ACTION);
-
- if (type == 0) {
- continue;
- }
-
- for (ulint i = 0; i < foreign->n_fields; i++) {
- if (strcmp(foreign->foreign_col_names[i],
- col_name) == 0) {
- return(true);
- }
- }
- }
- return(false);
-}
-
/** Adds the given set of foreign key objects to the dictionary tables
in the database. This function does not modify the dictionary cache. The
caller must ensure that all foreign key objects contain a valid constraint
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index fc897af4b6e..9e0fcc4ed4b 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -20368,6 +20368,7 @@ static bool table_name_parse(
if (char *is_part = strchr(tbl_buf, '#')) {
*is_part = '\0';
+ tblnamelen = is_part - tbl_buf;
}
filename_to_tablename(tbl_buf, tblname, MAX_TABLE_NAME_LEN + 1, true);
@@ -20485,13 +20486,12 @@ static TABLE* innodb_find_table_for_vc(THD* thd, dict_table_t* table)
}
/** Get the computed value by supplying the base column values.
-@param[in,out] table table whose virtual column template to be built */
-void
-innobase_init_vc_templ(
- dict_table_t* table)
+@param[in,out] table table whose virtual column
+ template to be built */
+TABLE* innobase_init_vc_templ(dict_table_t* table)
{
if (table->vc_templ != NULL) {
- return;
+ return NULL;
}
table->vc_templ = UT_NEW_NOKEY(dict_vcol_templ_t());
@@ -20500,12 +20500,13 @@ innobase_init_vc_templ(
ut_ad(mysql_table);
if (!mysql_table) {
- return;
+ return NULL;
}
mutex_enter(&dict_sys->mutex);
innobase_build_v_templ(mysql_table, table, table->vc_templ, NULL, true);
mutex_exit(&dict_sys->mutex);
+ return mysql_table;
}
/** Change dbname and table name in table->vc_templ.
diff --git a/storage/innobase/include/row0mysql.h b/storage/innobase/include/row0mysql.h
index 96454995e74..cabca5699c4 100644
--- a/storage/innobase/include/row0mysql.h
+++ b/storage/innobase/include/row0mysql.h
@@ -944,10 +944,9 @@ innobase_get_computed_value(
dict_foreign_t* foreign);
/** Get the computed value by supplying the base column values.
-@param[in,out] table the table whose virtual column template to be built */
-void
-innobase_init_vc_templ(
- dict_table_t* table);
+@param[in,out] table the table whose virtual column
+ template to be built */
+TABLE* innobase_init_vc_templ(dict_table_t* table);
/** Change dbname and table name in table->vc_templ.
@param[in,out] table the table whose virtual column template
diff --git a/storage/innobase/log/log0recv.cc b/storage/innobase/log/log0recv.cc
index 5a42f9db206..07d44596ada 100644
--- a/storage/innobase/log/log0recv.cc
+++ b/storage/innobase/log/log0recv.cc
@@ -3400,6 +3400,8 @@ recv_recovery_from_checkpoint_start(lsn_t flush_lsn)
then there is a possiblity that hash table will not contain
all space ids redo logs. Rescan the remaining unstored
redo logs for the validation of missing tablespace. */
+ ut_ad(rescan || !missing_tablespace);
+
while (missing_tablespace) {
DBUG_PRINT("ib_log", ("Rescan of redo log to validate "
"the missing tablespace. Scan "
@@ -3423,6 +3425,8 @@ recv_recovery_from_checkpoint_start(lsn_t flush_lsn)
log_mutex_exit();
return err;
}
+
+ rescan = true;
}
if (srv_operation == SRV_OPERATION_NORMAL) {
diff --git a/storage/innobase/row/row0purge.cc b/storage/innobase/row/row0purge.cc
index b02343fd952..527cf0336d5 100644
--- a/storage/innobase/row/row0purge.cc
+++ b/storage/innobase/row/row0purge.cc
@@ -375,6 +375,13 @@ retry_purge_sec:
ut_ad(mtr.has_committed());
+ /* If the virtual column info is not used then reset the virtual column
+ info. */
+ if (node->vcol_info.is_requested()
+ && !node->vcol_info.is_used()) {
+ node->vcol_info.reset();
+ }
+
if (store_cur && !row_purge_restore_vsec_cur(
node, index, sec_pcur, sec_mtr, is_tree)) {
return false;
@@ -1100,8 +1107,10 @@ try_again:
goto try_again;
}
- /* Initialize the template for the table */
- innobase_init_vc_templ(node->table);
+ node->vcol_info.set_requested();
+ node->vcol_info.set_used();
+ node->vcol_info.set_table(innobase_init_vc_templ(node->table));
+ node->vcol_info.set_used();
}
clust_index = dict_table_get_first_index(node->table);
diff --git a/storage/innobase/sync/sync0rw.cc b/storage/innobase/sync/sync0rw.cc
index d5b0537c095..787d6d8501d 100644
--- a/storage/innobase/sync/sync0rw.cc
+++ b/storage/innobase/sync/sync0rw.cc
@@ -487,14 +487,6 @@ rw_lock_x_lock_wait_func(
lock->count_os_wait += static_cast<uint32_t>(count_os_wait);
rw_lock_stats.rw_x_os_wait_count.add(count_os_wait);
}
-
- rw_lock_stats.rw_x_spin_round_count.add(n_spins);
-
- if (count_os_wait > 0) {
- lock->count_os_wait +=
- static_cast<uint32_t>(count_os_wait);
- rw_lock_stats.rw_x_os_wait_count.add(count_os_wait);
- }
}
#ifdef UNIV_DEBUG