MDEV-13564 follow-up: Remove dead code
In MariaDB 10.4.0, commit 09af00cbde1d62dfda574dee10e5c0fd240c3f7f removed the crash-upgrade logic for the MariaDB 10.2 innodb_safe_truncate=OFF TRUNCATE TABLE (which was the only option between MariaDB 10.2.2 and 10.2.18), but failed to adjust some comments and code. buf_page_io_complete(): Remove a bogus comment about TRUNCATE. dict_recreate_index_tree(): Unused function; remove. fil_space_t::stop_new_ops: Clarify the comment. fil_space_acquire_low(): Remove a bogus comment about TRUNCATE. fil_check_pending_ops(), fil_check_pending_io(): Adjust a warning message. This code is only invoked as part of DISCARD TABLESPACE or DROP TABLE. DROP TABLE is internally used as part of ALTER TABLE, OPTIMIZE TABLE, or TRUNCATE TABLE. RemoteDatafile::create_link_file(): Clarify a comment. ibuf_delete_for_discarded_space(): Clarify the function comment. dict_table_x_lock_indexes(), dict_table_x_unlock_indexes(): Merge with the only remaining caller, row_quiesce_set_state(). page_create_zip(): Remove a bogus comment about TRUNCATE.
This commit is contained in:
parent
d3350c160a
commit
e3c39c0be8
@ -6207,8 +6207,6 @@ database_corrupted:
|
||||
recv_recover_page(bpage);
|
||||
}
|
||||
|
||||
/* If space is being truncated then avoid ibuf operation.
|
||||
During re-init we have already freed ibuf entries. */
|
||||
if (uncompressed
|
||||
&& !recv_no_ibuf_operations
|
||||
&& (bpage->id.space() == 0
|
||||
|
@ -957,87 +957,6 @@ dict_drop_index_tree(
|
||||
return false;
|
||||
}
|
||||
|
||||
/*******************************************************************//**
|
||||
Recreate the index tree associated with a row in SYS_INDEXES table.
|
||||
@return new root page number, or FIL_NULL on failure */
|
||||
ulint
|
||||
dict_recreate_index_tree(
|
||||
/*=====================*/
|
||||
const dict_table_t*
|
||||
table, /*!< in/out: the table the index belongs to */
|
||||
btr_pcur_t* pcur, /*!< in/out: persistent cursor pointing to
|
||||
record in the clustered index of
|
||||
SYS_INDEXES table. The cursor may be
|
||||
repositioned in this call. */
|
||||
mtr_t* mtr) /*!< in/out: mtr having the latch
|
||||
on the record page. */
|
||||
{
|
||||
ut_ad(mutex_own(&dict_sys.mutex));
|
||||
ut_a(!dict_table_is_comp(dict_sys.sys_indexes));
|
||||
ut_ad(!table->space || table->space->id == table->space_id);
|
||||
|
||||
ulint len;
|
||||
const rec_t* rec = btr_pcur_get_rec(pcur);
|
||||
|
||||
const byte* ptr = rec_get_nth_field_old(
|
||||
rec, DICT_FLD__SYS_INDEXES__PAGE_NO, &len);
|
||||
|
||||
ut_ad(len == 4);
|
||||
|
||||
ut_ad(table->space_id == mach_read_from_4(
|
||||
rec_get_nth_field_old(rec, DICT_FLD__SYS_INDEXES__SPACE,
|
||||
&len)));
|
||||
ut_ad(len == 4);
|
||||
|
||||
if (!table->space) {
|
||||
/* It is a single table tablespae and the .ibd file is
|
||||
missing: do nothing. */
|
||||
|
||||
ib::warn()
|
||||
<< "Trying to TRUNCATE a missing .ibd file of table "
|
||||
<< table->name << "!";
|
||||
|
||||
return(FIL_NULL);
|
||||
}
|
||||
|
||||
ptr = rec_get_nth_field_old(rec, DICT_FLD__SYS_INDEXES__TYPE, &len);
|
||||
ut_ad(len == 4);
|
||||
ulint type = mach_read_from_4(ptr);
|
||||
|
||||
ptr = rec_get_nth_field_old(rec, DICT_FLD__SYS_INDEXES__ID, &len);
|
||||
ut_ad(len == 8);
|
||||
index_id_t index_id = mach_read_from_8(ptr);
|
||||
|
||||
/* We will need to commit the mini-transaction in order to avoid
|
||||
deadlocks in the btr_create() call, because otherwise we would
|
||||
be freeing and allocating pages in the same mini-transaction. */
|
||||
btr_pcur_store_position(pcur, mtr);
|
||||
mtr_commit(mtr);
|
||||
|
||||
mtr_start(mtr);
|
||||
mtr->set_named_space(table->space);
|
||||
btr_pcur_restore_position(BTR_MODIFY_LEAF, pcur, mtr);
|
||||
|
||||
/* Find the index corresponding to this SYS_INDEXES record. */
|
||||
for (dict_index_t* index = UT_LIST_GET_FIRST(table->indexes);
|
||||
index != NULL;
|
||||
index = UT_LIST_GET_NEXT(indexes, index)) {
|
||||
if (index->id == index_id) {
|
||||
ulint root_page_no = (index->type & DICT_FTS)
|
||||
? FIL_NULL
|
||||
: btr_create(type, table->space,
|
||||
index_id, index, mtr);
|
||||
index->page = unsigned(root_page_no);
|
||||
return root_page_no;
|
||||
}
|
||||
}
|
||||
|
||||
ib::error() << "Failed to create index with index id " << index_id
|
||||
<< " of table " << table->name;
|
||||
|
||||
return(FIL_NULL);
|
||||
}
|
||||
|
||||
/*********************************************************************//**
|
||||
Creates a table create graph.
|
||||
@return own: table create node */
|
||||
|
@ -1873,10 +1873,8 @@ for concurrency control.
|
||||
@param[in] id tablespace ID
|
||||
@param[in] silent whether to silently ignore missing tablespaces
|
||||
@return the tablespace
|
||||
@retval NULL if missing or being deleted or truncated */
|
||||
UNIV_INTERN
|
||||
fil_space_t*
|
||||
fil_space_acquire_low(ulint id, bool silent)
|
||||
@retval NULL if missing or being deleted */
|
||||
fil_space_t* fil_space_acquire_low(ulint id, bool silent)
|
||||
{
|
||||
fil_space_t* space;
|
||||
|
||||
@ -2203,9 +2201,7 @@ enum fil_operation_t {
|
||||
@param[in] space tablespace
|
||||
@param[in] count number of attempts so far
|
||||
@return 0 if no operations else count + 1. */
|
||||
static
|
||||
ulint
|
||||
fil_check_pending_ops(const fil_space_t* space, ulint count)
|
||||
static ulint fil_check_pending_ops(const fil_space_t* space, ulint count)
|
||||
{
|
||||
ut_ad(mutex_own(&fil_system.mutex));
|
||||
|
||||
@ -2216,7 +2212,7 @@ fil_check_pending_ops(const fil_space_t* space, ulint count)
|
||||
if (ulint n_pending_ops = space->n_pending_ops) {
|
||||
|
||||
if (count > 5000) {
|
||||
ib::warn() << "Trying to close/delete/truncate"
|
||||
ib::warn() << "Trying to delete"
|
||||
" tablespace '" << space->name
|
||||
<< "' but there are " << n_pending_ops
|
||||
<< " pending operations on it.";
|
||||
@ -2263,7 +2259,7 @@ fil_check_pending_io(
|
||||
ut_a(!(*node)->being_extended);
|
||||
|
||||
if (count > 1000) {
|
||||
ib::warn() << "Trying to delete/close/truncate"
|
||||
ib::warn() << "Trying to delete"
|
||||
" tablespace '" << space->name
|
||||
<< "' but there are "
|
||||
<< space->n_pending_flushes
|
||||
|
@ -931,8 +931,9 @@ RemoteDatafile::create_link_file(
|
||||
|
||||
prev_filepath = read_link_file(link_filepath);
|
||||
if (prev_filepath) {
|
||||
/* Truncate will call this with an existing
|
||||
link file which contains the same filepath. */
|
||||
/* Truncate (starting with MySQL 5.6, probably no
|
||||
longer since MariaDB Server 10.2.19) used to call this
|
||||
with an existing link file which contains the same filepath. */
|
||||
bool same = !strcmp(prev_filepath, filepath);
|
||||
ut_free(prev_filepath);
|
||||
if (same) {
|
||||
|
@ -4614,15 +4614,10 @@ reset_bit:
|
||||
ibuf_add_ops(ibuf->n_discarded_ops, dops);
|
||||
}
|
||||
|
||||
/*********************************************************************//**
|
||||
Deletes all entries in the insert buffer for a given space id. This is used
|
||||
in DISCARD TABLESPACE, IMPORT TABLESPACE, and 5.7 TRUNCATE TABLE recovery.
|
||||
NOTE: this does not update the page free bitmaps in the space. The space will
|
||||
become CORRUPT when you call this function! */
|
||||
void
|
||||
ibuf_delete_for_discarded_space(
|
||||
/*============================*/
|
||||
ulint space) /*!< in: space id */
|
||||
/** Delete all change buffer entries for a tablespace,
|
||||
in DISCARD TABLESPACE, IMPORT TABLESPACE, or crash recovery.
|
||||
@param[in] space missing or to-be-discarded tablespace */
|
||||
void ibuf_delete_for_discarded_space(ulint space)
|
||||
{
|
||||
mem_heap_t* heap;
|
||||
btr_pcur_t pcur;
|
||||
|
@ -96,22 +96,6 @@ dict_create_index_tree(
|
||||
dict_index_t* index, /*!< in/out: index */
|
||||
const trx_t* trx); /*!< in: InnoDB transaction handle */
|
||||
|
||||
/*******************************************************************//**
|
||||
Recreate the index tree associated with a row in SYS_INDEXES table.
|
||||
@return new root page number, or FIL_NULL on failure */
|
||||
ulint
|
||||
dict_recreate_index_tree(
|
||||
/*======================*/
|
||||
const dict_table_t* table, /*!< in: the table the index
|
||||
belongs to */
|
||||
btr_pcur_t* pcur, /*!< in/out: persistent cursor pointing
|
||||
to record in the clustered index of
|
||||
SYS_INDEXES table. The cursor may be
|
||||
repositioned in this call. */
|
||||
mtr_t* mtr); /*!< in: mtr having the latch
|
||||
on the record page. The mtr may be
|
||||
committed and restarted in this call. */
|
||||
|
||||
/** Drop the index tree associated with a row in SYS_INDEXES table.
|
||||
@param[in,out] rec SYS_INDEXES record
|
||||
@param[in,out] pcur persistent cursor on rec
|
||||
|
@ -910,24 +910,6 @@ inline ulint dict_table_extent_size(const dict_table_t* table)
|
||||
return FSP_EXTENT_SIZE;
|
||||
}
|
||||
|
||||
/*********************************************************************//**
|
||||
Obtain exclusive locks on all index trees of the table. This is to prevent
|
||||
accessing index trees while InnoDB is updating internal metadata for
|
||||
operations such as truncate tables. */
|
||||
UNIV_INLINE
|
||||
void
|
||||
dict_table_x_lock_indexes(
|
||||
/*======================*/
|
||||
dict_table_t* table) /*!< in: table */
|
||||
MY_ATTRIBUTE((nonnull));
|
||||
/*********************************************************************//**
|
||||
Release the exclusive locks on all index tree. */
|
||||
UNIV_INLINE
|
||||
void
|
||||
dict_table_x_unlock_indexes(
|
||||
/*========================*/
|
||||
dict_table_t* table) /*!< in: table */
|
||||
MY_ATTRIBUTE((nonnull));
|
||||
/********************************************************************//**
|
||||
Checks if a column is in the ordering columns of the clustered index of a
|
||||
table. Column prefixes are treated like whole columns.
|
||||
|
@ -705,28 +705,6 @@ dict_tf_to_sys_tables_type(
|
||||
return(type);
|
||||
}
|
||||
|
||||
/*********************************************************************//**
|
||||
Obtain exclusive locks on all index trees of the table. This is to prevent
|
||||
accessing index trees while InnoDB is updating internal metadata for
|
||||
operations such as truncate tables. */
|
||||
UNIV_INLINE
|
||||
void
|
||||
dict_table_x_lock_indexes(
|
||||
/*======================*/
|
||||
dict_table_t* table) /*!< in: table */
|
||||
{
|
||||
dict_index_t* index;
|
||||
|
||||
ut_ad(mutex_own(&dict_sys.mutex));
|
||||
|
||||
/* Loop through each index of the table and lock them */
|
||||
for (index = dict_table_get_first_index(table);
|
||||
index != NULL;
|
||||
index = dict_table_get_next_index(index)) {
|
||||
rw_lock_x_lock(dict_index_get_lock(index));
|
||||
}
|
||||
}
|
||||
|
||||
/*********************************************************************//**
|
||||
Returns true if the particular FTS index in the table is still syncing
|
||||
in the background, false otherwise.
|
||||
@ -748,24 +726,6 @@ dict_fts_index_syncing(
|
||||
}
|
||||
return(false);
|
||||
}
|
||||
/*********************************************************************//**
|
||||
Release the exclusive locks on all index tree. */
|
||||
UNIV_INLINE
|
||||
void
|
||||
dict_table_x_unlock_indexes(
|
||||
/*========================*/
|
||||
dict_table_t* table) /*!< in: table */
|
||||
{
|
||||
dict_index_t* index;
|
||||
|
||||
ut_ad(mutex_own(&dict_sys.mutex));
|
||||
|
||||
for (index = dict_table_get_first_index(table);
|
||||
index != NULL;
|
||||
index = dict_table_get_next_index(index)) {
|
||||
rw_lock_x_unlock(dict_index_get_lock(index));
|
||||
}
|
||||
}
|
||||
|
||||
/********************************************************************//**
|
||||
Gets the number of fields in the internal representation of an index,
|
||||
|
@ -92,18 +92,15 @@ struct fil_space_t {
|
||||
/** Log sequence number of the latest MLOG_INDEX_LOAD record
|
||||
that was found while parsing the redo log */
|
||||
lsn_t enable_lsn;
|
||||
/** set when an .ibd file is about to be deleted,
|
||||
or an undo tablespace is about to be truncated.
|
||||
When this is set following new ops are not allowed:
|
||||
* read IO request
|
||||
* ibuf merge
|
||||
* file flush
|
||||
Note that we can still possibly have new write operations
|
||||
because we don't check this flag when doing flush batches. */
|
||||
bool stop_new_ops;
|
||||
/*!< we set this true when we start
|
||||
deleting a single-table tablespace.
|
||||
When this is set following new ops
|
||||
are not allowed:
|
||||
* read IO request
|
||||
* ibuf merge
|
||||
* file flush
|
||||
Note that we can still possibly have
|
||||
new write operations because we don't
|
||||
check this flag when doing flush
|
||||
batches. */
|
||||
/** whether undo tablespace truncation is in progress */
|
||||
bool is_being_truncated;
|
||||
#ifdef UNIV_DEBUG
|
||||
@ -1112,10 +1109,8 @@ for concurrency control.
|
||||
@param[in] id tablespace ID
|
||||
@param[in] silent whether to silently ignore missing tablespaces
|
||||
@return the tablespace
|
||||
@retval NULL if missing or being deleted or truncated */
|
||||
UNIV_INTERN
|
||||
fil_space_t*
|
||||
fil_space_acquire_low(ulint id, bool silent)
|
||||
@retval NULL if missing or being deleted */
|
||||
fil_space_t* fil_space_acquire_low(ulint id, bool silent)
|
||||
MY_ATTRIBUTE((warn_unused_result));
|
||||
|
||||
/** Acquire a tablespace when it could be dropped concurrently.
|
||||
|
@ -337,15 +337,11 @@ ibuf_merge_or_delete_for_page(
|
||||
ulint zip_size,
|
||||
bool update_ibuf_bitmap);
|
||||
|
||||
/*********************************************************************//**
|
||||
Deletes all entries in the insert buffer for a given space id. This is used
|
||||
in DISCARD TABLESPACE and IMPORT TABLESPACE.
|
||||
NOTE: this does not update the page free bitmaps in the space. The space will
|
||||
become CORRUPT when you call this function! */
|
||||
void
|
||||
ibuf_delete_for_discarded_space(
|
||||
/*============================*/
|
||||
ulint space); /*!< in: space id */
|
||||
/** Delete all change buffer entries for a tablespace,
|
||||
in DISCARD TABLESPACE, IMPORT TABLESPACE, or crash recovery.
|
||||
@param[in] space missing or to-be-discarded tablespace */
|
||||
void ibuf_delete_for_discarded_space(ulint space);
|
||||
|
||||
/** Contract the change buffer by reading pages to the buffer pool.
|
||||
@param[in] full If true, do a full contraction based
|
||||
on PCT_IO(100). If false, the size of contract batch is determined
|
||||
|
@ -1023,9 +1023,7 @@ page_create_zip(
|
||||
buf_block_t* block, /*!< in/out: a buffer frame
|
||||
where the page is created */
|
||||
dict_index_t* index, /*!< in: the index of the
|
||||
page, or NULL when applying
|
||||
TRUNCATE log
|
||||
record during recovery */
|
||||
page */
|
||||
ulint level, /*!< in: the B-tree level of
|
||||
the page */
|
||||
trx_id_t max_trx_id, /*!< in: PAGE_MAX_TRX_ID */
|
||||
|
@ -448,9 +448,7 @@ page_create_zip(
|
||||
buf_block_t* block, /*!< in/out: a buffer frame
|
||||
where the page is created */
|
||||
dict_index_t* index, /*!< in: the index of the
|
||||
page, or NULL when applying
|
||||
TRUNCATE log
|
||||
record during recovery */
|
||||
page */
|
||||
ulint level, /*!< in: the B-tree level
|
||||
of the page */
|
||||
trx_id_t max_trx_id, /*!< in: PAGE_MAX_TRX_ID */
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 2012, 2016, 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
|
||||
@ -669,8 +669,11 @@ row_quiesce_set_state(
|
||||
}
|
||||
|
||||
row_mysql_lock_data_dictionary(trx);
|
||||
|
||||
dict_table_x_lock_indexes(table);
|
||||
for (dict_index_t* index = dict_table_get_first_index(table);
|
||||
index != NULL;
|
||||
index = dict_table_get_next_index(index)) {
|
||||
rw_lock_x_lock(&index->lock);
|
||||
}
|
||||
|
||||
switch (state) {
|
||||
case QUIESCE_START:
|
||||
@ -687,7 +690,11 @@ row_quiesce_set_state(
|
||||
|
||||
table->quiesce = state;
|
||||
|
||||
dict_table_x_unlock_indexes(table);
|
||||
for (dict_index_t* index = dict_table_get_first_index(table);
|
||||
index != NULL;
|
||||
index = dict_table_get_next_index(index)) {
|
||||
rw_lock_x_unlock(&index->lock);
|
||||
}
|
||||
|
||||
row_mysql_unlock_data_dictionary(trx);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user