MDEV-14685 Assertion `!fully || (bool) hist_part' failed in Vers_part_info::initialized

This commit is contained in:
Aleksey Midenkov 2017-12-20 21:04:22 +03:00
parent 4bc268d406
commit 6e530d4df5
2 changed files with 25 additions and 0 deletions

View file

@ -33,6 +33,7 @@
#include "sql_acl.h" // *_ACL
#include "sql_base.h" // fill_record
#include "sql_statistics.h" // vers_stat_end
#include "vers_utils.h"
#ifdef WITH_PARTITION_STORAGE_ENGINE
#include "ha_partition.h"
@ -1168,6 +1169,17 @@ bool partition_info::vers_setup_stats(THD * thd, bool is_create_table_ind)
bool error= false;
TABLE_LIST tl;
tl.init_one_table(
LEX_STRING_WITH_LEN(table->s->db),
LEX_STRING_WITH_LEN(table->s->table_name),
table->s->table_name.str,
TL_WRITE);
MDL_auto_lock mdl_lock(thd, tl);
if (mdl_lock.acquire_error())
return true;
mysql_mutex_lock(&table->s->LOCK_rotation);
if (table->s->busy_rotation)
{

View file

@ -16,8 +16,21 @@ public:
thd(_thd), table(_table)
{
DBUG_ASSERT(thd);
MDL_request protection_request;
if (thd->global_read_lock.can_acquire_protection())
{
error= true;
return;
}
protection_request.init(MDL_key::GLOBAL, "", "", MDL_INTENTION_EXCLUSIVE,
MDL_EXPLICIT);
error= thd->mdl_context.acquire_lock(&protection_request, thd->variables.lock_wait_timeout);
if (error)
return;
table.mdl_request.init(MDL_key::TABLE, table.db, table.table_name, MDL_EXCLUSIVE, MDL_EXPLICIT);
error= thd->mdl_context.acquire_lock(&table.mdl_request, thd->variables.lock_wait_timeout);
thd->mdl_context.release_lock(protection_request.ticket);
}
~MDL_auto_lock()
{