Commit a4feb04a authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-14310 ALTER TABLE…ADD INDEX may corrupt the InnoDB system tablespace

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.
parent d04c4b39
......@@ -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++) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment