summaryrefslogtreecommitdiff
path: root/storage/innobase
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2019-04-29 11:43:22 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2019-04-29 11:43:22 +0300
commit1b577e4d8baf962a7eb0ff8c946697b1e3d8f412 (patch)
tree2e894f8e4b6f82b456f7c4aac8b23b7d55d3b7b4 /storage/innobase
parente10b3fa97a47cad0e6dbcc1d1691bad655087f70 (diff)
downloadmariadb-git-1b577e4d8baf962a7eb0ff8c946697b1e3d8f412.tar.gz
MDEV-19356 Assertion 'space->free_limit == 0 || space->free_limit == free_limit'
fil_node_t::read_page0(): Do not replace up-to-date metadata with a possibly old version of page 0 that is being reread from the file. A more up-to-date page 0 could still exists in the buffer pool, waiting to be written back to the file.
Diffstat (limited to 'storage/innobase')
-rw-r--r--storage/innobase/fil/fil0fil.cc19
1 files changed, 13 insertions, 6 deletions
diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc
index ccf1ac0ecef..d892898f555 100644
--- a/storage/innobase/fil/fil0fil.cc
+++ b/storage/innobase/fil/fil0fil.cc
@@ -579,13 +579,9 @@ bool fil_node_t::read_page0(bool first)
return false;
}
- ut_ad(space->free_limit == 0 || space->free_limit == free_limit);
- ut_ad(space->free_len == 0 || space->free_len == free_len);
- space->size_in_header = size;
- space->free_limit = free_limit;
- space->free_len = free_len;
-
if (first) {
+ ut_ad(space->id != TRX_SYS_SPACE);
+
/* Truncate the size to a multiple of extent size. */
ulint mask = psize * FSP_EXTENT_SIZE - 1;
@@ -598,8 +594,19 @@ bool fil_node_t::read_page0(bool first)
this->size = ulint(size_bytes / psize);
space->size += this->size;
+ } else if (space->id != TRX_SYS_SPACE || space->size_in_header) {
+ /* If this is not the first-time open, do nothing.
+ For the system tablespace, we always get invoked as
+ first=false, so we detect the true first-time-open based
+ on size_in_header and proceed to initiailze the data. */
+ return true;
}
+ ut_ad(space->free_limit == 0 || space->free_limit == free_limit);
+ ut_ad(space->free_len == 0 || space->free_len == free_len);
+ space->size_in_header = size;
+ space->free_limit = free_limit;
+ space->free_len = free_len;
return true;
}