Commit 8f23aab0 authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-15528 fixup: Remove dict_table_open_on_index_id()

dict_table_open_on_index_id(): Remove. This function was used by
the background scrubbing, which was removed in
commit a5584b13.
parent df931d88
/***************************************************************************** /*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2016, 2020, MariaDB Corporation. Copyright (c) 2016, 2021, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under 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 the terms of the GNU General Public License as published by the Free Software
...@@ -3685,81 +3685,3 @@ dict_load_foreigns( ...@@ -3685,81 +3685,3 @@ dict_load_foreigns(
DBUG_RETURN(DB_SUCCESS); DBUG_RETURN(DB_SUCCESS);
} }
/***********************************************************************//**
Loads a table id based on the index id.
@return true if found */
static
bool
dict_load_table_id_on_index_id(
/*===========================*/
index_id_t index_id, /*!< in: index id */
table_id_t* table_id) /*!< out: table id */
{
/* check hard coded indexes */
switch(index_id) {
case DICT_TABLES_ID:
case DICT_COLUMNS_ID:
case DICT_INDEXES_ID:
case DICT_FIELDS_ID:
*table_id = index_id;
return true;
case DICT_TABLE_IDS_ID:
/* The following is a secondary index on SYS_TABLES */
*table_id = DICT_TABLES_ID;
return true;
}
bool found = false;
mtr_t mtr;
ut_ad(mutex_own(&dict_sys.mutex));
/* NOTE that the operation of this function is protected by
the dictionary mutex, and therefore no deadlocks can occur
with other dictionary operations. */
mtr_start(&mtr);
btr_pcur_t pcur;
const rec_t* rec = dict_startscan_system(&pcur, &mtr, SYS_INDEXES);
while (rec) {
ulint len;
const byte* field = rec_get_nth_field_old(
rec, DICT_FLD__SYS_INDEXES__ID, &len);
ut_ad(len == 8);
/* Check if the index id is the one searched for */
if (index_id == mach_read_from_8(field)) {
found = true;
/* Now we get the table id */
const byte* field = rec_get_nth_field_old(
rec,
DICT_FLD__SYS_INDEXES__TABLE_ID,
&len);
*table_id = mach_read_from_8(field);
break;
}
mtr_commit(&mtr);
mtr_start(&mtr);
rec = dict_getnext_system(&pcur, &mtr);
}
btr_pcur_close(&pcur);
mtr_commit(&mtr);
return(found);
}
dict_table_t* dict_table_open_on_index_id(index_id_t index_id)
{
table_id_t table_id;
dict_table_t * table = NULL;
if (dict_load_table_id_on_index_id(index_id, &table_id)) {
table = dict_table_open_on_id(table_id, true,
DICT_TABLE_OP_LOAD_TABLESPACE);
}
return table;
}
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
Copyright (c) 1996, 2018, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 1996, 2018, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc. Copyright (c) 2012, Facebook Inc.
Copyright (c) 2013, 2020, MariaDB Corporation. Copyright (c) 2013, 2021, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under 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 the terms of the GNU General Public License as published by the Free Software
...@@ -152,12 +152,6 @@ dict_table_open_on_id(table_id_t table_id, bool dict_locked, ...@@ -152,12 +152,6 @@ dict_table_open_on_id(table_id_t table_id, bool dict_locked,
MDL_ticket **mdl= nullptr) MDL_ticket **mdl= nullptr)
MY_ATTRIBUTE((warn_unused_result)); MY_ATTRIBUTE((warn_unused_result));
/**********************************************************************//**
Returns a table object based on table id.
@return table, NULL if does not exist */
dict_table_t* dict_table_open_on_index_id(index_id_t index_id)
__attribute__((warn_unused_result));
/** Decrements the count of open handles of a table. /** Decrements the count of open handles of a table.
@param[in,out] table table @param[in,out] table table
@param[in] dict_locked data dictionary locked @param[in] dict_locked data dictionary locked
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment