summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Bostic <keith.bostic@mongodb.com>2016-10-23 18:07:37 -0400
committerAlex Gorrod <alexander.gorrod@mongodb.com>2016-10-24 09:07:37 +1100
commita1327e2d6e568b843b9483984171ab18c00eaf26 (patch)
tree69f5dc17712ba41416ec87c63324d1d06c690aa9
parent7802c51dcb1a046248ea13d5773930e6bb66576c (diff)
downloadmongo-a1327e2d6e568b843b9483984171ab18c00eaf26.tar.gz
WT-2904 Fix a bug where the reported checkpoint size could be many times data size (#3102)
Correct the rolling checkpoint size for the current checkpoint's root page size, it shouldn't be included because it's an allocation that's not part of the next checkpoint.
-rw-r--r--src/block/block_ckpt.c26
-rw-r--r--test/format/config.c13
2 files changed, 34 insertions, 5 deletions
diff --git a/src/block/block_ckpt.c b/src/block/block_ckpt.c
index b7ac953cdb1..a9bd706acbe 100644
--- a/src/block/block_ckpt.c
+++ b/src/block/block_ckpt.c
@@ -615,8 +615,6 @@ live_update:
WT_CKPT_FOREACH(ckptbase, ckpt)
if (F_ISSET(ckpt, WT_CKPT_ADD)) {
/*
- * Set the checkpoint size for the live system.
- *
* !!!
* Our caller wants the final checkpoint size. Setting
* the size here violates layering, but the alternative
@@ -624,7 +622,29 @@ live_update:
* cookie into its components, and that's a fair amount
* of work.
*/
- ckpt->ckpt_size = ci->ckpt_size = ckpt_size;
+ ckpt->ckpt_size = ckpt_size;
+
+ /*
+ * Set the rolling checkpoint size for the live system.
+ * The current size includes the current checkpoint's
+ * root page size (root pages are on the checkpoint's
+ * block allocation list as root pages are allocated
+ * with the usual block allocation functions). That's
+ * correct, but we don't want to include it in the size
+ * for the next checkpoint.
+ */
+ ckpt_size -= ci->root_size;
+
+ /*
+ * Additionally, we had a bug for awhile where the live
+ * checkpoint size grew without bound. We can't sanity
+ * check the value, that would require walking the tree
+ * as part of the checkpoint. Bound any bug at the size
+ * of the file.
+ */
+ WT_ASSERT(session, ckpt_size <= (uint64_t)block->size);
+ ci->ckpt_size =
+ WT_MIN(ckpt_size, (uint64_t)block->size);
WT_ERR(__ckpt_update(session, block, ckpt, ci, true));
}
diff --git a/test/format/config.c b/test/format/config.c
index 95b05c3c833..839ff5058de 100644
--- a/test/format/config.c
+++ b/test/format/config.c
@@ -187,8 +187,17 @@ config_setup(void)
/* Give in-memory configuration a final review. */
config_in_memory_check();
- /* Make the default maximum-run length 20 minutes. */
- if (!config_is_perm("timer"))
+ /*
+ * Run-length configured by a number of operations and a timer. If the
+ * operation count and the timer are both set by a configuration, there
+ * isn't anything to do. If only the operation count was configured,
+ * set a default maximum-run of 20 minutes. If only the timer is set,
+ * clear the operations count (which was set randomly).
+ */
+ if (config_is_perm("timer")) {
+ if (!config_is_perm("ops"))
+ config_single("ops=0", 0);
+ } else
config_single("timer=20", 0);
/*