Skip to content

Instantly share code, notes, and snippets.

@nirbhayc
Created May 25, 2016 10:07
Show Gist options
  • Save nirbhayc/778287792cc745c377ddb8b911ce4177 to your computer and use it in GitHub Desktop.
Save nirbhayc/778287792cc745c377ddb8b911ce4177 to your computer and use it in GitHub Desktop.
diff --git a/sql/table_cache.cc b/sql/table_cache.cc
index 95a169d..d6f20bd 100644
--- a/sql/table_cache.cc
+++ b/sql/table_cache.cc
@@ -522,7 +522,7 @@ void tdc_purge(bool all)
continue;
}
mysql_mutex_unlock(&LOCK_unused_shares);
-
+ share->tdc->wait_for_mdl_deadlock_detector();
tdc_delete_share_from_hash(element);
}
DBUG_VOID_RETURN;
@@ -791,6 +791,7 @@ void tdc_release_share(TABLE_SHARE *share)
if (share->tdc->flushed || tdc_records() > tdc_size)
{
mysql_mutex_unlock(&LOCK_unused_shares);
+ share->tdc->wait_for_mdl_deadlock_detector();
tdc_delete_share_from_hash(share->tdc);
DBUG_VOID_RETURN;
}
@@ -878,7 +879,7 @@ bool tdc_remove_table(THD *thd, enum_tdc_remove_table_type remove_type,
element->share->next= 0;
}
mysql_mutex_unlock(&LOCK_unused_shares);
-
+ element->wait_for_mdl_deadlock_detector();
tdc_delete_share_from_hash(element);
DBUG_RETURN(true);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment