summaryrefslogtreecommitdiff
path: root/src/meta/meta_table.c
diff options
context:
space:
mode:
authorMichael Cahill <michael.cahill@mongodb.com>2015-10-28 21:55:51 +1100
committerMichael Cahill <michael.cahill@mongodb.com>2015-10-28 21:55:51 +1100
commite0a9e44b3ddf66f89dc7cad12162a4abb2d362c2 (patch)
tree9b3018608ba0b68a96775e20bc710dc50b43f280 /src/meta/meta_table.c
parent7ca3231dc727dcee5250d47b8c5f9287c5ee1428 (diff)
downloadmongo-e0a9e44b3ddf66f89dc7cad12162a4abb2d362c2.tar.gz
WT-2170 Add a macro perfom an operation at an isolation level.
Lock down visibility checks so we never try to use a snapshot without one being allocated.
Diffstat (limited to 'src/meta/meta_table.c')
-rw-r--r--src/meta/meta_table.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/src/meta/meta_table.c b/src/meta/meta_table.c
index 16f89fe2e88..f4ea5b3908a 100644
--- a/src/meta/meta_table.c
+++ b/src/meta/meta_table.c
@@ -210,8 +210,6 @@ __wt_metadata_search(
{
WT_CURSOR *cursor;
WT_DECL_RET;
- WT_TXN *txn;
- WT_TXN_ISOLATION iso_orig;
const char *value;
*valuep = NULL;
@@ -224,6 +222,9 @@ __wt_metadata_search(
if (__metadata_turtle(key))
return (__wt_turtle_read(session, key, valuep));
+ WT_RET(__wt_metadata_cursor(session, NULL, &cursor));
+ cursor->set_key(cursor, key);
+
/*
* All metadata reads are at read-uncommitted isolation. That's
* because once a schema-level operation completes, subsequent
@@ -232,18 +233,13 @@ __wt_metadata_search(
* Metadata updates use non-transactional techniques (such as the
* schema and metadata locks) to protect access to in-flight updates.
*/
- if ((txn = &session->txn) != NULL) {
- iso_orig = txn->isolation;
- txn->isolation = WT_ISO_READ_UNCOMMITTED;
- }
- WT_ERR(__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));
err: WT_TRET(cursor->close(cursor));
- if (txn != NULL)
- txn->isolation = iso_orig;
return (ret);
}