summaryrefslogtreecommitdiff
path: root/src/conn/conn_dhandle.c
diff options
context:
space:
mode:
authorKeith Bostic <keith.bostic@mongodb.com>2016-05-31 20:30:18 -0400
committerMichael Cahill <michael.cahill@mongodb.com>2016-06-01 10:30:18 +1000
commit7033ed47f3986edb08ec8c4933e6ef211e73b3c4 (patch)
tree6cdc57dd2b037f9f61848ba1eae74c214b406e6a /src/conn/conn_dhandle.c
parentb89aaece7b2a58d183a0a2b33e20157ad7f02258 (diff)
downloadmongo-7033ed47f3986edb08ec8c4933e6ef211e73b3c4.tar.gz
WT-2674 simplify metadata file check (#2763)
Remove the need for a hash and name comparison to identify the metadata file, set a flag in the data handle when the file is opened. Move the code to insert the data handle into the connection list from the find function to the allocate function for clarity.
Diffstat (limited to 'src/conn/conn_dhandle.c')
-rw-r--r--src/conn/conn_dhandle.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/conn/conn_dhandle.c b/src/conn/conn_dhandle.c
index d8fd07b6007..4c2cf9a8dc2 100644
--- a/src/conn/conn_dhandle.c
+++ b/src/conn/conn_dhandle.c
@@ -39,6 +39,9 @@ __conn_dhandle_alloc(WT_SESSION_IMPL *session,
WT_BTREE *btree;
WT_DATA_HANDLE *dhandle;
WT_DECL_RET;
+ uint64_t bucket;
+
+ *dhandlep = NULL;
WT_RET(__wt_calloc_one(session, &dhandle));
@@ -57,6 +60,16 @@ __conn_dhandle_alloc(WT_SESSION_IMPL *session,
__wt_stat_dsrc_init(dhandle);
+ if (strcmp(uri, WT_METAFILE_URI) == 0)
+ F_SET(dhandle, WT_DHANDLE_IS_METADATA);
+
+ /*
+ * Prepend the handle to the connection list, assuming we're likely to
+ * need new files again soon, until they are cached by all sessions.
+ */
+ bucket = dhandle->name_hash % WT_HASH_ARRAY_SIZE;
+ WT_CONN_DHANDLE_INSERT(S2C(session), dhandle, bucket);
+
*dhandlep = dhandle;
return (0);
@@ -106,14 +119,6 @@ __wt_conn_dhandle_find(
WT_RET(__conn_dhandle_alloc(session, uri, checkpoint, &dhandle));
- /*
- * Prepend the handle to the connection list, assuming we're likely to
- * need new files again soon, until they are cached by all sessions.
- * Find the right hash bucket to insert into as well.
- */
- bucket = dhandle->name_hash % WT_HASH_ARRAY_SIZE;
- WT_CONN_DHANDLE_INSERT(conn, dhandle, bucket);
-
session->dhandle = dhandle;
return (0);
}