summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2020-02-20 22:00:43 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2020-02-20 22:00:43 +0200
commit96901d9545c5f2c5f02a47eeefb1af5ded80c578 (patch)
treef56256a237404002c0545655b7b754d87eb2d8e2
parent6618fc29749f8521c5a0a007ae6d6fadb5121717 (diff)
downloadmariadb-git-96901d9545c5f2c5f02a47eeefb1af5ded80c578.tar.gz
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.
-rw-r--r--storage/innobase/btr/btr0btr.cc12
-rw-r--r--storage/innobase/dict/dict0boot.cc12
-rw-r--r--storage/innobase/dict/dict0dict.cc31
-rw-r--r--storage/innobase/include/btr0btr.h2
-rw-r--r--storage/innobase/include/dict0dict.h13
-rw-r--r--storage/innobase/srv/srv0srv.cc6
-rw-r--r--storage/innobase/srv/srv0start.cc2
7 files changed, 16 insertions, 62 deletions
diff --git a/storage/innobase/btr/btr0btr.cc b/storage/innobase/btr/btr0btr.cc
index 54d13348e97..af3e7a69aa4 100644
--- a/storage/innobase/btr/btr0btr.cc
+++ b/storage/innobase/btr/btr0btr.cc
@@ -1031,7 +1031,7 @@ btr_free_root_check(
@param[in] type type of the index
@param[in] index_id index id
@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
@return page number of the created root
@retval FIL_NULL if did not succeed */
@@ -1101,7 +1101,7 @@ btr_create(
/* Not enough space for new segment, free root
segment before return. */
btr_free_root(block, mtr,
- !index->table->is_temporary());
+ !index || !index->table->is_temporary());
return(FIL_NULL);
}
@@ -1122,8 +1122,9 @@ btr_create(
ut_ad(!page_has_siblings(block->page.zip.data));
page_create_zip(block, index, 0, 0, mtr);
} else {
- page_create(block, mtr, index->table->not_redundant());
- if (index->is_spatial()) {
+ page_create(block, mtr,
+ index && index->table->not_redundant());
+ if (index && index->is_spatial()) {
static_assert(((FIL_PAGE_INDEX & 0xff00)
| byte(FIL_PAGE_RTREE))
== FIL_PAGE_RTREE, "compatibility");
@@ -1148,7 +1149,8 @@ btr_create(
Note: Insert Buffering is disabled for temporary tables given that
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);
}
diff --git a/storage/innobase/dict/dict0boot.cc b/storage/innobase/dict/dict0boot.cc
index f9d53267728..a68d8c2c0ba 100644
--- a/storage/innobase/dict/dict0boot.cc
+++ b/storage/innobase/dict/dict0boot.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
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
the terms of the GNU General Public License as published by the Free Software
@@ -162,7 +162,7 @@ dict_hdr_create(
/*--------------------------*/
root_page_no = btr_create(DICT_CLUSTERED | DICT_UNIQUE,
fil_system.sys_space, DICT_TABLES_ID,
- dict_ind_redundant, mtr);
+ nullptr, mtr);
if (root_page_no == FIL_NULL) {
return(FALSE);
@@ -172,7 +172,7 @@ dict_hdr_create(
/*--------------------------*/
root_page_no = btr_create(DICT_UNIQUE,
fil_system.sys_space, DICT_TABLE_IDS_ID,
- dict_ind_redundant, mtr);
+ nullptr, mtr);
if (root_page_no == FIL_NULL) {
return(FALSE);
@@ -183,7 +183,7 @@ dict_hdr_create(
/*--------------------------*/
root_page_no = btr_create(DICT_CLUSTERED | DICT_UNIQUE,
fil_system.sys_space, DICT_COLUMNS_ID,
- dict_ind_redundant, mtr);
+ nullptr, mtr);
if (root_page_no == FIL_NULL) {
return(FALSE);
@@ -194,7 +194,7 @@ dict_hdr_create(
/*--------------------------*/
root_page_no = btr_create(DICT_CLUSTERED | DICT_UNIQUE,
fil_system.sys_space, DICT_INDEXES_ID,
- dict_ind_redundant, mtr);
+ nullptr, mtr);
if (root_page_no == FIL_NULL) {
return(FALSE);
@@ -205,7 +205,7 @@ dict_hdr_create(
/*--------------------------*/
root_page_no = btr_create(DICT_CLUSTERED | DICT_UNIQUE,
fil_system.sys_space, DICT_FIELDS_ID,
- dict_ind_redundant, mtr);
+ nullptr, mtr);
if (root_page_no == FIL_NULL) {
return(FALSE);
diff --git a/storage/innobase/dict/dict0dict.cc b/storage/innobase/dict/dict0dict.cc
index 54f32a48e0c..710edb59764 100644
--- a/storage/innobase/dict/dict0dict.cc
+++ b/storage/innobase/dict/dict0dict.cc
@@ -40,9 +40,6 @@ Created 1/8/1996 Heikki Tuuri
#include "sql_table.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
/** Flag to control insert buffer debugging. */
extern uint ibuf_debug;
@@ -4357,34 +4354,6 @@ dict_set_merge_threshold_all_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.
@param[in] table the table where to look for the index
@param[in] name the index name to look for
diff --git a/storage/innobase/include/btr0btr.h b/storage/innobase/include/btr0btr.h
index f0b6a33d9a9..bc6c896cdf5 100644
--- a/storage/innobase/include/btr0btr.h
+++ b/storage/innobase/include/btr0btr.h
@@ -333,7 +333,7 @@ btr_node_ptr_get_child_page_no(
@param[in] type type of the index
@param[in,out] space tablespace where created
@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
@return page number of the created root
@retval FIL_NULL if did not succeed */
diff --git a/storage/innobase/include/dict0dict.h b/storage/innobase/include/dict0dict.h
index 70823dae7f4..4a2ca2b3daa 100644
--- a/storage/innobase/include/dict0dict.h
+++ b/storage/innobase/include/dict0dict.h
@@ -2,7 +2,7 @@
Copyright (c) 1996, 2018, Oracle and/or its affiliates. All Rights Reserved.
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
the terms of the GNU General Public License as published by the Free Software
@@ -1607,17 +1607,6 @@ extern dict_sys_t dict_sys;
#define dict_sys_lock() dict_sys.lock(__FILE__, __LINE__)
#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 @{ */
/* This struct is used to specify the name and type that a column must
diff --git a/storage/innobase/srv/srv0srv.cc b/storage/innobase/srv/srv0srv.cc
index aa12391f0d5..ca66ab453ed 100644
--- a/storage/innobase/srv/srv0srv.cc
+++ b/storage/innobase/srv/srv0srv.cc
@@ -761,10 +761,6 @@ static void srv_init()
mutex_create(LATCH_ID_PAGE_ZIP_STAT_PER_INDEX,
&page_zip_stat_per_index_mutex);
- /* Create dummy indexes for infimum and supremum records */
-
- dict_ind_init();
-
#ifdef WITH_INNODB_DISALLOW_WRITES
/* Writes have to be enabled on init or else we hang. Thus, we
always set the event here regardless of innobase_disallow_writes.
@@ -801,8 +797,6 @@ srv_free(void)
ut_d(os_event_destroy(srv_master_thread_disabled_event));
- dict_ind_free();
-
trx_i_s_cache_free(trx_i_s_cache);
srv_thread_pool_end();
}
diff --git a/storage/innobase/srv/srv0start.cc b/storage/innobase/srv/srv0start.cc
index eb139a59845..b6833543f44 100644
--- a/storage/innobase/srv/srv0start.cc
+++ b/storage/innobase/srv/srv0start.cc
@@ -1495,7 +1495,7 @@ file_checked:
ulint ibuf_root = btr_create(
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);