summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/third_party/wiredtiger/dist/filelist8
-rw-r--r--src/third_party/wiredtiger/dist/s_define.list1
-rw-r--r--src/third_party/wiredtiger/dist/stat_data.py51
-rw-r--r--src/third_party/wiredtiger/import.data2
-rw-r--r--src/third_party/wiredtiger/src/block/block_ext.c3
-rw-r--r--src/third_party/wiredtiger/src/block/block_read.c27
-rw-r--r--src/third_party/wiredtiger/src/block/block_write.c5
-rw-r--r--src/third_party/wiredtiger/src/block_cache/block_cache.c (renamed from src/third_party/wiredtiger/src/block/block_cache.c)265
-rw-r--r--src/third_party/wiredtiger/src/block_cache/block_mgr.c (renamed from src/third_party/wiredtiger/src/block/block_mgr.c)73
-rw-r--r--src/third_party/wiredtiger/src/include/block_cache.h36
-rw-r--r--src/third_party/wiredtiger/src/include/extern.h12
-rw-r--r--src/third_party/wiredtiger/src/include/stat.h2
-rw-r--r--src/third_party/wiredtiger/src/include/verify_build.h1
-rw-r--r--src/third_party/wiredtiger/src/include/wiredtiger.in52
-rw-r--r--src/third_party/wiredtiger/src/include/wt_internal.h2
-rw-r--r--src/third_party/wiredtiger/src/support/stat.c46
-rw-r--r--src/third_party/wiredtiger/test/format/wts.c3
17 files changed, 299 insertions, 290 deletions
diff --git a/src/third_party/wiredtiger/dist/filelist b/src/third_party/wiredtiger/dist/filelist
index a50ec3d667c..9dae82777b8 100644
--- a/src/third_party/wiredtiger/dist/filelist
+++ b/src/third_party/wiredtiger/dist/filelist
@@ -2,13 +2,11 @@
# List of source files for WiredTiger library.
src/block/block_addr.c
-src/block/block_cache.c
src/block/block_ckpt.c
src/block/block_ckpt_scan.c
src/block/block_compact.c
src/block/block_ext.c
src/block/block_map.c
-src/block/block_mgr.c
src/block/block_open.c
src/block/block_read.c
src/block/block_session.c
@@ -16,6 +14,8 @@ src/block/block_slvg.c
src/block/block_tiered.c
src/block/block_vrfy.c
src/block/block_write.c
+src/block_cache/block_cache.c
+src/block_cache/block_mgr.c
src/bloom/bloom.c
src/btree/bt_compact.c
src/btree/bt_curnext.c
@@ -51,8 +51,8 @@ src/checksum/arm64/crc32-arm64.c ARM64_HOST
src/checksum/power8/crc32.sx POWERPC_HOST
src/checksum/power8/crc32_wrapper.c POWERPC_HOST
src/checksum/software/checksum.c
-src/checksum/x86/crc32-x86.c X86_HOST
src/checksum/x86/crc32-x86-alt.c X86_HOST
+src/checksum/x86/crc32-x86.c X86_HOST
src/checksum/zseries/crc32-s390x.c ZSERIES_HOST
src/checksum/zseries/crc32le-vx.sx ZSERIES_HOST
src/config/config.c
@@ -100,8 +100,8 @@ src/evict/evict_page.c
src/evict/evict_stat.c
src/history/hs_conn.c
src/history/hs_cursor.c
-src/history/hs_verify.c
src/history/hs_rec.c
+src/history/hs_verify.c
src/log/log.c
src/log/log_auto.c
src/log/log_slot.c
diff --git a/src/third_party/wiredtiger/dist/s_define.list b/src/third_party/wiredtiger/dist/s_define.list
index 5d329aac55c..1cb6c2c4cac 100644
--- a/src/third_party/wiredtiger/dist/s_define.list
+++ b/src/third_party/wiredtiger/dist/s_define.list
@@ -20,7 +20,6 @@ WT_ATOMIC_CAS
WT_ATOMIC_CAS_FUNC
WT_ATOMIC_FUNC
WT_BACKUP_INVALID
-WT_BLKCACHE_ID_SIZE
WT_BLOCK_DESC_SIZE
WT_BLOCK_EXTLIST_VERSION_ORIG
WT_BLOCK_HEADER_SIZE
diff --git a/src/third_party/wiredtiger/dist/stat_data.py b/src/third_party/wiredtiger/dist/stat_data.py
index 1d69498cc01..abe9893c586 100644
--- a/src/third_party/wiredtiger/dist/stat_data.py
+++ b/src/third_party/wiredtiger/dist/stat_data.py
@@ -31,6 +31,10 @@ class Stat:
def __cmp__(self, other):
return cmp(self.desc.lower(), other.desc.lower())
+class BlockCacheStat(Stat):
+ prefix = 'block-cache'
+ def __init__(self, name, desc, flags=''):
+ Stat.__init__(self, name, BlockCacheStat.prefix, desc, flags)
class BlockStat(Stat):
prefix = 'block-manager'
def __init__(self, name, desc, flags=''):
@@ -129,6 +133,7 @@ class YieldStat(Stat):
groups = {}
groups['cursor'] = [CursorStat.prefix, SessionOpStat.prefix]
groups['evict'] = [
+ BlockCacheStat.prefix,
BlockStat.prefix,
CacheStat.prefix,
CacheWalkStat.prefix,
@@ -177,6 +182,31 @@ conn_stats = [
##########################################
# Block manager statistics
##########################################
+ BlockCacheStat('block_cache_blocks', 'total blocks'),
+ BlockCacheStat('block_cache_blocks_evicted', 'evicted blocks'),
+ BlockCacheStat('block_cache_blocks_insert_read', 'total blocks inserted on read path'),
+ BlockCacheStat('block_cache_blocks_insert_write', 'total blocks inserted on write path'),
+ BlockCacheStat('block_cache_blocks_removed', 'removed blocks'),
+ BlockCacheStat('block_cache_blocks_update', 'cached blocks updated'),
+ BlockCacheStat('block_cache_bypass_chkpt', 'number of put bypasses on checkpoint I/O'),
+ BlockCacheStat('block_cache_bypass_filesize', 'file size causing bypass'),
+ BlockCacheStat('block_cache_bypass_get', 'number of bypasses on get'),
+ BlockCacheStat('block_cache_bypass_overhead_put', 'number of bypasses due to overhead on put'),
+ BlockCacheStat('block_cache_bypass_put', 'number of bypasses on put because file is too small'),
+ BlockCacheStat('block_cache_bypass_writealloc', 'number of bypasses because no-write-allocate setting was on'),
+ BlockCacheStat('block_cache_bytes', 'total bytes'),
+ BlockCacheStat('block_cache_bytes_insert_read', 'total bytes inserted on read path'),
+ BlockCacheStat('block_cache_bytes_insert_write', 'total bytes inserted on write path'),
+ BlockCacheStat('block_cache_bytes_update', 'cached bytes updated'),
+ BlockCacheStat('block_cache_eviction_passes', 'number of eviction passes'),
+ BlockCacheStat('block_cache_hits', 'number of hits'),
+ BlockCacheStat('block_cache_lookups', 'lookups'),
+ BlockCacheStat('block_cache_misses', 'number of misses'),
+ BlockCacheStat('block_cache_not_evicted_overhead', 'number of blocks not evicted due to overhead'),
+
+ ##########################################
+ # Block manager statistics
+ ##########################################
BlockStat('block_byte_map_read', 'mapped bytes read', 'size'),
BlockStat('block_byte_read', 'bytes read', 'size'),
BlockStat('block_byte_read_mmap', 'bytes read via memory map API', 'size'),
@@ -185,27 +215,6 @@ conn_stats = [
BlockStat('block_byte_write_checkpoint', 'bytes written for checkpoint', 'size'),
BlockStat('block_byte_write_mmap', 'bytes written via memory map API', 'size'),
BlockStat('block_byte_write_syscall', 'bytes written via system call API', 'size'),
- BlockStat('block_cache_blocks', 'block cache total blocks'),
- BlockStat('block_cache_blocks_evicted', 'block cache evicted blocks'),
- BlockStat('block_cache_blocks_removed', 'block cache removed blocks'),
- BlockStat('block_cache_blocks_update', 'block cache cached blocks updated'),
- BlockStat('block_cache_blocks_insert_read', 'block cache total blocks inserted on read path'),
- BlockStat('block_cache_blocks_insert_write', 'block cache total blocks inserted on write path'),
- BlockStat('block_cache_bypass_chkpt', 'block cache number of put bypasses on checkpoint I/O'),
- BlockStat('block_cache_bypass_get', 'block cache number of bypasses on get'),
- BlockStat('block_cache_bypass_filesize', 'block cache file size causing bypass'),
- BlockStat('block_cache_bypass_overhead_put', 'block cache number of bypasses due to overhead on put'),
- BlockStat('block_cache_bypass_put', 'block cache number of bypasses on put because file is too small'),
- BlockStat('block_cache_bypass_writealloc', 'block cache number of bypasses because no-write-allocate setting was on'),
- BlockStat('block_cache_bytes', 'block cache total bytes'),
- BlockStat('block_cache_bytes_update', 'block cache cached bytes updated'),
- BlockStat('block_cache_bytes_insert_read', 'block cache total bytes inserted on read path'),
- BlockStat('block_cache_bytes_insert_write', 'block cache total bytes inserted on write path'),
- BlockStat('block_cache_data_refs', 'block cache lookups'),
- BlockStat('block_cache_eviction_passes', 'block cache number of eviction passes'),
- BlockStat('block_cache_hits', 'block cache number of hits including existence checks'),
- BlockStat('block_cache_misses', 'block cache number of misses including existence checks'),
- BlockStat('block_cache_not_evicted_overhead', 'block cache number of blocks not evicted due to overhead'),
BlockStat('block_map_read', 'mapped blocks read'),
BlockStat('block_preload', 'blocks pre-loaded'),
BlockStat('block_read', 'blocks read'),
diff --git a/src/third_party/wiredtiger/import.data b/src/third_party/wiredtiger/import.data
index 7c3de840f4e..af7e717ef4d 100644
--- a/src/third_party/wiredtiger/import.data
+++ b/src/third_party/wiredtiger/import.data
@@ -2,5 +2,5 @@
"vendor": "wiredtiger",
"github": "wiredtiger/wiredtiger.git",
"branch": "mongodb-master",
- "commit": "0c0e78d747547675c479e8fb7e81de0031ff08cd"
+ "commit": "88f6cad50464648cda0dbd3a93d91cea616fdc8f"
}
diff --git a/src/third_party/wiredtiger/src/block/block_ext.c b/src/third_party/wiredtiger/src/block/block_ext.c
index 32bde280e69..37916e482de 100644
--- a/src/third_party/wiredtiger/src/block/block_ext.c
+++ b/src/third_party/wiredtiger/src/block/block_ext.c
@@ -588,9 +588,6 @@ __wt_block_free(WT_SESSION_IMPL *session, WT_BLOCK *block, const uint8_t *addr,
ret = __wt_block_off_free(session, block, objectid, offset, (wt_off_t)size);
__wt_spin_unlock(session, &block->live_lock);
- /* Evict the freed block from the block cache */
- __wt_blkcache_remove(session, offset, size, checksum);
-
return (ret);
}
diff --git a/src/third_party/wiredtiger/src/block/block_read.c b/src/third_party/wiredtiger/src/block/block_read.c
index 0ed4c05d7b2..3f3fb1c4e76 100644
--- a/src/third_party/wiredtiger/src/block/block_read.c
+++ b/src/third_party/wiredtiger/src/block/block_read.c
@@ -16,7 +16,6 @@ int
__wt_bm_preload(WT_BM *bm, WT_SESSION_IMPL *session, const uint8_t *addr, size_t addr_size)
{
WT_BLOCK *block;
- WT_DECL_ITEM(tmp);
WT_DECL_RET;
WT_FH *fh;
WT_FILE_HANDLE *handle;
@@ -41,14 +40,6 @@ __wt_bm_preload(WT_BM *bm, WT_SESSION_IMPL *session, const uint8_t *addr, size_t
if (!mapped && handle->fh_advise != NULL)
ret = handle->fh_advise(
handle, (WT_SESSION *)session, offset, (wt_off_t)size, WT_FILE_HANDLE_WILLNEED);
- if (ret != EBUSY && ret != ENOTSUP)
- return (ret);
-
- /* If preload isn't supported, do it the slow way. */
- WT_RET(__wt_scr_alloc(session, 0, &tmp));
- ret = __wt_bm_read(bm, session, tmp, addr, addr_size);
- __wt_scr_free(session, &tmp);
-
return (ret);
}
@@ -217,10 +208,8 @@ __wt_block_read_off(WT_SESSION_IMPL *session, WT_BLOCK *block, WT_ITEM *buf, uin
wt_off_t offset, uint32_t size, uint32_t checksum)
{
WT_BLOCK_HEADER *blk, swap;
- WT_DECL_RET;
WT_FH *fh;
size_t bufsize;
- int cret;
__wt_verbose(session, WT_VERB_READ, "off %" PRIuMAX ", size %" PRIu32 ", checksum %#" PRIx32,
(uintmax_t)offset, size, checksum);
@@ -252,22 +241,8 @@ __wt_block_read_off(WT_SESSION_IMPL *session, WT_BLOCK *block, WT_ITEM *buf, uin
block->name, size, block->allocsize);
WT_RET(__wt_buf_init(session, buf, bufsize));
-
WT_RET(__wt_block_fh(session, block, objectid, &fh));
-
- /* Ask the block cache to give us the block. If it doesn't have it, read it. */
- if (fh->file_type != WT_FS_OPEN_FILE_TYPE_DATA)
- WT_RET(__wt_read(session, fh, offset, size, buf->mem));
- else {
- if ((cret = __wt_blkcache_get_or_check(session, offset, size, checksum, buf->mem)) != 0) {
- WT_RET(__wt_read(session, fh, offset, size, buf->mem));
- if (cret != WT_BLKCACHE_BYPASS) {
- WT_TRET_ERROR_OK(
- __wt_blkcache_put(session, offset, size, checksum, buf->mem, false, false),
- WT_BLKCACHE_FULL);
- }
- }
- }
+ WT_RET(__wt_read(session, fh, offset, size, buf->mem));
buf->size = size;
/*
diff --git a/src/third_party/wiredtiger/src/block/block_write.c b/src/third_party/wiredtiger/src/block/block_write.c
index 227395c7a1a..442d69927f8 100644
--- a/src/third_party/wiredtiger/src/block/block_write.c
+++ b/src/third_party/wiredtiger/src/block/block_write.c
@@ -333,11 +333,6 @@ __block_write_off(WT_SESSION_IMPL *session, WT_BLOCK *block, WT_ITEM *buf, uint3
WT_RET(ret);
}
- if (block->fh->file_type == WT_FS_OPEN_FILE_TYPE_DATA) {
- WT_TRET_ERROR_OK(
- __wt_blkcache_put(session, offset, align_size, checksum, buf->mem, checkpoint_io, true),
- WT_BLKCACHE_FULL);
- }
/*
* Optionally schedule writes for dirty pages in the system buffer cache, but only if the
* current session can wait.
diff --git a/src/third_party/wiredtiger/src/block/block_cache.c b/src/third_party/wiredtiger/src/block_cache/block_cache.c
index 17fbbd974dc..f72eee6cc1c 100644
--- a/src/third_party/wiredtiger/src/block/block_cache.c
+++ b/src/third_party/wiredtiger/src/block_cache/block_cache.c
@@ -9,6 +9,31 @@
#include "wt_internal.h"
/*
+ * __blkcache_verbose --
+ * Block cache verbose logging.
+ */
+static inline void
+__blkcache_verbose(
+ WT_SESSION_IMPL *session, const char *tag, uint64_t hash, const uint8_t *addr, size_t addr_size)
+{
+ WT_DECL_ITEM(tmp);
+ const char *addr_string;
+
+ if (!WT_VERBOSE_ISSET(session, WT_VERB_BLKCACHE))
+ return;
+
+ /*
+ * Complicate the error handling so we don't have to return a value from this function, it
+ * simplifies error handling in our callers.
+ */
+ addr_string = __wt_scr_alloc(session, 0, &tmp) == 0 ?
+ __wt_addr_string(session, addr, addr_size, tmp) :
+ "[unable to format addr]";
+ __wt_verbose(session, WT_VERB_BLKCACHE, "%s: %s, hash=%" PRIu64, tag, addr_string, hash);
+ __wt_scr_free(session, &tmp);
+}
+
+/*
* __blkcache_aggregate_metadata --
* Sum the metadata for all buckets and write it into the cache wide variables.
*/
@@ -45,8 +70,6 @@ __blkcache_alloc(WT_SESSION_IMPL *session, size_t size, void **retp)
else if (blkcache->type == BLKCACHE_NVRAM) {
#ifdef HAVE_LIBMEMKIND
*retp = memkind_malloc(blkcache->pmem_kind, size);
- if (*retp == NULL)
- return (WT_BLKCACHE_FULL);
#else
WT_RET_MSG(session, EINVAL, "NVRAM block cache type requires libmemkind");
#endif
@@ -242,7 +265,7 @@ __blkcache_eviction_thread(void *arg)
__blkcache_free(session, blkcache_item->data);
__blkcache_update_ref_histogram(session, blkcache_item, BLKCACHE_RM_EVICTION);
blkcache->bucket_metadata[i].bucket_num_data_blocks--;
- blkcache->bucket_metadata[i].bucket_bytes_used -= blkcache_item->id.size;
+ blkcache->bucket_metadata[i].bucket_bytes_used -= blkcache_item->data_size;
/*
* Update the number of removals because it is used to estimate the overhead,
@@ -252,7 +275,7 @@ __blkcache_eviction_thread(void *arg)
blkcache->removals++;
WT_STAT_CONN_INCR(session, block_cache_blocks_evicted);
- WT_STAT_CONN_DECRV(session, block_cache_bytes, blkcache_item->id.size);
+ WT_STAT_CONN_DECRV(session, block_cache_bytes, blkcache_item->data_size);
WT_STAT_CONN_DECR(session, block_cache_blocks);
__wt_free(session, blkcache_item);
} else {
@@ -265,9 +288,8 @@ __blkcache_eviction_thread(void *arg)
if (blkcache->blkcache_exiting)
return (0);
}
- if (no_eviction_candidates) {
+ if (no_eviction_candidates)
blkcache->min_num_references += BLKCACHE_MINREF_INCREMENT;
- }
WT_STAT_CONN_INCR(session, block_cache_eviction_passes);
}
@@ -312,24 +334,22 @@ __blkcache_estimate_filesize(WT_SESSION_IMPL *session)
}
/*
- * __wt_blkcache_get_or_check --
- * Get a block from the cache or check if one exists.
+ * __wt_blkcache_get --
+ * Get a block from the cache.
*/
int
-__wt_blkcache_get_or_check(
- WT_SESSION_IMPL *session, wt_off_t offset, size_t size, uint32_t checksum, void *data_ptr)
+__wt_blkcache_get(WT_SESSION_IMPL *session, WT_ITEM *data, const uint8_t *addr, size_t addr_size,
+ bool *foundp, bool *skip_cachep)
{
WT_BLKCACHE *blkcache;
- WT_BLKCACHE_ID id;
WT_BLKCACHE_ITEM *blkcache_item;
+ WT_DECL_RET;
uint64_t bucket, hash;
+ *foundp = *skip_cachep = false;
blkcache = &S2C(session)->blkcache;
- if (blkcache->type == BLKCACHE_UNCONFIGURED)
- return (-1);
-
- WT_STAT_CONN_INCR(session, block_cache_data_refs);
+ WT_STAT_CONN_INCR(session, block_cache_lookups);
/*
* We race to avoid using synchronization. We only care about an approximate value, so we accept
@@ -344,51 +364,39 @@ __wt_blkcache_get_or_check(
if ((__blkcache_estimate_filesize(session) * blkcache->percent_file_in_os_cache) / 100 <
blkcache->system_ram) {
WT_STAT_CONN_INCR(session, block_cache_bypass_get);
- return (WT_BLKCACHE_BYPASS);
+ *skip_cachep = true;
+ return (0);
}
- /*
- * We will use the item id structure as a byte array for (1) computing a hash, and (2) for
- * comparing with the items in the hash table.
- */
- id.checksum = checksum;
- id.offset = offset;
- id.size = (uint32_t)size;
- id.fid = S2BT(session)->id;
- hash = __wt_hash_city64(&id, sizeof(id));
-
+ hash = __wt_hash_city64(addr, addr_size);
bucket = hash % blkcache->hash_size;
__wt_spin_lock(session, &blkcache->hash_locks[bucket]);
TAILQ_FOREACH (blkcache_item, &blkcache->hash[bucket], hashq) {
- if (blkcache_item->id.checksum == id.checksum && blkcache_item->id.offset == id.offset &&
- blkcache_item->id.size == id.size && blkcache_item->id.fid == id.fid) {
- if (data_ptr != NULL)
- memcpy(data_ptr, blkcache_item->data, size);
-
- blkcache_item->num_references++;
- if (blkcache_item->freq_rec_counter < 0)
- blkcache_item->freq_rec_counter = 0;
- blkcache_item->freq_rec_counter++;
-
- __wt_spin_unlock(session, &blkcache->hash_locks[bucket]);
- WT_STAT_CONN_INCR(session, block_cache_hits);
- __wt_verbose(session, WT_VERB_BLKCACHE,
- "block found in cache: offset=%" PRIuMAX ", size=%" WT_SIZET_FMT ", checksum=%" PRIu32
- ", hash=%" PRIu64,
- (uintmax_t)offset, size, checksum, hash);
- return (0);
+ if (blkcache_item->addr_size == addr_size && blkcache_item->fid == S2BT(session)->id &&
+ memcmp(blkcache_item->addr, addr, addr_size) == 0) {
+ ret = __wt_buf_set(session, data, blkcache_item->data, blkcache_item->data_size);
+ if (ret == 0) {
+ blkcache_item->num_references++;
+ if (blkcache_item->freq_rec_counter < 0)
+ blkcache_item->freq_rec_counter = 0;
+ blkcache_item->freq_rec_counter++;
+
+ *foundp = true;
+ }
+ break;
}
}
-
- /* Block not found */
- __wt_verbose(session, WT_VERB_BLKCACHE,
- "block not found in cache: offset=%" PRIuMAX ", size=%" WT_SIZET_FMT ", checksum=%" PRIu32
- ", hash=%" PRIu64,
- (uintmax_t)offset, size, checksum, hash);
-
__wt_spin_unlock(session, &blkcache->hash_locks[bucket]);
- WT_STAT_CONN_INCR(session, block_cache_misses);
- return (-1);
+ WT_RET(ret);
+
+ if (*foundp) {
+ WT_STAT_CONN_INCR(session, block_cache_hits);
+ __blkcache_verbose(session, "block found in cache", hash, addr, addr_size);
+ } else {
+ WT_STAT_CONN_INCR(session, block_cache_misses);
+ __blkcache_verbose(session, "block not found in cache", hash, addr, addr_size);
+ }
+ return (0);
}
/*
@@ -396,31 +404,28 @@ __wt_blkcache_get_or_check(
* Put a block into the cache.
*/
int
-__wt_blkcache_put(WT_SESSION_IMPL *session, wt_off_t offset, size_t size, uint32_t checksum,
- void *data, bool checkpoint_io, bool write)
+__wt_blkcache_put(WT_SESSION_IMPL *session, WT_ITEM *data, const uint8_t *addr, size_t addr_size,
+ bool checkpoint_io, bool write)
{
WT_BLKCACHE *blkcache;
- WT_BLKCACHE_ID id;
- WT_BLKCACHE_ITEM *blkcache_item;
+ WT_BLKCACHE_ITEM *blkcache_item, *blkcache_store;
WT_DECL_RET;
uint64_t bucket, hash;
void *data_ptr;
blkcache = &S2C(session)->blkcache;
+ blkcache_store = NULL;
data_ptr = NULL;
- if (blkcache->type == BLKCACHE_UNCONFIGURED)
- return (-1);
-
/* Bypass on write if the no-write-allocate setting is on */
if (write && blkcache->cache_on_writes == false) {
WT_STAT_CONN_INCR(session, block_cache_bypass_writealloc);
- return (-1);
+ return (0);
}
/* Are we within cache size limits? */
if (blkcache->bytes_used >= blkcache->max_bytes)
- return (WT_BLKCACHE_FULL);
+ return (0);
/*
* If more than the configured fraction of the file is likely to fit into the OS buffer cache,
@@ -429,7 +434,7 @@ __wt_blkcache_put(WT_SESSION_IMPL *session, wt_off_t offset, size_t size, uint32
if ((__blkcache_estimate_filesize(session) * blkcache->percent_file_in_os_cache) / 100 <
blkcache->system_ram) {
WT_STAT_CONN_INCR(session, block_cache_bypass_put);
- return (WT_BLKCACHE_BYPASS);
+ return (0);
}
/*
@@ -442,90 +447,90 @@ __wt_blkcache_put(WT_SESSION_IMPL *session, wt_off_t offset, size_t size, uint32
*/
if ((blkcache->cache_on_checkpoint == false) && checkpoint_io) {
WT_STAT_CONN_INCR(session, block_cache_bypass_chkpt);
- return (WT_BLKCACHE_BYPASS);
+ return (0);
}
/* Bypass on high overhead */
if (__blkcache_high_overhead(session) == true) {
WT_STAT_CONN_INCR(session, block_cache_bypass_overhead_put);
- return (WT_BLKCACHE_BYPASS);
+ return (0);
}
- /*
- * Allocate space in the cache outside of the critical section. In the unlikely event that we
- * fail to allocate metadata, or if the item exists and the caller did not check for that prior
- * to calling this function, we will free the space.
- */
- WT_RET(__blkcache_alloc(session, size, &data_ptr));
/*
- * We will use the item id structure as a byte array for (1) computing a hash, and (2) for
- * comparing with the items in the hash table.
+ * Allocate and initialize space in the cache outside of the critical section. In the unlikely
+ * event that we fail an allocation, free the space. NVRAM allocations can fail if there's no
+ * available memory, treat it as a cache-full failure.
*/
- id.checksum = checksum;
- id.offset = offset;
- id.size = (uint32_t)size;
- id.fid = S2BT(session)->id;
- hash = __wt_hash_city64(&id, sizeof(id));
-
+ WT_RET(__blkcache_alloc(session, data->size, &data_ptr));
+ if (data_ptr == NULL)
+ return (0);
+ WT_ERR(__wt_calloc(session, 1, sizeof(*blkcache_store) + addr_size, &blkcache_store));
+ blkcache_store->data = data_ptr;
+ blkcache_store->data_size = WT_STORE_SIZE(data->size);
+ memcpy(blkcache_store->data, data->data, data->size);
+ blkcache_store->fid = S2BT(session)->id;
+ blkcache_store->addr_size = (uint8_t)addr_size;
+ memcpy(blkcache_store->addr, addr, addr_size);
+
+ hash = __wt_hash_city64(addr, addr_size);
bucket = hash % blkcache->hash_size;
__wt_spin_lock(session, &blkcache->hash_locks[bucket]);
- TAILQ_FOREACH (blkcache_item, &blkcache->hash[bucket], hashq) {
- if (blkcache_item->id.checksum == id.checksum && blkcache_item->id.offset == id.offset &&
- blkcache_item->id.size == id.size && blkcache_item->id.fid == id.fid)
- goto item_exists;
- }
- WT_ERR(__wt_calloc_one(session, &blkcache_item));
- blkcache_item->id = id;
- blkcache_item->data = data_ptr;
+ /*
+ * In the case of a read, check if the block is already in the cache: it's possible because two
+ * readers can attempt to cache the same overflow block because overflow blocks aren't cached at
+ * the btree level. Collisions are relatively unlikely because other page types are cached at
+ * higher levels and reads of those tree pages are single-threaded so the page can be converted
+ * to its in-memory form before reader access. In summary, because collisions are unlikely, the
+ * allocation and copying remains outside of the bucket lock and collision check. Writing a
+ * block is single-threaded at a higher level, and as there should never be a collision, only
+ * check in diagnostic mode.
+ */
+#if !defined(HAVE_DIAGNOSTIC)
+ if (!write)
+#endif
+ TAILQ_FOREACH (blkcache_item, &blkcache->hash[bucket], hashq)
+ if (blkcache_item->addr_size == addr_size && blkcache_item->fid == S2BT(session)->id &&
+ memcmp(blkcache_item->addr, addr, addr_size) == 0) {
+ __wt_spin_unlock(session, &blkcache->hash_locks[bucket]);
+ WT_ASSERT(session, !write);
+
+ WT_STAT_CONN_INCRV(session, block_cache_bytes_update, data->size);
+ WT_STAT_CONN_INCR(session, block_cache_blocks_update);
+ __blkcache_verbose(session, "block already in cache", hash, addr, addr_size);
+ goto err;
+ }
/*
* Set the recency timestamp on newly inserted blocks to the maximum value to reduce the chance
* of them being evicted before they are reused.
*/
- blkcache_item->freq_rec_counter = 1;
+ blkcache_store->freq_rec_counter = 1;
- if (data != NULL && blkcache_item->data != NULL) /* This makes static analyzers happier. */
- memcpy(blkcache_item->data, data, size);
- TAILQ_INSERT_HEAD(&blkcache->hash[bucket], blkcache_item, hashq);
+ TAILQ_INSERT_HEAD(&blkcache->hash[bucket], blkcache_store, hashq);
blkcache->bucket_metadata[bucket].bucket_num_data_blocks++;
- blkcache->bucket_metadata[bucket].bucket_bytes_used += size;
+ blkcache->bucket_metadata[bucket].bucket_bytes_used += data->size;
blkcache->inserts++;
__wt_spin_unlock(session, &blkcache->hash_locks[bucket]);
- WT_STAT_CONN_INCRV(session, block_cache_bytes, size);
+ WT_STAT_CONN_INCRV(session, block_cache_bytes, data->size);
WT_STAT_CONN_INCR(session, block_cache_blocks);
- if (write == true) {
- WT_STAT_CONN_INCRV(session, block_cache_bytes_insert_write, size);
+ if (write) {
+ WT_STAT_CONN_INCRV(session, block_cache_bytes_insert_write, data->size);
WT_STAT_CONN_INCR(session, block_cache_blocks_insert_write);
} else {
- WT_STAT_CONN_INCRV(session, block_cache_bytes_insert_read, size);
+ WT_STAT_CONN_INCRV(session, block_cache_bytes_insert_read, data->size);
WT_STAT_CONN_INCR(session, block_cache_blocks_insert_read);
}
- __wt_verbose(session, WT_VERB_BLKCACHE,
- "block inserted in cache: offset=%" PRIuMAX ", size=%" WT_SIZET_FMT ", checksum=%" PRIu32
- ", hash=%" PRIu64,
- (uintmax_t)offset, size, checksum, hash);
+ __blkcache_verbose(session, "block inserted in cache", hash, addr, addr_size);
return (0);
-item_exists:
- if (write) {
- memcpy(blkcache_item->data, data, size);
- WT_STAT_CONN_INCRV(session, block_cache_bytes_update, size);
- WT_STAT_CONN_INCR(session, block_cache_blocks_update);
- }
-
- __wt_verbose(session, WT_VERB_BLKCACHE,
- "block exists during put: offset=%" PRIuMAX ", size=%" WT_SIZET_FMT
- ", "
- "checksum=%" PRIu32 ", hash=%" PRIu64,
- (uintmax_t)offset, size, checksum, hash);
err:
__blkcache_free(session, data_ptr);
- __wt_spin_unlock(session, &blkcache->hash_locks[bucket]);
+ __blkcache_free(session, blkcache_store);
return (ret);
}
@@ -534,48 +539,32 @@ err:
* Remove a block from the cache.
*/
void
-__wt_blkcache_remove(WT_SESSION_IMPL *session, wt_off_t offset, size_t size, uint32_t checksum)
+__wt_blkcache_remove(WT_SESSION_IMPL *session, const uint8_t *addr, size_t addr_size)
{
WT_BLKCACHE *blkcache;
- WT_BLKCACHE_ID id;
WT_BLKCACHE_ITEM *blkcache_item;
uint64_t bucket, hash;
blkcache = &S2C(session)->blkcache;
- if (blkcache->type == BLKCACHE_UNCONFIGURED)
- return;
-
- /*
- * We will use the item id structure as a byte array for (1) computing a hash, and (2) for
- * comparing with the items in the hash table.
- */
- id.checksum = checksum;
- id.offset = offset;
- id.size = (uint32_t)size;
- id.fid = S2BT(session)->id;
- hash = __wt_hash_city64(&id, sizeof(id));
-
+ hash = __wt_hash_city64(addr, addr_size);
bucket = hash % blkcache->hash_size;
__wt_spin_lock(session, &blkcache->hash_locks[bucket]);
TAILQ_FOREACH (blkcache_item, &blkcache->hash[bucket], hashq) {
- if (blkcache_item->id.checksum == id.checksum && blkcache_item->id.offset == id.offset &&
- blkcache_item->id.size == id.size && blkcache_item->id.fid == id.fid) {
+ if (blkcache_item->addr_size == addr_size && blkcache_item->fid == S2BT(session)->id &&
+ memcmp(blkcache_item->addr, addr, addr_size) == 0) {
TAILQ_REMOVE(&blkcache->hash[bucket], blkcache_item, hashq);
blkcache->bucket_metadata[bucket].bucket_num_data_blocks--;
- blkcache->bucket_metadata[bucket].bucket_bytes_used -= size;
+ blkcache->bucket_metadata[bucket].bucket_bytes_used -= blkcache_item->data_size;
__blkcache_update_ref_histogram(session, blkcache_item, BLKCACHE_RM_FREE);
__wt_spin_unlock(session, &blkcache->hash_locks[bucket]);
- __blkcache_free(session, blkcache_item->data);
- __wt_overwrite_and_free(session, blkcache_item);
- WT_STAT_CONN_DECRV(session, block_cache_bytes, size);
+ WT_STAT_CONN_DECRV(session, block_cache_bytes, blkcache_item->data_size);
WT_STAT_CONN_DECR(session, block_cache_blocks);
WT_STAT_CONN_INCR(session, block_cache_blocks_removed);
blkcache->removals++;
- __wt_verbose(session, WT_VERB_BLKCACHE,
- "block removed from cache: offset=%" PRIuMAX ", size=%" WT_SIZET_FMT
- ", checksum=%" PRIu32 ", hash=%" PRIu64,
- (uintmax_t)offset, size, checksum, hash);
+ __blkcache_free(session, blkcache_item->data);
+ __wt_overwrite_and_free(session, blkcache_item);
+ __blkcache_verbose(session, "block removed from cache", hash, addr, addr_size);
return;
}
}
@@ -685,7 +674,7 @@ __wt_block_cache_destroy(WT_SESSION_IMPL *session)
__blkcache_free(session, blkcache_item->data);
__blkcache_update_ref_histogram(session, blkcache_item, BLKCACHE_RM_EXIT);
blkcache->bucket_metadata[i].bucket_num_data_blocks--;
- blkcache->bucket_metadata[i].bucket_bytes_used -= blkcache_item->id.size;
+ blkcache->bucket_metadata[i].bucket_bytes_used -= blkcache_item->data_size;
__wt_free(session, blkcache_item);
}
__wt_spin_unlock(session, &blkcache->hash_locks[i]);
diff --git a/src/third_party/wiredtiger/src/block/block_mgr.c b/src/third_party/wiredtiger/src/block_cache/block_mgr.c
index 983de3d7c52..f60905849d5 100644
--- a/src/third_party/wiredtiger/src/block/block_mgr.c
+++ b/src/third_party/wiredtiger/src/block_cache/block_mgr.c
@@ -331,6 +331,14 @@ __bm_compact_start_readonly(WT_BM *bm, WT_SESSION_IMPL *session)
static int
__bm_free(WT_BM *bm, WT_SESSION_IMPL *session, const uint8_t *addr, size_t addr_size)
{
+ WT_BLKCACHE *blkcache;
+
+ blkcache = &S2C(session)->blkcache;
+
+ /* Evict the freed block from the block cache */
+ if (blkcache->type != BLKCACHE_UNCONFIGURED)
+ __wt_blkcache_remove(session, addr, addr_size);
+
return (__wt_block_free(session, bm->block, addr, addr_size));
}
@@ -373,6 +381,56 @@ __bm_map_discard(WT_BM *bm, WT_SESSION_IMPL *session, void *map, size_t len)
}
/*
+ * __bm_read --
+ * Read an address cookie referenced block into a buffer.
+ */
+static int
+__bm_read(WT_BM *bm, WT_SESSION_IMPL *session, WT_ITEM *buf, const uint8_t *addr, size_t addr_size)
+{
+ WT_BLKCACHE *blkcache;
+ bool found, skip_cache;
+
+ blkcache = &S2C(session)->blkcache;
+
+ /* Check the block cache. */
+ skip_cache = true;
+ if (blkcache->type != BLKCACHE_UNCONFIGURED) {
+ WT_RET(__wt_blkcache_get(session, buf, addr, addr_size, &found, &skip_cache));
+ if (found)
+ return (0);
+ }
+
+ /* Read the block. */
+ WT_RET(__wt_bm_read(bm, session, buf, addr, addr_size));
+
+ /* Optionally store in the block cache. */
+ if (!skip_cache)
+ WT_RET(__wt_blkcache_put(session, buf, addr, addr_size, false, false));
+ return (0);
+}
+
+/*
+ * __bm_preload --
+ * Pre-load a page.
+ */
+static int
+__bm_preload(WT_BM *bm, WT_SESSION_IMPL *session, const uint8_t *addr, size_t addr_size)
+{
+ WT_DECL_ITEM(tmp);
+ WT_DECL_RET;
+
+ /* Ignore underlying preload errors, just use them as an indication preload didn't work. */
+ if (__wt_bm_preload(bm, session, addr, addr_size) == 0)
+ return (0);
+
+ /* Do it the slow way. */
+ WT_RET(__wt_scr_alloc(session, 0, &tmp));
+ ret = __bm_read(bm, session, tmp, addr, addr_size);
+ __wt_scr_free(session, &tmp);
+ return (ret);
+}
+
+/*
* __bm_salvage_end --
* End a block manager salvage.
*/
@@ -557,10 +615,19 @@ static int
__bm_write(WT_BM *bm, WT_SESSION_IMPL *session, WT_ITEM *buf, uint8_t *addr, size_t *addr_sizep,
bool data_checksum, bool checkpoint_io)
{
+ WT_BLKCACHE *blkcache;
+
+ blkcache = &S2C(session)->blkcache;
+
__wt_capacity_throttle(
session, buf->size, checkpoint_io ? WT_THROTTLE_CKPT : WT_THROTTLE_EVICT);
- return (
+
+ WT_RET(
__wt_block_write(session, bm->block, buf, addr, addr_sizep, data_checksum, checkpoint_io));
+
+ if (blkcache->type != BLKCACHE_UNCONFIGURED)
+ WT_RET(__wt_blkcache_put(session, buf, addr, *addr_sizep, checkpoint_io, true));
+ return (0);
}
/*
@@ -629,8 +696,8 @@ __bm_method_set(WT_BM *bm, bool readonly)
bm->free = __bm_free;
bm->is_mapped = __bm_is_mapped;
bm->map_discard = __bm_map_discard;
- bm->preload = __wt_bm_preload;
- bm->read = __wt_bm_read;
+ bm->preload = __bm_preload;
+ bm->read = __bm_read;
bm->salvage_end = __bm_salvage_end;
bm->salvage_next = __bm_salvage_next;
bm->salvage_start = __bm_salvage_start;
diff --git a/src/third_party/wiredtiger/src/include/block_cache.h b/src/third_party/wiredtiger/src/include/block_cache.h
index 0686a3eaf66..9dfb4a2c1b6 100644
--- a/src/third_party/wiredtiger/src/include/block_cache.h
+++ b/src/third_party/wiredtiger/src/include/block_cache.h
@@ -24,33 +24,19 @@
#define BLKCACHE_HASHSIZE_MIN 512
#define BLKCACHE_HASHSIZE_MAX WT_GIGABYTE
-#define WT_BLKCACHE_FULL -2
-#define WT_BLKCACHE_BYPASS -3
-
#define BLKCACHE_MINREF_INCREMENT 20
#define BLKCACHE_EVICT_OTHER 0
#define BLKCACHE_NOT_EVICTION_CANDIDATE 1
/*
- * WT_BLKCACHE_ID --
- * File ID, checksum, offset and size uniquely identify a block.
- */
-WT_PACKED_STRUCT_BEGIN(__wt_blkcache_id)
- uint32_t fid;
- uint32_t checksum;
- uint32_t size;
- wt_off_t offset;
-WT_PACKED_STRUCT_END
-#define WT_BLKCACHE_ID_SIZE (sizeof(wt_off_t) + 3 * sizeof(uint32_t))
-
-/*
* WT_BLKCACHE_ITEM --
* Block cache item. It links with other items in the same hash bucket.
*/
struct __wt_blkcache_item {
- struct __wt_blkcache_id id;
TAILQ_ENTRY(__wt_blkcache_item) hashq;
+
void *data;
+ uint32_t data_size;
uint32_t num_references;
/*
@@ -60,6 +46,10 @@ struct __wt_blkcache_item {
* this counter is a metric combining frequency and recency, and hence its name.
*/
int32_t freq_rec_counter;
+
+ uint32_t fid; /* File ID */
+ uint8_t addr_size; /* Address cookie */
+ uint8_t addr[];
};
/*
@@ -107,14 +97,14 @@ struct __wt_blkcache {
int refs_since_filesize_estimated; /* Counter for recalculating the aggregate file size */
/*
- * This fraction tells us the good enough ratio of file data cached in the DRAM resident OS
- * buffer cache, which makes the use of this block cache unnecessary. Suppose we set that
- * fraction to 50%. Then if half of our file data fits into system DRAM, we consider this block
- * cache unhelpful.
+ * This fraction tells us the ratio of total file data to the application-declared size of the
+ * OS filesystem buffer cache, which makes the use of this block cache unnecessary. Suppose we
+ * set that fraction to 50%. Then if half of our total file data fits into whatever value the
+ * user gives us for the filesystem buffer cache, we consider this block cache unhelpful.
*
- * E.g., if the fraction is set to 50%, our aggregate file size is 500GB, and we have 300GB of
- * RAM, then we will not use this block cache, because we know that half of our files (250GB)
- * must be cached by the OS in DRAM.
+ * E.g., if the fraction is set to 50%, our aggregate file size is 500GB, and the application
+ * declares there to be 300GB of OS filesystem buffer cache, then we will not use this block
+ * cache, because half of our total file size (250GB) would fit into such a buffer cache.
*/
u_int percent_file_in_os_cache;
diff --git a/src/third_party/wiredtiger/src/include/extern.h b/src/third_party/wiredtiger/src/include/extern.h
index 36aea1783c9..3f4b06363d4 100644
--- a/src/third_party/wiredtiger/src/include/extern.h
+++ b/src/third_party/wiredtiger/src/include/extern.h
@@ -92,10 +92,11 @@ extern int __wt_backup_open(WT_SESSION_IMPL *session)
WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result));
extern int __wt_bad_object_type(WT_SESSION_IMPL *session, const char *uri)
WT_GCC_FUNC_DECL_ATTRIBUTE((cold)) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result));
-extern int __wt_blkcache_get_or_check(WT_SESSION_IMPL *session, wt_off_t offset, size_t size,
- uint32_t checksum, void *data_ptr) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result));
-extern int __wt_blkcache_put(WT_SESSION_IMPL *session, wt_off_t offset, size_t size,
- uint32_t checksum, void *data, bool checkpoint_io, bool write)
+extern int __wt_blkcache_get(WT_SESSION_IMPL *session, WT_ITEM *data, const uint8_t *addr,
+ size_t addr_size, bool *foundp, bool *skip_cachep)
+ WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result));
+extern int __wt_blkcache_put(WT_SESSION_IMPL *session, WT_ITEM *data, const uint8_t *addr,
+ size_t addr_size, bool checkpoint_io, bool write)
WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result));
extern int __wt_block_addr_invalid(WT_SESSION_IMPL *session, WT_BLOCK *block, const uint8_t *addr,
size_t addr_size, bool live) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result));
@@ -1697,8 +1698,7 @@ extern void *__wt_ext_scr_alloc(WT_EXTENSION_API *wt_api, WT_SESSION *wt_session
extern void __wt_abort(WT_SESSION_IMPL *session) WT_GCC_FUNC_DECL_ATTRIBUTE((noreturn))
WT_GCC_FUNC_DECL_ATTRIBUTE((visibility("default")));
extern void __wt_backup_destroy(WT_SESSION_IMPL *session);
-extern void __wt_blkcache_remove(
- WT_SESSION_IMPL *session, wt_off_t offset, size_t size, uint32_t checksum);
+extern void __wt_blkcache_remove(WT_SESSION_IMPL *session, const uint8_t *addr, size_t addr_size);
extern void __wt_block_cache_destroy(WT_SESSION_IMPL *session);
extern void __wt_block_ckpt_destroy(WT_SESSION_IMPL *session, WT_BLOCK_CKPT *ci);
extern void __wt_block_compact_get_progress_stats(WT_SESSION_IMPL *session, WT_BM *bm,
diff --git a/src/third_party/wiredtiger/src/include/stat.h b/src/third_party/wiredtiger/src/include/stat.h
index f7ada3015b5..069cef7806f 100644
--- a/src/third_party/wiredtiger/src/include/stat.h
+++ b/src/third_party/wiredtiger/src/include/stat.h
@@ -346,7 +346,7 @@ struct __wt_connection_stats {
int64_t block_cache_bytes_update;
int64_t block_cache_blocks_evicted;
int64_t block_cache_bypass_filesize;
- int64_t block_cache_data_refs;
+ int64_t block_cache_lookups;
int64_t block_cache_not_evicted_overhead;
int64_t block_cache_bypass_writealloc;
int64_t block_cache_bypass_overhead_put;
diff --git a/src/third_party/wiredtiger/src/include/verify_build.h b/src/third_party/wiredtiger/src/include/verify_build.h
index 1b83b6e1813..af0e81c141d 100644
--- a/src/third_party/wiredtiger/src/include/verify_build.h
+++ b/src/third_party/wiredtiger/src/include/verify_build.h
@@ -49,7 +49,6 @@ static inline void
__wt_verify_build(void)
{
/* Check specific structures weren't padded. */
- WT_SIZE_CHECK(WT_BLKCACHE_ID, WT_BLKCACHE_ID_SIZE);
WT_SIZE_CHECK(WT_BLOCK_DESC, WT_BLOCK_DESC_SIZE);
WT_SIZE_CHECK(WT_REF, WT_REF_SIZE);
diff --git a/src/third_party/wiredtiger/src/include/wiredtiger.in b/src/third_party/wiredtiger/src/include/wiredtiger.in
index d6c2562f270..b8c4260991a 100644
--- a/src/third_party/wiredtiger/src/include/wiredtiger.in
+++ b/src/third_party/wiredtiger/src/include/wiredtiger.in
@@ -5130,56 +5130,50 @@ extern int wiredtiger_extension_terminate(WT_CONNECTION *connection);
#define WT_STAT_CONN_LSM_WORK_UNITS_CREATED 1008
/*! LSM: tree queue hit maximum */
#define WT_STAT_CONN_LSM_WORK_QUEUE_MAX 1009
-/*! block-manager: block cache cached blocks updated */
+/*! block-cache: cached blocks updated */
#define WT_STAT_CONN_BLOCK_CACHE_BLOCKS_UPDATE 1010
-/*! block-manager: block cache cached bytes updated */
+/*! block-cache: cached bytes updated */
#define WT_STAT_CONN_BLOCK_CACHE_BYTES_UPDATE 1011
-/*! block-manager: block cache evicted blocks */
+/*! block-cache: evicted blocks */
#define WT_STAT_CONN_BLOCK_CACHE_BLOCKS_EVICTED 1012
-/*! block-manager: block cache file size causing bypass */
+/*! block-cache: file size causing bypass */
#define WT_STAT_CONN_BLOCK_CACHE_BYPASS_FILESIZE 1013
-/*! block-manager: block cache lookups */
-#define WT_STAT_CONN_BLOCK_CACHE_DATA_REFS 1014
-/*!
- * block-manager: block cache number of blocks not evicted due to
- * overhead
- */
+/*! block-cache: lookups */
+#define WT_STAT_CONN_BLOCK_CACHE_LOOKUPS 1014
+/*! block-cache: number of blocks not evicted due to overhead */
#define WT_STAT_CONN_BLOCK_CACHE_NOT_EVICTED_OVERHEAD 1015
/*!
- * block-manager: block cache number of bypasses because no-write-
- * allocate setting was on
+ * block-cache: number of bypasses because no-write-allocate setting was
+ * on
*/
#define WT_STAT_CONN_BLOCK_CACHE_BYPASS_WRITEALLOC 1016
-/*! block-manager: block cache number of bypasses due to overhead on put */
+/*! block-cache: number of bypasses due to overhead on put */
#define WT_STAT_CONN_BLOCK_CACHE_BYPASS_OVERHEAD_PUT 1017
-/*! block-manager: block cache number of bypasses on get */
+/*! block-cache: number of bypasses on get */
#define WT_STAT_CONN_BLOCK_CACHE_BYPASS_GET 1018
-/*!
- * block-manager: block cache number of bypasses on put because file is
- * too small
- */
+/*! block-cache: number of bypasses on put because file is too small */
#define WT_STAT_CONN_BLOCK_CACHE_BYPASS_PUT 1019
-/*! block-manager: block cache number of eviction passes */
+/*! block-cache: number of eviction passes */
#define WT_STAT_CONN_BLOCK_CACHE_EVICTION_PASSES 1020
-/*! block-manager: block cache number of hits including existence checks */
+/*! block-cache: number of hits */
#define WT_STAT_CONN_BLOCK_CACHE_HITS 1021
-/*! block-manager: block cache number of misses including existence checks */
+/*! block-cache: number of misses */
#define WT_STAT_CONN_BLOCK_CACHE_MISSES 1022
-/*! block-manager: block cache number of put bypasses on checkpoint I/O */
+/*! block-cache: number of put bypasses on checkpoint I/O */
#define WT_STAT_CONN_BLOCK_CACHE_BYPASS_CHKPT 1023
-/*! block-manager: block cache removed blocks */
+/*! block-cache: removed blocks */
#define WT_STAT_CONN_BLOCK_CACHE_BLOCKS_REMOVED 1024
-/*! block-manager: block cache total blocks */
+/*! block-cache: total blocks */
#define WT_STAT_CONN_BLOCK_CACHE_BLOCKS 1025
-/*! block-manager: block cache total blocks inserted on read path */
+/*! block-cache: total blocks inserted on read path */
#define WT_STAT_CONN_BLOCK_CACHE_BLOCKS_INSERT_READ 1026
-/*! block-manager: block cache total blocks inserted on write path */
+/*! block-cache: total blocks inserted on write path */
#define WT_STAT_CONN_BLOCK_CACHE_BLOCKS_INSERT_WRITE 1027
-/*! block-manager: block cache total bytes */
+/*! block-cache: total bytes */
#define WT_STAT_CONN_BLOCK_CACHE_BYTES 1028
-/*! block-manager: block cache total bytes inserted on read path */
+/*! block-cache: total bytes inserted on read path */
#define WT_STAT_CONN_BLOCK_CACHE_BYTES_INSERT_READ 1029
-/*! block-manager: block cache total bytes inserted on write path */
+/*! block-cache: total bytes inserted on write path */
#define WT_STAT_CONN_BLOCK_CACHE_BYTES_INSERT_WRITE 1030
/*! block-manager: blocks pre-loaded */
#define WT_STAT_CONN_BLOCK_PRELOAD 1031
diff --git a/src/third_party/wiredtiger/src/include/wt_internal.h b/src/third_party/wiredtiger/src/include/wt_internal.h
index 0d6319d6ec2..9f4b76aa5d1 100644
--- a/src/third_party/wiredtiger/src/include/wt_internal.h
+++ b/src/third_party/wiredtiger/src/include/wt_internal.h
@@ -73,8 +73,6 @@ struct __wt_blkcache;
typedef struct __wt_blkcache WT_BLKCACHE;
struct __wt_blkcache_bucket_metadata;
typedef struct __wt_blkcache_bucket_metadata WT_BLKCACHE_BUCKET_METADATA;
-struct __wt_blkcache_id;
-typedef struct __wt_blkcache_id WT_BLKCACHE_ID;
struct __wt_blkcache_item;
typedef struct __wt_blkcache_item WT_BLKCACHE_ITEM;
struct __wt_blkincr;
diff --git a/src/third_party/wiredtiger/src/support/stat.c b/src/third_party/wiredtiger/src/support/stat.c
index faefe679770..7d9bd538f32 100644
--- a/src/third_party/wiredtiger/src/support/stat.c
+++ b/src/third_party/wiredtiger/src/support/stat.c
@@ -1058,27 +1058,27 @@ static const char *const __stats_connection_desc[] = {
"LSM: tree maintenance operations executed",
"LSM: tree maintenance operations scheduled",
"LSM: tree queue hit maximum",
- "block-manager: block cache cached blocks updated",
- "block-manager: block cache cached bytes updated",
- "block-manager: block cache evicted blocks",
- "block-manager: block cache file size causing bypass",
- "block-manager: block cache lookups",
- "block-manager: block cache number of blocks not evicted due to overhead",
- "block-manager: block cache number of bypasses because no-write-allocate setting was on",
- "block-manager: block cache number of bypasses due to overhead on put",
- "block-manager: block cache number of bypasses on get",
- "block-manager: block cache number of bypasses on put because file is too small",
- "block-manager: block cache number of eviction passes",
- "block-manager: block cache number of hits including existence checks",
- "block-manager: block cache number of misses including existence checks",
- "block-manager: block cache number of put bypasses on checkpoint I/O",
- "block-manager: block cache removed blocks",
- "block-manager: block cache total blocks",
- "block-manager: block cache total blocks inserted on read path",
- "block-manager: block cache total blocks inserted on write path",
- "block-manager: block cache total bytes",
- "block-manager: block cache total bytes inserted on read path",
- "block-manager: block cache total bytes inserted on write path",
+ "block-cache: cached blocks updated",
+ "block-cache: cached bytes updated",
+ "block-cache: evicted blocks",
+ "block-cache: file size causing bypass",
+ "block-cache: lookups",
+ "block-cache: number of blocks not evicted due to overhead",
+ "block-cache: number of bypasses because no-write-allocate setting was on",
+ "block-cache: number of bypasses due to overhead on put",
+ "block-cache: number of bypasses on get",
+ "block-cache: number of bypasses on put because file is too small",
+ "block-cache: number of eviction passes",
+ "block-cache: number of hits",
+ "block-cache: number of misses",
+ "block-cache: number of put bypasses on checkpoint I/O",
+ "block-cache: removed blocks",
+ "block-cache: total blocks",
+ "block-cache: total blocks inserted on read path",
+ "block-cache: total blocks inserted on write path",
+ "block-cache: total bytes",
+ "block-cache: total bytes inserted on read path",
+ "block-cache: total bytes inserted on write path",
"block-manager: blocks pre-loaded",
"block-manager: blocks read",
"block-manager: blocks written",
@@ -1637,7 +1637,7 @@ __wt_stat_connection_clear_single(WT_CONNECTION_STATS *stats)
stats->block_cache_bytes_update = 0;
stats->block_cache_blocks_evicted = 0;
stats->block_cache_bypass_filesize = 0;
- stats->block_cache_data_refs = 0;
+ stats->block_cache_lookups = 0;
stats->block_cache_not_evicted_overhead = 0;
stats->block_cache_bypass_writealloc = 0;
stats->block_cache_bypass_overhead_put = 0;
@@ -2171,7 +2171,7 @@ __wt_stat_connection_aggregate(WT_CONNECTION_STATS **from, WT_CONNECTION_STATS *
to->block_cache_bytes_update += WT_STAT_READ(from, block_cache_bytes_update);
to->block_cache_blocks_evicted += WT_STAT_READ(from, block_cache_blocks_evicted);
to->block_cache_bypass_filesize += WT_STAT_READ(from, block_cache_bypass_filesize);
- to->block_cache_data_refs += WT_STAT_READ(from, block_cache_data_refs);
+ to->block_cache_lookups += WT_STAT_READ(from, block_cache_lookups);
to->block_cache_not_evicted_overhead += WT_STAT_READ(from, block_cache_not_evicted_overhead);
to->block_cache_bypass_writealloc += WT_STAT_READ(from, block_cache_bypass_writealloc);
to->block_cache_bypass_overhead_put += WT_STAT_READ(from, block_cache_bypass_overhead_put);
diff --git a/src/third_party/wiredtiger/test/format/wts.c b/src/third_party/wiredtiger/test/format/wts.c
index 6c893c22d8a..7c3447325de 100644
--- a/src/third_party/wiredtiger/test/format/wts.c
+++ b/src/third_party/wiredtiger/test/format/wts.c
@@ -215,8 +215,6 @@ create_database(const char *home, WT_CONNECTION **connp)
if (GV(RUNS_IN_MEMORY) != 0)
CONFIG_APPEND(p, ",in_memory=1");
- /* FIXME WT-8314: configuring a block cache corrupts tables. */
-#if 0
/* Block cache configuration. */
if (GV(BLOCK_CACHE) != 0)
CONFIG_APPEND(p,
@@ -226,7 +224,6 @@ create_database(const char *home, WT_CONNECTION **connp)
",size=%" PRIu32 "MB)",
GV(BLOCK_CACHE_CACHE_ON_CHECKPOINT) == 0 ? "false" : "true",
GV(BLOCK_CACHE_CACHE_ON_WRITES) == 0 ? "false" : "true", GV(BLOCK_CACHE_SIZE));
-#endif
/* LSM configuration. */
if (g.lsm_config)