diff options
author | Luke Chen <luke.chen@mongodb.com> | 2018-09-11 16:21:26 +1000 |
---|---|---|
committer | Luke Chen <luke.chen@mongodb.com> | 2018-09-11 16:48:34 +1000 |
commit | 47826721dd85248b8acb569694687db0e71257cd (patch) | |
tree | 648b6250d55b16a2cac3070c4f1c963864d1ef70 /src/third_party/wiredtiger/src/btree/bt_random.c | |
parent | e2be5a4e3684daf2410e4d5e31439c9669a38e6d (diff) | |
download | mongo-47826721dd85248b8acb569694687db0e71257cd.tar.gz |
Import wiredtiger: 45fd19bcb1007fd4e473d77ddd09d3157ff15c7e from branch mongodb-4.2
ref: 63b8cf2e0b..45fd19bcb1
for: 4.1.3
WT-3879 Disallow checkpoint from evicting metadata pages
WT-4090 Low priority reads
WT-4119 Avoid restarts updating / removing during a column store scan
WT-4131 Rename lookaside to cache overflow
WT-4154 Surface the oldest read timestamp
WT-4156 Add new wiredtiger_salvage top level API
WT-4177 Backup cursor open should force a log file switch
WT-4218 Change eviction to evict prepared updates
WT-4231 Fix ctags index of functions with attributes
WT-4246 Change transaction update list to support indirect references
WT-4259 Restore ref to the previous state rather than MEM when eviction fails
WT-4261 Test salvage of out-of-sync metadata/turtle files
WT-4267 fixed-length column store operations can corrupt data
WT-4268 Random abort should wait until record files exist before starting timer
WT-4270 Add an operation field to know where threads hang
WT-4272 Increase startup timeout to 30 seconds for slow I/O systems
WT-4274 Fix memory leak in wt4156_metadata_salvage test
WT-4277 Make truncate in column stores more efficient
WT-4281 Shorten runtime of Python test suite
WT-4282 Don't transition pages from limbo to mem unless required
WT-4283 Restore WT_ERROR and use a corrupt flag
WT-4284 Print a verbose message in recovery on error too
WT-4285 Fix wt4156_metadata_salvage Coverity/lint complaints
WT-4286 Column store should skip end-of-table checks if there's an exact match
WT-4288 Don't let return value of closing conn overwrite WT_TRY_SALVAGE
WT-4289 Update WT_DATA_CORRUPTION to WT_TRY_SALVAGE in test_txn19.py
WT-4291 Fix test_txn19.py error detection
WT-4292 Add call to testutil_cleanup to avoid memory leak
WT-4300 Setting the update timestamp can overwrite the WT_REF.addr field
WT-4301 WT_CURSOR.reserve operations can leak memory when committed
WT-4305 Add a gating variable for long running prepare support
WT-4306 Fix mode if metadata pages need eviction
Diffstat (limited to 'src/third_party/wiredtiger/src/btree/bt_random.c')
-rw-r--r-- | src/third_party/wiredtiger/src/btree/bt_random.c | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/src/third_party/wiredtiger/src/btree/bt_random.c b/src/third_party/wiredtiger/src/btree/bt_random.c index 4f310b27237..ed68513b245 100644 --- a/src/third_party/wiredtiger/src/btree/bt_random.c +++ b/src/third_party/wiredtiger/src/btree/bt_random.c @@ -169,27 +169,27 @@ __wt_row_random_leaf(WT_SESSION_IMPL *session, WT_CURSOR_BTREE *cbt) * Find a random page in a tree for either sampling or eviction. */ int -__wt_random_descent(WT_SESSION_IMPL *session, WT_REF **refp, bool eviction) +__wt_random_descent(WT_SESSION_IMPL *session, WT_REF **refp, uint32_t flags) { WT_BTREE *btree; WT_DECL_RET; WT_PAGE *page; WT_PAGE_INDEX *pindex; WT_REF *current, *descent; - uint32_t flags, i, entries, retry; + uint32_t i, entries, retry; + bool eviction; *refp = NULL; btree = S2BT(session); current = NULL; retry = 100; - - /* Eviction should not be tapped to do eviction. */ - if (eviction) - flags = WT_READ_CACHE | WT_READ_NO_EVICT | WT_READ_NO_GEN | - WT_READ_NO_WAIT | WT_READ_NOTFOUND_OK | WT_READ_RESTART_OK; - else - flags = WT_READ_RESTART_OK; + /* + * This function is called by eviction to find a random page in the + * cache. That case is indicated by the WT_READ_CACHE flag. Ordinary + * lookups in a tree will read pages into cache as needed. + */ + eviction = LF_ISSET(WT_READ_CACHE); if (0) { restart: /* @@ -302,11 +302,15 @@ __wt_btcur_next_random(WT_CURSOR_BTREE *cbt) WT_UPDATE *upd; wt_off_t size; uint64_t n, skip; + uint32_t read_flags; bool valid; btree = cbt->btree; cursor = &cbt->iface; session = (WT_SESSION_IMPL *)cbt->iface.session; + read_flags = WT_READ_RESTART_OK; + if (F_ISSET(cbt, WT_CBT_READ_ONCE)) + FLD_SET(read_flags, WT_READ_WONT_NEED); /* * Only supports row-store: applications can trivially select a random @@ -337,7 +341,7 @@ __wt_btcur_next_random(WT_CURSOR_BTREE *cbt) if (cbt->ref == NULL || cbt->next_random_sample_size == 0) { WT_ERR(__cursor_func_init(cbt, true)); WT_WITH_PAGE_INDEX(session, - ret = __wt_random_descent(session, &cbt->ref, false)); + ret = __wt_random_descent(session, &cbt->ref, read_flags)); if (ret == 0) goto random_page_entry; |