summaryrefslogtreecommitdiff
path: root/sql/sql_base.cc
diff options
context:
space:
mode:
authorAleksey Midenkov <midenok@gmail.com>2022-06-29 22:53:29 +0300
committerAleksey Midenkov <midenok@gmail.com>2022-06-29 22:53:29 +0300
commitf88511647aa2498a1ffa449f305ed2f0f73de14c (patch)
tree467f5328107c09fa6efb153762a8c91fc0379f37 /sql/sql_base.cc
parent4a164364d71eecb004dc7c21ff608df996c05f0a (diff)
downloadmariadb-git-f88511647aa2498a1ffa449f305ed2f0f73de14c.tar.gz
MDEV-28567 Assertion `0' in open_tables upon function-related operation
DBUG_ASSERT(0) was added by MDEV-17554 (auto-create history partitions) as an experimental measure. Testing has shown this conditional branch of can_recover_from_failed_open() can be possible due to MDL deadlock. The fix replaces DBUG_ASSERT with more specific one for !OT_ADD_HISTORY_PARTITION. Test case was synchronized to reproduce deadlock always and commented with execution path of MDL locking for Good (no deadlock) and Bad (deadlock). The logging was done with the help of preceding patch for debug MDL tracing.
Diffstat (limited to 'sql/sql_base.cc')
-rw-r--r--sql/sql_base.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index d9e04261dc8..ed73f1cb88c 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -4678,10 +4678,11 @@ restart:
if (unlikely(error))
{
+ /* F.ex. deadlock happened */
if (ot_ctx.can_recover_from_failed_open())
{
- // FIXME: is this really used?
- DBUG_ASSERT(0);
+ DBUG_ASSERT(ot_ctx.get_action() !=
+ Open_table_context::OT_ADD_HISTORY_PARTITION);
close_tables_for_reopen(thd, start,
ot_ctx.start_of_statement_svp());
if (ot_ctx.recover_from_failed_open())