summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2020-09-29 11:07:34 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2020-09-29 11:07:34 +0300
commitaa2f263e595624bb64ddd31ce081126381f86a39 (patch)
tree1a88d3a45d0e6778b4f4911f5fc7825a09a347ed
parent74bd3683ca8da4084e664f4f417b95fd74a5b319 (diff)
downloadmariadb-git-aa2f263e595624bb64ddd31ce081126381f86a39.tar.gz
Cleanup: Remove constant parameters async=false, index_name=NULL
-rw-r--r--storage/innobase/btr/btr0defragment.cc7
-rw-r--r--storage/innobase/handler/ha_innodb.cc35
-rw-r--r--storage/innobase/handler/ha_innodb.h3
-rw-r--r--storage/innobase/include/btr0defragment.h2
4 files changed, 6 insertions, 41 deletions
diff --git a/storage/innobase/btr/btr0defragment.cc b/storage/innobase/btr/btr0defragment.cc
index dfaa61a1343..645334cbf4d 100644
--- a/storage/innobase/btr/btr0defragment.cc
+++ b/storage/innobase/btr/btr0defragment.cc
@@ -157,8 +157,6 @@ synchronized defragmentation. */
os_event_t
btr_defragment_add_index(
dict_index_t* index, /*!< index to be added */
- bool async, /*!< whether this is an async
- defragmentation */
dberr_t* err) /*!< out: error code */
{
mtr_t mtr;
@@ -191,10 +189,7 @@ btr_defragment_add_index(
return NULL;
}
btr_pcur_t* pcur = btr_pcur_create_for_mysql();
- os_event_t event = NULL;
- if (!async) {
- event = os_event_create(0);
- }
+ os_event_t event = os_event_create(0);
btr_pcur_open_at_index_side(true, index, BTR_SEARCH_LEAF, pcur,
true, 0, &mtr);
btr_pcur_move_to_next(pcur, &mtr);
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index 2493a11b554..fb12297d698 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -14705,25 +14705,14 @@ ha_innobase::analyze(
/*****************************************************************//**
Defragment table.
@return error number */
-UNIV_INTERN
-int
-ha_innobase::defragment_table(
-/*==========================*/
- const char* name, /*!< in: table name */
- const char* index_name, /*!< in: index name */
- bool async) /*!< in: whether to wait until finish */
+inline int ha_innobase::defragment_table(const char *name)
{
char norm_name[FN_REFLEN];
dict_table_t* table = NULL;
dict_index_t* index = NULL;
- ibool one_index = (index_name != 0);
int ret = 0;
dberr_t err = DB_SUCCESS;
- if (!srv_defragment) {
- return ER_FEATURE_DISABLED;
- }
-
normalize_table_name(norm_name, name);
table = dict_table_open_on_name(norm_name, FALSE,
@@ -14751,10 +14740,6 @@ ha_innobase::defragment_table(
continue;
}
- if (one_index && strcasecmp(index_name, index->name) != 0) {
- continue;
- }
-
if (btr_defragment_find_index(index)) {
// We borrow this error code. When the same index is
// already in the defragmentation queue, issue another
@@ -14770,7 +14755,7 @@ ha_innobase::defragment_table(
break;
}
- os_event_t event = btr_defragment_add_index(index, async, &err);
+ os_event_t event = btr_defragment_add_index(index, &err);
if (err != DB_SUCCESS) {
push_warning_printf(
@@ -14786,7 +14771,7 @@ ha_innobase::defragment_table(
break;
}
- if (!async && event) {
+ if (event) {
while(os_event_wait_time(event, 1000000)) {
if (thd_killed(current_thd)) {
btr_defragment_remove_index(index);
@@ -14800,19 +14785,9 @@ ha_innobase::defragment_table(
if (ret) {
break;
}
-
- if (one_index) {
- one_index = FALSE;
- break;
- }
}
dict_table_close(table, FALSE, FALSE);
-
- if (ret == 0 && one_index) {
- ret = ER_NO_SUCH_INDEX;
- }
-
return ret;
}
@@ -14838,9 +14813,7 @@ ha_innobase::optimize(
bool try_alter = true;
if (!m_prebuilt->table->is_temporary() && srv_defragment) {
- int err;
-
- err = defragment_table(m_prebuilt->table->name.m_name, NULL, false);
+ int err = defragment_table(m_prebuilt->table->name.m_name);
if (err == 0) {
try_alter = false;
diff --git a/storage/innobase/handler/ha_innodb.h b/storage/innobase/handler/ha_innodb.h
index 6d5c108c4a3..a02c897f7ae 100644
--- a/storage/innobase/handler/ha_innodb.h
+++ b/storage/innobase/handler/ha_innodb.h
@@ -219,8 +219,7 @@ public:
int delete_table(const char *name);
int rename_table(const char* from, const char* to);
- int defragment_table(const char* name, const char* index_name,
- bool async);
+ inline int defragment_table(const char* name);
int check(THD* thd, HA_CHECK_OPT* check_opt);
char* update_table_comment(const char* comment);
diff --git a/storage/innobase/include/btr0defragment.h b/storage/innobase/include/btr0defragment.h
index 57f8c2f3811..d622c3c7c39 100644
--- a/storage/innobase/include/btr0defragment.h
+++ b/storage/innobase/include/btr0defragment.h
@@ -64,8 +64,6 @@ is a synchronized defragmentation. */
os_event_t
btr_defragment_add_index(
dict_index_t* index, /*!< index to be added */
- bool async, /*!< whether this is an async
- defragmentation */
dberr_t* err); /*!< out: error code */
/******************************************************************//**
When table is dropped, this function is called to mark a table as removed in