summaryrefslogtreecommitdiff
path: root/src/third_party/wiredtiger/src/block/block_read.c
diff options
context:
space:
mode:
authorLuke Chen <luke.chen@mongodb.com>2019-07-12 16:51:32 +1000
committerLuke Chen <luke.chen@mongodb.com>2019-07-12 16:51:32 +1000
commit67b760c562d7f189bad589841b4dcd14acf702d9 (patch)
treebd2291d5306357a1093125f19ae01d5c03d9547c /src/third_party/wiredtiger/src/block/block_read.c
parent9ae337bd27f7a513df548256400596a6eba4d7a3 (diff)
downloadmongo-67b760c562d7f189bad589841b4dcd14acf702d9.tar.gz
Import wiredtiger: 3f686382114354b29b1d92b9c4a7dfc870dc5b94 from branch mongodb-4.2
ref: 99e0760cc5..3f68638211 for: 4.3.1 WT-4530 WiredTiger session statistics cursor returns incorrect key on BigEndian systems WT-4612 Improve test coverage for prepare updates older than the oldest WT-4791 Coverity: Dereferencing null (cbt->ins) WT-4842 Enhance lookaside score calculation WT-4857 Fix a bug in column store where skip list traversal could miss an entry WT-4889 Dump additional transaction fields WT-4913 Fix the Windows CRC32 on blocks that aren't 8B aligned and/or multiples of 8B WT-4916 Clang Format pre-formatting fixes WT-4926 Fix the WiredTiger static test suite's test for EBUSY failures WT-4927 Allow updates with timestamps to be evicted to lookaside WT-4928 Fix clang scan warnings in Jenkins Pull Request testing
Diffstat (limited to 'src/third_party/wiredtiger/src/block/block_read.c')
-rw-r--r--src/third_party/wiredtiger/src/block/block_read.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/src/third_party/wiredtiger/src/block/block_read.c b/src/third_party/wiredtiger/src/block/block_read.c
index 0c2ef31254f..ce2aa031b8f 100644
--- a/src/third_party/wiredtiger/src/block/block_read.c
+++ b/src/third_party/wiredtiger/src/block/block_read.c
@@ -224,7 +224,6 @@ __wt_block_read_off(WT_SESSION_IMPL *session, WT_BLOCK *block,
{
WT_BLOCK_HEADER *blk, swap;
size_t bufsize;
- uint32_t page_checksum;
__wt_verbose(session, WT_VERB_READ,
"off %" PRIuMAX ", size %" PRIu32 ", checksum %#" PRIx32,
@@ -248,9 +247,6 @@ __wt_block_read_off(WT_SESSION_IMPL *session, WT_BLOCK *block,
F_SET(buf, WT_ITEM_ALIGNED);
bufsize = WT_MAX(size, buf->memsize + 10);
}
- WT_RET(__wt_buf_init(session, buf, bufsize));
- WT_RET(__wt_read(session, block->fh, offset, size, buf->mem));
- buf->size = size;
/*
* Ensure we don't read information that isn't there. It shouldn't ever
@@ -262,6 +258,10 @@ __wt_block_read_off(WT_SESSION_IMPL *session, WT_BLOCK *block,
"allocation size of %" PRIu32,
block->name, size, block->allocsize);
+ WT_RET(__wt_buf_init(session, buf, bufsize));
+ WT_RET(__wt_read(session, block->fh, offset, size, buf->mem));
+ buf->size = size;
+
/*
* We incrementally read through the structure before doing a checksum,
* do little- to big-endian handling early on, and then select from the
@@ -271,10 +271,9 @@ __wt_block_read_off(WT_SESSION_IMPL *session, WT_BLOCK *block,
__wt_block_header_byteswap_copy(blk, &swap);
if (swap.checksum == checksum) {
blk->checksum = 0;
- page_checksum = __wt_checksum(buf->mem,
+ if (__wt_checksum_match(buf->mem,
F_ISSET(&swap, WT_BLOCK_DATA_CKSUM) ?
- size : WT_BLOCK_COMPRESS_SKIP);
- if (page_checksum == checksum) {
+ size : WT_BLOCK_COMPRESS_SKIP, checksum)) {
/*
* Swap the page-header as needed; this doesn't belong
* here, but it's the best place to catch all callers.
@@ -287,10 +286,8 @@ __wt_block_read_off(WT_SESSION_IMPL *session, WT_BLOCK *block,
__wt_errx(session,
"%s: read checksum error for %" PRIu32 "B block at "
"offset %" PRIuMAX ": calculated block checksum "
- "of %#" PRIx32 " doesn't match expected checksum "
- "of %#" PRIx32,
- block->name,
- size, (uintmax_t)offset, page_checksum, checksum);
+ " doesn't match expected checksum",
+ block->name, size, (uintmax_t)offset);
} else
if (!F_ISSET(session, WT_SESSION_QUIET_CORRUPT_FILE))
__wt_errx(session,