1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

MDEV-19745 BACKUP STAGE BLOCK_DDL hangs on flush sequence table

Problem was that FLUSH TABLES where trying to read latest sequence state
which conflicted with a running ALTER SEQUENCE. Removed the reading
of the state, when opening a table for FLUSH, as it's not needed in this
case.

Other thing:
- Fixed a potential issue with concurrently running ALTER SEQUENCE where
  the later ALTER could potentially read old data
This commit is contained in:
Monty
2020-06-08 15:13:04 +03:00
parent 08d475c73b
commit 6a3b581b90
5 changed files with 26 additions and 11 deletions

View File

@ -453,7 +453,7 @@ int SEQUENCE::read_initial_values(TABLE *table)
/*
There is already a mdl_ticket for this table. However, for list_fields
the MDL lock is of type MDL_SHARED_HIGH_PRIO which is not usable
for doing a able lock. Get a proper read lock to solve this.
for doing a table lock. Get a proper read lock to solve this.
*/
if (table->mdl_ticket == 0)
{
@ -929,6 +929,8 @@ bool Sql_cmd_alter_sequence::execute(THD *thd)
table= first_table->table;
seq= table->s->sequence;
seq->write_lock(table);
new_seq->reserved_until= seq->reserved_until;
/* Copy from old sequence those fields that the user didn't specified */
@ -961,18 +963,18 @@ bool Sql_cmd_alter_sequence::execute(THD *thd)
first_table->db.str,
first_table->table_name.str);
error= 1;
seq->write_unlock(table);
goto end;
}
table->s->sequence->write_lock(table);
if (likely(!(error= new_seq->write(table, 1))))
{
/* Store the sequence values in table share */
table->s->sequence->copy(new_seq);
seq->copy(new_seq);
}
else
table->file->print_error(error, MYF(0));
table->s->sequence->write_unlock(table);
seq->write_unlock(table);
if (trans_commit_stmt(thd))
error= 1;
if (trans_commit_implicit(thd))