summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2021-06-07 17:46:59 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2021-06-07 18:09:59 +0300
commit6ef55d9dac434e7b192566773e90d0479e8683ef (patch)
tree239f08f3628a8f0f2fe574db5488b86bcbee6218
parentddddfc33c7825609a25ce9531183a0b0fb97f206 (diff)
downloadmariadb-git-bb-10.4-MDEV-25869.tar.gz
MDEV-25869 Change buffer entries are lost on InnoDB restartbb-10.4-MDEV-25869
buf_read_ibuf_merge_pages(): If space->size is 0, invoke fil_space_get_size() to determine the size of the tablespace by reading the header page. Only after that proceed to delete any entries that are beyond the end of the tablespace. Otherwise, we could be deleting valid entries that actually need to be applied. This fixes a regression that had been introduced in commit b80df9eba23b4eb9694e770a41135127c6dbc5df (MDEV-21069), which aimed to avoid crashes during DROP TABLE of corrupted tables.
-rw-r--r--storage/innobase/buf/buf0rea.cc11
1 files changed, 8 insertions, 3 deletions
diff --git a/storage/innobase/buf/buf0rea.cc b/storage/innobase/buf/buf0rea.cc
index 9bd1b16a0a2..67f42bf8ff0 100644
--- a/storage/innobase/buf/buf0rea.cc
+++ b/storage/innobase/buf/buf0rea.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2015, 2020, MariaDB Corporation.
+Copyright (c) 2015, 2021, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -772,13 +772,18 @@ tablespace_deleted:
continue;
}
- if (UNIV_UNLIKELY(page_nos[i] >= space->size)) {
+ ulint size = space->size;
+ if (!size) {
+ size = fil_space_get_size(space->id);
+ }
+
+ if (UNIV_UNLIKELY(page_nos[i] >= size)) {
do {
ibuf_delete_recs(page_id_t(space_ids[i],
page_nos[i]));
} while (++i < n_stored
&& space_ids[i - 1] == space_ids[i]
- && page_nos[i] >= space->size);
+ && page_nos[i] >= size);
i--;
next:
space->release();