diff options
author | Monty <monty@mariadb.org> | 2020-06-08 15:13:04 +0300 |
---|---|---|
committer | Monty <monty@mariadb.org> | 2020-06-14 19:39:43 +0300 |
commit | 6a3b581b9051e5832d43e841b73c88df9fe90755 (patch) | |
tree | 116fd511a63aea3ba1e6fd0ab65b946bd9d7a256 /sql/ha_sequence.cc | |
parent | 08d475c73b0dab575940162d6181187367368974 (diff) | |
download | mariadb-git-6a3b581b9051e5832d43e841b73c88df9fe90755.tar.gz |
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
Diffstat (limited to 'sql/ha_sequence.cc')
-rw-r--r-- | sql/ha_sequence.cc | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/sql/ha_sequence.cc b/sql/ha_sequence.cc index 4eabd820071..bf3b5ce2cd0 100644 --- a/sql/ha_sequence.cc +++ b/sql/ha_sequence.cc @@ -108,8 +108,12 @@ int ha_sequence::open(const char *name, int mode, uint flags) MY_TEST(flags & HA_OPEN_INTERNAL_TABLE); reset_statistics(); - /* Don't try to read the initial row the call is part of create code */ - if (!(flags & (HA_OPEN_FOR_CREATE | HA_OPEN_FOR_REPAIR))) + /* + Don't try to read the initial row if the call is part of CREATE, REPAIR + or FLUSH + */ + if (!(flags & (HA_OPEN_FOR_CREATE | HA_OPEN_FOR_REPAIR | + HA_OPEN_FOR_FLUSH))) { if (unlikely((error= table->s->sequence->read_initial_values(table)))) file->ha_close(); @@ -121,7 +125,8 @@ int ha_sequence::open(const char *name, int mode, uint flags) The following is needed to fix comparison of rows in ha_update_first_row() for InnoDB */ - memcpy(table->record[1], table->s->default_values, table->s->reclength); + if (!error) + memcpy(table->record[1], table->s->default_values, table->s->reclength); } DBUG_RETURN(error); } |