Commit 96901d95 authored by Marko Mäkelä's avatar Marko Mäkelä

Cleanup: Remove dict_ind_redundant

There is no reason for the dummy index object dict_ind_redundant
to exist any more. It was only being passed to btr_create().

btr_create(): If !index, assume that a ROW_FORMAT=REDUNDANT
table is being created.

We could pass ibuf.index, dict_sys.sys_tables->indexes.start
and so on, if those objects had been initialized before the
function btr_create() is called.
parent 6618fc29
...@@ -1031,7 +1031,7 @@ btr_free_root_check( ...@@ -1031,7 +1031,7 @@ btr_free_root_check(
@param[in] type type of the index @param[in] type type of the index
@param[in] index_id index id @param[in] index_id index id
@param[in,out] space tablespace where created @param[in,out] space tablespace where created
@param[in] index index @param[in] index index, or NULL to create a system table
@param[in,out] mtr mini-transaction @param[in,out] mtr mini-transaction
@return page number of the created root @return page number of the created root
@retval FIL_NULL if did not succeed */ @retval FIL_NULL if did not succeed */
...@@ -1101,7 +1101,7 @@ btr_create( ...@@ -1101,7 +1101,7 @@ btr_create(
/* Not enough space for new segment, free root /* Not enough space for new segment, free root
segment before return. */ segment before return. */
btr_free_root(block, mtr, btr_free_root(block, mtr,
!index->table->is_temporary()); !index || !index->table->is_temporary());
return(FIL_NULL); return(FIL_NULL);
} }
...@@ -1122,8 +1122,9 @@ btr_create( ...@@ -1122,8 +1122,9 @@ btr_create(
ut_ad(!page_has_siblings(block->page.zip.data)); ut_ad(!page_has_siblings(block->page.zip.data));
page_create_zip(block, index, 0, 0, mtr); page_create_zip(block, index, 0, 0, mtr);
} else { } else {
page_create(block, mtr, index->table->not_redundant()); page_create(block, mtr,
if (index->is_spatial()) { index && index->table->not_redundant());
if (index && index->is_spatial()) {
static_assert(((FIL_PAGE_INDEX & 0xff00) static_assert(((FIL_PAGE_INDEX & 0xff00)
| byte(FIL_PAGE_RTREE)) | byte(FIL_PAGE_RTREE))
== FIL_PAGE_RTREE, "compatibility"); == FIL_PAGE_RTREE, "compatibility");
...@@ -1148,7 +1149,8 @@ btr_create( ...@@ -1148,7 +1149,8 @@ btr_create(
Note: Insert Buffering is disabled for temporary tables given that Note: Insert Buffering is disabled for temporary tables given that
most temporary tables are smaller in size and short-lived. */ most temporary tables are smaller in size and short-lived. */
if (!(type & DICT_CLUSTERED) && !index->table->is_temporary()) { if (!(type & DICT_CLUSTERED)
&& (!index || !index->table->is_temporary())) {
ibuf_reset_free_bits(block); ibuf_reset_free_bits(block);
} }
......
/***************************************************************************** /*****************************************************************************
Copyright (c) 1996, 2017, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 1996, 2017, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2016, 2019, MariaDB Corporation. Copyright (c) 2016, 2020, 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
...@@ -162,7 +162,7 @@ dict_hdr_create( ...@@ -162,7 +162,7 @@ dict_hdr_create(
/*--------------------------*/ /*--------------------------*/
root_page_no = btr_create(DICT_CLUSTERED | DICT_UNIQUE, root_page_no = btr_create(DICT_CLUSTERED | DICT_UNIQUE,
fil_system.sys_space, DICT_TABLES_ID, fil_system.sys_space, DICT_TABLES_ID,
dict_ind_redundant, mtr); nullptr, mtr);
if (root_page_no == FIL_NULL) { if (root_page_no == FIL_NULL) {
return(FALSE); return(FALSE);
...@@ -172,7 +172,7 @@ dict_hdr_create( ...@@ -172,7 +172,7 @@ dict_hdr_create(
/*--------------------------*/ /*--------------------------*/
root_page_no = btr_create(DICT_UNIQUE, root_page_no = btr_create(DICT_UNIQUE,
fil_system.sys_space, DICT_TABLE_IDS_ID, fil_system.sys_space, DICT_TABLE_IDS_ID,
dict_ind_redundant, mtr); nullptr, mtr);
if (root_page_no == FIL_NULL) { if (root_page_no == FIL_NULL) {
return(FALSE); return(FALSE);
...@@ -183,7 +183,7 @@ dict_hdr_create( ...@@ -183,7 +183,7 @@ dict_hdr_create(
/*--------------------------*/ /*--------------------------*/
root_page_no = btr_create(DICT_CLUSTERED | DICT_UNIQUE, root_page_no = btr_create(DICT_CLUSTERED | DICT_UNIQUE,
fil_system.sys_space, DICT_COLUMNS_ID, fil_system.sys_space, DICT_COLUMNS_ID,
dict_ind_redundant, mtr); nullptr, mtr);
if (root_page_no == FIL_NULL) { if (root_page_no == FIL_NULL) {
return(FALSE); return(FALSE);
...@@ -194,7 +194,7 @@ dict_hdr_create( ...@@ -194,7 +194,7 @@ dict_hdr_create(
/*--------------------------*/ /*--------------------------*/
root_page_no = btr_create(DICT_CLUSTERED | DICT_UNIQUE, root_page_no = btr_create(DICT_CLUSTERED | DICT_UNIQUE,
fil_system.sys_space, DICT_INDEXES_ID, fil_system.sys_space, DICT_INDEXES_ID,
dict_ind_redundant, mtr); nullptr, mtr);
if (root_page_no == FIL_NULL) { if (root_page_no == FIL_NULL) {
return(FALSE); return(FALSE);
...@@ -205,7 +205,7 @@ dict_hdr_create( ...@@ -205,7 +205,7 @@ dict_hdr_create(
/*--------------------------*/ /*--------------------------*/
root_page_no = btr_create(DICT_CLUSTERED | DICT_UNIQUE, root_page_no = btr_create(DICT_CLUSTERED | DICT_UNIQUE,
fil_system.sys_space, DICT_FIELDS_ID, fil_system.sys_space, DICT_FIELDS_ID,
dict_ind_redundant, mtr); nullptr, mtr);
if (root_page_no == FIL_NULL) { if (root_page_no == FIL_NULL) {
return(FALSE); return(FALSE);
......
...@@ -40,9 +40,6 @@ Created 1/8/1996 Heikki Tuuri ...@@ -40,9 +40,6 @@ Created 1/8/1996 Heikki Tuuri
#include "sql_table.h" #include "sql_table.h"
#include <mysql/service_thd_mdl.h> #include <mysql/service_thd_mdl.h>
/** dummy index for ROW_FORMAT=REDUNDANT supremum and infimum records */
dict_index_t* dict_ind_redundant;
#if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG #if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG
/** Flag to control insert buffer debugging. */ /** Flag to control insert buffer debugging. */
extern uint ibuf_debug; extern uint ibuf_debug;
...@@ -4357,34 +4354,6 @@ dict_set_merge_threshold_all_debug( ...@@ -4357,34 +4354,6 @@ dict_set_merge_threshold_all_debug(
#endif /* UNIV_DEBUG */ #endif /* UNIV_DEBUG */
/** Initialize dict_ind_redundant. */
void
dict_ind_init()
{
dict_table_t* table;
/* create dummy table and index for REDUNDANT infimum and supremum */
table = dict_mem_table_create("SYS_DUMMY1", NULL, 1, 0, 0, 0);
dict_mem_table_add_col(table, NULL, NULL, DATA_CHAR,
DATA_ENGLISH | DATA_NOT_NULL, 8);
dict_ind_redundant = dict_mem_index_create(table, "SYS_DUMMY1", 0, 1);
dict_index_add_col(dict_ind_redundant, table,
dict_table_get_nth_col(table, 0), 0);
/* avoid ut_ad(index->cached) in dict_index_get_n_unique_in_tree */
dict_ind_redundant->cached = TRUE;
}
/** Free dict_ind_redundant. */
void
dict_ind_free()
{
dict_table_t* table = dict_ind_redundant->table;
dict_mem_index_free(dict_ind_redundant);
dict_ind_redundant = NULL;
dict_mem_table_free(table);
}
/** Get an index by name. /** Get an index by name.
@param[in] table the table where to look for the index @param[in] table the table where to look for the index
@param[in] name the index name to look for @param[in] name the index name to look for
......
...@@ -333,7 +333,7 @@ btr_node_ptr_get_child_page_no( ...@@ -333,7 +333,7 @@ btr_node_ptr_get_child_page_no(
@param[in] type type of the index @param[in] type type of the index
@param[in,out] space tablespace where created @param[in,out] space tablespace where created
@param[in] index_id index id @param[in] index_id index id
@param[in] index index @param[in] index index, or NULL to create a system table
@param[in,out] mtr mini-transaction @param[in,out] mtr mini-transaction
@return page number of the created root @return page number of the created root
@retval FIL_NULL if did not succeed */ @retval FIL_NULL if did not succeed */
......
...@@ -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, 2019, MariaDB Corporation. Copyright (c) 2013, 2020, 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
...@@ -1607,17 +1607,6 @@ extern dict_sys_t dict_sys; ...@@ -1607,17 +1607,6 @@ extern dict_sys_t dict_sys;
#define dict_sys_lock() dict_sys.lock(__FILE__, __LINE__) #define dict_sys_lock() dict_sys.lock(__FILE__, __LINE__)
#define dict_sys_unlock() dict_sys.unlock() #define dict_sys_unlock() dict_sys.unlock()
/** dummy index for ROW_FORMAT=REDUNDANT supremum and infimum records */
extern dict_index_t* dict_ind_redundant;
/** Initialize dict_ind_redundant. */
void
dict_ind_init();
/** Free dict_ind_redundant. */
void
dict_ind_free();
/* Auxiliary structs for checking a table definition @{ */ /* Auxiliary structs for checking a table definition @{ */
/* This struct is used to specify the name and type that a column must /* This struct is used to specify the name and type that a column must
......
...@@ -761,10 +761,6 @@ static void srv_init() ...@@ -761,10 +761,6 @@ static void srv_init()
mutex_create(LATCH_ID_PAGE_ZIP_STAT_PER_INDEX, mutex_create(LATCH_ID_PAGE_ZIP_STAT_PER_INDEX,
&page_zip_stat_per_index_mutex); &page_zip_stat_per_index_mutex);
/* Create dummy indexes for infimum and supremum records */
dict_ind_init();
#ifdef WITH_INNODB_DISALLOW_WRITES #ifdef WITH_INNODB_DISALLOW_WRITES
/* Writes have to be enabled on init or else we hang. Thus, we /* Writes have to be enabled on init or else we hang. Thus, we
always set the event here regardless of innobase_disallow_writes. always set the event here regardless of innobase_disallow_writes.
...@@ -801,8 +797,6 @@ srv_free(void) ...@@ -801,8 +797,6 @@ srv_free(void)
ut_d(os_event_destroy(srv_master_thread_disabled_event)); ut_d(os_event_destroy(srv_master_thread_disabled_event));
dict_ind_free();
trx_i_s_cache_free(trx_i_s_cache); trx_i_s_cache_free(trx_i_s_cache);
srv_thread_pool_end(); srv_thread_pool_end();
} }
......
...@@ -1495,7 +1495,7 @@ dberr_t srv_start(bool create_new_db) ...@@ -1495,7 +1495,7 @@ dberr_t srv_start(bool create_new_db)
ulint ibuf_root = btr_create( ulint ibuf_root = btr_create(
DICT_CLUSTERED | DICT_IBUF, fil_system.sys_space, DICT_CLUSTERED | DICT_IBUF, fil_system.sys_space,
DICT_IBUF_ID_MIN, dict_ind_redundant, &mtr); DICT_IBUF_ID_MIN, nullptr, &mtr);
mtr_commit(&mtr); mtr_commit(&mtr);
......
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