summaryrefslogtreecommitdiff
path: root/src/third_party/wiredtiger/src/block/block_ckpt.c
diff options
context:
space:
mode:
authorLuke Chen <luke.chen@mongodb.com>2020-05-08 18:42:59 +1000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-05-08 09:00:58 +0000
commit5e2be935dc5a09a6238a796d67b895509c47bb95 (patch)
tree1ef5a2eae2faea1b072ca024a71d11d2259d4647 /src/third_party/wiredtiger/src/block/block_ckpt.c
parentc1e9eee0dd99c16dcaaaf77dad10d995992693e5 (diff)
downloadmongo-5e2be935dc5a09a6238a796d67b895509c47bb95.tar.gz
Import wiredtiger: 404b4a70af14e7d3aecf7f206380884af5d06786 from branch mongodb-4.4
ref: 18dfb9e58e..404b4a70af for: 4.5.1 WT-6093 Fix and reenable test_random_abort in recovery-stress-test WT-6097 Let the Python test suite runner allocate tests to buckets for evergreen WT-6128 Reduce the data size in test_checkpoint04 so it completes quickly WT-6131 Add a test to verify checkpointing truncation in durable history WT-6137 Fix calculation of bits versus bytes for incremental bitmap WT-6138 Turn off non-timestamp testing in schema_abort WT-6141 Disable checkpoint deletion during backup WT-6142 Fix the assert with no more than one aborted update in chain WT-6144 Avoid configures verify_metadata in test/format when running on historic builds WT-6152 Fix accessing checkpoint durable timestamp including older version WT-6156 Enable format to select "backup.incremental=log"
Diffstat (limited to 'src/third_party/wiredtiger/src/block/block_ckpt.c')
-rw-r--r--src/third_party/wiredtiger/src/block/block_ckpt.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/src/third_party/wiredtiger/src/block/block_ckpt.c b/src/third_party/wiredtiger/src/block/block_ckpt.c
index 292917be5d6..7480ddfca2b 100644
--- a/src/third_party/wiredtiger/src/block/block_ckpt.c
+++ b/src/third_party/wiredtiger/src/block/block_ckpt.c
@@ -661,14 +661,20 @@ static int
__ckpt_add_blkmod_entry(
WT_SESSION_IMPL *session, WT_BLOCK_MODS *blk_mod, wt_off_t offset, wt_off_t len)
{
- uint64_t end, start;
- uint32_t end_buf_bytes, end_rdup_bytes;
+ uint64_t end_bit, start_bit;
+ uint32_t end_buf_bytes, end_rdup_bits, end_rdup_bytes;
WT_ASSERT(session, blk_mod->granularity != 0);
- start = (uint64_t)offset / blk_mod->granularity;
- end = (uint64_t)(offset + len) / blk_mod->granularity;
- WT_ASSERT(session, end < UINT32_MAX);
- end_rdup_bytes = WT_MAX(__wt_rduppo2((uint32_t)end, 8), WT_BLOCK_MODS_LIST_MIN);
+ /*
+ * Figure out how the starting and ending bits based on the granularity and our offset and
+ * length.
+ */
+ start_bit = (uint64_t)offset / blk_mod->granularity;
+ end_bit = (uint64_t)(offset + len - 1) / blk_mod->granularity;
+ WT_ASSERT(session, end_bit < UINT32_MAX);
+ /* We want to grow the bitmap by 64 bits, or 8 bytes at a time. */
+ end_rdup_bits = WT_MAX(__wt_rduppo2((uint32_t)end_bit, 64), WT_BLOCK_MODS_LIST_MIN);
+ end_rdup_bytes = end_rdup_bits >> 3;
end_buf_bytes = (uint32_t)blk_mod->nbits >> 3;
/*
* We are doing a lot of shifting. Make sure that the number of bytes we end up with is a
@@ -687,11 +693,10 @@ __ckpt_add_blkmod_entry(
memset(
(uint8_t *)blk_mod->bitstring.mem + end_buf_bytes, 0, end_rdup_bytes - end_buf_bytes);
}
- blk_mod->nbits = end_rdup_bytes << 3;
+ blk_mod->nbits = end_rdup_bits;
}
-
/* Set all the bits needed to record this offset/length pair. */
- __bit_nset(blk_mod->bitstring.mem, start, end);
+ __bit_nset(blk_mod->bitstring.mem, start_bit, end_bit);
return (0);
}