summaryrefslogtreecommitdiff
path: root/src/third_party/wiredtiger/src/meta/meta_table.c
diff options
context:
space:
mode:
authorMichael Cahill <michael.cahill@mongodb.com>2015-09-11 16:23:54 +1000
committerMichael Cahill <michael.cahill@mongodb.com>2015-09-11 16:23:54 +1000
commit58c7ad85c90619d4fa0e7e4df3b9f4d643b9b73b (patch)
tree63cfbe95d22f14a3d3366d68976df0d739318e9c /src/third_party/wiredtiger/src/meta/meta_table.c
parent8b205afd0ae74fd7351bc183e39b8931044f3987 (diff)
downloadmongo-58c7ad85c90619d4fa0e7e4df3b9f4d643b9b73b.tar.gz
Import wiredtiger-wiredtiger-2.6.1-1056-g5205bb1.tar.gz from wiredtiger branch mongodb-3.2
Diffstat (limited to 'src/third_party/wiredtiger/src/meta/meta_table.c')
-rw-r--r--src/third_party/wiredtiger/src/meta/meta_table.c33
1 files changed, 26 insertions, 7 deletions
diff --git a/src/third_party/wiredtiger/src/meta/meta_table.c b/src/third_party/wiredtiger/src/meta/meta_table.c
index 227d0fa9a6c..8255f004dab 100644
--- a/src/third_party/wiredtiger/src/meta/meta_table.c
+++ b/src/third_party/wiredtiger/src/meta/meta_table.c
@@ -12,22 +12,22 @@
* __metadata_turtle --
* Return if a key's value should be taken from the turtle file.
*/
-static int
+static bool
__metadata_turtle(const char *key)
{
switch (key[0]) {
case 'f':
if (strcmp(key, WT_METAFILE_URI) == 0)
- return (1);
+ return (true);
break;
case 'W':
if (strcmp(key, "WiredTiger version") == 0)
- return (1);
+ return (true);
if (strcmp(key, "WiredTiger version string") == 0)
- return (1);
+ return (true);
break;
}
- return (0);
+ return (false);
}
/*
@@ -37,6 +37,8 @@ __metadata_turtle(const char *key)
int
__wt_metadata_open(WT_SESSION_IMPL *session)
{
+ WT_BTREE *btree;
+
if (session->meta_dhandle != NULL)
return (0);
@@ -45,7 +47,24 @@ __wt_metadata_open(WT_SESSION_IMPL *session)
session->meta_dhandle = session->dhandle;
WT_ASSERT(session, session->meta_dhandle != NULL);
- /* The meta_dhandle doesn't need to stay locked -- release it. */
+ /*
+ * Set special flags for the metadata file: eviction (the metadata file
+ * is in-memory and never evicted), logging (the metadata file is always
+ * logged if possible).
+ *
+ * Test flags before setting them so updates can't race in subsequent
+ * opens (the first update is safe because it's single-threaded from
+ * wiredtiger_open).
+ */
+ btree = S2BT(session);
+ if (!F_ISSET(btree, WT_BTREE_IN_MEMORY))
+ F_SET(btree, WT_BTREE_IN_MEMORY);
+ if (!F_ISSET(btree, WT_BTREE_NO_EVICTION))
+ F_SET(btree, WT_BTREE_NO_EVICTION);
+ if (F_ISSET(btree, WT_BTREE_NO_LOGGING))
+ F_CLR(btree, WT_BTREE_NO_LOGGING);
+
+ /* The metadata handle doesn't need to stay locked -- release it. */
return (__wt_session_release_btree(session));
}
@@ -59,9 +78,9 @@ __wt_metadata_cursor(
{
WT_DATA_HANDLE *saved_dhandle;
WT_DECL_RET;
+ int is_dead;
const char *cfg[] =
{ WT_CONFIG_BASE(session, WT_SESSION_open_cursor), config, NULL };
- int is_dead;
saved_dhandle = session->dhandle;
WT_ERR(__wt_metadata_open(session));