summaryrefslogtreecommitdiff
path: root/src/third_party/wiredtiger/src/meta
diff options
context:
space:
mode:
authorMichael Cahill <michael.cahill@mongodb.com>2015-11-02 11:55:14 +1100
committerMichael Cahill <michael.cahill@mongodb.com>2015-11-02 11:55:14 +1100
commitfb6ebe75207c3221314ed318595489a838ef1db0 (patch)
tree6b9b210b15f9b9685b9a5dd707001297127ee1d3 /src/third_party/wiredtiger/src/meta
parent4fbfa13ec0f819080a35ed8b528a030797e483a6 (diff)
downloadmongo-fb6ebe75207c3221314ed318595489a838ef1db0.tar.gz
Import wiredtiger-wiredtiger-mongodb-3.2.0-rc1-194-g0dc3f20.tar.gz from wiredtiger branch mongodb-3.2
Diffstat (limited to 'src/third_party/wiredtiger/src/meta')
-rw-r--r--src/third_party/wiredtiger/src/meta/meta_table.c20
-rw-r--r--src/third_party/wiredtiger/src/meta/meta_track.c35
-rw-r--r--src/third_party/wiredtiger/src/meta/meta_turtle.c4
3 files changed, 24 insertions, 35 deletions
diff --git a/src/third_party/wiredtiger/src/meta/meta_table.c b/src/third_party/wiredtiger/src/meta/meta_table.c
index 0bab52b9d9c..e7074a9c1b5 100644
--- a/src/third_party/wiredtiger/src/meta/meta_table.c
+++ b/src/third_party/wiredtiger/src/meta/meta_table.c
@@ -151,8 +151,11 @@ __wt_metadata_update(
key, value, WT_META_TRACKING(session) ? "true" : "false",
__metadata_turtle(key) ? "" : "not "));
- if (__metadata_turtle(key))
- return (__wt_turtle_update(session, key, value));
+ if (__metadata_turtle(key)) {
+ WT_WITH_TURTLE_LOCK(session,
+ ret = __wt_turtle_update(session, key, value));
+ return (ret);
+ }
if (WT_META_TRACKING(session))
WT_RET(__wt_meta_track_update(session, key));
@@ -219,9 +222,20 @@ __wt_metadata_search(
if (__metadata_turtle(key))
return (__wt_turtle_read(session, key, valuep));
+ /*
+ * All metadata reads are at read-uncommitted isolation. That's
+ * because once a schema-level operation completes, subsequent
+ * operations must see the current version of checkpoint metadata, or
+ * they may try to read blocks that may have been freed from a file.
+ * Metadata updates use non-transactional techniques (such as the
+ * schema and metadata locks) to protect access to in-flight updates.
+ */
WT_RET(__wt_metadata_cursor(session, NULL, &cursor));
cursor->set_key(cursor, key);
- WT_ERR(cursor->search(cursor));
+ WT_WITH_TXN_ISOLATION(session, WT_ISO_READ_UNCOMMITTED,
+ ret = cursor->search(cursor));
+ WT_ERR(ret);
+
WT_ERR(cursor->get_value(cursor, &value));
WT_ERR(__wt_strdup(session, value, valuep));
diff --git a/src/third_party/wiredtiger/src/meta/meta_track.c b/src/third_party/wiredtiger/src/meta/meta_track.c
index b223c2fb8fc..bc96a35efc7 100644
--- a/src/third_party/wiredtiger/src/meta/meta_track.c
+++ b/src/third_party/wiredtiger/src/meta/meta_track.c
@@ -223,35 +223,6 @@ __meta_track_unroll(WT_SESSION_IMPL *session, WT_META_TRACK *trk)
}
/*
- * __wt_meta_track_find_handle --
- * Check if we have already seen a handle.
- */
-int
-__wt_meta_track_find_handle(
- WT_SESSION_IMPL *session, const char *name, const char *checkpoint)
-{
- WT_META_TRACK *trk, *trk_orig;
-
- WT_ASSERT(session,
- WT_META_TRACKING(session) && session->meta_track_nest > 0);
-
- trk_orig = session->meta_track;
- trk = session->meta_track_next;
-
- while (--trk >= trk_orig) {
- if (trk->op != WT_ST_LOCK)
- continue;
- if (strcmp(trk->dhandle->name, name) == 0 &&
- ((trk->dhandle->checkpoint == NULL && checkpoint == NULL) ||
- (trk->dhandle->checkpoint != NULL &&
- strcmp(trk->dhandle->checkpoint, checkpoint) == 0)))
- return (0);
- }
-
- return (WT_NOTFOUND);
-}
-
-/*
* __wt_meta_track_off --
* Turn off metadata operation tracking, unrolling on error.
*/
@@ -293,7 +264,8 @@ __wt_meta_track_off(WT_SESSION_IMPL *session, bool need_sync, bool unroll)
* If we don't have the metadata handle (e.g, we're in the process of
* creating the metadata), we can't sync it.
*/
- if (!need_sync || session->meta_dhandle == NULL)
+ if (!need_sync || session->meta_dhandle == NULL ||
+ F_ISSET(S2C(session), WT_CONN_IN_MEMORY))
goto done;
/* If we're logging, make sure the metadata update was flushed. */
@@ -304,7 +276,8 @@ __wt_meta_track_off(WT_SESSION_IMPL *session, bool need_sync, bool unroll)
WT_RET(ret);
} else {
WT_WITH_DHANDLE(session, session->meta_dhandle,
- ret = __wt_checkpoint(session, NULL));
+ WT_WITH_TXN_ISOLATION(session, WT_ISO_READ_COMMITTED,
+ ret = __wt_checkpoint(session, NULL)));
WT_RET(ret);
WT_WITH_DHANDLE(session, session->meta_dhandle,
ret = __wt_checkpoint_sync(session, NULL));
diff --git a/src/third_party/wiredtiger/src/meta/meta_turtle.c b/src/third_party/wiredtiger/src/meta/meta_turtle.c
index 1aa9c953689..13e8b31916f 100644
--- a/src/third_party/wiredtiger/src/meta/meta_turtle.c
+++ b/src/third_party/wiredtiger/src/meta/meta_turtle.c
@@ -202,7 +202,9 @@ __wt_turtle_init(WT_SESSION_IMPL *session)
/* Create the turtle file. */
WT_RET(__metadata_config(session, &metaconf));
- WT_ERR(__wt_turtle_update(session, WT_METAFILE_URI, metaconf));
+ WT_WITH_TURTLE_LOCK(session, ret = __wt_turtle_update(
+ session, WT_METAFILE_URI, metaconf));
+ WT_ERR(ret);
}
/* Remove the backup files, we'll never read them again. */