summaryrefslogtreecommitdiff
path: root/src/third_party/wiredtiger/src/cursor
diff options
context:
space:
mode:
authorLuke Chen <luke.chen@mongodb.com>2018-04-06 16:06:32 +1000
committerLuke Chen <luke.chen@mongodb.com>2018-04-06 16:23:17 +1000
commitb180ec4ad34b40b499cb4c7a2f01508ed639b44b (patch)
tree87c8fe8e92a19bb0beb69c1c2696e2b3d98aca07 /src/third_party/wiredtiger/src/cursor
parentf728898d2be6b231175c9d64b39d0f072f5d8d18 (diff)
downloadmongo-b180ec4ad34b40b499cb4c7a2f01508ed639b44b.tar.gz
Import wiredtiger: ea986ede145b8c2e3da8f8d11ef25813770c0b39 from branch mongodb-3.8
ref: 875e91581c..ea986ede14 for: 3.7.4 WT-3724 Log an error if flushing with F_FULLSYNC fails WT-3849 Add timestamp validation to WT_SESSION::prepare_transaction WT-3870 Bi-weekly WT codebase lint WT-3922 Allow truncate operations to be prepared WT-3931 cursor.prev split race WT-3971 Make cursor duplication use cursor caching WT-3973 Allow alter to modify app_metadata WT-3981 Make snapshot consistent with read_timestamp WT-3984 Fix race conditions around prepare state transitions WT-3996 Test truncate with timestamps and lookaside WT-3997 The cursor walk code can spin without sleeping on restart/split. WT-4002 Allow duplicates in api_data.py WT-4005 AddressSanitizer in __wt_timestamp_iszero(). WT-4007 eviction instantiates pages from dead trees. WT-4008 Add ARM NEON support for row search operations WT-4011 Checkpoint should not read truncated pages WT-4022 Avoid WT_RESTART error return during eviction walk WT-4025 Allow debug dumping of internal pages
Diffstat (limited to 'src/third_party/wiredtiger/src/cursor')
-rw-r--r--src/third_party/wiredtiger/src/cursor/cur_std.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/third_party/wiredtiger/src/cursor/cur_std.c b/src/third_party/wiredtiger/src/cursor/cur_std.c
index 1f5c5f25c57..00a6bc4645d 100644
--- a/src/third_party/wiredtiger/src/cursor/cur_std.c
+++ b/src/third_party/wiredtiger/src/cursor/cur_std.c
@@ -704,7 +704,7 @@ err: WT_TRET(cursor->reopen(cursor, false));
*/
int
__wt_cursor_cache_get(WT_SESSION_IMPL *session, const char *uri,
- const char *cfg[], WT_CURSOR **cursorp)
+ WT_CURSOR *to_dup, const char *cfg[], WT_CURSOR **cursorp)
{
WT_CONFIG_ITEM cval;
WT_CURSOR *cursor;
@@ -752,10 +752,22 @@ __wt_cursor_cache_get(WT_SESSION_IMPL *session, const char *uri,
}
/*
+ * Caller guarantees that exactly one of the URI and the
+ * duplicate cursor is non-NULL.
+ */
+ if (to_dup != NULL) {
+ WT_ASSERT(session, uri == NULL);
+ uri = to_dup->uri;
+ hash_value = to_dup->uri_hash;
+ } else {
+ WT_ASSERT(session, uri != NULL);
+ hash_value = __wt_hash_city64(uri, strlen(uri));
+ }
+
+ /*
* Walk through all cursors, if there is a cached
* cursor that matches uri and configuration, use it.
*/
- hash_value = __wt_hash_city64(uri, strlen(uri));
bucket = hash_value % WT_HASH_ARRAY_SIZE;
TAILQ_FOREACH(cursor, &session->cursor_cache[bucket], q) {
if (cursor->uri_hash == hash_value &&