diff options
author | Michael Cahill <michael.cahill@wiredtiger.com> | 2013-05-16 09:54:57 +1000 |
---|---|---|
committer | Michael Cahill <michael.cahill@wiredtiger.com> | 2013-05-16 09:54:57 +1000 |
commit | e602bd6397310a095c65663ff53b9d599ba4d247 (patch) | |
tree | a1faf7beb3c852f00e2d8bdc7b9e93358b1cb475 | |
parent | 38e70629f216c08a8084ec5874cd91e5242b98da (diff) | |
download | mongo-e602bd6397310a095c65663ff53b9d599ba4d247.tar.gz |
Use the name hash to avoid string comparisons in the session list of data handles as well as the shared connection list.
-rw-r--r-- | src/include/extern.h | 2 | ||||
-rw-r--r-- | src/schema/schema_create.c | 2 | ||||
-rw-r--r-- | src/session/session_dhandle.c | 5 | ||||
-rw-r--r-- | src/support/hash_city.c | 2 |
4 files changed, 7 insertions, 4 deletions
diff --git a/src/include/extern.h b/src/include/extern.h index 0fb7628a749..ce7a96efb76 100644 --- a/src/include/extern.h +++ b/src/include/extern.h @@ -1136,7 +1136,7 @@ extern int __wt_nfilename(WT_SESSION_IMPL *session, extern int __wt_library_init(void); extern int __wt_breakpoint(void); extern void __wt_attach(WT_SESSION_IMPL *session); -extern uint64_t __wt_hash_city64(const void *string, uint32_t len); +extern uint64_t __wt_hash_city64(const void *string, size_t len); extern uint64_t __wt_hash_fnv64(const void *string, uint32_t len); extern int __wt_hazard_set(WT_SESSION_IMPL *session, WT_REF *ref, int *busyp diff --git a/src/schema/schema_create.c b/src/schema/schema_create.c index 4d5510c71c4..685da0d6386 100644 --- a/src/schema/schema_create.c +++ b/src/schema/schema_create.c @@ -71,7 +71,7 @@ __create_file(WT_SESSION_IMPL *session, * Keep the handle exclusive until it is released at the end of the * call, otherwise we could race with a drop. */ - WT_ERR(__wt_conn_btree_get( + WT_ERR(__wt_session_get_btree( session, uri, NULL, NULL, WT_DHANDLE_EXCLUSIVE)); if (WT_META_TRACKING(session)) WT_ERR(__wt_meta_track_handle_lock(session, 1)); diff --git a/src/session/session_dhandle.c b/src/session/session_dhandle.c index a73459e13aa..7ec01598616 100644 --- a/src/session/session_dhandle.c +++ b/src/session/session_dhandle.c @@ -216,14 +216,17 @@ __wt_session_get_btree(WT_SESSION_IMPL *session, WT_DATA_HANDLE *dhandle; WT_DATA_HANDLE_CACHE *dhandle_cache; WT_DECL_RET; + uint64_t hash; int candidate; dhandle = NULL; candidate = 0; + hash = __wt_hash_city64(uri, strlen(uri)); TAILQ_FOREACH(dhandle_cache, &session->dhandles, q) { dhandle = dhandle_cache->dhandle; - if (strcmp(uri, dhandle->name) != 0) + if (hash != dhandle->name_hash || + strcmp(uri, dhandle->name) != 0) continue; if (checkpoint == NULL && dhandle->checkpoint == NULL) break; diff --git a/src/support/hash_city.c b/src/support/hash_city.c index f6fa87b475a..70550ba7caf 100644 --- a/src/support/hash_city.c +++ b/src/support/hash_city.c @@ -65,7 +65,7 @@ static inline uint64_t CityHash64(const char *, size_t); * Wired Tiger wrapper around third party hash implementation. */ uint64_t -__wt_hash_city64(const void *string, uint32_t len) +__wt_hash_city64(const void *string, size_t len) { return (CityHash64((const char *)string, len)); } |