summaryrefslogtreecommitdiff
path: root/storage/innobase
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2020-03-21 11:37:10 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2020-03-21 11:37:10 +0200
commit5203bc10f1f545131d01c253163ba06b6218be2c (patch)
treebb28122ee8a279bd9ad9b0358ac131356a80a7e8 /storage/innobase
parent76cdc1d73ec0215c91725a8507da7bda416c52ec (diff)
parent9394cc89143e4fce3126a96ac1c8a91a66d71dea (diff)
downloadmariadb-git-5203bc10f1f545131d01c253163ba06b6218be2c.tar.gz
Merge 10.4 into 10.5
Diffstat (limited to 'storage/innobase')
-rw-r--r--storage/innobase/buf/buf0buf.cc2
-rw-r--r--storage/innobase/buf/buf0rea.cc7
-rw-r--r--storage/innobase/dict/dict0dict.cc2
-rw-r--r--storage/innobase/fil/fil0fil.cc18
-rw-r--r--storage/innobase/handler/ha_innodb.cc2
-rw-r--r--storage/innobase/include/fil0fil.h9
-rw-r--r--storage/innobase/include/log0recv.h7
-rw-r--r--storage/innobase/include/row0merge.h12
-rw-r--r--storage/innobase/lock/lock0lock.cc5
-rw-r--r--storage/innobase/log/log0recv.cc13
-rw-r--r--storage/innobase/os/os0file.cc4
-rw-r--r--storage/innobase/row/row0merge.cc16
-rw-r--r--storage/innobase/row/row0mysql.cc13
-rw-r--r--storage/innobase/trx/trx0roll.cc3
14 files changed, 36 insertions, 77 deletions
diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc
index 7df8815d73f..bb2e2c230c9 100644
--- a/storage/innobase/buf/buf0buf.cc
+++ b/storage/innobase/buf/buf0buf.cc
@@ -2319,7 +2319,7 @@ withdraw_retry:
ut_zalloc_nokey_nofatal(new_chunks_size));
DBUG_EXECUTE_IF("buf_pool_resize_chunk_null",
- { ut_free(new_chunks); new_chunks= nullptr; });
+ ut_free(new_chunks); new_chunks= nullptr; );
if (!new_chunks) {
ib::error() << "failed to allocate"
diff --git a/storage/innobase/buf/buf0rea.cc b/storage/innobase/buf/buf0rea.cc
index 4dceaf8f524..adecbf3cfe1 100644
--- a/storage/innobase/buf/buf0rea.cc
+++ b/storage/innobase/buf/buf0rea.cc
@@ -747,9 +747,12 @@ buf_read_recv_pages(
for (ulint i = 0; i < n_stored; i++) {
const page_id_t cur_page_id(space_id, page_nos[i]);
- for (ulint count = 0, limit = recv_sys.max_blocks() / 2;
- buf_pool.n_pend_reads >= limit; ) {
+ ulint limit = 0;
+ for (ulint j = 0; j < buf_pool.n_chunks; j++) {
+ limit += buf_pool.chunks[j].size / 2;
+ }
+ for (ulint count = 0; buf_pool.n_pend_reads >= limit; ) {
os_thread_sleep(10000);
if (!(++count % 1000)) {
diff --git a/storage/innobase/dict/dict0dict.cc b/storage/innobase/dict/dict0dict.cc
index d66dd642acb..b907fc3575a 100644
--- a/storage/innobase/dict/dict0dict.cc
+++ b/storage/innobase/dict/dict0dict.cc
@@ -1495,7 +1495,7 @@ dict_table_rename_in_cache(
return(DB_OUT_OF_MEMORY);
}
- fil_delete_tablespace(table->space_id);
+ fil_delete_tablespace(table->space_id, !table->space);
/* Delete any temp file hanging around. */
if (os_file_status(filepath, &exists, &ftype)
diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc
index d7c3fb5cb69..788fd34bd52 100644
--- a/storage/innobase/fil/fil0fil.cc
+++ b/storage/innobase/fil/fil0fil.cc
@@ -2253,14 +2253,9 @@ bool fil_table_accessible(const dict_table_t* table)
/** Delete a tablespace and associated .ibd file.
@param[in] id tablespace identifier
+@param[in] if_exists whether to ignore missing tablespace
@return DB_SUCCESS or error */
-dberr_t
-fil_delete_tablespace(
- ulint id
-#ifdef BTR_CUR_HASH_ADAPT
- , bool drop_ahi /*!< whether to drop the adaptive hash index */
-#endif /* BTR_CUR_HASH_ADAPT */
- )
+dberr_t fil_delete_tablespace(ulint id, bool if_exists)
{
char* path = 0;
fil_space_t* space = 0;
@@ -2271,10 +2266,11 @@ fil_delete_tablespace(
id, FIL_OPERATION_DELETE, &space, &path);
if (err != DB_SUCCESS) {
-
- ib::error() << "Cannot delete tablespace " << id
- << " because it is not found in the tablespace"
- " memory cache.";
+ if (!if_exists) {
+ ib::error() << "Cannot delete tablespace " << id
+ << " because it is not found"
+ " in the tablespace memory cache.";
+ }
return(err);
}
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index 2107153b48e..808f78a9498 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -14881,7 +14881,7 @@ ha_innobase::optimize(
calls to OPTIMIZE, which is undesirable. */
bool try_alter = true;
- if (srv_defragment) {
+ if (!m_prebuilt->table->is_temporary() && srv_defragment) {
int err= defragment_table(
m_prebuilt->table->name.m_name, NULL, false);
diff --git a/storage/innobase/include/fil0fil.h b/storage/innobase/include/fil0fil.h
index 8c1cd2e9a34..5622ffb4f9e 100644
--- a/storage/innobase/include/fil0fil.h
+++ b/storage/innobase/include/fil0fil.h
@@ -1187,14 +1187,9 @@ bool fil_table_accessible(const dict_table_t* table)
/** Delete a tablespace and associated .ibd file.
@param[in] id tablespace identifier
+@param[in] if_exists whether to ignore missing tablespace
@return DB_SUCCESS or error */
-dberr_t
-fil_delete_tablespace(
- ulint id
-#ifdef BTR_CUR_HASH_ADAPT
- , bool drop_ahi = false /*!< whether to drop the adaptive hash index */
-#endif /* BTR_CUR_HASH_ADAPT */
- );
+dberr_t fil_delete_tablespace(ulint id, bool if_exists= false);
/** Prepare to truncate an undo tablespace.
@param[in] space_id undo tablespace id
diff --git a/storage/innobase/include/log0recv.h b/storage/innobase/include/log0recv.h
index dfc3caba656..c8e0f6717f2 100644
--- a/storage/innobase/include/log0recv.h
+++ b/storage/innobase/include/log0recv.h
@@ -307,15 +307,10 @@ private:
void open_log_files_if_needed();
- /** Maximum number of buffer pool blocks to allocate for redo log records */
- ulint max_log_blocks;
-
- /** Base node of the redo block list (up to max_log_blocks)
+ /** Base node of the redo block list.
List elements are linked via buf_block_t::unzip_LRU. */
UT_LIST_BASE_NODE_T(buf_block_t) blocks;
public:
- /** @return the maximum number of buffer pool blocks for log records */
- ulint max_blocks() const { return max_log_blocks; }
/** Check whether the number of read redo log blocks exceeds the maximum.
Store last_stored_lsn if the recovery is not in the last phase.
@param[in,out] store whether to store page operations
diff --git a/storage/innobase/include/row0merge.h b/storage/innobase/include/row0merge.h
index 25ee088f1f7..5a2e63d6d23 100644
--- a/storage/innobase/include/row0merge.h
+++ b/storage/innobase/include/row0merge.h
@@ -203,18 +203,6 @@ row_merge_file_destroy_low(
const pfs_os_file_t& fd); /*!< in: merge file descriptor */
/*********************************************************************//**
-Provide a new pathname for a table that is being renamed if it belongs to
-a file-per-table tablespace. The caller is responsible for freeing the
-memory allocated for the return value.
-@return new pathname of tablespace file, or NULL if space = 0 */
-char*
-row_make_new_pathname(
-/*==================*/
- dict_table_t* table, /*!< in: table to be renamed */
- const char* new_name) /*!< in: new name */
- MY_ATTRIBUTE((nonnull, warn_unused_result));
-
-/*********************************************************************//**
Rename an index in the dictionary that was created. The data
dictionary must have been locked exclusively by the caller, because
the transaction will not be committed.
diff --git a/storage/innobase/lock/lock0lock.cc b/storage/innobase/lock/lock0lock.cc
index 401de967808..d36bd822ab6 100644
--- a/storage/innobase/lock/lock0lock.cc
+++ b/storage/innobase/lock/lock0lock.cc
@@ -6754,7 +6754,7 @@ DeadlockChecker::trx_rollback()
print("*** WE ROLL BACK TRANSACTION (1)\n");
#ifdef WITH_WSREP
- if (wsrep_on(trx->mysql_thd)) {
+ if (wsrep_on(trx->mysql_thd) && wsrep_thd_is_SR(trx->mysql_thd)) {
wsrep_handle_SR_rollback(m_start->mysql_thd, trx->mysql_thd);
}
#endif
@@ -6847,7 +6847,8 @@ DeadlockChecker::check_and_resolve(const lock_t* lock, trx_t* trx)
print("*** WE ROLL BACK TRANSACTION (2)\n");
#ifdef WITH_WSREP
- if (wsrep_on(trx->mysql_thd)) {
+ if (wsrep_on(trx->mysql_thd)
+ && wsrep_thd_is_SR(trx->mysql_thd)) {
wsrep_handle_SR_rollback(trx->mysql_thd,
victim_trx->mysql_thd);
}
diff --git a/storage/innobase/log/log0recv.cc b/storage/innobase/log/log0recv.cc
index 098bc987252..93865602c98 100644
--- a/storage/innobase/log/log0recv.cc
+++ b/storage/innobase/log/log0recv.cc
@@ -1008,14 +1008,8 @@ void recv_sys_t::create()
apply_log_recs = false;
apply_batch_on = false;
- if (buf_pool.is_initialised()) {
- max_log_blocks = buf_pool.get_n_pages() / 3;
- } else {
- ut_ad(srv_operation == SRV_OPERATION_BACKUP
- || srv_operation == SRV_OPERATION_RESTORE_DELTA);
- max_log_blocks = 0;
- }
- buf = static_cast<byte*>(ut_malloc_dontdump(RECV_PARSING_BUF_SIZE, PSI_INSTRUMENT_ME));
+ buf = static_cast<byte*>(ut_malloc_dontdump(RECV_PARSING_BUF_SIZE,
+ PSI_INSTRUMENT_ME));
len = 0;
parse_start_lsn = 0;
scanned_lsn = 0;
@@ -2722,7 +2716,8 @@ Store last_stored_lsn if the recovery is not in the last phase.
@return whether the memory is exhausted */
inline bool recv_sys_t::is_memory_exhausted(store_t *store)
{
- if (*store == STORE_NO || UT_LIST_GET_LEN(blocks) < max_log_blocks)
+ if (*store == STORE_NO ||
+ UT_LIST_GET_LEN(blocks) * 3 < buf_pool.get_n_pages())
return false;
if (*store == STORE_YES)
last_stored_lsn= recovered_lsn;
diff --git a/storage/innobase/os/os0file.cc b/storage/innobase/os/os0file.cc
index b46caac721e..324ee7d40a5 100644
--- a/storage/innobase/os/os0file.cc
+++ b/storage/innobase/os/os0file.cc
@@ -1928,12 +1928,12 @@ os_file_flush_func(
/** Retrieves the last error number if an error occurs in a file io function.
The number should be retrieved before any other OS calls (because they may
overwrite the error number). If the number is not known to this program,
-the OS error number + 100 is returned.
+then OS error number + OS_FILE_ERROR_MAX is returned.
@param[in] report_all_errors true if we want an error message printed
of all errors
@param[in] on_error_silent true then don't print any diagnostic
to the log
-@return error number, or OS error number + 100 */
+@return error number, or OS error number + OS_FILE_ERROR_MAX */
static
ulint
os_file_get_last_error_low(
diff --git a/storage/innobase/row/row0merge.cc b/storage/innobase/row/row0merge.cc
index ef9d8ee542c..1c3f52e1b4a 100644
--- a/storage/innobase/row/row0merge.cc
+++ b/storage/innobase/row/row0merge.cc
@@ -4236,22 +4236,6 @@ row_merge_rename_index_to_drop(
return(err);
}
-/*********************************************************************//**
-Provide a new pathname for a table that is being renamed if it belongs to
-a file-per-table tablespace. The caller is responsible for freeing the
-memory allocated for the return value.
-@return new pathname of tablespace file, or NULL if space = 0 */
-char*
-row_make_new_pathname(
-/*==================*/
- dict_table_t* table, /*!< in: table to be renamed */
- const char* new_name) /*!< in: new name */
-{
- ut_ad(!is_system_tablespace(table->space_id));
- return os_file_make_new_pathname(table->space->chain.start->name,
- new_name);
-}
-
/** Create the index and load in to the dictionary.
@param[in,out] table the index is on this table
@param[in] index_def the index definition
diff --git a/storage/innobase/row/row0mysql.cc b/storage/innobase/row/row0mysql.cc
index a9bcd9463a2..48c44d15941 100644
--- a/storage/innobase/row/row0mysql.cc
+++ b/storage/innobase/row/row0mysql.cc
@@ -3735,10 +3735,11 @@ do_drop:
dict_table_t. */
if (DICT_TF_HAS_DATA_DIR(table->flags)) {
dict_get_and_save_data_dir_path(table, true);
- ut_a(table->data_dir_path);
+ ut_ad(table->data_dir_path || !space);
filepath = space ? NULL : fil_make_filepath(
table->data_dir_path,
- table->name.m_name, IBD, true);
+ table->name.m_name, IBD,
+ table->data_dir_path != NULL);
} else {
filepath = space ? NULL : fil_make_filepath(
NULL, table->name.m_name, IBD, false);
@@ -4316,14 +4317,14 @@ row_rename_table_for_mysql(
/* SYS_TABLESPACES and SYS_DATAFILES need to be updated if
the table is in a single-table tablespace. */
- if (err == DB_SUCCESS
- && dict_table_is_file_per_table(table)) {
- /* Make a new pathname to update SYS_DATAFILES. */
+ if (err != DB_SUCCESS || !dict_table_is_file_per_table(table)) {
+ } else if (table->space) {
/* If old path and new path are the same means tablename
has not changed and only the database name holding the table
has changed so we need to make the complete filepath again. */
char* new_path = dict_tables_have_same_db(old_name, new_name)
- ? row_make_new_pathname(table, new_name)
+ ? os_file_make_new_pathname(
+ table->space->chain.start->name, new_name)
: fil_make_filepath(NULL, new_name, IBD, false);
info = pars_info_create();
diff --git a/storage/innobase/trx/trx0roll.cc b/storage/innobase/trx/trx0roll.cc
index 38e98324f7e..e55bf5ebc4b 100644
--- a/storage/innobase/trx/trx0roll.cc
+++ b/storage/innobase/trx/trx0roll.cc
@@ -182,7 +182,8 @@ trx_rollback_to_savepoint(
complete rollback */
{
#ifdef WITH_WSREP
- if (savept == NULL && wsrep_on(trx->mysql_thd)) {
+ if (savept == NULL && wsrep_on(trx->mysql_thd)
+ && wsrep_thd_is_SR(trx->mysql_thd)) {
wsrep_handle_SR_rollback(NULL, trx->mysql_thd);
}
#endif /* WITH_WSREP */