diff options
Diffstat (limited to 'src/third_party/wiredtiger/src/session/session_api.c')
-rw-r--r-- | src/third_party/wiredtiger/src/session/session_api.c | 140 |
1 files changed, 65 insertions, 75 deletions
diff --git a/src/third_party/wiredtiger/src/session/session_api.c b/src/third_party/wiredtiger/src/session/session_api.c index 1a63ed675b5..73dea95aa2d 100644 --- a/src/third_party/wiredtiger/src/session/session_api.c +++ b/src/third_party/wiredtiger/src/session/session_api.c @@ -136,68 +136,6 @@ __session_clear(WT_SESSION_IMPL *session) } /* - * __session_alter -- - * Alter a table setting. - */ -static int -__session_alter(WT_SESSION *wt_session, const char *uri, const char *config) -{ - WT_DECL_RET; - WT_SESSION_IMPL *session; - - session = (WT_SESSION_IMPL *)wt_session; - - SESSION_API_CALL(session, alter, config, cfg); - - /* In-memory ignores alter operations. */ - if (F_ISSET(S2C(session), WT_CONN_IN_MEMORY)) - goto err; - - /* Disallow objects in the WiredTiger name space. */ - WT_ERR(__wt_str_name_check(session, uri)); - - /* - * We replace the default configuration listing with the current - * configuration. Otherwise the defaults for values that can be - * altered would override settings used by the user in create. - */ - cfg[0] = cfg[1]; - cfg[1] = NULL; - WT_WITH_CHECKPOINT_LOCK(session, - WT_WITH_SCHEMA_LOCK(session, - ret = __wt_schema_worker(session, uri, __wt_alter, NULL, cfg, - WT_BTREE_ALTER | WT_DHANDLE_EXCLUSIVE))); - -err: if (ret != 0) - WT_STAT_CONN_INCR(session, session_table_alter_fail); - else - WT_STAT_CONN_INCR(session, session_table_alter_success); - API_END_RET_NOTFOUND_MAP(session, ret); -} - -/* - * __session_alter_readonly -- - * WT_SESSION->alter method; readonly version. - */ -static int -__session_alter_readonly( - WT_SESSION *wt_session, const char *uri, const char *config) -{ - WT_DECL_RET; - WT_SESSION_IMPL *session; - - WT_UNUSED(uri); - WT_UNUSED(config); - - session = (WT_SESSION_IMPL *)wt_session; - SESSION_API_CALL_NOCONF(session, alter); - - WT_STAT_CONN_INCR(session, session_table_alter_fail); - ret = __wt_session_notsup(session); -err: API_END_RET(session, ret); -} - -/* * __session_close -- * WT_SESSION->close method. */ @@ -244,9 +182,6 @@ __session_close(WT_SESSION *wt_session, const char *config) /* Discard cached handles. */ __wt_session_close_cache(session); - /* Close all tables. */ - WT_TRET(__wt_schema_close_tables(session)); - /* Confirm we're not holding any hazard pointers. */ __wt_hazard_close(session); @@ -524,6 +459,68 @@ err: if (cursor != NULL) } /* + * __session_alter -- + * Alter a table setting. + */ +static int +__session_alter(WT_SESSION *wt_session, const char *uri, const char *config) +{ + WT_DECL_RET; + WT_SESSION_IMPL *session; + + session = (WT_SESSION_IMPL *)wt_session; + + SESSION_API_CALL(session, alter, config, cfg); + + /* In-memory ignores alter operations. */ + if (F_ISSET(S2C(session), WT_CONN_IN_MEMORY)) + goto err; + + /* Disallow objects in the WiredTiger name space. */ + WT_ERR(__wt_str_name_check(session, uri)); + + /* + * We replace the default configuration listing with the current + * configuration. Otherwise the defaults for values that can be + * altered would override settings used by the user in create. + */ + cfg[0] = cfg[1]; + cfg[1] = NULL; + WT_WITH_CHECKPOINT_LOCK(session, + WT_WITH_SCHEMA_LOCK(session, + ret = __wt_schema_worker(session, uri, __wt_alter, NULL, cfg, + WT_BTREE_ALTER | WT_DHANDLE_EXCLUSIVE))); + +err: if (ret != 0) + WT_STAT_CONN_INCR(session, session_table_alter_fail); + else + WT_STAT_CONN_INCR(session, session_table_alter_success); + API_END_RET_NOTFOUND_MAP(session, ret); +} + +/* + * __session_alter_readonly -- + * WT_SESSION->alter method; readonly version. + */ +static int +__session_alter_readonly( + WT_SESSION *wt_session, const char *uri, const char *config) +{ + WT_DECL_RET; + WT_SESSION_IMPL *session; + + WT_UNUSED(uri); + WT_UNUSED(config); + + session = (WT_SESSION_IMPL *)wt_session; + SESSION_API_CALL_NOCONF(session, alter); + + WT_STAT_CONN_INCR(session, session_table_alter_fail); + ret = __wt_session_notsup(session); +err: API_END_RET(session, ret); +} + +/* * __wt_session_create -- * Internal version of WT_SESSION::create. */ @@ -836,8 +833,6 @@ __session_reset(WT_SESSION *wt_session) WT_TRET(__wt_session_reset_cursors(session, true)); - WT_TRET(__wt_schema_sweep_tables(session)); - /* Release common session resources. */ WT_TRET(__wt_session_release_resources(session)); @@ -1768,11 +1763,11 @@ __open_session(WT_CONNECTION_IMPL *conn, static const WT_SESSION stds = { NULL, NULL, - __session_alter, __session_close, __session_reconfigure, __wt_session_strerror, __session_open_cursor, + __session_alter, __session_create, __wt_session_compact, __session_drop, @@ -1797,11 +1792,11 @@ __open_session(WT_CONNECTION_IMPL *conn, }, stds_readonly = { NULL, NULL, - __session_alter_readonly, __session_close, __session_reconfigure, __wt_session_strerror, __session_open_cursor, + __session_alter_readonly, __session_create_readonly, __wt_session_compact_readonly, __session_drop_readonly, @@ -1883,13 +1878,8 @@ __open_session(WT_CONNECTION_IMPL *conn, if (session_ret->dhhash == NULL) WT_ERR(__wt_calloc(session, WT_HASH_ARRAY_SIZE, sizeof(struct __dhandles_hash), &session_ret->dhhash)); - if (session_ret->tablehash == NULL) - WT_ERR(__wt_calloc(session, WT_HASH_ARRAY_SIZE, - sizeof(struct __tables_hash), &session_ret->tablehash)); - for (i = 0; i < WT_HASH_ARRAY_SIZE; i++) { + for (i = 0; i < WT_HASH_ARRAY_SIZE; i++) TAILQ_INIT(&session_ret->dhhash[i]); - TAILQ_INIT(&session_ret->tablehash[i]); - } /* Initialize transaction support: default to read-committed. */ session_ret->isolation = WT_ISO_READ_COMMITTED; |