summaryrefslogtreecommitdiff
path: root/storage/innobase
diff options
context:
space:
mode:
Diffstat (limited to 'storage/innobase')
-rw-r--r--storage/innobase/buf/buf0buddy.cc2
-rw-r--r--storage/innobase/dict/dict0mem.cc11
-rw-r--r--storage/innobase/dict/dict0stats_bg.cc22
-rw-r--r--storage/innobase/fsp/fsp0file.cc7
-rw-r--r--storage/innobase/handler/ha_innodb.cc19
-rw-r--r--storage/innobase/handler/ha_innodb.h13
-rw-r--r--storage/innobase/handler/handler0alter.cc4
-rw-r--r--storage/innobase/include/dict0mem.h11
-rw-r--r--storage/innobase/include/ut0new.h3
-rw-r--r--storage/innobase/os/os0file.cc2
-rw-r--r--storage/innobase/row/row0mysql.cc9
-rw-r--r--storage/innobase/row/row0trunc.cc17
-rw-r--r--storage/innobase/trx/trx0purge.cc2
-rw-r--r--storage/innobase/ut/ut0new.cc3
14 files changed, 61 insertions, 64 deletions
diff --git a/storage/innobase/buf/buf0buddy.cc b/storage/innobase/buf/buf0buddy.cc
index f932195897c..bd8d575d8c2 100644
--- a/storage/innobase/buf/buf0buddy.cc
+++ b/storage/innobase/buf/buf0buddy.cc
@@ -358,7 +358,7 @@ buf_buddy_alloc_zip(
if (buf) {
/* Trash the page other than the BUF_BUDDY_STAMP_NONFREE. */
- UNIV_MEM_TRASH(buf, ~i, BUF_BUDDY_STAMP_OFFSET);
+ UNIV_MEM_TRASH((void*) buf, ~i, BUF_BUDDY_STAMP_OFFSET);
UNIV_MEM_TRASH(BUF_BUDDY_STAMP_OFFSET + 4
+ buf->stamp.bytes, ~i,
(BUF_BUDDY_LOW << i)
diff --git a/storage/innobase/dict/dict0mem.cc b/storage/innobase/dict/dict0mem.cc
index 077fab8f131..d3333de5ced 100644
--- a/storage/innobase/dict/dict0mem.cc
+++ b/storage/innobase/dict/dict0mem.cc
@@ -2,7 +2,7 @@
Copyright (c) 1996, 2018, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc.
-Copyright (c) 2013, 2018, MariaDB Corporation.
+Copyright (c) 2013, 2019, 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
@@ -1076,14 +1076,7 @@ dict_mem_index_free(
mem_heap_free(index->heap);
}
-/** Create a temporary tablename like "#sql-ibtid-inc where
- tid = the Table ID
- inc = a randomly initialized number that is incremented for each file
-The table ID is a 64 bit integer, can use up to 20 digits, and is
-initialized at bootstrap. The second number is 32 bits, can use up to 10
-digits, and is initialized at startup to a randomly distributed number.
-It is hoped that the combination of these two numbers will provide a
-reasonably unique temporary file name.
+/** Create a temporary tablename like "#sql-ibNNN".
@param[in] heap A memory heap
@param[in] dbtab Table name in the form database/table name
@param[in] id Table id
diff --git a/storage/innobase/dict/dict0stats_bg.cc b/storage/innobase/dict/dict0stats_bg.cc
index ae31b3d0e37..7f4b12d302b 100644
--- a/storage/innobase/dict/dict0stats_bg.cc
+++ b/storage/innobase/dict/dict0stats_bg.cc
@@ -166,10 +166,26 @@ void dict_stats_update_if_needed_func(dict_table_t* table)
&& dict_stats_auto_recalc_is_enabled(table)) {
#ifdef WITH_WSREP
- if (thd && wsrep_on(thd) && wsrep_thd_is_BF(thd, 0)) {
+ /* Do not add table to background
+ statistic calculation if this thread is not a
+ applier (as all DDL, which is replicated (i.e
+ is binlogged in master node), will be executed
+ with high priority (a.k.a BF) in slave nodes)
+ and is BF. This could again lead BF lock
+ waits in applier node but it is better than
+ no persistent index/table statistics at
+ applier nodes. TODO: allow BF threads
+ wait for these InnoDB internal SQL-parser
+ generated row locks and allow BF thread
+ lock waits to be enqueued at head of waiting
+ queue. */
+ if (thd
+ && !wsrep_thd_is_applier(thd)
+ && wsrep_on(thd)
+ && wsrep_thd_is_BF(thd, 0)) {
WSREP_DEBUG("Avoiding background statistics"
- " calculation for table %s",
- table->name.m_name);
+ " calculation for table %s.",
+ table->name.m_name);
return;
}
#endif /* WITH_WSREP */
diff --git a/storage/innobase/fsp/fsp0file.cc b/storage/innobase/fsp/fsp0file.cc
index 3070f989c04..f32cf18b774 100644
--- a/storage/innobase/fsp/fsp0file.cc
+++ b/storage/innobase/fsp/fsp0file.cc
@@ -513,9 +513,9 @@ Datafile::validate_first_page(lsn_t* flush_lsn)
if (error_txt != NULL) {
err_exit:
- ib::error() << error_txt << " in datafile: " << m_filepath
+ ib::info() << error_txt << " in datafile: " << m_filepath
<< ", Space ID:" << m_space_id << ", Flags: "
- << m_flags << ". " << TROUBLESHOOT_DATADICT_MSG;
+ << m_flags;
m_is_valid = false;
free_first_page();
return(DB_CORRUPTION);
@@ -562,8 +562,7 @@ err_exit:
goto err_exit;
}
- if (m_space_id == ULINT_UNDEFINED) {
- /* The space_id can be most anything, except -1. */
+ if (m_space_id >= SRV_LOG_SPACE_FIRST_ID) {
error_txt = "A bad Space ID was found";
goto err_exit;
}
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index f33527b156d..8f45da30f9d 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -2914,7 +2914,6 @@ ha_innobase::ha_innobase(
TABLE_SHARE* table_arg)
:handler(hton, table_arg),
m_prebuilt(),
- m_prebuilt_ptr(&m_prebuilt),
m_user_thd(),
m_int_table_flags(HA_REC_NOT_IN_SEQ
| HA_NULL_IN_KEY
@@ -13000,8 +12999,6 @@ inline int ha_innobase::delete_table(const char* name, enum_sql_command sqlcom)
}
}
- /* TODO: remove this when the conversion tool from ha_partition to
- native innodb partitioning is completed */
if (err == DB_TABLE_NOT_FOUND
&& innobase_get_lower_case_table_names() == 1) {
char* is_part = is_partition(norm_name);
@@ -13349,12 +13346,26 @@ int ha_innobase::truncate()
if (!err) {
/* Reopen the newly created table, and drop the
original table that was renamed to temp_name. */
- close();
+
+ row_prebuilt_t* prebuilt = m_prebuilt;
+ uchar* upd_buf = m_upd_buf;
+ ulint upd_buf_size = m_upd_buf_size;
+ /* Mimic ha_innobase::close(). */
+ m_prebuilt = NULL;
+ m_upd_buf = NULL;
+ m_upd_buf_size = 0;
err = open(name, 0, 0);
if (!err) {
m_prebuilt->stored_select_lock_type = stored_lock;
m_prebuilt->table->update_time = update_time;
+ row_prebuilt_free(prebuilt, FALSE);
delete_table(temp_name, SQLCOM_TRUNCATE);
+ my_free(upd_buf);
+ } else {
+ /* Revert to the old table before truncation. */
+ m_prebuilt = prebuilt;
+ m_upd_buf = upd_buf;
+ m_upd_buf_size = upd_buf_size;
}
}
diff --git a/storage/innobase/handler/ha_innodb.h b/storage/innobase/handler/ha_innodb.h
index c2c93ad823c..ba34b739587 100644
--- a/storage/innobase/handler/ha_innodb.h
+++ b/storage/innobase/handler/ha_innodb.h
@@ -468,10 +468,6 @@ protected:
/** Save CPU time with prebuilt/cached data structures */
row_prebuilt_t* m_prebuilt;
- /** prebuilt pointer for the right prebuilt. For native
- partitioning, points to the current partition prebuilt. */
- row_prebuilt_t** m_prebuilt_ptr;
-
/** Thread handle of the user currently using the handler;
this is set in external_lock function */
THD* m_user_thd;
@@ -564,15 +560,6 @@ bool thd_is_strict_mode(const MYSQL_THD thd);
*/
extern void mysql_bin_log_commit_pos(THD *thd, ulonglong *out_pos, const char **out_file);
-/** Get the partition_info working copy.
-@param thd Thread object.
-@return NULL or pointer to partition_info working copy. */
-/* JAN: TODO: MySQL 5.7 Partitioning
-partition_info*
-thd_get_work_part_info(
- THD* thd);
-*/
-
struct trx_t;
#ifdef WITH_WSREP
//extern "C" int wsrep_trx_order_before(void *thd1, void *thd2);
diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc
index ae634c791b1..5d921f10793 100644
--- a/storage/innobase/handler/handler0alter.cc
+++ b/storage/innobase/handler/handler0alter.cc
@@ -6897,7 +6897,7 @@ err_exit:
if (heap) {
ha_alter_info->handler_ctx
= new ha_innobase_inplace_ctx(
- (*m_prebuilt_ptr),
+ m_prebuilt,
drop_index, n_drop_index,
rename_index, n_rename_index,
drop_fk, n_drop_fk,
@@ -7028,7 +7028,7 @@ found_col:
DBUG_ASSERT(!ha_alter_info->handler_ctx);
ha_alter_info->handler_ctx = new ha_innobase_inplace_ctx(
- (*m_prebuilt_ptr),
+ m_prebuilt,
drop_index, n_drop_index,
rename_index, n_rename_index,
drop_fk, n_drop_fk, add_fk, n_add_fk,
diff --git a/storage/innobase/include/dict0mem.h b/storage/innobase/include/dict0mem.h
index ef2a505085b..ea8460c1376 100644
--- a/storage/innobase/include/dict0mem.h
+++ b/storage/innobase/include/dict0mem.h
@@ -2,7 +2,7 @@
Copyright (c) 1996, 2017, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc.
-Copyright (c) 2013, 2018, MariaDB Corporation.
+Copyright (c) 2013, 2019, 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
@@ -476,14 +476,7 @@ void
dict_mem_table_free_foreign_vcol_set(
dict_table_t* table);
-/** Create a temporary tablename like "#sql-ibtid-inc where
- tid = the Table ID
- inc = a randomly initialized number that is incremented for each file
-The table ID is a 64 bit integer, can use up to 20 digits, and is
-initialized at bootstrap. The second number is 32 bits, can use up to 10
-digits, and is initialized at startup to a randomly distributed number.
-It is hoped that the combination of these two numbers will provide a
-reasonably unique temporary file name.
+/** Create a temporary tablename like "#sql-ibNNN".
@param[in] heap A memory heap
@param[in] dbtab Table name in the form database/table name
@param[in] id Table id
diff --git a/storage/innobase/include/ut0new.h b/storage/innobase/include/ut0new.h
index b79d03f1b0b..18321774cd4 100644
--- a/storage/innobase/include/ut0new.h
+++ b/storage/innobase/include/ut0new.h
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2014, 2015, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, 2018, MariaDB Corporation.
+Copyright (c) 2017, 2019, 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
@@ -174,7 +174,6 @@ extern PSI_memory_key mem_key_other;
extern PSI_memory_key mem_key_row_log_buf;
extern PSI_memory_key mem_key_row_merge_sort;
extern PSI_memory_key mem_key_std;
-extern PSI_memory_key mem_key_partitioning;
/** Setup the internal objects needed for UT_NEW() to operate.
This must be called before the first call to UT_NEW(). */
diff --git a/storage/innobase/os/os0file.cc b/storage/innobase/os/os0file.cc
index 82f792ad0fa..7890ea4e6dc 100644
--- a/storage/innobase/os/os0file.cc
+++ b/storage/innobase/os/os0file.cc
@@ -5726,7 +5726,7 @@ AIO::AIO(
m_not_full = os_event_create("aio_not_full");
m_is_empty = os_event_create("aio_is_empty");
- memset(&m_slots[0], 0x0, sizeof(m_slots[0]) * m_slots.size());
+ memset((void*)&m_slots[0], 0x0, sizeof(m_slots[0]) * m_slots.size());
#ifdef LINUX_NATIVE_AIO
memset(&m_events[0], 0x0, sizeof(m_events[0]) * m_events.size());
#endif /* LINUX_NATIVE_AIO */
diff --git a/storage/innobase/row/row0mysql.cc b/storage/innobase/row/row0mysql.cc
index 1d5357f7473..772d5487a0f 100644
--- a/storage/innobase/row/row0mysql.cc
+++ b/storage/innobase/row/row0mysql.cc
@@ -2686,10 +2686,15 @@ next:
goto next;
}
+ char* name = mem_strdup(table->name.m_name);
+
dict_table_close(table, FALSE, FALSE);
- if (DB_SUCCESS != row_drop_table_for_mysql_in_background(
- table->name.m_name)) {
+ dberr_t err = row_drop_table_for_mysql_in_background(name);
+
+ ut_free(name);
+
+ if (err != DB_SUCCESS) {
/* If the DROP fails for some table, we return, and let the
main thread retry later */
return(n_tables + n_tables_dropped);
diff --git a/storage/innobase/row/row0trunc.cc b/storage/innobase/row/row0trunc.cc
index ce98717b3c9..5f8a60b83c9 100644
--- a/storage/innobase/row/row0trunc.cc
+++ b/storage/innobase/row/row0trunc.cc
@@ -263,7 +263,7 @@ TruncateLogParser::scan(
while (fil_file_readdir_next_file(
&err, dir_path, dir, &fileinfo) == 0) {
- ulint nm_len = strlen(fileinfo.name);
+ const size_t nm_len = strlen(fileinfo.name);
if (fileinfo.type == OS_FILE_TYPE_FILE
&& nm_len > sizeof "ib_trunc.log"
@@ -286,18 +286,13 @@ TruncateLogParser::scan(
err = DB_OUT_OF_MEMORY;
break;
}
- memset(log_file_name, 0, sz);
- strncpy(log_file_name, dir_path, dir_len);
- ulint log_file_name_len = strlen(log_file_name);
- if (log_file_name[log_file_name_len - 1]
- != OS_PATH_SEPARATOR) {
-
- log_file_name[log_file_name_len]
- = OS_PATH_SEPARATOR;
- log_file_name_len = strlen(log_file_name);
+ memcpy(log_file_name, dir_path, dir_len);
+ char* e = log_file_name + dir_len;
+ if (e[-1] != OS_PATH_SEPARATOR) {
+ *e++ = OS_PATH_SEPARATOR;
}
- strcat(log_file_name, fileinfo.name);
+ strcpy(e, fileinfo.name);
log_files.push_back(log_file_name);
}
}
diff --git a/storage/innobase/trx/trx0purge.cc b/storage/innobase/trx/trx0purge.cc
index 1c9450fb26d..b77e09c898f 100644
--- a/storage/innobase/trx/trx0purge.cc
+++ b/storage/innobase/trx/trx0purge.cc
@@ -1447,7 +1447,7 @@ trx_purge_attach_undo_recs(ulint n_purge_threads)
const ulint batch_size = srv_purge_batch_size;
- for (;;) {
+ while (UNIV_LIKELY(srv_undo_sources) || !srv_fast_shutdown) {
purge_node_t* node;
trx_purge_rec_t* purge_rec;
diff --git a/storage/innobase/ut/ut0new.cc b/storage/innobase/ut/ut0new.cc
index 14f2748218c..f1d5eb7407a 100644
--- a/storage/innobase/ut/ut0new.cc
+++ b/storage/innobase/ut/ut0new.cc
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 2014, 2016, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2019, 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
@@ -41,7 +42,6 @@ PSI_memory_key mem_key_other;
PSI_memory_key mem_key_row_log_buf;
PSI_memory_key mem_key_row_merge_sort;
PSI_memory_key mem_key_std;
-PSI_memory_key mem_key_partitioning;
#ifdef UNIV_PFS_MEMORY
@@ -69,7 +69,6 @@ static PSI_memory_info pfs_info[] = {
{&mem_key_row_log_buf, "row_log_buf", 0},
{&mem_key_row_merge_sort, "row_merge_sort", 0},
{&mem_key_std, "std", 0},
- {&mem_key_partitioning, "partitioning", 0},
};
/** Map used for default performance schema keys, based on file name of the