diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/third_party/wiredtiger/dist/api_data.py | 5 | ||||
-rw-r--r-- | src/third_party/wiredtiger/src/block/block_mgr.c | 5 | ||||
-rw-r--r-- | src/third_party/wiredtiger/src/block/block_vrfy.c | 19 | ||||
-rw-r--r-- | src/third_party/wiredtiger/src/btree/bt_page.c | 2 | ||||
-rw-r--r-- | src/third_party/wiredtiger/src/btree/bt_vrfy.c | 4 | ||||
-rw-r--r-- | src/third_party/wiredtiger/src/config/config_def.c | 5 | ||||
-rw-r--r-- | src/third_party/wiredtiger/src/evict/evict_lru.c | 28 | ||||
-rw-r--r-- | src/third_party/wiredtiger/src/include/block.h | 4 | ||||
-rw-r--r-- | src/third_party/wiredtiger/src/include/cache.h | 2 | ||||
-rw-r--r-- | src/third_party/wiredtiger/src/include/cache.i | 19 | ||||
-rw-r--r-- | src/third_party/wiredtiger/src/include/extern.h | 2 | ||||
-rw-r--r-- | src/third_party/wiredtiger/src/include/wiredtiger.in | 4 |
12 files changed, 70 insertions, 29 deletions
diff --git a/src/third_party/wiredtiger/dist/api_data.py b/src/third_party/wiredtiger/dist/api_data.py index fd63bc059b5..26a7825b5aa 100644 --- a/src/third_party/wiredtiger/dist/api_data.py +++ b/src/third_party/wiredtiger/dist/api_data.py @@ -834,6 +834,11 @@ methods = { Config('dump_shape', 'false', r''' Display the shape of the tree after verification, using the application's message handler, intended for debugging''', + type='boolean'), + Config('strict', 'false', r''' + Treat any verification problem as an error; by default, verify will + warn, but not fail, in the case of errors that won't affect future + behavior (for example, a leaked block)''', type='boolean') ]), diff --git a/src/third_party/wiredtiger/src/block/block_mgr.c b/src/third_party/wiredtiger/src/block/block_mgr.c index 13e6ec73b32..558008ee7b0 100644 --- a/src/third_party/wiredtiger/src/block/block_mgr.c +++ b/src/third_party/wiredtiger/src/block/block_mgr.c @@ -302,9 +302,10 @@ __bm_salvage_end(WT_BM *bm, WT_SESSION_IMPL *session) * Start a block manager verify. */ static int -__bm_verify_start(WT_BM *bm, WT_SESSION_IMPL *session, WT_CKPT *ckptbase) +__bm_verify_start(WT_BM *bm, + WT_SESSION_IMPL *session, WT_CKPT *ckptbase, const char *cfg[]) { - return (__wt_block_verify_start(session, bm->block, ckptbase)); + return (__wt_block_verify_start(session, bm->block, ckptbase, cfg)); } /* diff --git a/src/third_party/wiredtiger/src/block/block_vrfy.c b/src/third_party/wiredtiger/src/block/block_vrfy.c index 1e341aff77a..29a9e4950b4 100644 --- a/src/third_party/wiredtiger/src/block/block_vrfy.c +++ b/src/third_party/wiredtiger/src/block/block_vrfy.c @@ -28,10 +28,11 @@ static int __verify_last_truncate(WT_SESSION_IMPL *, WT_BLOCK *, WT_CKPT *); * Start file verification. */ int -__wt_block_verify_start( - WT_SESSION_IMPL *session, WT_BLOCK *block, WT_CKPT *ckptbase) +__wt_block_verify_start(WT_SESSION_IMPL *session, + WT_BLOCK *block, WT_CKPT *ckptbase, const char *cfg[]) { WT_CKPT *ckpt; + WT_CONFIG_ITEM cval; wt_off_t size; /* @@ -98,6 +99,10 @@ __wt_block_verify_start( */ WT_RET(__verify_last_avail(session, block, ckpt)); + /* Configuration: strict behavior on any error. */ + WT_RET(__wt_config_gets(session, cfg, "strict", &cval)); + block->verify_strict = cval.val ? 1 : 0; + block->verify = 1; return (0); } @@ -164,14 +169,18 @@ __wt_block_verify_end(WT_SESSION_IMPL *session, WT_BLOCK *block) /* Confirm we verified every file block. */ ret = __verify_filefrag_chk(session, block); + block->verify = 0; + block->verify_strict = 0; + block->verify_size = 0; + /* Discard the accumulated allocation list. */ __wt_block_extlist_free(session, &block->verify_alloc); /* Discard the fragment tracking lists. */ + block->frags = 0; __wt_free(session, block->fragfile); __wt_free(session, block->fragckpt); - block->verify = 0; return (ret); } @@ -434,7 +443,7 @@ __verify_filefrag_chk(WT_SESSION_IMPL *session, WT_BLOCK *block) return (0); __wt_errx(session, "file ranges never verified: %" PRIu64, count); - return (WT_ERROR); + return (block->verify_strict ? WT_ERROR : 0); } /* @@ -527,5 +536,5 @@ __verify_ckptfrag_chk(WT_SESSION_IMPL *session, WT_BLOCK *block) __wt_errx(session, "checkpoint ranges never verified: %" PRIu64, count); - return (WT_ERROR); + return (block->verify_strict ? WT_ERROR : 0); } diff --git a/src/third_party/wiredtiger/src/btree/bt_page.c b/src/third_party/wiredtiger/src/btree/bt_page.c index b55f2196a25..e239f62403f 100644 --- a/src/third_party/wiredtiger/src/btree/bt_page.c +++ b/src/third_party/wiredtiger/src/btree/bt_page.c @@ -183,7 +183,7 @@ __wt_page_in_func(WT_SESSION_IMPL *session, WT_REF *ref, uint32_t flags page->read_gen != WT_READGEN_OLDEST && page->read_gen < __wt_cache_read_gen(session)) page->read_gen = - __wt_cache_read_gen_set(session); + __wt_cache_read_gen_bump(session); skip_evict: /* * Check if we need an autocommit transaction. diff --git a/src/third_party/wiredtiger/src/btree/bt_vrfy.c b/src/third_party/wiredtiger/src/btree/bt_vrfy.c index 0ded95c0d8c..ccd1fd8d3ae 100644 --- a/src/third_party/wiredtiger/src/btree/bt_vrfy.c +++ b/src/third_party/wiredtiger/src/btree/bt_vrfy.c @@ -23,7 +23,7 @@ typedef struct { #define WT_VRFY_DUMP(vs) \ ((vs)->dump_address || \ (vs)->dump_blocks || (vs)->dump_pages || (vs)->dump_shape) - int dump_address; /* Debugging hooks */ + int dump_address; /* Configure: dump special */ int dump_blocks; int dump_pages; int dump_shape; @@ -183,7 +183,7 @@ __wt_verify(WT_SESSION_IMPL *session, const char *cfg[]) __wt_meta_ckptlist_get(session, btree->dhandle->name, &ckptbase)); /* Inform the underlying block manager we're verifying. */ - WT_ERR(bm->verify_start(bm, session, ckptbase)); + WT_ERR(bm->verify_start(bm, session, ckptbase, cfg)); bm_start = 1; /* Loop through the file's checkpoints, verifying each one. */ diff --git a/src/third_party/wiredtiger/src/config/config_def.c b/src/third_party/wiredtiger/src/config/config_def.c index 6e9c1c2d01b..4aab159be28 100644 --- a/src/third_party/wiredtiger/src/config/config_def.c +++ b/src/third_party/wiredtiger/src/config/config_def.c @@ -336,6 +336,7 @@ static const WT_CONFIG_CHECK confchk_WT_SESSION_verify[] = { { "dump_offsets", "list", NULL, NULL, NULL, 0 }, { "dump_pages", "boolean", NULL, NULL, NULL, 0 }, { "dump_shape", "boolean", NULL, NULL, NULL, 0 }, + { "strict", "boolean", NULL, NULL, NULL, 0 }, { NULL, NULL, NULL, NULL, NULL, 0 } }; @@ -909,8 +910,8 @@ static const WT_CONFIG_ENTRY config_entries[] = { }, { "WT_SESSION.verify", "dump_address=0,dump_blocks=0,dump_offsets=,dump_pages=0," - "dump_shape=0", - confchk_WT_SESSION_verify, 5 + "dump_shape=0,strict=0", + confchk_WT_SESSION_verify, 6 }, { "colgroup.meta", "app_metadata=,collator=,columns=,source=,type=file", diff --git a/src/third_party/wiredtiger/src/evict/evict_lru.c b/src/third_party/wiredtiger/src/evict/evict_lru.c index a16d2743536..bc171bb0dd5 100644 --- a/src/third_party/wiredtiger/src/evict/evict_lru.c +++ b/src/third_party/wiredtiger/src/evict/evict_lru.c @@ -485,6 +485,14 @@ __evict_pass(WT_SESSION_IMPL *session) session, cache->evict_waiter_cond)); } + /* + * Increment the shared read generation. We do this + * occasionally even if eviction is not currently required, so + * that pages have some relative read generation when the + * eviction server does need to do some work. + */ + __wt_cache_read_gen_incr(session); + WT_RET(__evict_has_work(session, &flags)); if (flags == 0) break; @@ -830,6 +838,9 @@ __evict_lru_walk(WT_SESSION_IMPL *session, uint32_t flags) WT_ASSERT(session, cache->evict[0].ref != NULL); + /* Track the oldest read generation we have in the queue. */ + cache->read_gen_oldest = cache->evict[0].ref->page->read_gen; + if (LF_ISSET(WT_EVICT_PASS_AGGRESSIVE | WT_EVICT_PASS_WOULD_BLOCK)) /* * Take all candidates if we only gathered pages with an oldest @@ -924,9 +935,6 @@ __evict_walk(WT_SESSION_IMPL *session, uint32_t flags) incr = dhandle_locked = 0; retries = 0; - /* Increment the shared read generation. */ - __wt_cache_read_gen_incr(session); - /* * Update the oldest ID: we use it to decide whether pages are * candidates for eviction. Without this, if all threads are blocked @@ -1213,15 +1221,11 @@ __evict_walk_file(WT_SESSION_IMPL *session, u_int *slotp, uint32_t flags) continue; /* - * If this page has never been considered for eviction, - * set its read generation to a little bit in the - * future and move on, give readers a chance to start - * updating the read generation. + * If this page has never been considered for eviction, set its + * read generation to somewhere in the middle of the LRU list. */ - if (page->read_gen == WT_READGEN_NOTSET) { - page->read_gen = __wt_cache_read_gen_set(session); - continue; - } + if (page->read_gen == WT_READGEN_NOTSET) + page->read_gen = __wt_cache_read_gen_new(session); fast: /* If the page can't be evicted, give up. */ if (!__wt_page_can_evict(session, page, 1, NULL)) @@ -1414,7 +1418,7 @@ __wt_evict_lru_page(WT_SESSION_IMPL *session, int is_server) */ page = ref->page; if (page->read_gen != WT_READGEN_OLDEST) - page->read_gen = __wt_cache_read_gen_set(session); + page->read_gen = __wt_cache_read_gen_bump(session); /* * If we are evicting in a dead tree, don't write dirty pages. diff --git a/src/third_party/wiredtiger/src/include/block.h b/src/third_party/wiredtiger/src/include/block.h index 29a0f67b518..795d646db1e 100644 --- a/src/third_party/wiredtiger/src/include/block.h +++ b/src/third_party/wiredtiger/src/include/block.h @@ -185,7 +185,8 @@ struct __wt_bm { int (*sync)(WT_BM *, WT_SESSION_IMPL *, int); int (*verify_addr)(WT_BM *, WT_SESSION_IMPL *, const uint8_t *, size_t); int (*verify_end)(WT_BM *, WT_SESSION_IMPL *); - int (*verify_start)(WT_BM *, WT_SESSION_IMPL *, WT_CKPT *); + int (*verify_start) + (WT_BM *, WT_SESSION_IMPL *, WT_CKPT *, const char *[]); int (*write) (WT_BM *, WT_SESSION_IMPL *, WT_ITEM *, uint8_t *, size_t *, int); int (*write_size)(WT_BM *, WT_SESSION_IMPL *, size_t *); @@ -246,6 +247,7 @@ struct __wt_block { /* Verification support */ int verify; /* If performing verification */ + int verify_strict; /* Fail hard on any error */ wt_off_t verify_size; /* Checkpoint's file size */ WT_EXTLIST verify_alloc; /* Verification allocation list */ uint64_t frags; /* Maximum frags in the file */ diff --git a/src/third_party/wiredtiger/src/include/cache.h b/src/third_party/wiredtiger/src/include/cache.h index 0e426c88ec9..cb7e66d2bbd 100644 --- a/src/third_party/wiredtiger/src/include/cache.h +++ b/src/third_party/wiredtiger/src/include/cache.h @@ -71,6 +71,8 @@ struct __wt_cache { * Read information. */ uint64_t read_gen; /* Page read generation (LRU) */ + uint64_t read_gen_oldest; /* The oldest read generation that + eviction knows about */ /* * Eviction thread information. diff --git a/src/third_party/wiredtiger/src/include/cache.i b/src/third_party/wiredtiger/src/include/cache.i index 31bae1ac679..ad1e17e1fdc 100644 --- a/src/third_party/wiredtiger/src/include/cache.i +++ b/src/third_party/wiredtiger/src/include/cache.i @@ -27,11 +27,11 @@ __wt_cache_read_gen_incr(WT_SESSION_IMPL *session) } /* - * __wt_cache_read_gen_set -- - * Get the read generation to store in a page. + * __wt_cache_read_gen_bump -- + * Get the read generation to keep a page in memory. */ static inline uint64_t -__wt_cache_read_gen_set(WT_SESSION_IMPL *session) +__wt_cache_read_gen_bump(WT_SESSION_IMPL *session) { /* * We return read-generations from the future (where "the future" is @@ -46,6 +46,19 @@ __wt_cache_read_gen_set(WT_SESSION_IMPL *session) } /* + * __wt_cache_read_gen_new -- + * Get the read generation for a new page in memory. + */ +static inline uint64_t +__wt_cache_read_gen_new(WT_SESSION_IMPL *session) +{ + WT_CACHE *cache; + + cache = S2C(session)->cache; + return (__wt_cache_read_gen(session) + cache->read_gen_oldest) / 2; +} + +/* * __wt_cache_pages_inuse -- * Return the number of pages in use. */ diff --git a/src/third_party/wiredtiger/src/include/extern.h b/src/third_party/wiredtiger/src/include/extern.h index 871adb2d25d..6b3dc327817 100644 --- a/src/third_party/wiredtiger/src/include/extern.h +++ b/src/third_party/wiredtiger/src/include/extern.h @@ -66,7 +66,7 @@ extern int __wt_block_salvage_end(WT_SESSION_IMPL *session, WT_BLOCK *block); extern int __wt_block_offset_invalid(WT_BLOCK *block, wt_off_t offset, uint32_t size); extern int __wt_block_salvage_next(WT_SESSION_IMPL *session, WT_BLOCK *block, uint8_t *addr, size_t *addr_sizep, int *eofp); extern int __wt_block_salvage_valid(WT_SESSION_IMPL *session, WT_BLOCK *block, uint8_t *addr, size_t addr_size, int valid); -extern int __wt_block_verify_start( WT_SESSION_IMPL *session, WT_BLOCK *block, WT_CKPT *ckptbase); +extern int __wt_block_verify_start(WT_SESSION_IMPL *session, WT_BLOCK *block, WT_CKPT *ckptbase, const char *cfg[]); extern int __wt_block_verify_end(WT_SESSION_IMPL *session, WT_BLOCK *block); extern int __wt_verify_ckpt_load( WT_SESSION_IMPL *session, WT_BLOCK *block, WT_BLOCK_CKPT *ci); extern int __wt_verify_ckpt_unload(WT_SESSION_IMPL *session, WT_BLOCK *block); diff --git a/src/third_party/wiredtiger/src/include/wiredtiger.in b/src/third_party/wiredtiger/src/include/wiredtiger.in index 8c4e58e02fe..8a99c1635e1 100644 --- a/src/third_party/wiredtiger/src/include/wiredtiger.in +++ b/src/third_party/wiredtiger/src/include/wiredtiger.in @@ -1360,6 +1360,10 @@ struct __wt_session { * @config{dump_shape, Display the shape of the tree after * verification\, using the application's message handler\, intended for * debugging., a boolean flag; default \c false.} + * @config{strict, Treat any verification problem as an error; by + * default\, verify will warn\, but not fail\, in the case of errors + * that won't affect future behavior (for example\, a leaked block)., a + * boolean flag; default \c false.} * @configend * @ebusy_errors */ |