Skip to content

Commit

Permalink
MDEV-14310 ALTER TABLE…ADD INDEX may corrupt the InnoDB system tables…
Browse files Browse the repository at this point in the history
…pace

FlushObserver::flush(): Never discard unwritten changes.
We do not want to risk corrupting the system tablespace
or .ibd files that are not part of a table-rebuilding ALTER.
  • Loading branch information
dr-m committed Nov 7, 2017
1 parent d04c4b3 commit a4feb04
Showing 1 changed file with 9 additions and 16 deletions.
25 changes: 9 additions & 16 deletions storage/innobase/buf/buf0flu.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3821,24 +3821,17 @@ FlushObserver::notify_remove(
void
FlushObserver::flush()
{
buf_remove_t buf_remove;

if (m_interrupted) {
buf_remove = BUF_REMOVE_FLUSH_NO_WRITE;
} else {
buf_remove = BUF_REMOVE_FLUSH_WRITE;

if (m_stage != NULL) {
ulint pages_to_flush =
buf_flush_get_dirty_pages_count(
m_space_id, this);

m_stage->begin_phase_flush(pages_to_flush);
}
if (!m_interrupted && m_stage) {
m_stage->begin_phase_flush(buf_flush_get_dirty_pages_count(
m_space_id, this));
}

/* Flush or remove dirty pages. */
buf_LRU_flush_or_remove_pages(m_space_id, buf_remove, m_trx);
/* MDEV-14317 FIXME: Discard all changes to only those pages
that will be freed by the clean-up of the ALTER operation.
(Maybe, instead of buf_pool->flush_list, use a dedicated list
for pages on which redo logging has been disabled.) */
buf_LRU_flush_or_remove_pages(
m_space_id, BUF_REMOVE_FLUSH_WRITE, m_trx);

/* Wait for all dirty pages were flushed. */
for (ulint i = 0; i < srv_buf_pool_instances; i++) {
Expand Down

0 comments on commit a4feb04

Please sign in to comment.