summaryrefslogtreecommitdiff
path: root/storage
diff options
context:
space:
mode:
authorRich Prohaska <prohaska@tokutek.com>2014-06-26 15:24:47 -0400
committerRich Prohaska <prohaska@tokutek.com>2014-06-26 15:24:47 -0400
commitca032f3e82993c5ddb6cf507c3a5366dcd64415c (patch)
tree16c92f6c0fd7bb1115d2c9db92ed68f4064a752b /storage
parent3625b932af54d5a913c6ccc7ce08a16c0784cef6 (diff)
downloadmariadb-git-ca032f3e82993c5ddb6cf507c3a5366dcd64415c.tar.gz
#256 only force MDL X for certain alter table operations
Diffstat (limited to 'storage')
-rw-r--r--storage/tokudb/ha_tokudb_alter_56.cc50
1 files changed, 29 insertions, 21 deletions
diff --git a/storage/tokudb/ha_tokudb_alter_56.cc b/storage/tokudb/ha_tokudb_alter_56.cc
index 5062a2ae67b..e55b7b48ad8 100644
--- a/storage/tokudb/ha_tokudb_alter_56.cc
+++ b/storage/tokudb/ha_tokudb_alter_56.cc
@@ -720,27 +720,6 @@ bool ha_tokudb::commit_inplace_alter_table(TABLE *altered_table, Alter_inplace_i
tokudb_alter_ctx *ctx = static_cast<tokudb_alter_ctx *>(ha_alter_info->handler_ctx);
bool result = false; // success
THD *thd = ha_thd();
- MDL_ticket *ticket = table->mdl_ticket;
- if (ticket->get_type() != MDL_EXCLUSIVE) {
- // get exclusive lock no matter what
-#if defined(MARIADB_BASE_VERSION)
- killed_state saved_killed_state = thd->killed;
- thd->killed = NOT_KILLED;
- while (wait_while_table_is_used(thd, table, HA_EXTRA_NOT_USED) && thd->killed)
- thd->killed = NOT_KILLED;
- assert(ticket->get_type() == MDL_EXCLUSIVE);
- if (thd->killed == NOT_KILLED)
- thd->killed = saved_killed_state;
-#else
- THD::killed_state saved_killed_state = thd->killed;
- thd->killed = THD::NOT_KILLED;
- while (wait_while_table_is_used(thd, table, HA_EXTRA_NOT_USED) && thd->killed)
- thd->killed = THD::NOT_KILLED;
- assert(ticket->get_type() == MDL_EXCLUSIVE);
- if (thd->killed == THD::NOT_KILLED)
- thd->killed = saved_killed_state;
-#endif
- }
if (commit) {
#if (50613 <= MYSQL_VERSION_ID && MYSQL_VERSION_ID <= 50699) || \
@@ -768,6 +747,35 @@ bool ha_tokudb::commit_inplace_alter_table(TABLE *altered_table, Alter_inplace_i
}
if (!commit) {
+ if (table->mdl_ticket->get_type() != MDL_EXCLUSIVE &&
+ (ctx->add_index_changed || ctx->drop_index_changed || ctx->compression_changed)) {
+
+ // get exclusive lock no matter what
+#if defined(MARIADB_BASE_VERSION)
+ killed_state saved_killed_state = thd->killed;
+ thd->killed = NOT_KILLED;
+ for (volatile uint i = 0; wait_while_table_is_used(thd, table, HA_EXTRA_NOT_USED); i++) {
+ if (thd->killed != NOT_KILLED)
+ thd->killed = NOT_KILLED;
+ sleep(1);
+ }
+ assert(table->mdl_ticket->get_type() == MDL_EXCLUSIVE);
+ if (thd->killed == NOT_KILLED)
+ thd->killed = saved_killed_state;
+#else
+ THD::killed_state saved_killed_state = thd->killed;
+ thd->killed = THD::NOT_KILLED;
+ for (volatile uint i = 0; wait_while_table_is_used(thd, table, HA_EXTRA_NOT_USED); i++) {
+ if (thd->killed != THD::NOT_KILLED)
+ thd->killed = THD::NOT_KILLED;
+ sleep(1);
+ }
+ assert(table->mdl_ticket->get_type() == MDL_EXCLUSIVE);
+ if (thd->killed == THD::NOT_KILLED)
+ thd->killed = saved_killed_state;
+#endif
+ }
+
// abort the alter transaction NOW so that any alters are rolled back. this allows the following restores to work.
tokudb_trx_data *trx = (tokudb_trx_data *) thd_get_ha_data(thd, tokudb_hton);
assert(ctx->alter_txn == trx->stmt);