summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2017-11-07 15:34:04 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2017-11-07 23:00:51 +0200
commita4feb04ace2e7759aee4dd74b71cbb1151b1886f (patch)
tree36e721dc26cf5d6be2417e3321f32d702b2b8794
parentd04c4b3905980a6a3eaef39e6f6c24e1b64db1a4 (diff)
downloadmariadb-git-a4feb04ace2e7759aee4dd74b71cbb1151b1886f.tar.gz
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.
-rw-r--r--storage/innobase/buf/buf0flu.cc25
1 files changed, 9 insertions, 16 deletions
diff --git a/storage/innobase/buf/buf0flu.cc b/storage/innobase/buf/buf0flu.cc
index e7a2a844330..8fa9c0f3d20 100644
--- a/storage/innobase/buf/buf0flu.cc
+++ b/storage/innobase/buf/buf0flu.cc
@@ -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++) {