summaryrefslogtreecommitdiff
path: root/src/session
diff options
context:
space:
mode:
authorMichael Cahill <michael.cahill@wiredtiger.com>2012-08-13 12:37:08 +1000
committerMichael Cahill <michael.cahill@wiredtiger.com>2012-08-13 12:37:08 +1000
commit6bae50301c05708b37ce1b90a7eee65b0af11696 (patch)
treebd396dbe25667c5d9adf8e050a8d23358b9f7f73 /src/session
parentddf4996a071e719a3f8ddccafbf762bdf5bfb320 (diff)
parentb3236229a726ecd7bdf232b60466ff28d0aabf93 (diff)
downloadmongo-6bae50301c05708b37ce1b90a7eee65b0af11696.tar.gz
Merge branch 'develop' into lsm.
Diffstat (limited to 'src/session')
-rw-r--r--src/session/session_api.c45
1 files changed, 43 insertions, 2 deletions
diff --git a/src/session/session_api.c b/src/session/session_api.c
index 97f7efcd480..917833116ec 100644
--- a/src/session/session_api.c
+++ b/src/session/session_api.c
@@ -114,6 +114,40 @@ err: API_END_NOTFOUND_MAP(session, ret);
}
/*
+ * __session_reconfigure --
+ * WT_SESSION->reconfigure method.
+ */
+static int
+__session_reconfigure(WT_SESSION *wt_session, const char *config)
+{
+ WT_CONFIG_ITEM cval;
+ WT_DECL_RET;
+ WT_SESSION_IMPL *session;
+
+ session = (WT_SESSION_IMPL *)wt_session;
+ SESSION_API_CALL(session, reconfigure, config, cfg);
+
+ WT_ERR(__wt_config_gets_defno(session, cfg, "isolation", &cval));
+ if (cval.len != 0) {
+ if (!F_ISSET(S2C(session), WT_CONN_TRANSACTIONAL))
+ WT_ERR_MSG(session, EINVAL,
+ "Database not configured for transactions");
+
+ if (TAILQ_FIRST(&session->cursors) != NULL)
+ WT_ERR_MSG(
+ session, EINVAL, "Not permitted with open cursors");
+
+ session->isolation =
+ WT_STRING_MATCH("snapshot", cval.str, cval.len) ?
+ TXN_ISO_SNAPSHOT :
+ WT_STRING_MATCH("read-uncommitted", cval.str, cval.len) ?
+ TXN_ISO_READ_UNCOMMITTED : TXN_ISO_READ_COMMITTED;
+ }
+
+err: API_END_NOTFOUND_MAP(session, ret);
+}
+
+/*
* __session_open_cursor --
* WT_SESSION->open_cursor method.
*/
@@ -513,6 +547,7 @@ __wt_open_session(WT_CONNECTION_IMPL *conn, int internal,
static WT_SESSION stds = {
NULL,
__session_close,
+ __session_reconfigure,
__session_open_cursor,
__session_create,
__session_drop,
@@ -532,8 +567,6 @@ __wt_open_session(WT_CONNECTION_IMPL *conn, int internal,
WT_SESSION_IMPL *session, *session_ret;
uint32_t i;
- WT_UNUSED(config);
-
session = conn->default_session;
session_ret = NULL;
@@ -591,6 +624,14 @@ __wt_open_session(WT_CONNECTION_IMPL *conn, int internal,
F_SET(session_ret, WT_SESSION_INTERNAL);
/*
+ * Configuration: currently, the configuration for open_session is the
+ * same as session.reconfigure, so use that function.
+ */
+ if (config != NULL)
+ WT_ERR(
+ __session_reconfigure((WT_SESSION *)session_ret, config));
+
+ /*
* Publish: make the entry visible to server threads. There must be a
* barrier for two reasons, to ensure structure fields are set before
* any other thread will consider the session, and to push the session