diff options
author | Michael Cahill <michael.cahill@wiredtiger.com> | 2011-05-30 11:36:18 +1000 |
---|---|---|
committer | Michael Cahill <michael.cahill@wiredtiger.com> | 2011-05-30 11:36:18 +1000 |
commit | ccf2be5ed6e744e57abafc80f6db49e5abd8774e (patch) | |
tree | 1ea5480d3baf4ba52a64305c386984e77d18a439 | |
parent | 8cc9e4eeb5725655c8fcdcfefc8e1d612215efc8 (diff) | |
download | mongo-ccf2be5ed6e744e57abafc80f6db49e5abd8774e.tar.gz |
Change all struct names to have the prefix "__wt_", and all corresponding typedefs to start with "WT_".
81 files changed, 1128 insertions, 1049 deletions
diff --git a/dist/log.py b/dist/log.py index e58b2889ce5..9b992b77074 100644 --- a/dist/log.py +++ b/dist/log.py @@ -28,7 +28,7 @@ tfile.write('/* DO NOT EDIT: automatically built by dist/log.py. */\n') for t in log_data.types: tfile.write(''' static inline int -__wt_logput_%(name)s(SESSION *session, %(param_decl)s) +__wt_logput_%(name)s(WT_SESSION_IMPL *session, %(param_decl)s) { return (__wt_log_put(session, &__wt_logdesc_%(name)s, %(param_list)s)); } diff --git a/dist/stat.py b/dist/stat.py index 09ff6793ebe..5ee4c19f82e 100644 --- a/dist/stat.py +++ b/dist/stat.py @@ -45,7 +45,7 @@ def print_func(name, list): f.write('\n') f.write('int\n') f.write('__wt_stat_alloc_' + name + - '_stats(SESSION *session, WT_' + + '_stats(WT_SESSION_IMPL *session, WT_' + name.upper() + '_STATS **statsp)\n') f.write('{\n') f.write('\tWT_' + name.upper() + '_STATS *stats;\n\n') diff --git a/src/api/api.c b/src/api/api.c index be93235f89f..fb903d471d7 100644 --- a/src/api/api.c +++ b/src/api/api.c @@ -7,7 +7,7 @@ #include "wt_internal.h" -static int __wt_api_arg_min(SESSION *, const char *, uint64_t, uint64_t); +static int __wt_api_arg_min(WT_SESSION_IMPL *, const char *, uint64_t, uint64_t); /* * __session_close -- @@ -16,14 +16,14 @@ static int __wt_api_arg_min(SESSION *, const char *, uint64_t, uint64_t); static int __session_close(WT_SESSION *wt_session, const char *config) { - BTREE_SESSION *btree_session; - CONNECTION *conn; - SESSION *session; + WT_BTREE_SESSION *btree_session; + WT_CONNECTION_IMPL *conn; + WT_SESSION_IMPL *session; WT_CURSOR *cursor; int ret; - conn = (CONNECTION *)wt_session->connection; - session = (SESSION *)wt_session; + conn = (WT_CONNECTION_IMPL *)wt_session->connection; + session = (WT_SESSION_IMPL *)wt_session; ret = 0; SESSION_API_CALL(session, close, config); @@ -55,11 +55,11 @@ static int __session_open_cursor(WT_SESSION *wt_session, const char *uri, WT_CURSOR *to_dup, const char *config, WT_CURSOR **cursorp) { - SESSION *session; + WT_SESSION_IMPL *session; WT_UNUSED(to_dup); - session = (SESSION *)wt_session; + session = (WT_SESSION_IMPL *)wt_session; SESSION_API_CALL(session, open_cursor, config); if (strncmp(uri, "config:", 7) == 0) @@ -82,13 +82,13 @@ __session_open_cursor(WT_SESSION *wt_session, static int __session_create(WT_SESSION *wt_session, const char *name, const char *config) { - CONNECTION *conn; - SESSION *session; + WT_CONNECTION_IMPL *conn; + WT_SESSION_IMPL *session; WT_CONFIG_ITEM cval; const char *collapse, *key_format, *value_format; - session = (SESSION *)wt_session; - conn = (CONNECTION *)wt_session->connection; + session = (WT_SESSION_IMPL *)wt_session; + conn = (WT_CONNECTION_IMPL *)wt_session->connection; SESSION_API_CALL(session, create, config); @@ -139,7 +139,7 @@ __session_create(WT_SESSION *wt_session, const char *name, const char *config) WT_RET(__wt_btree_create(session, name, collapse)); } - /* Allocate a BTREE handle, and open the underlying file. */ + /* Allocate a WT_BTREE handle, and open the underlying file. */ WT_RET(__wt_btree_open(session, name, 0)); WT_RET(__wt_session_add_btree(session, NULL)); @@ -171,11 +171,11 @@ static int __session_drop( WT_SESSION *wt_session, const char *name, const char *config) { - SESSION *session; + WT_SESSION_IMPL *session; WT_CONFIG_ITEM cval; int force, ret; - session = (SESSION *)wt_session; + session = (WT_SESSION_IMPL *)wt_session; SESSION_API_CALL(session, drop, config); if (strncmp(name, "table:", 6) != 0) { @@ -202,10 +202,10 @@ __session_drop( static int __session_salvage(WT_SESSION *wt_session, const char *name, const char *config) { - SESSION *session; + WT_SESSION_IMPL *session; int ret; - session = (SESSION *)wt_session; + session = (WT_SESSION_IMPL *)wt_session; ret = 0; SESSION_API_CALL(session, salvage, config); @@ -229,7 +229,7 @@ __session_salvage(WT_SESSION *wt_session, const char *name, const char *config) WT_TRET(__wt_salvage(session, config)); - /* Close the file and discard the BTREE structure. */ + /* Close the file and discard the WT_BTREE structure. */ WT_TRET(__wt_btree_close(session)); API_END(); @@ -274,10 +274,10 @@ __session_truncate(WT_SESSION *wt_session, static int __session_verify(WT_SESSION *wt_session, const char *name, const char *config) { - SESSION *session; + WT_SESSION_IMPL *session; int ret; - session = (SESSION *)wt_session; + session = (WT_SESSION_IMPL *)wt_session; ret = 0; SESSION_API_CALL(session, verify, config); @@ -304,7 +304,7 @@ __session_verify(WT_SESSION *wt_session, const char *name, const char *config) WT_TRET(__wt_verify(session, NULL, config)); - /* Close the file and discard the BTREE structure. */ + /* Close the file and discard the WT_BTREE structure. */ WT_TRET(__wt_btree_close(session)); API_END(); @@ -370,10 +370,10 @@ __session_checkpoint(WT_SESSION *wt_session, const char *config) static int __session_msg_printf(WT_SESSION *wt_session, const char *fmt, ...) { - SESSION *session; + WT_SESSION_IMPL *session; va_list ap; - session = (SESSION *)wt_session; + session = (WT_SESSION_IMPL *)wt_session; va_start(ap, fmt); __wt_msgv(session, session->name, NULL, fmt, ap); @@ -390,8 +390,8 @@ static int __conn_load_extension(WT_CONNECTION *wt_conn, const char *path, const char *config) { - CONNECTION *conn; - SESSION *session; + WT_CONNECTION_IMPL *conn; + WT_SESSION_IMPL *session; const char *entry_name; char namebuf[100]; int (*entry)(WT_CONNECTION *, const char *); @@ -401,7 +401,7 @@ __conn_load_extension(WT_CONNECTION *wt_conn, WT_UNUSED(path); - conn = (CONNECTION *)wt_conn; + conn = (WT_CONNECTION_IMPL *)wt_conn; CONNECTION_API_CALL(conn, session, load_extension, config); entry_name = "wiredtiger_extension_init"; @@ -434,13 +434,13 @@ static int __conn_add_cursor_type(WT_CONNECTION *wt_conn, const char *prefix, WT_CURSOR_TYPE *ctype, const char *config) { - CONNECTION *conn; - SESSION *session; + WT_CONNECTION_IMPL *conn; + WT_SESSION_IMPL *session; WT_UNUSED(prefix); WT_UNUSED(ctype); - conn = (CONNECTION *)wt_conn; + conn = (WT_CONNECTION_IMPL *)wt_conn; CONNECTION_API_CALL(conn, session, add_cursor_type, config); API_END(); @@ -455,13 +455,13 @@ static int __conn_add_collator(WT_CONNECTION *wt_conn, const char *name, WT_COLLATOR *collator, const char *config) { - CONNECTION *conn; - SESSION *session; + WT_CONNECTION_IMPL *conn; + WT_SESSION_IMPL *session; WT_UNUSED(name); WT_UNUSED(collator); - conn = (CONNECTION *)wt_conn; + conn = (WT_CONNECTION_IMPL *)wt_conn; CONNECTION_API_CALL(conn, session, add_collator, config); API_END(); @@ -476,13 +476,13 @@ static int __conn_add_compressor(WT_CONNECTION *wt_conn, const char *name, WT_COMPRESSOR *compressor, const char *config) { - CONNECTION *conn; - SESSION *session; + WT_CONNECTION_IMPL *conn; + WT_SESSION_IMPL *session; WT_UNUSED(name); WT_UNUSED(compressor); - conn = (CONNECTION *)wt_conn; + conn = (WT_CONNECTION_IMPL *)wt_conn; CONNECTION_API_CALL(conn, session, add_collator, config); API_END(); @@ -497,13 +497,13 @@ static int __conn_add_extractor(WT_CONNECTION *wt_conn, const char *name, WT_EXTRACTOR *extractor, const char *config) { - CONNECTION *conn; - SESSION *session; + WT_CONNECTION_IMPL *conn; + WT_SESSION_IMPL *session; WT_UNUSED(name); WT_UNUSED(extractor); - conn = (CONNECTION *)wt_conn; + conn = (WT_CONNECTION_IMPL *)wt_conn; CONNECTION_API_CALL(conn, session, add_collator, config); API_END(); @@ -513,7 +513,7 @@ __conn_add_extractor(WT_CONNECTION *wt_conn, static const char * __conn_get_home(WT_CONNECTION *wt_conn) { - return (((CONNECTION *)wt_conn)->home); + return (((WT_CONNECTION_IMPL *)wt_conn)->home); } /* @@ -536,12 +536,12 @@ static int __conn_close(WT_CONNECTION *wt_conn, const char *config) { int ret; - CONNECTION *conn; - SESSION *s, *session; + WT_CONNECTION_IMPL *conn; + WT_SESSION_IMPL *s, *session; WT_SESSION *wt_session; ret = 0; - conn = (CONNECTION *)wt_conn; + conn = (WT_CONNECTION_IMPL *)wt_conn; CONNECTION_API_CALL(conn, session, close, config); @@ -587,11 +587,11 @@ __conn_open_session(WT_CONNECTION *wt_conn, __session_checkpoint, __session_msg_printf, }; - CONNECTION *conn; - SESSION *session, *session_ret; + WT_CONNECTION_IMPL *conn; + WT_SESSION_IMPL *session, *session_ret; int ret; - conn = (CONNECTION *)wt_conn; + conn = (WT_CONNECTION_IMPL *)wt_conn; session_ret = NULL; CONNECTION_API_CALL(conn, session, open_session, config); @@ -615,7 +615,7 @@ __conn_open_session(WT_CONNECTION *wt_conn, TAILQ_INSERT_HEAD(&conn->sessions_head, session_ret, q); __wt_unlock(session, conn->mtx); - STATIC_ASSERT(offsetof(CONNECTION, iface) == 0); + STATIC_ASSERT(offsetof(WT_CONNECTION_IMPL, iface) == 0); *wt_sessionp = &session_ret->iface; if (0) { @@ -661,8 +661,8 @@ wiredtiger_open(const char *home, WT_EVENT_HANDLER *event_handler, { "evict", WT_VERB_EVICT }, { NULL, 0 } }; - CONNECTION *conn; - SESSION *session; + WT_CONNECTION_IMPL *conn; + WT_SESSION_IMPL *session; WT_CONFIG subconfig; WT_CONFIG_ITEM cval, skey, sval; const char *__cfg[] = { __wt_confdfl_wiredtiger_open, config, NULL }; @@ -766,7 +766,7 @@ wiredtiger_open(const char *home, WT_EVENT_HANDLER *event_handler, else if (ret != 0) goto err; - STATIC_ASSERT(offsetof(CONNECTION, iface) == 0); + STATIC_ASSERT(offsetof(WT_CONNECTION_IMPL, iface) == 0); *wt_connp = &conn->iface; if (0) { @@ -786,7 +786,7 @@ err: if (opened) */ static int __wt_api_arg_min( - SESSION *session, const char *arg_name, uint64_t v, uint64_t min) + WT_SESSION_IMPL *session, const char *arg_name, uint64_t v, uint64_t min) { if (v >= min) return (0); diff --git a/src/api/config.c b/src/api/config.c index c7a4d0f0734..2e2cd857ce2 100644 --- a/src/api/config.c +++ b/src/api/config.c @@ -570,7 +570,7 @@ __wt_config_getones(const char *cfg, const char *key, WT_CONFIG_ITEM *value) * somewhere in the defaults. */ int -__wt_config_checklist(SESSION *session, +__wt_config_checklist(WT_SESSION_IMPL *session, const char **defaults, const char *config) { WT_CONFIG cparser; @@ -616,7 +616,8 @@ __wt_config_checklist(SESSION *session, * application-supplied config string appear somewhere in the defaults. */ int -__wt_config_check(SESSION *session, const char *defaults, const char *config) +__wt_config_check( + WT_SESSION_IMPL *session, const char *defaults, const char *config) { const char *defs[2]; defs[0] = defaults; @@ -632,7 +633,7 @@ __wt_config_check(SESSION *session, const char *defaults, const char *config) * buffer. */ int -__wt_config_collapse(SESSION *session, +__wt_config_collapse(WT_SESSION_IMPL *session, const char **cfg, const char **config_ret) { char *config, *end, *p; diff --git a/src/api/cur_btree.c b/src/api/cur_btree.c index d3c4fe1816d..8e0889b1624 100644 --- a/src/api/cur_btree.c +++ b/src/api/cur_btree.c @@ -15,7 +15,7 @@ static int __curbtree_first(WT_CURSOR *cursor) { CURSOR_BTREE *cbt; - SESSION *session; + WT_SESSION_IMPL *session; int ret; cbt = (CURSOR_BTREE *)cursor; @@ -34,7 +34,7 @@ static int __curbtree_last(WT_CURSOR *cursor) { CURSOR_BTREE *cbt; - SESSION *session; + WT_SESSION_IMPL *session; cbt = (CURSOR_BTREE *)cursor; CURSOR_API_CALL(cursor, session, last, cbt->btree); @@ -51,7 +51,7 @@ static int __curbtree_next(WT_CURSOR *cursor) { CURSOR_BTREE *cbt; - SESSION *session; + WT_SESSION_IMPL *session; int ret; cbt = (CURSOR_BTREE *)cursor; @@ -70,7 +70,7 @@ static int __curbtree_prev(WT_CURSOR *cursor) { CURSOR_BTREE *cbt; - SESSION *session; + WT_SESSION_IMPL *session; cbt = (CURSOR_BTREE *)cursor; CURSOR_API_CALL(cursor, session, prev, cbt->btree); @@ -87,7 +87,7 @@ static int __curbtree_search_near(WT_CURSOR *cursor, int *lastcmp) { CURSOR_BTREE *cbt; - SESSION *session; + WT_SESSION_IMPL *session; int ret; cbt = (CURSOR_BTREE *)cursor; @@ -106,7 +106,7 @@ static int __curbtree_insert(WT_CURSOR *cursor) { CURSOR_BTREE *cbt; - SESSION *session; + WT_SESSION_IMPL *session; int ret; cbt = (CURSOR_BTREE *)cursor; @@ -125,7 +125,7 @@ static int __curbtree_update(WT_CURSOR *cursor) { CURSOR_BTREE *cbt; - SESSION *session; + WT_SESSION_IMPL *session; int ret; cbt = (CURSOR_BTREE *)cursor; @@ -144,7 +144,7 @@ static int __curbtree_remove(WT_CURSOR *cursor) { CURSOR_BTREE *cbt; - SESSION *session; + WT_SESSION_IMPL *session; int ret; cbt = (CURSOR_BTREE *)cursor; @@ -163,7 +163,7 @@ static int __curbtree_close(WT_CURSOR *cursor, const char *config) { CURSOR_BTREE *cbt; - SESSION *session; + WT_SESSION_IMPL *session; int ret; cbt = (CURSOR_BTREE *)cursor; @@ -181,7 +181,7 @@ __curbtree_close(WT_CURSOR *cursor, const char *config) * WT_SESSION->open_cursor method for the btree cursor type. */ int -__wt_curbtree_open(SESSION *session, +__wt_curbtree_open(WT_SESSION_IMPL *session, const char *uri, const char *config, WT_CURSOR **cursorp) { static WT_CURSOR iface = { @@ -210,8 +210,8 @@ __wt_curbtree_open(SESSION *session, 0 /* uint32_t flags */ }; const char *tablename; - BTREE_SESSION *btree_session; - CONNECTION *conn; + WT_BTREE_SESSION *btree_session; + WT_CONNECTION_IMPL *conn; CURSOR_BTREE *cbt; WT_CONFIG_ITEM cval; WT_CURSOR *cursor; diff --git a/src/api/cur_bulk.c b/src/api/cur_bulk.c index 2b3cc93519c..4f7d2b97ee2 100644 --- a/src/api/cur_bulk.c +++ b/src/api/cur_bulk.c @@ -14,9 +14,9 @@ static int __curbulk_insert(WT_CURSOR *cursor) { - BTREE *btree; + WT_BTREE *btree; CURSOR_BULK *cbulk; - SESSION *session; + WT_SESSION_IMPL *session; cbulk = (CURSOR_BULK *)cursor; btree = cbulk->cbt.btree; @@ -54,9 +54,9 @@ __curbulk_insert(WT_CURSOR *cursor) static int __curbulk_close(WT_CURSOR *cursor, const char *config) { - BTREE *btree; + WT_BTREE *btree; CURSOR_BULK *cbulk; - SESSION *session; + WT_SESSION_IMPL *session; int ret; cbulk = (CURSOR_BULK *)cursor; diff --git a/src/api/cur_config.c b/src/api/cur_config.c index 700d06d5fe1..32ad17c0ff5 100644 --- a/src/api/cur_config.c +++ b/src/api/cur_config.c @@ -123,7 +123,7 @@ __curconfig_close(WT_CURSOR *cursor, const char *config) * WT_SESSION->open_cursor method for config cursors. */ int -__wt_curconfig_open(SESSION *session, +__wt_curconfig_open(WT_SESSION_IMPL *session, const char *uri, const char *config, WT_CURSOR **cursorp) { static WT_CURSOR iface = { diff --git a/src/api/cur_dump.c b/src/api/cur_dump.c index 64f316f5052..0ed421eaa59 100644 --- a/src/api/cur_dump.c +++ b/src/api/cur_dump.c @@ -13,7 +13,7 @@ * convert it to a dumpable string. */ static int -__convert_to_dump(SESSION *session, WT_BUF *buf) +__convert_to_dump(WT_SESSION_IMPL *session, WT_BUF *buf) { WT_UNUSED(session); WT_UNUSED(buf); @@ -27,7 +27,7 @@ __convert_to_dump(SESSION *session, WT_BUF *buf) * convert it to a raw value. */ static int -__convert_from_dump(SESSION *session, WT_BUF *buf) +__convert_from_dump(WT_SESSION_IMPL *session, WT_BUF *buf) { WT_UNUSED(session); WT_UNUSED(buf); @@ -42,7 +42,7 @@ __convert_from_dump(SESSION *session, WT_BUF *buf) static int __curdump_get_key(WT_CURSOR *cursor, ...) { - SESSION *session; + WT_SESSION_IMPL *session; WT_ITEM *key; va_list ap; @@ -73,7 +73,7 @@ __curdump_get_key(WT_CURSOR *cursor, ...) static int __curdump_get_value(WT_CURSOR *cursor, ...) { - SESSION *session; + WT_SESSION_IMPL *session; WT_ITEM *value; va_list ap; @@ -103,7 +103,7 @@ __curdump_get_value(WT_CURSOR *cursor, ...) static void __curdump_set_key(WT_CURSOR *cursor, ...) { - SESSION *session; + WT_SESSION_IMPL *session; va_list ap; int ret; @@ -130,7 +130,7 @@ __curdump_set_key(WT_CURSOR *cursor, ...) static void __curdump_set_value(WT_CURSOR *cursor, ...) { - SESSION *session; + WT_SESSION_IMPL *session; va_list ap; int ret; diff --git a/src/api/cur_stat.c b/src/api/cur_stat.c index c11711227d3..4a7cfe358e9 100644 --- a/src/api/cur_stat.c +++ b/src/api/cur_stat.c @@ -14,7 +14,7 @@ static int __curstat_first(WT_CURSOR *cursor) { - SESSION *session; + WT_SESSION_IMPL *session; int ret; CURSOR_API_CALL(cursor, session, first, NULL); @@ -31,7 +31,7 @@ __curstat_first(WT_CURSOR *cursor) static int __curstat_last(WT_CURSOR *cursor) { - SESSION *session; + WT_SESSION_IMPL *session; int ret; CURSOR_API_CALL(cursor, session, last, NULL); @@ -48,7 +48,7 @@ __curstat_last(WT_CURSOR *cursor) static int __curstat_next(WT_CURSOR *cursor) { - SESSION *session; + WT_SESSION_IMPL *session; int ret; CURSOR_API_CALL(cursor, session, next, NULL); @@ -65,7 +65,7 @@ __curstat_next(WT_CURSOR *cursor) static int __curstat_prev(WT_CURSOR *cursor) { - SESSION *session; + WT_SESSION_IMPL *session; int ret; CURSOR_API_CALL(cursor, session, prev, NULL); @@ -82,7 +82,7 @@ __curstat_prev(WT_CURSOR *cursor) static int __curstat_search_near(WT_CURSOR *cursor, int *lastcmp) { - SESSION *session; + WT_SESSION_IMPL *session; int ret; WT_UNUSED(lastcmp); @@ -101,7 +101,7 @@ __curstat_search_near(WT_CURSOR *cursor, int *lastcmp) static int __curstat_insert(WT_CURSOR *cursor) { - SESSION *session; + WT_SESSION_IMPL *session; int ret; CURSOR_API_CALL(cursor, session, insert, NULL); @@ -118,7 +118,7 @@ __curstat_insert(WT_CURSOR *cursor) static int __curstat_update(WT_CURSOR *cursor) { - SESSION *session; + WT_SESSION_IMPL *session; int ret; CURSOR_API_CALL(cursor, session, update, NULL); @@ -135,7 +135,7 @@ __curstat_update(WT_CURSOR *cursor) static int __curstat_remove(WT_CURSOR *cursor) { - SESSION *session; + WT_SESSION_IMPL *session; int ret; CURSOR_API_CALL(cursor, session, insert, NULL); @@ -152,7 +152,7 @@ __curstat_remove(WT_CURSOR *cursor) static int __curstat_close(WT_CURSOR *cursor, const char *config) { - SESSION *session; + WT_SESSION_IMPL *session; int ret; CURSOR_API_CALL_CONF(cursor, session, close, NULL, config); @@ -168,7 +168,7 @@ __curstat_close(WT_CURSOR *cursor, const char *config) * WT_SESSION->open_cursor method for the btree cursor type. */ int -__wt_curstat_open(SESSION *session, +__wt_curstat_open(WT_SESSION_IMPL *session, const char *uri, const char *config, WT_CURSOR **cursorp) { static WT_CURSOR iface = { diff --git a/src/api/cur_std.c b/src/api/cur_std.c index 03424d23953..59eda5e97fa 100644 --- a/src/api/cur_std.c +++ b/src/api/cur_std.c @@ -14,7 +14,7 @@ static int __cursor_get_key(WT_CURSOR *cursor, ...) { - SESSION *session; + WT_SESSION_IMPL *session; const char *fmt; va_list ap; int ret; @@ -38,7 +38,7 @@ __cursor_get_key(WT_CURSOR *cursor, ...) static int __cursor_get_value(WT_CURSOR *cursor, ...) { - SESSION *session; + WT_SESSION_IMPL *session; const char *fmt; va_list ap; int ret; @@ -62,7 +62,7 @@ __cursor_get_value(WT_CURSOR *cursor, ...) static void __cursor_set_key(WT_CURSOR *cursor, ...) { - SESSION *session; + WT_SESSION_IMPL *session; WT_BUF *buf; WT_ITEM *item; const char *fmt, *str; @@ -116,7 +116,7 @@ __cursor_set_key(WT_CURSOR *cursor, ...) static void __cursor_set_value(WT_CURSOR *cursor, ...) { - SESSION *session; + WT_SESSION_IMPL *session; WT_BUF *buf; WT_ITEM *item; const char *fmt, *str; @@ -180,7 +180,7 @@ __cursor_search(WT_CURSOR *cursor) int __wt_cursor_close(WT_CURSOR *cursor, const char *config) { - SESSION *session; + WT_SESSION_IMPL *session; int ret; CURSOR_API_CALL_CONF(cursor, session, close, NULL, config); diff --git a/src/api/session_btree.c b/src/api/session_btree.c index b3743ea4e9d..eac01dad5ec 100644 --- a/src/api/session_btree.c +++ b/src/api/session_btree.c @@ -12,12 +12,13 @@ * Add a btree handle to the session's cache. */ int -__wt_session_add_btree(SESSION *session, BTREE_SESSION **btree_sessionp) +__wt_session_add_btree( + WT_SESSION_IMPL *session, WT_BTREE_SESSION **btree_sessionp) { const char *config; char *format; - BTREE_SESSION *btree_session; - CONNECTION *conn; + WT_BTREE_SESSION *btree_session; + WT_CONNECTION_IMPL *conn; WT_CONFIG_ITEM cval; WT_RET(__wt_calloc_def(session, 1, &btree_session)); @@ -26,8 +27,8 @@ __wt_session_add_btree(SESSION *session, BTREE_SESSION **btree_sessionp) /* * Make a copy of the key and value format, it's easier for everyone - * if they are NUL-terminated. They live in the BTREE_SESSION to save - * allocating memory on every cursor open. + * if they are NUL-terminated. They live in the WT_BTREE_SESSION to + * save allocating memory on every cursor open. */ config = session->btree->config; @@ -58,11 +59,11 @@ __wt_session_add_btree(SESSION *session, BTREE_SESSION **btree_sessionp) * Get the btree handle for the named table. */ int -__wt_session_get_btree(SESSION *session, - const char *name, size_t namelen, BTREE_SESSION **btree_sessionp) +__wt_session_get_btree(WT_SESSION_IMPL *session, + const char *name, size_t namelen, WT_BTREE_SESSION **btree_sessionp) { - BTREE *btree; - BTREE_SESSION *btree_session; + WT_BTREE *btree; + WT_BTREE_SESSION *btree_session; TAILQ_FOREACH(btree_session, &session->btrees, q) { btree = btree_session->btree; @@ -81,9 +82,10 @@ __wt_session_get_btree(SESSION *session, * Remove the btree handle from the session, closing if necessary. */ int -__wt_session_remove_btree(SESSION *session, BTREE_SESSION *btree_session) +__wt_session_remove_btree( + WT_SESSION_IMPL *session, WT_BTREE_SESSION *btree_session) { - CONNECTION *conn; + WT_CONNECTION_IMPL *conn; int need_close; conn = S2C(session); diff --git a/src/btree/bt_alloc.c b/src/btree/bt_alloc.c index e244cf8ee4a..50b8605b7e2 100644 --- a/src/btree/bt_alloc.c +++ b/src/btree/bt_alloc.c @@ -7,17 +7,17 @@ #include "wt_internal.h" -static void __wt_block_extend(SESSION *, uint32_t *, uint32_t); -static int __wt_block_truncate(SESSION *); +static void __wt_block_extend(WT_SESSION_IMPL *, uint32_t *, uint32_t); +static int __wt_block_truncate(WT_SESSION_IMPL *); /* * __wt_block_alloc -- * Alloc a chunk of space from the underlying file. */ int -__wt_block_alloc(SESSION *session, uint32_t *addrp, uint32_t size) +__wt_block_alloc(WT_SESSION_IMPL *session, uint32_t *addrp, uint32_t size) { - BTREE *btree; + WT_BTREE *btree; WT_FREE_ENTRY *fe, *new; btree = session->btree; @@ -79,9 +79,9 @@ __wt_block_alloc(SESSION *session, uint32_t *addrp, uint32_t size) * Extend the file to allocate space. */ static void -__wt_block_extend(SESSION *session, uint32_t *addrp, uint32_t size) +__wt_block_extend(WT_SESSION_IMPL *session, uint32_t *addrp, uint32_t size) { - BTREE *btree; + WT_BTREE *btree; WT_FH *fh; btree = session->btree; @@ -101,9 +101,9 @@ __wt_block_extend(SESSION *session, uint32_t *addrp, uint32_t size) * Free a chunk of space to the underlying file. */ int -__wt_block_free(SESSION *session, uint32_t addr, uint32_t size) +__wt_block_free(WT_SESSION_IMPL *session, uint32_t addr, uint32_t size) { - BTREE *btree; + WT_BTREE *btree; WT_FREE_ENTRY *fe, *new; btree = session->btree; @@ -231,10 +231,10 @@ combine:/* * Read the free-list at the tail of the file. */ int -__wt_block_read(SESSION *session) +__wt_block_read(WT_SESSION_IMPL *session) { WT_BUF *tmp; - BTREE *btree; + WT_BTREE *btree; uint32_t *p; int ret; @@ -268,9 +268,9 @@ err: if (tmp != NULL) * Write the free-list at the tail of the file. */ int -__wt_block_write(SESSION *session) +__wt_block_write(WT_SESSION_IMPL *session) { - BTREE *btree; + WT_BTREE *btree; WT_BUF *tmp; WT_FREE_ENTRY *fe; WT_PAGE_DISK *dsk; @@ -351,9 +351,9 @@ err: if (tmp != NULL) * Truncate the file if the last part of the file isn't in use. */ static int -__wt_block_truncate(SESSION *session) +__wt_block_truncate(WT_SESSION_IMPL *session) { - BTREE *btree; + WT_BTREE *btree; WT_FH *fh; WT_FREE_ENTRY *fe; int need_trunc; @@ -391,9 +391,9 @@ __wt_block_truncate(SESSION *session) * Discard any free-list entries. */ void -__wt_block_discard(SESSION *session) +__wt_block_discard(WT_SESSION_IMPL *session) { - BTREE *btree; + WT_BTREE *btree; WT_FREE_ENTRY *fe; btree = session->btree; @@ -409,9 +409,9 @@ __wt_block_discard(SESSION *session) #ifdef HAVE_DIAGNOSTIC void -__wt_block_dump(SESSION *session) +__wt_block_dump(WT_SESSION_IMPL *session) { - BTREE *btree; + WT_BTREE *btree; WT_FREE_ENTRY *fe; btree = session->btree; diff --git a/src/btree/bt_bulk.c b/src/btree/bt_bulk.c index a1f70b053a2..7169e61ec6b 100644 --- a/src/btree/bt_bulk.c +++ b/src/btree/bt_bulk.c @@ -20,10 +20,10 @@ static int __wt_bulk_row_page(CURSOR_BULK *); int __wt_bulk_init(CURSOR_BULK *cbulk) { - BTREE *btree; - SESSION *session; + WT_BTREE *btree; + WT_SESSION_IMPL *session; - session = (SESSION *)cbulk->cbt.iface.session; + session = (WT_SESSION_IMPL *)cbulk->cbt.iface.session; btree = session->btree; /* @@ -75,10 +75,10 @@ __wt_bulk_init(CURSOR_BULK *cbulk) int __wt_bulk_insert(CURSOR_BULK *cbulk) { - BTREE *btree; - SESSION *session; + WT_BTREE *btree; + WT_SESSION_IMPL *session; - session = (SESSION *)cbulk->cbt.iface.session; + session = (WT_SESSION_IMPL *)cbulk->cbt.iface.session; btree = session->btree; /* @@ -118,12 +118,12 @@ __wt_bulk_insert(CURSOR_BULK *cbulk) static int __wt_bulk_col(CURSOR_BULK *cbulk) { - SESSION *session; + WT_SESSION_IMPL *session; WT_CURSOR *cursor; WT_UPDATE *upd; int ret; - session = (SESSION *)cbulk->cbt.iface.session; + session = (WT_SESSION_IMPL *)cbulk->cbt.iface.session; cursor = &cbulk->cbt.iface; upd = NULL; @@ -153,13 +153,13 @@ err: if (upd != NULL) static int __wt_bulk_row(CURSOR_BULK *cbulk) { - SESSION *session; + WT_SESSION_IMPL *session; WT_CURSOR *cursor; WT_INSERT *ins; WT_UPDATE *upd; int ret; - session = (SESSION *)cbulk->cbt.iface.session; + session = (WT_SESSION_IMPL *)cbulk->cbt.iface.session; cursor = &cbulk->cbt.iface; ins = NULL; upd = NULL; @@ -194,11 +194,11 @@ err: if (ins != NULL) int __wt_bulk_end(CURSOR_BULK *cbulk) { - SESSION *session; + WT_SESSION_IMPL *session; WT_PAGE *page; WT_REF *root_page; - session = (SESSION *)cbulk->cbt.iface.session; + session = (WT_SESSION_IMPL *)cbulk->cbt.iface.session; /* If the page has entries, reconcile and discard it. */ if (cbulk->ins_cnt != 0) @@ -256,11 +256,11 @@ __wt_bulk_end(CURSOR_BULK *cbulk) static int __wt_bulk_row_page(CURSOR_BULK *cbulk) { - SESSION *session; + WT_SESSION_IMPL *session; WT_PAGE *page; WT_ROW_REF *rref; - session = (SESSION *)cbulk->cbt.iface.session; + session = (WT_SESSION_IMPL *)cbulk->cbt.iface.session; /* * Take a copy of the first key for the parent; re-allocate the parent @@ -310,10 +310,10 @@ __wt_bulk_row_page(CURSOR_BULK *cbulk) static int __wt_bulk_col_page(CURSOR_BULK *cbulk) { - SESSION *session; + WT_SESSION_IMPL *session; WT_PAGE *page; - session = (SESSION *)cbulk->cbt.iface.session; + session = (WT_SESSION_IMPL *)cbulk->cbt.iface.session; /* * Take a copy of the first key for the parent; re-allocate the parent diff --git a/src/btree/bt_cache.c b/src/btree/bt_cache.c index 779603aa56c..738a8bd5d2f 100644 --- a/src/btree/bt_cache.c +++ b/src/btree/bt_cache.c @@ -13,10 +13,10 @@ * Create the underlying cache. */ int -__wt_cache_create(CONNECTION *conn) +__wt_cache_create(WT_CONNECTION_IMPL *conn) { WT_CACHE *cache; - SESSION *session; + WT_SESSION_IMPL *session; int ret; session = &conn->default_session; @@ -47,7 +47,7 @@ err: __wt_cache_destroy(conn); * Update the cache statistics for return to the application. */ void -__wt_cache_stats_update(CONNECTION *conn) +__wt_cache_stats_update(WT_CONNECTION_IMPL *conn) { WT_CACHE *cache; @@ -64,9 +64,9 @@ __wt_cache_stats_update(CONNECTION *conn) * Discard the underlying cache. */ void -__wt_cache_destroy(CONNECTION *conn) +__wt_cache_destroy(WT_CONNECTION_IMPL *conn) { - SESSION *session; + WT_SESSION_IMPL *session; WT_CACHE *cache; session = &conn->default_session; diff --git a/src/btree/bt_cell.c b/src/btree/bt_cell.c index d1c8bca3965..a1dbca812aa 100644 --- a/src/btree/bt_cell.c +++ b/src/btree/bt_cell.c @@ -258,9 +258,9 @@ __wt_cell_len(WT_CELL *cell) * Copy an on-page cell into a return buffer, processing as needed. */ int -__wt_cell_copy(SESSION *session, WT_CELL *cell, WT_BUF *retb) +__wt_cell_copy(WT_SESSION_IMPL *session, WT_CELL *cell, WT_BUF *retb) { - BTREE *btree; + WT_BTREE *btree; WT_OFF ovfl; uint32_t size; const void *p; diff --git a/src/btree/bt_cmp.c b/src/btree/bt_cmp.c index 1137b4afbf6..e6ebe4cd7f6 100644 --- a/src/btree/bt_cmp.c +++ b/src/btree/bt_cmp.c @@ -13,13 +13,13 @@ */ int __wt_bt_lex_compare( - BTREE *btree, const WT_ITEM *user_item, const WT_ITEM *tree_item) + WT_BTREE *btree, const WT_ITEM *user_item, const WT_ITEM *tree_item) { uint32_t len; const uint8_t *userp, *treep; /* - * The BTREE * argument isn't used by the default routine, but is + * The WT_BTREE * argument isn't used by the default routine, but is * a standard argument for user-specified comparison functions. */ WT_UNUSED(btree); @@ -51,7 +51,7 @@ __wt_bt_lex_compare( */ int __wt_bt_int_compare( - BTREE *btree, const WT_ITEM *user_item, const WT_ITEM *tree_item) + WT_BTREE *btree, const WT_ITEM *user_item, const WT_ITEM *tree_item) { uint64_t user_int, tree_int; diff --git a/src/btree/bt_cursor.c b/src/btree/bt_cursor.c index 1ec0b5e095e..c63dbeab3cc 100644 --- a/src/btree/bt_cursor.c +++ b/src/btree/bt_cursor.c @@ -16,9 +16,9 @@ int __wt_btcur_first(CURSOR_BTREE *cbt) { - SESSION *session; + WT_SESSION_IMPL *session; - session = (SESSION *)cbt->iface.session; + session = (WT_SESSION_IMPL *)cbt->iface.session; WT_RET(__wt_walk_begin(session, NULL, &cbt->walk, 0)); F_SET(&cbt->iface, WT_CURSTD_POSITIONED); @@ -123,12 +123,12 @@ __btcur_next_rle(CURSOR_BTREE *cbt, wiredtiger_recno_t *recnop, WT_BUF *value) static inline int __btcur_next_var(CURSOR_BTREE *cbt, wiredtiger_recno_t *recnop, WT_BUF *value) { - SESSION *session; + WT_SESSION_IMPL *session; WT_CELL *cell; WT_UPDATE *upd; int found; - session = (SESSION *)cbt->iface.session; + session = (WT_SESSION_IMPL *)cbt->iface.session; /* New page? */ if (cbt->nitems == 0) { @@ -183,12 +183,12 @@ __btcur_next_var(CURSOR_BTREE *cbt, wiredtiger_recno_t *recnop, WT_BUF *value) static inline int __btcur_next_row(CURSOR_BTREE *cbt, WT_BUF *key, WT_BUF *value) { - SESSION *session; + WT_SESSION_IMPL *session; WT_CELL *cell; WT_UPDATE *upd; int found; - session = (SESSION *)cbt->iface.session; + session = (WT_SESSION_IMPL *)cbt->iface.session; /* New page? */ if (cbt->nitems == 0) { @@ -254,12 +254,12 @@ __btcur_next_row(CURSOR_BTREE *cbt, WT_BUF *key, WT_BUF *value) int __wt_btcur_next(CURSOR_BTREE *cbt) { - SESSION *session; + WT_SESSION_IMPL *session; WT_CURSOR *cursor; int ret; cursor = &cbt->iface; - session = (SESSION *)cbt->iface.session; + session = (WT_SESSION_IMPL *)cbt->iface.session; if (cbt->walk.tree == NULL) return (__wt_btcur_first(cbt)); @@ -322,14 +322,14 @@ __wt_btcur_prev(CURSOR_BTREE *cbt) int __wt_btcur_search_near(CURSOR_BTREE *cbt, int *exact) { - BTREE *btree; - SESSION *session; + WT_BTREE *btree; + WT_SESSION_IMPL *session; WT_CURSOR *cursor; int ret; btree = cbt->btree; cursor = &cbt->iface; - session = (SESSION *)cursor->session; + session = (WT_SESSION_IMPL *)cursor->session; *exact = 0; switch (btree->type) { @@ -359,13 +359,13 @@ __wt_btcur_search_near(CURSOR_BTREE *cbt, int *exact) int __wt_btcur_insert(CURSOR_BTREE *cbt) { - BTREE *btree; - SESSION *session; + WT_BTREE *btree; + WT_SESSION_IMPL *session; WT_CURSOR *cursor; btree = cbt->btree; cursor = &cbt->iface; - session = (SESSION *)cursor->session; + session = (WT_SESSION_IMPL *)cursor->session; switch (btree->type) { case BTREE_COL_FIX: @@ -387,13 +387,13 @@ __wt_btcur_insert(CURSOR_BTREE *cbt) int __wt_btcur_update(CURSOR_BTREE *cbt) { - BTREE *btree; - SESSION *session; + WT_BTREE *btree; + WT_SESSION_IMPL *session; WT_CURSOR *cursor; btree = cbt->btree; cursor = &cbt->iface; - session = (SESSION *)cursor->session; + session = (WT_SESSION_IMPL *)cursor->session; switch (btree->type) { case BTREE_COL_FIX: @@ -415,13 +415,13 @@ __wt_btcur_update(CURSOR_BTREE *cbt) int __wt_btcur_remove(CURSOR_BTREE *cbt) { - BTREE *btree; - SESSION *session; + WT_BTREE *btree; + WT_SESSION_IMPL *session; WT_CURSOR *cursor; btree = cbt->btree; cursor = &cbt->iface; - session = (SESSION *)cursor->session; + session = (WT_SESSION_IMPL *)cursor->session; switch (btree->type) { case BTREE_COL_FIX: @@ -441,11 +441,11 @@ __wt_btcur_remove(CURSOR_BTREE *cbt) int __wt_btcur_close(CURSOR_BTREE *cbt, const char *config) { - SESSION *session; + WT_SESSION_IMPL *session; WT_UNUSED(config); - session = (SESSION *)cbt->iface.session; + session = (WT_SESSION_IMPL *)cbt->iface.session; __wt_walk_end(session, &cbt->walk); return (0); } diff --git a/src/btree/bt_debug.c b/src/btree/bt_debug.c index 0f3dfbdb9d8..a78be45fee2 100644 --- a/src/btree/bt_debug.c +++ b/src/btree/bt_debug.c @@ -10,21 +10,24 @@ #include "cell.i" #ifdef HAVE_DIAGNOSTIC -static int __wt_debug_cell(SESSION *, WT_CELL *, FILE *fp); -static int __wt_debug_cell_data(SESSION *, WT_CELL *, FILE *); +static int __wt_debug_cell(WT_SESSION_IMPL *, WT_CELL *, FILE *fp); +static int __wt_debug_cell_data(WT_SESSION_IMPL *, WT_CELL *, FILE *); static void __wt_debug_col_insert(WT_INSERT *, FILE *); -static int __wt_debug_dsk_cell(SESSION *, WT_PAGE_DISK *, FILE *); -static void __wt_debug_dsk_col_fix(BTREE *, WT_PAGE_DISK *, FILE *); +static int __wt_debug_dsk_cell(WT_SESSION_IMPL *, WT_PAGE_DISK *, FILE *); +static void __wt_debug_dsk_col_fix(WT_BTREE *, WT_PAGE_DISK *, FILE *); static void __wt_debug_dsk_col_int(WT_PAGE_DISK *, FILE *); -static void __wt_debug_dsk_col_rle(BTREE *, WT_PAGE_DISK *, FILE *); -static void __wt_debug_page_col_fix(SESSION *, WT_PAGE *, FILE *); -static int __wt_debug_page_col_int(SESSION *, WT_PAGE *, FILE *, uint32_t); -static void __wt_debug_page_col_rle(SESSION *, WT_PAGE *, FILE *); -static int __wt_debug_page_col_var(SESSION *, WT_PAGE *, FILE *); +static void __wt_debug_dsk_col_rle(WT_BTREE *, WT_PAGE_DISK *, FILE *); +static void __wt_debug_page_col_fix(WT_SESSION_IMPL *, WT_PAGE *, FILE *); +static int __wt_debug_page_col_int( + WT_SESSION_IMPL *, WT_PAGE *, FILE *, uint32_t); +static void __wt_debug_page_col_rle(WT_SESSION_IMPL *, WT_PAGE *, FILE *); +static int __wt_debug_page_col_var(WT_SESSION_IMPL *, WT_PAGE *, FILE *); static void __wt_debug_page_flags(WT_PAGE *, FILE *); -static int __wt_debug_page_row_int(SESSION *, WT_PAGE *, FILE *, uint32_t); -static int __wt_debug_page_row_leaf(SESSION *, WT_PAGE *, FILE *); -static int __wt_debug_page_work(SESSION *, WT_PAGE *, FILE *, uint32_t); +static int __wt_debug_page_row_int( + WT_SESSION_IMPL *, WT_PAGE *, FILE *, uint32_t); +static int __wt_debug_page_row_leaf(WT_SESSION_IMPL *, WT_PAGE *, FILE *); +static int __wt_debug_page_work( + WT_SESSION_IMPL *, WT_PAGE *, FILE *, uint32_t); static void __wt_debug_pair(const char *, const void *, uint32_t, FILE *); static void __wt_debug_ref(WT_REF *, FILE *); static void __wt_debug_row_insert(WT_INSERT *, FILE *); @@ -66,7 +69,7 @@ __wt_debug_set_fp(const char *ofile, FILE **fpp, int *close_varp) * open. */ int -__wt_debug_dump(SESSION *session, const char *ofile, FILE *fp) +__wt_debug_dump(WT_SESSION_IMPL *session, const char *ofile, FILE *fp) { int do_close, ret; @@ -90,8 +93,8 @@ __wt_debug_dump(SESSION *session, const char *ofile, FILE *fp) * Read and dump a disk page in debugging mode. */ int -__wt_debug_addr( - SESSION *session, uint32_t addr, uint32_t size, const char *ofile, FILE *fp) +__wt_debug_addr(WT_SESSION_IMPL *session, + uint32_t addr, uint32_t size, const char *ofile, FILE *fp) { int do_close, ret; char *bp; @@ -119,9 +122,9 @@ err: __wt_free(session, bp); */ int __wt_debug_disk( - SESSION *session, WT_PAGE_DISK *dsk, const char *ofile, FILE *fp) + WT_SESSION_IMPL *session, WT_PAGE_DISK *dsk, const char *ofile, FILE *fp) { - BTREE *btree; + WT_BTREE *btree; int do_close, ret; btree = session->btree; @@ -192,7 +195,7 @@ __wt_debug_disk( */ int __wt_debug_tree_all( - SESSION *session, WT_PAGE *page, const char *ofile, FILE *fp) + WT_SESSION_IMPL *session, WT_PAGE *page, const char *ofile, FILE *fp) { int do_close, ret; @@ -216,7 +219,8 @@ __wt_debug_tree_all( * Dump the in-memory information for a tree, not including leaf pages. */ int -__wt_debug_tree(SESSION *session, WT_PAGE *page, const char *ofile, FILE *fp) +__wt_debug_tree( + WT_SESSION_IMPL *session, WT_PAGE *page, const char *ofile, FILE *fp) { int do_close, ret; @@ -239,7 +243,8 @@ __wt_debug_tree(SESSION *session, WT_PAGE *page, const char *ofile, FILE *fp) * Dump the in-memory information for a page. */ int -__wt_debug_page(SESSION *session, WT_PAGE *page, const char *ofile, FILE *fp) +__wt_debug_page( + WT_SESSION_IMPL *session, WT_PAGE *page, const char *ofile, FILE *fp) { int do_close, ret; @@ -258,9 +263,10 @@ __wt_debug_page(SESSION *session, WT_PAGE *page, const char *ofile, FILE *fp) * Dump the in-memory information for an in-memory page. */ static int -__wt_debug_page_work(SESSION *session, WT_PAGE *page, FILE *fp, uint32_t flags) +__wt_debug_page_work( + WT_SESSION_IMPL *session, WT_PAGE *page, FILE *fp, uint32_t flags) { - BTREE *btree; + WT_BTREE *btree; btree = session->btree; @@ -357,7 +363,7 @@ __wt_debug_page_flags(WT_PAGE *page, FILE *fp) * Dump an in-memory WT_PAGE_COL_FIX page. */ static void -__wt_debug_page_col_fix(SESSION *session, WT_PAGE *page, FILE *fp) +__wt_debug_page_col_fix(WT_SESSION_IMPL *session, WT_PAGE *page, FILE *fp) { WT_COL *cip; WT_UPDATE *upd; @@ -389,7 +395,7 @@ __wt_debug_page_col_fix(SESSION *session, WT_PAGE *page, FILE *fp) */ static int __wt_debug_page_col_int( - SESSION *session, WT_PAGE *page, FILE *fp, uint32_t flags) + WT_SESSION_IMPL *session, WT_PAGE *page, FILE *fp, uint32_t flags) { WT_COL_REF *cref; uint32_t i; @@ -418,7 +424,7 @@ __wt_debug_page_col_int( * Dump an in-memory WT_PAGE_COL_RLE page. */ static void -__wt_debug_page_col_rle(SESSION *session, WT_PAGE *page, FILE *fp) +__wt_debug_page_col_rle(WT_SESSION_IMPL *session, WT_PAGE *page, FILE *fp) { WT_COL *cip; WT_INSERT *ins; @@ -451,7 +457,7 @@ __wt_debug_page_col_rle(SESSION *session, WT_PAGE *page, FILE *fp) * Dump an in-memory WT_PAGE_COL_VAR page. */ static int -__wt_debug_page_col_var(SESSION *session, WT_PAGE *page, FILE *fp) +__wt_debug_page_col_var(WT_SESSION_IMPL *session, WT_PAGE *page, FILE *fp) { WT_COL *cip; WT_UPDATE *upd; @@ -478,7 +484,7 @@ __wt_debug_page_col_var(SESSION *session, WT_PAGE *page, FILE *fp) */ static int __wt_debug_page_row_int( - SESSION *session, WT_PAGE *page, FILE *fp, uint32_t flags) + WT_SESSION_IMPL *session, WT_PAGE *page, FILE *fp, uint32_t flags) { WT_ROW_REF *rref; uint32_t i; @@ -512,7 +518,7 @@ __wt_debug_page_row_int( * Dump an in-memory WT_PAGE_ROW_LEAF page. */ static int -__wt_debug_page_row_leaf(SESSION *session, WT_PAGE *page, FILE *fp) +__wt_debug_page_row_leaf(WT_SESSION_IMPL *session, WT_PAGE *page, FILE *fp) { WT_INSERT *ins; WT_ROW *rip; @@ -611,7 +617,7 @@ __wt_debug_update(WT_UPDATE *upd, FILE *fp) * Dump a page of WT_CELL's. */ static int -__wt_debug_dsk_cell(SESSION *session, WT_PAGE_DISK *dsk, FILE *fp) +__wt_debug_dsk_cell(WT_SESSION_IMPL *session, WT_PAGE_DISK *dsk, FILE *fp) { WT_CELL *cell; uint32_t i; @@ -629,7 +635,7 @@ __wt_debug_dsk_cell(SESSION *session, WT_PAGE_DISK *dsk, FILE *fp) * Dump a single WT_CELL. */ static int -__wt_debug_cell(SESSION *session, WT_CELL *cell, FILE *fp) +__wt_debug_cell(WT_SESSION_IMPL *session, WT_CELL *cell, FILE *fp) { WT_OFF off; @@ -687,7 +693,7 @@ __wt_debug_dsk_col_int(WT_PAGE_DISK *dsk, FILE *fp) * Dump a WT_PAGE_COL_FIX page. */ static void -__wt_debug_dsk_col_fix(BTREE *btree, WT_PAGE_DISK *dsk, FILE *fp) +__wt_debug_dsk_col_fix(WT_BTREE *btree, WT_PAGE_DISK *dsk, FILE *fp) { uint32_t i; uint8_t *p; @@ -710,7 +716,7 @@ __wt_debug_dsk_col_fix(BTREE *btree, WT_PAGE_DISK *dsk, FILE *fp) * Dump a WT_PAGE_COL_RLE page. */ static void -__wt_debug_dsk_col_rle(BTREE *btree, WT_PAGE_DISK *dsk, FILE *fp) +__wt_debug_dsk_col_rle(WT_BTREE *btree, WT_PAGE_DISK *dsk, FILE *fp) { uint32_t i; uint8_t *p; @@ -735,7 +741,7 @@ __wt_debug_dsk_col_rle(BTREE *btree, WT_PAGE_DISK *dsk, FILE *fp) * Dump a single cell's data in debugging mode. */ static int -__wt_debug_cell_data(SESSION *session, WT_CELL *cell, FILE *fp) +__wt_debug_cell_data(WT_SESSION_IMPL *session, WT_CELL *cell, FILE *fp) { WT_BUF *tmp; uint32_t size; diff --git a/src/btree/bt_desc.c b/src/btree/bt_desc.c index c11986f8731..087cb56c5ab 100644 --- a/src/btree/bt_desc.c +++ b/src/btree/bt_desc.c @@ -12,9 +12,9 @@ * Read and verify the file's metadata. */ int -__wt_desc_read(SESSION *session) +__wt_desc_read(WT_SESSION_IMPL *session) { - BTREE *btree; + WT_BTREE *btree; WT_BTREE_DESC *desc; WT_CONFIG_ITEM cval; uint8_t *p, *ep, buf[512]; @@ -93,7 +93,7 @@ eof: __wt_errx(session, * Write the file's descriptor structure. */ int -__wt_desc_write(SESSION *session, const char *config, WT_FH *fh) +__wt_desc_write(WT_SESSION_IMPL *session, const char *config, WT_FH *fh) { WT_BTREE_DESC *desc; uint8_t buf[512]; @@ -119,9 +119,9 @@ __wt_desc_write(SESSION *session, const char *config, WT_FH *fh) * Update the file's descriptor structure. */ int -__wt_desc_update(SESSION *session) +__wt_desc_update(WT_SESSION_IMPL *session) { - BTREE *btree; + WT_BTREE *btree; WT_BTREE_DESC *desc; uint8_t buf[512]; diff --git a/src/btree/bt_discard.c b/src/btree/bt_discard.c index 0494818eccd..b0c0a345dfb 100644 --- a/src/btree/bt_discard.c +++ b/src/btree/bt_discard.c @@ -8,16 +8,16 @@ #include "wt_internal.h" #include "btree.i" -static void __wt_free_insert(SESSION *, WT_INSERT **, uint32_t); -static void __wt_free_insert_list(SESSION *, WT_INSERT *); -static void __wt_free_page_col_fix(SESSION *, WT_PAGE *); -static void __wt_free_page_col_int(SESSION *, WT_PAGE *); -static void __wt_free_page_col_rle(SESSION *, WT_PAGE *); -static void __wt_free_page_col_var(SESSION *, WT_PAGE *); -static void __wt_free_page_row_int(SESSION *, WT_PAGE *, uint32_t); -static void __wt_free_page_row_leaf(SESSION *, WT_PAGE *, uint32_t); -static void __wt_free_update(SESSION *, WT_UPDATE **, uint32_t); -static void __wt_free_update_list(SESSION *, WT_UPDATE *); +static void __wt_free_insert(WT_SESSION_IMPL *, WT_INSERT **, uint32_t); +static void __wt_free_insert_list(WT_SESSION_IMPL *, WT_INSERT *); +static void __wt_free_page_col_fix(WT_SESSION_IMPL *, WT_PAGE *); +static void __wt_free_page_col_int(WT_SESSION_IMPL *, WT_PAGE *); +static void __wt_free_page_col_rle(WT_SESSION_IMPL *, WT_PAGE *); +static void __wt_free_page_col_var(WT_SESSION_IMPL *, WT_PAGE *); +static void __wt_free_page_row_int(WT_SESSION_IMPL *, WT_PAGE *, uint32_t); +static void __wt_free_page_row_leaf(WT_SESSION_IMPL *, WT_PAGE *, uint32_t); +static void __wt_free_update(WT_SESSION_IMPL *, WT_UPDATE **, uint32_t); +static void __wt_free_update_list(WT_SESSION_IMPL *, WT_UPDATE *); /* * __wt_page_free -- @@ -25,7 +25,7 @@ static void __wt_free_update_list(SESSION *, WT_UPDATE *); */ void __wt_page_free( - SESSION *session, WT_PAGE *page, uint32_t addr, uint32_t size) + WT_SESSION_IMPL *session, WT_PAGE *page, uint32_t addr, uint32_t size) { WT_VERBOSE(S2C(session), WT_VERB_EVICT, (session, "discard addr %lu/%lu (type %s)", @@ -112,7 +112,7 @@ __wt_page_free( * Discard a WT_PAGE_COL_FIX page. */ static void -__wt_free_page_col_fix(SESSION *session, WT_PAGE *page) +__wt_free_page_col_fix(WT_SESSION_IMPL *session, WT_PAGE *page) { /* Free the in-memory index array. */ if (page->u.col_leaf.d != NULL) @@ -129,7 +129,7 @@ __wt_free_page_col_fix(SESSION *session, WT_PAGE *page) * Discard a WT_PAGE_COL_INT page. */ static void -__wt_free_page_col_int(SESSION *session, WT_PAGE *page) +__wt_free_page_col_int(WT_SESSION_IMPL *session, WT_PAGE *page) { /* Free the subtree-reference array. */ if (page->u.col_int.t != NULL) @@ -141,7 +141,7 @@ __wt_free_page_col_int(SESSION *session, WT_PAGE *page) * Discard a WT_PAGE_COL_RLE page. */ static void -__wt_free_page_col_rle(SESSION *session, WT_PAGE *page) +__wt_free_page_col_rle(WT_SESSION_IMPL *session, WT_PAGE *page) { /* Free the in-memory index array. */ if (page->u.col_leaf.d != NULL) @@ -158,7 +158,7 @@ __wt_free_page_col_rle(SESSION *session, WT_PAGE *page) * Discard a WT_PAGE_COL_VAR page. */ static void -__wt_free_page_col_var(SESSION *session, WT_PAGE *page) +__wt_free_page_col_var(WT_SESSION_IMPL *session, WT_PAGE *page) { /* Free the in-memory index array. */ if (page->u.col_leaf.d != NULL) @@ -175,7 +175,7 @@ __wt_free_page_col_var(SESSION *session, WT_PAGE *page) * Discard a WT_PAGE_ROW_INT page. */ static void -__wt_free_page_row_int(SESSION *session, WT_PAGE *page, uint32_t size) +__wt_free_page_row_int(WT_SESSION_IMPL *session, WT_PAGE *page, uint32_t size) { WT_ROW_REF *rref; uint32_t i; @@ -198,7 +198,7 @@ __wt_free_page_row_int(SESSION *session, WT_PAGE *page, uint32_t size) * Discard a WT_PAGE_ROW_LEAF page. */ static void -__wt_free_page_row_leaf(SESSION *session, WT_PAGE *page, uint32_t size) +__wt_free_page_row_leaf(WT_SESSION_IMPL *session, WT_PAGE *page, uint32_t size) { WT_ROW *rip; uint32_t i; @@ -238,7 +238,7 @@ __wt_free_page_row_leaf(SESSION *session, WT_PAGE *page, uint32_t size) */ static void __wt_free_insert( - SESSION *session, WT_INSERT **insert_head, uint32_t entries) + WT_SESSION_IMPL *session, WT_INSERT **insert_head, uint32_t entries) { WT_INSERT **insp; @@ -260,7 +260,7 @@ __wt_free_insert( * of a WT_INSERT structure and its associated chain of WT_UPDATE structures. */ static void -__wt_free_insert_list(SESSION *session, WT_INSERT *ins) +__wt_free_insert_list(WT_SESSION_IMPL *session, WT_INSERT *ins) { WT_INSERT *next; @@ -278,7 +278,7 @@ __wt_free_insert_list(SESSION *session, WT_INSERT *ins) */ static void __wt_free_update( - SESSION *session, WT_UPDATE **update_head, uint32_t entries) + WT_SESSION_IMPL *session, WT_UPDATE **update_head, uint32_t entries) { WT_UPDATE **updp; @@ -300,7 +300,7 @@ __wt_free_update( * of a WT_UPDATE structure and its associated data. */ static void -__wt_free_update_list(SESSION *session, WT_UPDATE *upd) +__wt_free_update_list(WT_SESSION_IMPL *session, WT_UPDATE *upd) { WT_UPDATE *next; diff --git a/src/btree/bt_dump.c b/src/btree/bt_dump.c index 879f6b14919..28442991eb7 100644 --- a/src/btree/bt_dump.c +++ b/src/btree/bt_dump.c @@ -15,11 +15,11 @@ typedef struct { uint64_t fcnt; /* Progress counter */ } WT_DSTUFF; -static int __wt_dump_page(SESSION *, WT_PAGE *, void *); -static void __wt_dump_page_col_fix(SESSION *, WT_PAGE *, WT_DSTUFF *); -static int __wt_dump_page_col_rle(SESSION *, WT_PAGE *, WT_DSTUFF *); -static int __wt_dump_page_col_var(SESSION *, WT_PAGE *, WT_DSTUFF *); -static int __wt_dump_page_row_leaf(SESSION *, WT_PAGE *, WT_DSTUFF *); +static int __wt_dump_page(WT_SESSION_IMPL *, WT_PAGE *, void *); +static void __wt_dump_page_col_fix(WT_SESSION_IMPL *, WT_PAGE *, WT_DSTUFF *); +static int __wt_dump_page_col_rle(WT_SESSION_IMPL *, WT_PAGE *, WT_DSTUFF *); +static int __wt_dump_page_col_var(WT_SESSION_IMPL *, WT_PAGE *, WT_DSTUFF *); +static int __wt_dump_page_row_leaf(WT_SESSION_IMPL *, WT_PAGE *, WT_DSTUFF *); static void __wt_print_byte_string_hex(const uint8_t *, uint32_t, FILE *); static void __wt_print_byte_string_nl(const uint8_t *, uint32_t, FILE *); @@ -28,7 +28,7 @@ static void __wt_print_byte_string_nl(const uint8_t *, uint32_t, FILE *); * Db.dump method. */ int -__wt_btree_dump(SESSION *session, FILE *stream, uint32_t flags) +__wt_btree_dump(WT_SESSION_IMPL *session, FILE *stream, uint32_t flags) { WT_DSTUFF dstuff; int ret; @@ -68,7 +68,7 @@ __wt_btree_dump(SESSION *session, FILE *stream, uint32_t flags) * Depth-first recursive walk of a btree. */ static int -__wt_dump_page(SESSION *session, WT_PAGE *page, void *arg) +__wt_dump_page(WT_SESSION_IMPL *session, WT_PAGE *page, void *arg) { WT_DSTUFF *dp; @@ -105,9 +105,9 @@ __wt_dump_page(SESSION *session, WT_PAGE *page, void *arg) * Dump a WT_PAGE_COL_FIX page. */ static void -__wt_dump_page_col_fix(SESSION *session, WT_PAGE *page, WT_DSTUFF *dp) +__wt_dump_page_col_fix(WT_SESSION_IMPL *session, WT_PAGE *page, WT_DSTUFF *dp) { - BTREE *btree; + WT_BTREE *btree; WT_COL *cip; WT_UPDATE *upd; uint32_t i; @@ -133,9 +133,9 @@ __wt_dump_page_col_fix(SESSION *session, WT_PAGE *page, WT_DSTUFF *dp) * Dump a WT_PAGE_COL_RLE page. */ static int -__wt_dump_page_col_rle(SESSION *session, WT_PAGE *page, WT_DSTUFF *dp) +__wt_dump_page_col_rle(WT_SESSION_IMPL *session, WT_PAGE *page, WT_DSTUFF *dp) { - BTREE *btree; + WT_BTREE *btree; FILE *fp; WT_COL *cip; WT_INSERT *ins; @@ -181,9 +181,9 @@ __wt_dump_page_col_rle(SESSION *session, WT_PAGE *page, WT_DSTUFF *dp) * Dump a WT_PAGE_COL_VAR page. */ static int -__wt_dump_page_col_var(SESSION *session, WT_PAGE *page, WT_DSTUFF *dp) +__wt_dump_page_col_var(WT_SESSION_IMPL *session, WT_PAGE *page, WT_DSTUFF *dp) { - BTREE *btree; + WT_BTREE *btree; WT_BUF *tmp; WT_COL *cip; WT_CELL *cell; @@ -235,9 +235,9 @@ err: __wt_scr_release(&tmp); * Dump a WT_PAGE_ROW_LEAF page. */ static int -__wt_dump_page_row_leaf(SESSION *session, WT_PAGE *page, WT_DSTUFF *dp) +__wt_dump_page_row_leaf(WT_SESSION_IMPL *session, WT_PAGE *page, WT_DSTUFF *dp) { - BTREE *btree; + WT_BTREE *btree; WT_BUF *key_tmp, *value_tmp; WT_CELL *cell; WT_INSERT *ins; diff --git a/src/btree/bt_evict.c b/src/btree/bt_evict.c index 04c988aad53..f11097a6fdd 100644 --- a/src/btree/bt_evict.c +++ b/src/btree/bt_evict.c @@ -9,20 +9,20 @@ #include "btree.i" static inline void __evict_clr(WT_EVICT_LIST *); -static inline void __evict_req_clr(SESSION *, WT_EVICT_REQ *); -static inline void __evict_req_set(SESSION *, WT_EVICT_REQ *, int); +static inline void __evict_req_clr(WT_SESSION_IMPL *, WT_EVICT_REQ *); +static inline void __evict_req_set(WT_SESSION_IMPL *, WT_EVICT_REQ *, int); -static void __evict_dup_remove(SESSION *); -static int __evict_file(SESSION *, WT_EVICT_REQ *); -static int __evict_lru(SESSION *); +static void __evict_dup_remove(WT_SESSION_IMPL *); +static int __evict_file(WT_SESSION_IMPL *, WT_EVICT_REQ *); +static int __evict_lru(WT_SESSION_IMPL *); static int __evict_lru_cmp(const void *, const void *); -static void __evict_page(SESSION *); +static void __evict_page(WT_SESSION_IMPL *); static int __evict_page_cmp(const void *, const void *); -static int __evict_request_retry(SESSION *); -static int __evict_request_walk(SESSION *); -static int __evict_walk(SESSION *); -static int __evict_walk_file(SESSION *, u_int); -static int __evict_worker(SESSION *); +static int __evict_request_retry(WT_SESSION_IMPL *); +static int __evict_request_walk(WT_SESSION_IMPL *); +static int __evict_walk(WT_SESSION_IMPL *); +static int __evict_walk_file(WT_SESSION_IMPL *, u_int); +static int __evict_worker(WT_SESSION_IMPL *); /* * Tuning constants -- I hesitate to call this tuning, but we should review some @@ -66,7 +66,7 @@ __evict_clr(WT_EVICT_LIST *e) * Set an entry in the eviction request list. */ static inline void -__evict_req_set(SESSION *session, WT_EVICT_REQ *r, int close_method) +__evict_req_set(WT_SESSION_IMPL *session, WT_EVICT_REQ *r, int close_method) { r->close_method = close_method; WT_ASSERT(session, r->retry == NULL); @@ -84,7 +84,7 @@ __evict_req_set(SESSION *session, WT_EVICT_REQ *r, int close_method) * Set an entry in the eviction request list. */ static inline void -__evict_req_clr(SESSION *session, WT_EVICT_REQ *r) +__evict_req_clr(WT_SESSION_IMPL *session, WT_EVICT_REQ *r) { if (r->retry != NULL) __wt_free(session, r->retry); @@ -99,9 +99,9 @@ __evict_req_clr(SESSION *session, WT_EVICT_REQ *r) * See if the eviction server thread needs to be awakened. */ void -__wt_workq_evict_server(CONNECTION *conn, int force) +__wt_workq_evict_server(WT_CONNECTION_IMPL *conn, int force) { - SESSION *session; + WT_SESSION_IMPL *session; WT_CACHE *cache; uint64_t bytes_inuse, bytes_max; @@ -140,7 +140,7 @@ __wt_workq_evict_server(CONNECTION *conn, int force) * or closed. */ int -__wt_evict_file_serial_func(SESSION *session) +__wt_evict_file_serial_func(WT_SESSION_IMPL *session) { WT_CACHE *cache; WT_EVICT_REQ *er, *er_end; @@ -167,8 +167,8 @@ __wt_evict_file_serial_func(SESSION *session) void * __wt_cache_evict_server(void *arg) { - CONNECTION *conn; - SESSION *session; + WT_CONNECTION_IMPL *conn; + WT_SESSION_IMPL *session; WT_SESSION *wt_session; WT_CACHE *cache; WT_EVICT_REQ *er, *er_end; @@ -191,7 +191,7 @@ __wt_cache_evict_server(void *arg) session = &conn->default_session; wt_session = NULL; WT_ERR(conn->iface.open_session(&conn->iface, NULL, NULL, &wt_session)); - session = (SESSION *)wt_session; + session = (WT_SESSION_IMPL *)wt_session; /* * Don't close this session during WT_CONNECTION->close: we do it * before the thread completes. @@ -244,9 +244,9 @@ err: __wt_err(session, ret, "cache eviction server error"); * The exit flag is set, wake the eviction server to exit. */ void -__wt_workq_evict_server_exit(CONNECTION *conn) +__wt_workq_evict_server_exit(WT_CONNECTION_IMPL *conn) { - SESSION *session; + WT_SESSION_IMPL *session; WT_CACHE *cache; session = &conn->default_session; @@ -260,7 +260,7 @@ __wt_workq_evict_server_exit(CONNECTION *conn) * Evict pages from memory. */ static int -__evict_worker(SESSION *session) +__evict_worker(WT_SESSION_IMPL *session) { WT_CACHE *cache; uint64_t bytes_start, bytes_inuse, bytes_max; @@ -329,9 +329,9 @@ __evict_worker(SESSION *session) * Walk the eviction request queue. */ static int -__evict_request_walk(SESSION *session) +__evict_request_walk(WT_SESSION_IMPL *session) { - SESSION *request_session; + WT_SESSION_IMPL *request_session; WT_CACHE *cache; WT_EVICT_REQ *er, *er_end; int ret; @@ -339,10 +339,10 @@ __evict_request_walk(SESSION *session) cache = S2C(session)->cache; /* - * Walk the eviction request queue, looking for sync or close requests - * (defined by a valid SESSION handle). If we find a request, perform - * it, flush the result and clear the request slot, then wake up the - * requesting thread. + * Walk the eviction request queue, looking for sync or close requests + * (defined by a valid WT_SESSION_IMPL handle). If we find a request, + * perform it, flush the result and clear the request slot, then wake + * up the requesting thread. */ WT_EVICT_REQ_FOREACH(er, er_end, cache) { if ((request_session = er->session) == NULL) @@ -354,7 +354,7 @@ __evict_request_walk(SESSION *session) */ memset(cache->evict, 0, cache->evict_allocated); - /* Reference the correct BTREE handle. */ + /* Reference the correct WT_BTREE handle. */ WT_SET_BTREE_IN_SESSION(session, request_session->btree); ret = __evict_file(session, er); @@ -379,9 +379,9 @@ __evict_request_walk(SESSION *session) * Flush pages for a specific file as part of a close/sync operation. */ static int -__evict_file(SESSION *session, WT_EVICT_REQ *er) +__evict_file(WT_SESSION_IMPL *session, WT_EVICT_REQ *er) { - BTREE *btree; + WT_BTREE *btree; WT_PAGE *page; uint32_t flags; int ret; @@ -443,9 +443,9 @@ err: /* End the walk cleanly. */ * Retry an eviction request. */ static int -__evict_request_retry(SESSION *session) +__evict_request_retry(WT_SESSION_IMPL *session) { - SESSION *request_session; + WT_SESSION_IMPL *request_session; WT_CACHE *cache; WT_EVICT_REQ *er, *er_end; uint32_t i, flags; @@ -470,7 +470,7 @@ __evict_request_retry(SESSION *session) */ memset(cache->evict, 0, cache->evict_allocated); - /* Reference the correct BTREE handle. */ + /* Reference the correct WT_BTREE handle. */ request_session = er->session; WT_SET_BTREE_IN_SESSION(session, request_session->btree); @@ -510,7 +510,7 @@ __evict_request_retry(SESSION *session) * Evict pages from the cache based on their read generation. */ static int -__evict_lru(SESSION *session) +__evict_lru(WT_SESSION_IMPL *session) { /* Get some more pages to consider for eviction. */ WT_RET(__evict_walk(session)); @@ -529,10 +529,10 @@ __evict_lru(SESSION *session) * Fill in the array by walking the next set of pages. */ static int -__evict_walk(SESSION *session) +__evict_walk(WT_SESSION_IMPL *session) { - CONNECTION *conn; - BTREE *btree; + WT_CONNECTION_IMPL *conn; + WT_BTREE *btree; WT_CACHE *cache; u_int elem, i; int ret; @@ -561,7 +561,7 @@ __evict_walk(SESSION *session) if (F_ISSET(btree, WT_BTREE_NO_EVICTION)) continue; - /* Reference the correct BTREE handle. */ + /* Reference the correct WT_BTREE handle. */ WT_SET_BTREE_IN_SESSION(session, btree); WT_ERR(__evict_walk_file(session, i)); @@ -577,9 +577,9 @@ err: __wt_unlock(session, conn->mtx); * Get a few page eviction candidates from a single underlying file. */ static int -__evict_walk_file(SESSION *session, u_int slot) +__evict_walk_file(WT_SESSION_IMPL *session, u_int slot) { - BTREE *btree; + WT_BTREE *btree; WT_CACHE *cache; WT_PAGE *page; int i, restarted_once; @@ -635,7 +635,7 @@ walk: WT_RET(__wt_walk_begin( * Discard duplicates from the list of pages we collected. */ static void -__evict_dup_remove(SESSION *session) +__evict_dup_remove(WT_SESSION_IMPL *session) { WT_CACHE *cache; WT_EVICT_LIST *evict; @@ -683,7 +683,7 @@ __evict_dup_remove(SESSION *session) * Reconcile and discard cache pages. */ static void -__evict_page(SESSION *session) +__evict_page(WT_SESSION_IMPL *session) { WT_CACHE *cache; WT_EVICT_LIST *evict; @@ -700,7 +700,7 @@ __evict_page(SESSION *session) if ((page = evict->page) == NULL) continue; - /* Reference the correct BTREE handle. */ + /* Reference the correct WT_BTREE handle. */ WT_SET_BTREE_IN_SESSION(session, evict->btree); /* diff --git a/src/btree/bt_handle.c b/src/btree/bt_handle.c index e4d3c3fa5b3..f845194e944 100644 --- a/src/btree/bt_handle.c +++ b/src/btree/bt_handle.c @@ -7,17 +7,18 @@ #include "wt_internal.h" -static int __btree_conf(SESSION *); -static int __btree_init(SESSION *, const char *); -static int __btree_page_sizes(SESSION *); -static int __btree_type(SESSION *); +static int __btree_conf(WT_SESSION_IMPL *); +static int __btree_init(WT_SESSION_IMPL *, const char *); +static int __btree_page_sizes(WT_SESSION_IMPL *); +static int __btree_type(WT_SESSION_IMPL *); /* * __wt_btree_create -- * Create a Btree. */ int -__wt_btree_create(SESSION *session, const char *name, const char *config) +__wt_btree_create( + WT_SESSION_IMPL *session, const char *name, const char *config) { WT_FH *fh; int ret; @@ -48,30 +49,30 @@ __wt_btree_create(SESSION *session, const char *name, const char *config) * Open a Btree. */ int -__wt_btree_open(SESSION *session, const char *name, uint32_t flags) +__wt_btree_open(WT_SESSION_IMPL *session, const char *name, uint32_t flags) { - CONNECTION *conn; - BTREE *btree; + WT_CONNECTION_IMPL *conn; + WT_BTREE *btree; WT_PAGE *page; conn = S2C(session); btree = session->btree; - /* Create the BTREE structure. */ + /* Create the WT_BTREE structure. */ WT_RET(__wt_calloc_def(session, 1, &btree)); btree->flags = flags; btree->conn = conn; session->btree = btree; - /* Initialize the BTREE structure. */ + /* Initialize the WT_BTREE structure. */ WT_RET(__btree_init(session, name)); /* Open the underlying file handle. */ WT_RET(__wt_open(session, name, 0666, 1, &btree->fh)); /* - * Read in the file's metadata, configure the BTREE structure based on - * the configuration string, read in the free-list. + * Read in the file's metadata, configure the WT_BTREE structure based + * on the configuration string, read in the free-list. * * XXX Take extra care with this if WT_BTREE_VERIFY is set? */ @@ -130,12 +131,12 @@ __wt_btree_open(SESSION *session, const char *name, uint32_t flags) /* * __btree_init -- - * Initialize the BTREE structure, after an zero-filled allocation. + * Initialize the WT_BTREE structure, after an zero-filled allocation. */ static int -__btree_init(SESSION *session, const char *name) +__btree_init(WT_SESSION_IMPL *session, const char *name) { - BTREE *btree; + WT_BTREE *btree; btree = session->btree; @@ -161,10 +162,10 @@ __btree_init(SESSION *session, const char *name) * Close a Btree. */ int -__wt_btree_close(SESSION *session) +__wt_btree_close(WT_SESSION_IMPL *session) { - BTREE *btree; - CONNECTION *conn; + WT_BTREE *btree; + WT_CONNECTION_IMPL *conn; int ret; btree = session->btree; @@ -213,7 +214,7 @@ __wt_btree_close(SESSION *session) * Configure the btree and verify the configuration relationships. */ static int -__btree_conf(SESSION *session) +__btree_conf(WT_SESSION_IMPL *session) { /* File type. */ WT_RET(__btree_type(session)); @@ -232,11 +233,11 @@ __btree_conf(SESSION *session) * Figure out the database type. */ static int -__btree_type(SESSION *session) +__btree_type(WT_SESSION_IMPL *session) { const char *config; char *endp, t; - BTREE *btree; + WT_BTREE *btree; WT_CONFIG_ITEM cval; btree = session->btree; @@ -276,9 +277,9 @@ __btree_type(SESSION *session) * Verify the page sizes. */ static int -__btree_page_sizes(SESSION *session) +__btree_page_sizes(WT_SESSION_IMPL *session) { - BTREE *btree; + WT_BTREE *btree; WT_CONFIG_ITEM cval; const char *config; diff --git a/src/btree/bt_huffman.c b/src/btree/bt_huffman.c index 32a206c9d54..0a6c01a7194 100644 --- a/src/btree/bt_huffman.c +++ b/src/btree/bt_huffman.c @@ -124,7 +124,7 @@ static const struct __wt_huffman_table __wt_huffman_nytenglish[] = { /* ~ */ { 0x7e, 1 } }; -static int __wt_huffman_read(SESSION *, +static int __wt_huffman_read(WT_SESSION_IMPL *, WT_CONFIG_ITEM *, struct __wt_huffman_table **, u_int *, u_int *); /* @@ -132,9 +132,9 @@ static int __wt_huffman_read(SESSION *, * Configure Huffman encoding for the tree. */ int -__wt_btree_huffman_open(SESSION *session) +__wt_btree_huffman_open(WT_SESSION_IMPL *session) { - BTREE *btree; + WT_BTREE *btree; u_int entries, numbytes; struct __wt_huffman_table *table; WT_CONFIG_ITEM key_conf, value_conf; @@ -226,7 +226,7 @@ __wt_btree_huffman_open(SESSION *session) * Read a Huffman table from a file. */ static int -__wt_huffman_read(SESSION *session, WT_CONFIG_ITEM *ip, +__wt_huffman_read(WT_SESSION_IMPL *session, WT_CONFIG_ITEM *ip, struct __wt_huffman_table **tablep, u_int *entriesp, u_int *numbytesp) { struct __wt_huffman_table *table, *tp; @@ -333,9 +333,9 @@ err: if (ret == 0) * Close the Huffman tables. */ void -__wt_btree_huffman_close(SESSION *session) +__wt_btree_huffman_close(WT_SESSION_IMPL *session) { - BTREE *btree; + WT_BTREE *btree; btree = session->btree; diff --git a/src/btree/bt_ovfl.c b/src/btree/bt_ovfl.c index a0b793b1c74..79aaf49fdd3 100644 --- a/src/btree/bt_ovfl.c +++ b/src/btree/bt_ovfl.c @@ -12,10 +12,10 @@ * Read an overflow item from the disk. */ int -__wt_ovfl_in(SESSION *session, WT_OFF *ovfl, WT_BUF *store) +__wt_ovfl_in(WT_SESSION_IMPL *session, WT_OFF *ovfl, WT_BUF *store) { - BTREE *btree; - CONNECTION *conn; + WT_BTREE *btree; + WT_CONNECTION_IMPL *conn; conn = S2C(session); btree = session->btree; diff --git a/src/btree/bt_page.c b/src/btree/bt_page.c index f96b56c68b0..4ec18d97c9e 100644 --- a/src/btree/bt_page.c +++ b/src/btree/bt_page.c @@ -9,12 +9,12 @@ #include "btree.i" #include "cell.i" -static int __wt_page_inmem_col_fix(SESSION *, WT_PAGE *); -static int __wt_page_inmem_col_int(SESSION *, WT_PAGE *); -static int __wt_page_inmem_col_rle(SESSION *, WT_PAGE *); -static int __wt_page_inmem_col_var(SESSION *, WT_PAGE *); -static int __wt_page_inmem_row_int(SESSION *, WT_PAGE *); -static int __wt_page_inmem_row_leaf(SESSION *, WT_PAGE *); +static int __wt_page_inmem_col_fix(WT_SESSION_IMPL *, WT_PAGE *); +static int __wt_page_inmem_col_int(WT_SESSION_IMPL *, WT_PAGE *); +static int __wt_page_inmem_col_rle(WT_SESSION_IMPL *, WT_PAGE *); +static int __wt_page_inmem_col_var(WT_SESSION_IMPL *, WT_PAGE *); +static int __wt_page_inmem_row_int(WT_SESSION_IMPL *, WT_PAGE *); +static int __wt_page_inmem_row_leaf(WT_SESSION_IMPL *, WT_PAGE *); /* * __wt_page_in -- @@ -22,7 +22,8 @@ static int __wt_page_inmem_row_leaf(SESSION *, WT_PAGE *); * read it from the disk and build an in-memory version. */ int -__wt_page_in_func(SESSION *session, WT_PAGE *parent, WT_REF *ref, int dsk_verify +__wt_page_in_func( + WT_SESSION_IMPL *session, WT_PAGE *parent, WT_REF *ref, int dsk_verify #ifdef HAVE_DIAGNOSTIC , const char *file, int line #endif @@ -76,7 +77,7 @@ __wt_page_in_func(SESSION *session, WT_PAGE *parent, WT_REF *ref, int dsk_verify * Build in-memory page information. */ int -__wt_page_inmem(SESSION *session, +__wt_page_inmem(WT_SESSION_IMPL *session, WT_PAGE *parent, WT_REF *parent_ref, WT_PAGE_DISK *dsk, WT_PAGE **pagep) { WT_PAGE *page; @@ -140,9 +141,9 @@ err: if (page != NULL) * Build in-memory index for fixed-length column-store leaf pages. */ static int -__wt_page_inmem_col_fix(SESSION *session, WT_PAGE *page) +__wt_page_inmem_col_fix(WT_SESSION_IMPL *session, WT_PAGE *page) { - BTREE *btree; + WT_BTREE *btree; WT_COL *cip; WT_PAGE_DISK *dsk; uint32_t i; @@ -175,7 +176,7 @@ __wt_page_inmem_col_fix(SESSION *session, WT_PAGE *page) * Build in-memory index for column-store internal pages. */ static int -__wt_page_inmem_col_int(SESSION *session, WT_PAGE *page) +__wt_page_inmem_col_int(WT_SESSION_IMPL *session, WT_PAGE *page) { WT_COL_REF *cref; WT_OFF_RECORD *off_record; @@ -213,9 +214,9 @@ __wt_page_inmem_col_int(SESSION *session, WT_PAGE *page) * leaf pages. */ static int -__wt_page_inmem_col_rle(SESSION *session, WT_PAGE *page) +__wt_page_inmem_col_rle(WT_SESSION_IMPL *session, WT_PAGE *page) { - BTREE *btree; + WT_BTREE *btree; WT_COL *cip; WT_PAGE_DISK *dsk; uint32_t i; @@ -249,7 +250,7 @@ __wt_page_inmem_col_rle(SESSION *session, WT_PAGE *page) * column-store trees. */ static int -__wt_page_inmem_col_var(SESSION *session, WT_PAGE *page) +__wt_page_inmem_col_var(WT_SESSION_IMPL *session, WT_PAGE *page) { WT_COL *cip; WT_CELL *cell; @@ -283,7 +284,7 @@ __wt_page_inmem_col_var(SESSION *session, WT_PAGE *page) * Build in-memory index for row-store internal pages. */ static int -__wt_page_inmem_row_int(SESSION *session, WT_PAGE *page) +__wt_page_inmem_row_int(WT_SESSION_IMPL *session, WT_PAGE *page) { WT_CELL *cell; WT_OFF off; @@ -340,7 +341,7 @@ __wt_page_inmem_row_int(SESSION *session, WT_PAGE *page) * Build in-memory index for row-store leaf pages. */ static int -__wt_page_inmem_row_leaf(SESSION *session, WT_PAGE *page) +__wt_page_inmem_row_leaf(WT_SESSION_IMPL *session, WT_PAGE *page) { WT_CELL *cell; WT_PAGE_DISK *dsk; diff --git a/src/btree/bt_read.c b/src/btree/bt_read.c index b0350b41ca4..eb942537f3b 100644 --- a/src/btree/bt_read.c +++ b/src/btree/bt_read.c @@ -8,11 +8,11 @@ #include "wt_internal.h" #include "btree.i" -static inline void - __cache_read_req_set(SESSION *, WT_READ_REQ *, WT_PAGE *, WT_REF *, int); +static inline void __cache_read_req_set( + WT_SESSION_IMPL *, WT_READ_REQ *, WT_PAGE *, WT_REF *, int); static inline void __cache_read_req_clr(WT_READ_REQ *); -static int __cache_read(SESSION *, WT_PAGE *, WT_REF *, int); +static int __cache_read(WT_SESSION_IMPL *, WT_PAGE *, WT_REF *, int); #define WT_READ_REQ_FOREACH(rr, rr_end, cache) \ for ((rr) = (cache)->read_request, \ @@ -20,7 +20,7 @@ static int __cache_read(SESSION *, WT_PAGE *, WT_REF *, int); (rr) < (rr_end); ++(rr)) static inline void -__cache_read_req_set(SESSION *session, +__cache_read_req_set(WT_SESSION_IMPL *session, WT_READ_REQ *rr, WT_PAGE *parent, WT_REF *ref, int dsk_verify) { rr->parent = parent; @@ -44,7 +44,7 @@ __cache_read_req_clr(WT_READ_REQ *rr) * See if the read server thread needs to be awakened. */ void -__wt_workq_read_server(CONNECTION *conn, int force) +__wt_workq_read_server(WT_CONNECTION_IMPL *conn, int force) { WT_CACHE *cache; uint64_t bytes_inuse, bytes_max; @@ -94,7 +94,7 @@ __wt_workq_read_server(CONNECTION *conn, int force) * allocation or a read. */ int -__wt_cache_read_serial_func(SESSION *session) +__wt_cache_read_serial_func(WT_SESSION_IMPL *session) { WT_CACHE *cache; WT_PAGE *parent; @@ -124,8 +124,8 @@ __wt_cache_read_serial_func(SESSION *session) void * __wt_cache_read_server(void *arg) { - CONNECTION *conn; - SESSION *session, *request_session; + WT_CONNECTION_IMPL *conn; + WT_SESSION_IMPL *session, *request_session; WT_CACHE *cache; WT_READ_REQ *rr, *rr_end; WT_SESSION *wt_session; @@ -151,7 +151,7 @@ __wt_cache_read_server(void *arg) __wt_err(session, ret, "cache read server error"); return (NULL); } - session = (SESSION *)wt_session; + session = (WT_SESSION_IMPL *)wt_session; /* * Don't close this session during WT_CONNECTION->close: we do it * before the thread completes. @@ -170,9 +170,9 @@ __wt_cache_read_server(void *arg) /* * Walk the read-request queue, looking for reads (defined by - * a valid SESSION handle). If we find a read request, perform - * it, flush the result and clear the request slot, then wake - * up the requesting thread. + * a valid WT_SESSION_IMPL handle). If we find a read request, + * perform it, flush the result and clear the request slot, + * then wake up the requesting thread. */ do { didwork = 0; @@ -183,7 +183,7 @@ __wt_cache_read_server(void *arg) continue; didwork = 1; - /* Reference the correct BTREE handle. */ + /* Reference the correct WT_BTREE handle. */ WT_SET_BTREE_IN_SESSION( session, request_session->btree); @@ -213,9 +213,9 @@ __wt_cache_read_server(void *arg) * The exit flag is set, wake the read server to exit. */ void -__wt_workq_read_server_exit(CONNECTION *conn) +__wt_workq_read_server_exit(WT_CONNECTION_IMPL *conn) { - SESSION *session; + WT_SESSION_IMPL *session; WT_CACHE *cache; session = &conn->default_session; @@ -229,7 +229,8 @@ __wt_workq_read_server_exit(CONNECTION *conn) * Read a page from the file. */ static int -__cache_read(SESSION *session, WT_PAGE *parent, WT_REF *ref, int dsk_verify) +__cache_read( + WT_SESSION_IMPL *session, WT_PAGE *parent, WT_REF *ref, int dsk_verify) { WT_PAGE_DISK *dsk; uint32_t addr, size; diff --git a/src/btree/bt_reconcile.c b/src/btree/bt_reconcile.c index 30451dc9aae..147d5cb579b 100644 --- a/src/btree/bt_reconcile.c +++ b/src/btree/bt_reconcile.c @@ -192,59 +192,59 @@ typedef struct { int key_prefix_compress; /* If can prefix-compress next key */ } WT_RECONCILE; -static inline void __rec_copy_incr(SESSION *, WT_RECONCILE *, WT_KV *); -static inline int __rec_discard_add_ovfl(SESSION *, WT_CELL *); -static inline void __rec_incr(SESSION *, WT_RECONCILE *, uint32_t); +static inline void __rec_copy_incr(WT_SESSION_IMPL *, WT_RECONCILE *, WT_KV *); +static inline int __rec_discard_add_ovfl(WT_SESSION_IMPL *, WT_CELL *); +static inline void __rec_incr(WT_SESSION_IMPL *, WT_RECONCILE *, uint32_t); static inline void __rec_prefix_key_update(WT_RECONCILE *); static int __hazard_bsearch_cmp(const void *, const void *); -static void __hazard_copy(SESSION *); -static int __hazard_exclusive(SESSION *, WT_REF *); +static void __hazard_copy(WT_SESSION_IMPL *); +static int __hazard_exclusive(WT_SESSION_IMPL *, WT_REF *); static int __hazard_qsort_cmp(const void *, const void *); static uint32_t - __rec_allocation_size(SESSION *, WT_BUF *, uint8_t *); -static int __rec_cell_build_key(SESSION *, const void *, uint32_t); -static int __rec_cell_build_ovfl(SESSION *, WT_KV *, u_int); -static int __rec_cell_build_val(SESSION *, void *, uint32_t); -static int __rec_col_fix(SESSION *, WT_PAGE *); -static int __rec_col_fix_bulk(SESSION *, WT_PAGE *); -static int __rec_col_int(SESSION *, WT_PAGE *); -static int __rec_col_merge(SESSION *, WT_PAGE *); -static int __rec_col_rle(SESSION *, WT_PAGE *); -static int __rec_col_rle_bulk(SESSION *, WT_PAGE *); -static int __rec_col_split(SESSION *, WT_PAGE **, WT_PAGE *); -static int __rec_col_var(SESSION *, WT_PAGE *); -static int __rec_col_var_bulk(SESSION *, WT_PAGE *); -static int __rec_discard_add(SESSION *, WT_PAGE *, uint32_t, uint32_t); -static int __rec_discard_evict(SESSION *); + __rec_allocation_size(WT_SESSION_IMPL *, WT_BUF *, uint8_t *); +static int __rec_cell_build_key(WT_SESSION_IMPL *, const void *, uint32_t); +static int __rec_cell_build_ovfl(WT_SESSION_IMPL *, WT_KV *, u_int); +static int __rec_cell_build_val(WT_SESSION_IMPL *, void *, uint32_t); +static int __rec_col_fix(WT_SESSION_IMPL *, WT_PAGE *); +static int __rec_col_fix_bulk(WT_SESSION_IMPL *, WT_PAGE *); +static int __rec_col_int(WT_SESSION_IMPL *, WT_PAGE *); +static int __rec_col_merge(WT_SESSION_IMPL *, WT_PAGE *); +static int __rec_col_rle(WT_SESSION_IMPL *, WT_PAGE *); +static int __rec_col_rle_bulk(WT_SESSION_IMPL *, WT_PAGE *); +static int __rec_col_split(WT_SESSION_IMPL *, WT_PAGE **, WT_PAGE *); +static int __rec_col_var(WT_SESSION_IMPL *, WT_PAGE *); +static int __rec_col_var_bulk(WT_SESSION_IMPL *, WT_PAGE *); +static int __rec_discard_add(WT_SESSION_IMPL *, WT_PAGE *, uint32_t, uint32_t); +static int __rec_discard_evict(WT_SESSION_IMPL *); static void __rec_discard_init(WT_RECONCILE *); -static int __rec_imref_add(SESSION *, WT_REF *); +static int __rec_imref_add(WT_SESSION_IMPL *, WT_REF *); static int __rec_imref_bsearch_cmp(const void *, const void *); -static int __rec_imref_fixup(SESSION *, WT_PAGE *); +static int __rec_imref_fixup(WT_SESSION_IMPL *, WT_PAGE *); static void __rec_imref_init(WT_RECONCILE *); static int __rec_imref_qsort_cmp(const void *, const void *); -static int __rec_init(SESSION *, uint32_t); -static int __rec_ovfl_delete(SESSION *, WT_PAGE *); -static int __rec_parent_update( - SESSION *, WT_PAGE *, WT_PAGE *, uint32_t, uint32_t, uint32_t); -static void __rec_parent_update_clean(SESSION *, WT_PAGE *); -static int __rec_row_int(SESSION *, WT_PAGE *); -static int __rec_row_leaf(SESSION *, WT_PAGE *, uint32_t); -static int __rec_row_leaf_insert(SESSION *, WT_INSERT *); -static int __rec_row_merge(SESSION *, WT_PAGE *); -static int __rec_row_split(SESSION *, WT_PAGE **, WT_PAGE *); -static int __rec_split(SESSION *); -static int __rec_split_finish(SESSION *); -static int __rec_split_fixup(SESSION *); +static int __rec_init(WT_SESSION_IMPL *, uint32_t); +static int __rec_ovfl_delete(WT_SESSION_IMPL *, WT_PAGE *); +static int __rec_parent_update(WT_SESSION_IMPL *, + WT_PAGE *, WT_PAGE *, uint32_t, uint32_t, uint32_t); +static void __rec_parent_update_clean(WT_SESSION_IMPL *, WT_PAGE *); +static int __rec_row_int(WT_SESSION_IMPL *, WT_PAGE *); +static int __rec_row_leaf(WT_SESSION_IMPL *, WT_PAGE *, uint32_t); +static int __rec_row_leaf_insert(WT_SESSION_IMPL *, WT_INSERT *); +static int __rec_row_merge(WT_SESSION_IMPL *, WT_PAGE *); +static int __rec_row_split(WT_SESSION_IMPL *, WT_PAGE **, WT_PAGE *); +static int __rec_split(WT_SESSION_IMPL *); +static int __rec_split_finish(WT_SESSION_IMPL *); +static int __rec_split_fixup(WT_SESSION_IMPL *); static int __rec_split_init( - SESSION *, WT_PAGE *, uint64_t, uint32_t, uint32_t); -static int __rec_split_write(SESSION *, WT_BUF *, void *); -static int __rec_subtree(SESSION *, WT_PAGE *); -static int __rec_subtree_col(SESSION *, WT_PAGE *); -static void __rec_subtree_col_clear(SESSION *, WT_PAGE *); -static int __rec_subtree_row(SESSION *, WT_PAGE *); -static void __rec_subtree_row_clear(SESSION *, WT_PAGE *); -static int __rec_wrapup(SESSION *, WT_PAGE *); + WT_SESSION_IMPL *, WT_PAGE *, uint64_t, uint32_t, uint32_t); +static int __rec_split_write(WT_SESSION_IMPL *, WT_BUF *, void *); +static int __rec_subtree(WT_SESSION_IMPL *, WT_PAGE *); +static int __rec_subtree_col(WT_SESSION_IMPL *, WT_PAGE *); +static void __rec_subtree_col_clear(WT_SESSION_IMPL *, WT_PAGE *); +static int __rec_subtree_row(WT_SESSION_IMPL *, WT_PAGE *); +static void __rec_subtree_row_clear(WT_SESSION_IMPL *, WT_PAGE *); +static int __rec_wrapup(WT_SESSION_IMPL *, WT_PAGE *); /* * When discarding a page, we discard a number of things: pages merged into the @@ -256,7 +256,7 @@ static int __rec_wrapup(SESSION *, WT_PAGE *); #define __rec_discard_add_page(session, page) \ __rec_discard_add(session, page, WT_PADDR(page), WT_PSIZE(page)) static inline int -__rec_discard_add_ovfl(SESSION *session, WT_CELL *cell) +__rec_discard_add_ovfl(WT_SESSION_IMPL *session, WT_CELL *cell) { WT_OFF ovfl; @@ -272,9 +272,9 @@ __rec_discard_add_ovfl(SESSION *session, WT_CELL *cell) * Initialize the reconciliation structure. */ static int -__rec_init(SESSION *session, uint32_t flags) +__rec_init(WT_SESSION_IMPL *session, uint32_t flags) { - CONNECTION *conn; + WT_CONNECTION_IMPL *conn; WT_RECONCILE *r; /* Allocate a reconciliation structure if we don't already have one. */ @@ -320,7 +320,7 @@ __rec_init(SESSION *session, uint32_t flags) * Clean up the reconciliation structure. */ void -__wt_rec_destroy(SESSION *session) +__wt_rec_destroy(WT_SESSION_IMPL *session) { WT_RECONCILE *r; WT_SPLIT *spl; @@ -364,7 +364,7 @@ __wt_rec_destroy(SESSION *session) * Copy a key/value cell and buffer pair onto a page. */ static inline void -__rec_copy_incr(SESSION *session, WT_RECONCILE *r, WT_KV *kv) +__rec_copy_incr(WT_SESSION_IMPL *session, WT_RECONCILE *r, WT_KV *kv) { uint32_t len; uint8_t *p, *t; @@ -394,7 +394,7 @@ __rec_copy_incr(SESSION *session, WT_RECONCILE *r, WT_KV *kv) * Update the memory tracking structure for a new entry. */ static inline void -__rec_incr(SESSION *session, WT_RECONCILE *r, uint32_t size) +__rec_incr(WT_SESSION_IMPL *session, WT_RECONCILE *r, uint32_t size) { /* * The buffer code is fragile and prone to off-by-one errors -- @@ -415,9 +415,9 @@ __rec_incr(SESSION *session, WT_RECONCILE *r, uint32_t size) * (the page size can either grow or shrink), and zero out unused bytes. */ static inline uint32_t -__rec_allocation_size(SESSION *session, WT_BUF *buf, uint8_t *end) +__rec_allocation_size(WT_SESSION_IMPL *session, WT_BUF *buf, uint8_t *end) { - BTREE *btree; + WT_BTREE *btree; uint32_t alloc_len, current_len, write_len; btree = session->btree; @@ -444,9 +444,9 @@ __rec_allocation_size(SESSION *session, WT_BUF *buf, uint8_t *end) */ int __wt_page_reconcile( - SESSION *session, WT_PAGE *page, uint32_t slvg_skip, uint32_t flags) + WT_SESSION_IMPL *session, WT_PAGE *page, uint32_t slvg_skip, uint32_t flags) { - BTREE *btree; + WT_BTREE *btree; WT_CACHE *cache; int ret; @@ -586,7 +586,7 @@ __wt_page_reconcile( * Get exclusive access to a subtree for reconciliation. */ static int -__rec_subtree(SESSION *session, WT_PAGE *page) +__rec_subtree(WT_SESSION_IMPL *session, WT_PAGE *page) { WT_RECONCILE *r; int ret; @@ -667,7 +667,7 @@ __rec_subtree(SESSION *session, WT_PAGE *page) * pages. */ static int -__rec_subtree_col(SESSION *session, WT_PAGE *parent) +__rec_subtree_col(WT_SESSION_IMPL *session, WT_PAGE *parent) { WT_COL_REF *cref; WT_PAGE *page; @@ -769,7 +769,7 @@ __rec_subtree_col(SESSION *session, WT_PAGE *parent) * isn't possible. */ static void -__rec_subtree_col_clear(SESSION *session, WT_PAGE *parent) +__rec_subtree_col_clear(WT_SESSION_IMPL *session, WT_PAGE *parent) { WT_COL_REF *cref; WT_PAGE *page; @@ -793,7 +793,7 @@ __rec_subtree_col_clear(SESSION *session, WT_PAGE *parent) * pages. */ static int -__rec_subtree_row(SESSION *session, WT_PAGE *parent) +__rec_subtree_row(WT_SESSION_IMPL *session, WT_PAGE *parent) { WT_PAGE *page; WT_RECONCILE *r; @@ -894,7 +894,7 @@ __rec_subtree_row(SESSION *session, WT_PAGE *parent) * isn't possible. */ static void -__rec_subtree_row_clear(SESSION *session, WT_PAGE *parent) +__rec_subtree_row_clear(WT_SESSION_IMPL *session, WT_PAGE *parent) { WT_PAGE *page; WT_ROW_REF *rref; @@ -918,7 +918,7 @@ __rec_subtree_row_clear(SESSION *session, WT_PAGE *parent) * for discard. */ static int -__rec_ovfl_delete(SESSION *session, WT_PAGE *page) +__rec_ovfl_delete(WT_SESSION_IMPL *session, WT_PAGE *page) { WT_CELL *cell; WT_PAGE_DISK *dsk; @@ -941,10 +941,10 @@ __rec_ovfl_delete(SESSION *session, WT_PAGE *page) * Initialization for the reconciliation split functions. */ static int -__rec_split_init( - SESSION *session, WT_PAGE *page, uint64_t recno, uint32_t max, uint32_t min) +__rec_split_init(WT_SESSION_IMPL *session, + WT_PAGE *page, uint64_t recno, uint32_t max, uint32_t min) { - BTREE *btree; + WT_BTREE *btree; WT_PAGE_DISK *dsk; WT_RECONCILE *r; @@ -1030,7 +1030,7 @@ __rec_split_init( * has 3 doubled letters in a row? Sweet-tooth does, too.) */ static int -__rec_split(SESSION *session) +__rec_split(WT_SESSION_IMPL *session) { WT_BOUNDARY *bnd; WT_PAGE_DISK *dsk; @@ -1172,7 +1172,7 @@ __rec_split(SESSION *session) * Wrap up reconciliation. */ static int -__rec_split_finish(SESSION *session) +__rec_split_finish(WT_SESSION_IMPL *session) { WT_PAGE_DISK *dsk; WT_RECONCILE *r; @@ -1196,7 +1196,7 @@ __rec_split_finish(SESSION *session) * Physically split the already-written page data. */ static int -__rec_split_fixup(SESSION *session) +__rec_split_fixup(WT_SESSION_IMPL *session) { WT_BOUNDARY *bnd; WT_BUF *tmp; @@ -1273,7 +1273,7 @@ err: if (tmp != NULL) * Write a disk block out for the split helper functions. */ static int -__rec_split_write(SESSION *session, WT_BUF *buf, void *end) +__rec_split_write(WT_SESSION_IMPL *session, WT_BUF *buf, void *end) { WT_CELL *cell; WT_PAGE *page; @@ -1359,7 +1359,7 @@ __rec_split_write(SESSION *session, WT_BUF *buf, void *end) * Reconcile a column-store internal page. */ static int -__rec_col_int(SESSION *session, WT_PAGE *page) +__rec_col_int(WT_SESSION_IMPL *session, WT_PAGE *page) { WT_RET(__rec_split_init(session, page, page->u.col_int.recno, @@ -1386,7 +1386,7 @@ __rec_col_int(SESSION *session, WT_PAGE *page) * Recursively walk a column-store internal tree of merge pages. */ static int -__rec_col_merge(SESSION *session, WT_PAGE *page) +__rec_col_merge(WT_SESSION_IMPL *session, WT_PAGE *page) { WT_COL_REF *cref; WT_OFF_RECORD off; @@ -1450,9 +1450,9 @@ __rec_col_merge(SESSION *session, WT_PAGE *page) * run-length encoding). */ static int -__rec_col_fix(SESSION *session, WT_PAGE *page) +__rec_col_fix(WT_SESSION_IMPL *session, WT_PAGE *page) { - BTREE *btree; + WT_BTREE *btree; WT_BUF *tmp; WT_COL *cip; WT_RECONCILE *r; @@ -1530,9 +1530,9 @@ err: if (tmp != NULL) * handle run-length encoding). */ static int -__rec_col_fix_bulk(SESSION *session, WT_PAGE *page) +__rec_col_fix_bulk(WT_SESSION_IMPL *session, WT_PAGE *page) { - BTREE *btree; + WT_BTREE *btree; WT_RECONCILE *r; WT_UPDATE *upd; uint32_t len; @@ -1567,9 +1567,9 @@ __rec_col_fix_bulk(SESSION *session, WT_PAGE *page) * Reconcile a fixed-width, run-length encoded, column-store leaf page. */ static int -__rec_col_rle(SESSION *session, WT_PAGE *page) +__rec_col_rle(WT_SESSION_IMPL *session, WT_PAGE *page) { - BTREE *btree; + WT_BTREE *btree; WT_BUF *tmp; WT_COL *cip; WT_INSERT *ins; @@ -1588,7 +1588,7 @@ __rec_col_rle(SESSION *session, WT_PAGE *page) /* * We need a "deleted" data item to store on the page. Make sure the - * SESSION's scratch buffer is big enough. Clear the buffer's contents + * session's scratch buffer is big enough. Clear the buffer's contents * and set the delete flag. */ len = btree->fixed_len; @@ -1680,9 +1680,9 @@ err: if (tmp != NULL) * leaf page. */ static int -__rec_col_rle_bulk(SESSION *session, WT_PAGE *page) +__rec_col_rle_bulk(WT_SESSION_IMPL *session, WT_PAGE *page) { - BTREE *btree; + WT_BTREE *btree; WT_RECONCILE *r; WT_UPDATE *upd; uint32_t len; @@ -1732,7 +1732,7 @@ __rec_col_rle_bulk(SESSION *session, WT_PAGE *page) * Reconcile a variable-width column-store leaf page. */ static int -__rec_col_var(SESSION *session, WT_PAGE *page) +__rec_col_var(WT_SESSION_IMPL *session, WT_PAGE *page) { WT_CELL *cell; WT_COL *cip; @@ -1801,7 +1801,7 @@ __rec_col_var(SESSION *session, WT_PAGE *page) * Reconcile a bulk-loaded, variable-width column-store leaf page. */ static int -__rec_col_var_bulk(SESSION *session, WT_PAGE *page) +__rec_col_var_bulk(WT_SESSION_IMPL *session, WT_PAGE *page) { WT_KV *val; WT_RECONCILE *r; @@ -1839,7 +1839,7 @@ __rec_col_var_bulk(SESSION *session, WT_PAGE *page) * Reconcile a row-store internal page. */ static int -__rec_row_int(SESSION *session, WT_PAGE *page) +__rec_row_int(WT_SESSION_IMPL *session, WT_PAGE *page) { WT_CELL *cell; WT_KV *key, *val; @@ -2047,7 +2047,7 @@ __rec_row_int(SESSION *session, WT_PAGE *page) * Recursively walk a row-store internal tree of merge pages. */ static int -__rec_row_merge(SESSION *session, WT_PAGE *page) +__rec_row_merge(WT_SESSION_IMPL *session, WT_PAGE *page) { WT_KV *key, *val; WT_PAGE *rp; @@ -2149,7 +2149,7 @@ __rec_row_merge(SESSION *session, WT_PAGE *page) * Reconcile a row-store leaf page. */ static int -__rec_row_leaf(SESSION *session, WT_PAGE *page, uint32_t slvg_skip) +__rec_row_leaf(WT_SESSION_IMPL *session, WT_PAGE *page, uint32_t slvg_skip) { WT_CELL *cell, *val_cell; WT_INSERT *ins; @@ -2320,7 +2320,7 @@ leaf_insert: /* Write any K/V pairs inserted into the page after this key. */ * Walk an insert chain, writing K/V pairs. */ static int -__rec_row_leaf_insert(SESSION *session, WT_INSERT *ins) +__rec_row_leaf_insert(WT_SESSION_IMPL *session, WT_INSERT *ins) { WT_KV *key, *val; WT_RECONCILE *r; @@ -2384,9 +2384,9 @@ __rec_row_leaf_insert(SESSION *session, WT_INSERT *ins) * Resolve the WT_RECONCILE information. */ static int -__rec_wrapup(SESSION *session, WT_PAGE *page) +__rec_wrapup(WT_SESSION_IMPL *session, WT_PAGE *page) { - BTREE *btree; + WT_BTREE *btree; WT_PAGE *imp; WT_RECONCILE *r; @@ -2552,7 +2552,7 @@ __rec_wrapup(SESSION *session, WT_PAGE *page) * Update a parent page's reference for an evicted, clean page. */ static void -__rec_parent_update_clean(SESSION *session, WT_PAGE *page) +__rec_parent_update_clean(WT_SESSION_IMPL *session, WT_PAGE *page) { WT_REF *parent_ref; @@ -2579,7 +2579,7 @@ __rec_parent_update_clean(SESSION *session, WT_PAGE *page) * Update a parent page's reference to a reconciled page. */ static int -__rec_parent_update(SESSION *session, WT_PAGE *page, +__rec_parent_update(WT_SESSION_IMPL *session, WT_PAGE *page, WT_PAGE *replace, uint32_t addr, uint32_t size, uint32_t state) { WT_REF *parent_ref; @@ -2630,9 +2630,9 @@ __rec_parent_update(SESSION *session, WT_PAGE *page, * stored on the page. */ static int -__rec_cell_build_key(SESSION *session, const void *data, uint32_t size) +__rec_cell_build_key(WT_SESSION_IMPL *session, const void *data, uint32_t size) { - BTREE *btree; + WT_BTREE *btree; WT_KV *key; WT_RECONCILE *r; uint32_t pfx_len, pfx; @@ -2713,9 +2713,9 @@ __rec_cell_build_key(SESSION *session, const void *data, uint32_t size) * be stored on the page. */ static int -__rec_cell_build_val(SESSION *session, void *data, uint32_t size) +__rec_cell_build_val(WT_SESSION_IMPL *session, void *data, uint32_t size) { - BTREE *btree; + WT_BTREE *btree; WT_KV *val; WT_RECONCILE *r; @@ -2760,7 +2760,7 @@ __rec_cell_build_val(SESSION *session, void *data, uint32_t size) * Store bulk-loaded overflow items in the file, returning the WT_OFF. */ static int -__rec_cell_build_ovfl(SESSION *session, WT_KV *kv, u_int type) +__rec_cell_build_ovfl(WT_SESSION_IMPL *session, WT_KV *kv, u_int type) { WT_BUF *tmp; WT_PAGE_DISK *dsk; @@ -2827,7 +2827,7 @@ __rec_prefix_key_update(WT_RECONCILE *r) * Update a row-store parent page's reference when a page is split. */ static int -__rec_row_split(SESSION *session, WT_PAGE **splitp, WT_PAGE *orig) +__rec_row_split(WT_SESSION_IMPL *session, WT_PAGE **splitp, WT_PAGE *orig) { WT_PAGE *imp, *page; WT_RECONCILE *r; @@ -2925,7 +2925,7 @@ err: __wt_free(session, page); * Update a column-store parent page's reference when a page is split. */ static int -__rec_col_split(SESSION *session, WT_PAGE **splitp, WT_PAGE *orig) +__rec_col_split(WT_SESSION_IMPL *session, WT_PAGE **splitp, WT_PAGE *orig) { WT_COL_REF *cref; WT_OFF_RECORD *off; @@ -3048,7 +3048,7 @@ __rec_imref_bsearch_cmp(const void *a, const void *b) * Fix up after splitting a page referencing an in-memory subtree. */ static int -__rec_imref_fixup(SESSION *session, WT_PAGE *page) +__rec_imref_fixup(WT_SESSION_IMPL *session, WT_PAGE *page) { WT_COL_REF *cref; WT_RECONCILE *r; @@ -3112,7 +3112,7 @@ __rec_imref_init(WT_RECONCILE *r) * Append a new reference to the list of in-memory subtree references. */ static int -__rec_imref_add(SESSION *session, WT_REF *ref) +__rec_imref_add(WT_SESSION_IMPL *session, WT_REF *ref) { WT_RECONCILE *r; @@ -3143,7 +3143,8 @@ __rec_discard_init(WT_RECONCILE *r) * Append an object to the list of discard objects. */ static int -__rec_discard_add(SESSION *session, WT_PAGE *page, uint32_t addr, uint32_t size) +__rec_discard_add( + WT_SESSION_IMPL *session, WT_PAGE *page, uint32_t addr, uint32_t size) { WT_RECONCILE *r; @@ -3167,7 +3168,7 @@ __rec_discard_add(SESSION *session, WT_PAGE *page, uint32_t addr, uint32_t size) * Discard the list of discard objects. */ static int -__rec_discard_evict(SESSION *session) +__rec_discard_evict(WT_SESSION_IMPL *session) { WT_DISCARD *discard; WT_RECONCILE *r; @@ -3205,9 +3206,9 @@ __hazard_qsort_cmp(const void *a, const void *b) * Copy the hazard array and prepare it for searching. */ static void -__hazard_copy(SESSION *session) +__hazard_copy(WT_SESSION_IMPL *session) { - CONNECTION *conn; + WT_CONNECTION_IMPL *conn; WT_RECONCILE *r; uint32_t elem, i, j; @@ -3249,7 +3250,7 @@ __hazard_bsearch_cmp(const void *search, const void *b) * Request exclusive access to a page. */ static int -__hazard_exclusive(SESSION *session, WT_REF *ref) +__hazard_exclusive(WT_SESSION_IMPL *session, WT_REF *ref) { WT_RECONCILE *r; diff --git a/src/btree/bt_ret.c b/src/btree/bt_ret.c index 6e2b70f0d2d..de78c5d5a58 100644 --- a/src/btree/bt_ret.c +++ b/src/btree/bt_ret.c @@ -14,9 +14,10 @@ * Return a WT_PAGE/WT_{ROW,COL}_INDX pair to the application. */ int -__wt_return_data(SESSION *session, WT_ITEM *key, WT_ITEM *value, int key_return) +__wt_return_data( + WT_SESSION_IMPL *session, WT_ITEM *key, WT_ITEM *value, int key_return) { - BTREE *btree; + WT_BTREE *btree; WT_CURSOR *cursor; WT_ITEM local_key, local_value; WT_COL *cip; @@ -26,7 +27,7 @@ __wt_return_data(SESSION *session, WT_ITEM *key, WT_ITEM *value, int key_return) WT_UPDATE *upd; const void *value_ret; uint32_t size_ret; - int (*callback)(BTREE *, WT_ITEM *, WT_ITEM *), ret; + int (*callback)(WT_BTREE *, WT_ITEM *, WT_ITEM *), ret; btree = session->btree; cursor = session->cursor; @@ -56,8 +57,8 @@ __wt_return_data(SESSION *session, WT_ITEM *key, WT_ITEM *value, int key_return) * allocate WT_ROW/COL memory for keys, but if we are looking at a key * only to return it, it's not that likely to be accessed again (think * of a cursor moving through the tree). Use memory in the - * application's WT_ITEM instead, it is discarded when the SESSION is - * discarded. + * application's WT_ITEM instead, it is discarded when the session is + * closed. * * Key return implies a reference to a WT_ROW index (we don't return * record number keys yet, that will probably change when I add cursor diff --git a/src/btree/bt_rw.c b/src/btree/bt_rw.c index c26dfd5a6ac..efcbd09a4e8 100644 --- a/src/btree/bt_rw.c +++ b/src/btree/bt_rw.c @@ -13,9 +13,9 @@ */ int __wt_disk_read( - SESSION *session, WT_PAGE_DISK *dsk, uint32_t addr, uint32_t size) + WT_SESSION_IMPL *session, WT_PAGE_DISK *dsk, uint32_t addr, uint32_t size) { - BTREE *btree; + WT_BTREE *btree; WT_FH *fh; off_t offset; uint32_t checksum; @@ -47,9 +47,9 @@ __wt_disk_read( */ int __wt_disk_write( - SESSION *session, WT_PAGE_DISK *dsk, uint32_t addr, uint32_t size) + WT_SESSION_IMPL *session, WT_PAGE_DISK *dsk, uint32_t addr, uint32_t size) { - BTREE *btree; + WT_BTREE *btree; WT_FH *fh; btree = session->btree; diff --git a/src/btree/bt_salvage.c b/src/btree/bt_salvage.c index 922024a7e81..036c5a89513 100644 --- a/src/btree/bt_salvage.c +++ b/src/btree/bt_salvage.c @@ -17,7 +17,7 @@ struct __wt_track; typedef struct __wt_track WT_TRACK; * to make the code prettier. */ struct __wt_stuff { - BTREE *btree; /* Enclosing Btree */ + WT_BTREE *btree; /* Enclosing Btree */ WT_TRACK **pages; /* Pages */ uint32_t pages_next; /* Next empty slot */ @@ -74,32 +74,38 @@ struct __wt_track { uint32_t flags; }; -static int __slvg_build_internal_col(SESSION *, uint32_t, WT_STUFF *); -static int __slvg_build_internal_row(SESSION *, uint32_t, WT_STUFF *); -static int __slvg_build_leaf_col(SESSION *, +static int __slvg_build_internal_col(WT_SESSION_IMPL *, uint32_t, WT_STUFF *); +static int __slvg_build_internal_row(WT_SESSION_IMPL *, uint32_t, WT_STUFF *); +static int __slvg_build_leaf_col(WT_SESSION_IMPL *, WT_TRACK *, WT_PAGE *, WT_COL_REF *, WT_STUFF *); -static int __slvg_build_leaf_row(SESSION *, +static int __slvg_build_leaf_row(WT_SESSION_IMPL *, WT_TRACK *, WT_PAGE *, WT_ROW_REF *, WT_STUFF *, int *); -static int __slvg_discard_ovfl(SESSION *, WT_STUFF *); -static int __slvg_free(SESSION *, WT_STUFF *); -static int __slvg_free_merge_block(SESSION *, WT_STUFF *); -static int __slvg_free_trk_col(SESSION *, WT_TRACK **, int); -static int __slvg_free_trk_ovfl(SESSION *, WT_TRACK **, int); -static int __slvg_free_trk_row(SESSION *, WT_TRACK **, int); -static int __slvg_key_copy(SESSION *, WT_BUF *, WT_BUF *); -static int __slvg_ovfl_col_dsk_ref(SESSION *, WT_PAGE_DISK *, WT_TRACK *); +static int __slvg_discard_ovfl(WT_SESSION_IMPL *, WT_STUFF *); +static int __slvg_free(WT_SESSION_IMPL *, WT_STUFF *); +static int __slvg_free_merge_block(WT_SESSION_IMPL *, WT_STUFF *); +static int __slvg_free_trk_col(WT_SESSION_IMPL *, WT_TRACK **, int); +static int __slvg_free_trk_ovfl(WT_SESSION_IMPL *, WT_TRACK **, int); +static int __slvg_free_trk_row(WT_SESSION_IMPL *, WT_TRACK **, int); +static int __slvg_key_copy(WT_SESSION_IMPL *, WT_BUF *, WT_BUF *); +static int __slvg_ovfl_col_dsk_ref( + WT_SESSION_IMPL *, WT_PAGE_DISK *, WT_TRACK *); static void __slvg_ovfl_col_inmem_ref(WT_PAGE *, WT_STUFF *); static int __slvg_ovfl_compare(const void *, const void *); -static int __slvg_ovfl_row_dsk_ref(SESSION *, WT_PAGE_DISK *, WT_TRACK *); +static int __slvg_ovfl_row_dsk_ref( + WT_SESSION_IMPL *, WT_PAGE_DISK *, WT_TRACK *); static void __slvg_ovfl_row_inmem_ref(WT_PAGE *, uint32_t, WT_STUFF *); -static int __slvg_range_col(SESSION *, WT_STUFF *); -static int __slvg_range_overlap_col(SESSION *, uint32_t, uint32_t, WT_STUFF *); -static int __slvg_range_overlap_row(SESSION *, uint32_t, uint32_t, WT_STUFF *); -static int __slvg_range_row(SESSION *, WT_STUFF *); -static int __slvg_read(SESSION *, WT_STUFF *); +static int __slvg_range_col(WT_SESSION_IMPL *, WT_STUFF *); +static int __slvg_range_overlap_col( + WT_SESSION_IMPL *, uint32_t, uint32_t, WT_STUFF *); +static int __slvg_range_overlap_row( + WT_SESSION_IMPL *, uint32_t, uint32_t, WT_STUFF *); +static int __slvg_range_row(WT_SESSION_IMPL *, WT_STUFF *); +static int __slvg_read(WT_SESSION_IMPL *, WT_STUFF *); static int __slvg_trk_compare(const void *, const void *); -static int __slvg_trk_leaf(SESSION *, WT_PAGE_DISK *, uint32_t, WT_STUFF *); -static int __slvg_trk_ovfl(SESSION *, WT_PAGE_DISK *, uint32_t, WT_STUFF *); +static int __slvg_trk_leaf( + WT_SESSION_IMPL *, WT_PAGE_DISK *, uint32_t, WT_STUFF *); +static int __slvg_trk_ovfl( + WT_SESSION_IMPL *, WT_PAGE_DISK *, uint32_t, WT_STUFF *); static void __slvg_trk_ovfl_ref(WT_TRACK *, WT_STUFF *); #ifdef HAVE_DIAGNOSTIC @@ -112,9 +118,9 @@ static void __slvg_trk_dump_row(WT_TRACK *); * Salvage a Btree. */ int -__wt_salvage(SESSION *session, const char *config) +__wt_salvage(WT_SESSION_IMPL *session, const char *config) { - BTREE *btree; + WT_BTREE *btree; WT_STUFF *ss, stuff; off_t len; uint32_t allocsize, i, leaf_cnt; @@ -265,9 +271,9 @@ err: /* Wrap up reporting. */ * Read the file and build a table of the pages we can use. */ static int -__slvg_read(SESSION *session, WT_STUFF *ss) +__slvg_read(WT_SESSION_IMPL *session, WT_STUFF *ss) { - BTREE *btree; + WT_BTREE *btree; WT_BUF *t; WT_FH *fh; WT_PAGE_DISK *dsk; @@ -416,9 +422,9 @@ err: __wt_scr_release(&t); */ static int __slvg_trk_leaf( - SESSION *session, WT_PAGE_DISK *dsk, uint32_t addr, WT_STUFF *ss) + WT_SESSION_IMPL *session, WT_PAGE_DISK *dsk, uint32_t addr, WT_STUFF *ss) { - BTREE *btree; + WT_BTREE *btree; WT_CELL *cell, *last_key_cell; WT_TRACK *trk; uint64_t stop_recno; @@ -513,7 +519,7 @@ err: if (trk != NULL) */ static int __slvg_trk_ovfl( - SESSION *session, WT_PAGE_DISK *dsk, uint32_t addr, WT_STUFF *ss) + WT_SESSION_IMPL *session, WT_PAGE_DISK *dsk, uint32_t addr, WT_STUFF *ss) { WT_TRACK *trk; @@ -538,7 +544,8 @@ __slvg_trk_ovfl( * Search a column-store page for overflow items. */ static int -__slvg_ovfl_col_dsk_ref(SESSION *session, WT_PAGE_DISK *dsk, WT_TRACK *trk) +__slvg_ovfl_col_dsk_ref( + WT_SESSION_IMPL *session, WT_PAGE_DISK *dsk, WT_TRACK *trk) { WT_CELL *cell; WT_OFF ovfl; @@ -574,7 +581,8 @@ __slvg_ovfl_col_dsk_ref(SESSION *session, WT_PAGE_DISK *dsk, WT_TRACK *trk) * Search a row-store page for overflow items. */ static int -__slvg_ovfl_row_dsk_ref(SESSION *session, WT_PAGE_DISK *dsk, WT_TRACK *trk) +__slvg_ovfl_row_dsk_ref( + WT_SESSION_IMPL *session, WT_PAGE_DISK *dsk, WT_TRACK *trk) { WT_CELL *cell; WT_OFF ovfl; @@ -697,7 +705,7 @@ __slvg_ovfl_row_dsk_ref(SESSION *session, WT_PAGE_DISK *dsk, WT_TRACK *trk) * re-sorting the array is small. */ static int -__slvg_range_col(SESSION *session, WT_STUFF *ss) +__slvg_range_col(WT_SESSION_IMPL *session, WT_STUFF *ss) { uint32_t i, j; @@ -748,7 +756,7 @@ __slvg_range_col(SESSION *session, WT_STUFF *ss) */ static int __slvg_range_overlap_col( - SESSION *session, uint32_t a_slot, uint32_t b_slot, WT_STUFF *ss) + WT_SESSION_IMPL *session, uint32_t a_slot, uint32_t b_slot, WT_STUFF *ss) { WT_TRACK *a_trk, *b_trk, *new; uint32_t i, j; @@ -913,7 +921,8 @@ delete: WT_RET(__slvg_free_trk_col(session, &ss->pages[b_slot], 1)); * pages we've found. */ static int -__slvg_build_internal_col(SESSION *session, uint32_t leaf_cnt, WT_STUFF *ss) +__slvg_build_internal_col( + WT_SESSION_IMPL *session, uint32_t leaf_cnt, WT_STUFF *ss) { WT_COL_REF *cref; WT_PAGE *page; @@ -998,7 +1007,7 @@ err: if (page->u.col_int.t != NULL) * Build a column-store leaf page for a merged page. */ static int -__slvg_build_leaf_col(SESSION *session, +__slvg_build_leaf_col(WT_SESSION_IMPL *session, WT_TRACK *trk, WT_PAGE *parent, WT_COL_REF *cref, WT_STUFF *ss) { WT_COL *cip, *save_col_leaf; @@ -1152,11 +1161,11 @@ __slvg_ovfl_col_inmem_ref(WT_PAGE *page, WT_STUFF *ss) * same time, tag the overflow pages they reference. */ static int -__slvg_range_row(SESSION *session, WT_STUFF *ss) +__slvg_range_row(WT_SESSION_IMPL *session, WT_STUFF *ss) { - BTREE *btree; + WT_BTREE *btree; uint32_t i, j; - int (*func)(BTREE *, const WT_ITEM *, const WT_ITEM *); + int (*func)(WT_BTREE *, const WT_ITEM *, const WT_ITEM *); btree = session->btree; func = btree->btree_compare; @@ -1209,12 +1218,12 @@ __slvg_range_row(SESSION *session, WT_STUFF *ss) */ static int __slvg_range_overlap_row( - SESSION *session, uint32_t a_slot, uint32_t b_slot, WT_STUFF *ss) + WT_SESSION_IMPL *session, uint32_t a_slot, uint32_t b_slot, WT_STUFF *ss) { - BTREE *btree; + WT_BTREE *btree; WT_TRACK *a_trk, *b_trk, *new; uint32_t i, j; - int (*func)(BTREE *, const WT_ITEM *, const WT_ITEM *); + int (*func)(WT_BTREE *, const WT_ITEM *, const WT_ITEM *); /* * DO NOT MODIFY THIS CODE WITHOUT REVIEWING THE CORRESPONDING ROW- OR @@ -1391,7 +1400,8 @@ delete: WT_RET(__slvg_free_trk_row(session, &ss->pages[b_slot], 1)); * pages we've found. */ static int -__slvg_build_internal_row(SESSION *session, uint32_t leaf_cnt, WT_STUFF *ss) +__slvg_build_internal_row( + WT_SESSION_IMPL *session, uint32_t leaf_cnt, WT_STUFF *ss) { WT_PAGE *page; WT_ROW_REF *rref; @@ -1479,15 +1489,15 @@ err: if (page->u.row_int.t != NULL) * Build a row-store leaf page for a merged page. */ static int -__slvg_build_leaf_row(SESSION *session, WT_TRACK *trk, +__slvg_build_leaf_row(WT_SESSION_IMPL *session, WT_TRACK *trk, WT_PAGE *parent, WT_ROW_REF *rref, WT_STUFF *ss, int *deletedp) { - BTREE *btree; + WT_BTREE *btree; WT_BUF *key; WT_PAGE *page; WT_ROW *rip; uint32_t i, skip_start, skip_stop; - int (*func)(BTREE *, const WT_ITEM *, const WT_ITEM *), ret; + int (*func)(WT_BTREE *, const WT_ITEM *, const WT_ITEM *), ret; void *item; btree = session->btree; @@ -1731,7 +1741,7 @@ __slvg_ovfl_compare(const void *a, const void *b) static int __slvg_trk_compare(const void *a, const void *b) { - BTREE *btree; + WT_BTREE *btree; WT_TRACK *a_trk, *b_trk; uint64_t a_lsn, a_recno, b_lsn, b_recno; int cmp; @@ -1776,7 +1786,7 @@ __slvg_trk_compare(const void *a, const void *b) * Copy a WT_TRACK start/stop key to another WT_TRACK start/stop key. */ static int -__slvg_key_copy(SESSION *session, WT_BUF *dst, WT_BUF *src) +__slvg_key_copy(WT_SESSION_IMPL *session, WT_BUF *dst, WT_BUF *src) { return (__wt_buf_set(session, dst, src->data, src->size)); } @@ -1786,7 +1796,7 @@ __slvg_key_copy(SESSION *session, WT_BUF *dst, WT_BUF *src) * Discard any overflow pages that are never referenced. */ static int -__slvg_discard_ovfl(SESSION *session, WT_STUFF *ss) +__slvg_discard_ovfl(WT_SESSION_IMPL *session, WT_STUFF *ss) { WT_TRACK *trk, **p, **t; uint32_t i; @@ -1815,7 +1825,7 @@ __slvg_discard_ovfl(SESSION *session, WT_STUFF *ss) * Free any file blocks that had to be merged back into the free-list. */ static int -__slvg_free_merge_block(SESSION *session, WT_STUFF *ss) +__slvg_free_merge_block(WT_SESSION_IMPL *session, WT_STUFF *ss) { WT_TRACK *trk; uint32_t i; @@ -1852,7 +1862,7 @@ __slvg_free_merge_block(SESSION *session, WT_STUFF *ss) * Discard memory allocated to the page and overflow arrays. */ static int -__slvg_free(SESSION *session, WT_STUFF *ss) +__slvg_free(WT_SESSION_IMPL *session, WT_STUFF *ss) { uint32_t i; @@ -1887,7 +1897,7 @@ __slvg_free(SESSION *session, WT_STUFF *ss) * Discard a column-store WT_TRACK structure and all its resources. */ static int -__slvg_free_trk_col(SESSION *session, WT_TRACK **trkp, int blocks) +__slvg_free_trk_col(WT_SESSION_IMPL *session, WT_TRACK **trkp, int blocks) { WT_TRACK *trk; @@ -1908,7 +1918,7 @@ __slvg_free_trk_col(SESSION *session, WT_TRACK **trkp, int blocks) * Discard a row-store WT_TRACK structure and all its resources. */ static int -__slvg_free_trk_row(SESSION *session, WT_TRACK **trkp, int blocks) +__slvg_free_trk_row(WT_SESSION_IMPL *session, WT_TRACK **trkp, int blocks) { WT_TRACK *trk; @@ -1932,7 +1942,7 @@ __slvg_free_trk_row(SESSION *session, WT_TRACK **trkp, int blocks) * Discard a overflow WT_TRACK structure and all its resources. */ static int -__slvg_free_trk_ovfl(SESSION *session, WT_TRACK **trkp, int blocks) +__slvg_free_trk_ovfl(WT_SESSION_IMPL *session, WT_TRACK **trkp, int blocks) { WT_TRACK *trk; diff --git a/src/btree/bt_stat.c b/src/btree/bt_stat.c index 3c0247037b4..35b82cc8aa5 100644 --- a/src/btree/bt_stat.c +++ b/src/btree/bt_stat.c @@ -8,17 +8,17 @@ #include "wt_internal.h" #include "cell.i" -static int __wt_stat_page_col_fix(SESSION *, WT_PAGE *); -static int __wt_stat_page_col_rle(SESSION *, WT_PAGE *); -static int __wt_stat_page_col_var(SESSION *, WT_PAGE *); -static int __wt_stat_page_row_leaf(SESSION *, WT_PAGE *, void *); +static int __wt_stat_page_col_fix(WT_SESSION_IMPL *, WT_PAGE *); +static int __wt_stat_page_col_rle(WT_SESSION_IMPL *, WT_PAGE *); +static int __wt_stat_page_col_var(WT_SESSION_IMPL *, WT_PAGE *); +static int __wt_stat_page_row_leaf(WT_SESSION_IMPL *, WT_PAGE *, void *); /* * __wt_page_stat -- * Stat any Btree page. */ int -__wt_page_stat(SESSION *session, WT_PAGE *page, void *arg) +__wt_page_stat(WT_SESSION_IMPL *session, WT_PAGE *page, void *arg) { WT_BTREE_FILE_STATS *stats; @@ -64,7 +64,7 @@ __wt_page_stat(SESSION *session, WT_PAGE *page, void *arg) * Stat a WT_PAGE_COL_FIX page. */ static int -__wt_stat_page_col_fix(SESSION *session, WT_PAGE *page) +__wt_stat_page_col_fix(WT_SESSION_IMPL *session, WT_PAGE *page) { WT_BTREE_FILE_STATS *stats; WT_COL *cip; @@ -93,7 +93,7 @@ __wt_stat_page_col_fix(SESSION *session, WT_PAGE *page) * Stat a WT_PAGE_COL_RLE page. */ static int -__wt_stat_page_col_rle(SESSION *session, WT_PAGE *page) +__wt_stat_page_col_rle(WT_SESSION_IMPL *session, WT_PAGE *page) { WT_BTREE_FILE_STATS *stats; WT_COL *cip; @@ -147,7 +147,7 @@ __wt_stat_page_col_rle(SESSION *session, WT_PAGE *page) * Stat a WT_PAGE_COL_VAR page. */ static int -__wt_stat_page_col_var(SESSION *session, WT_PAGE *page) +__wt_stat_page_col_var(WT_SESSION_IMPL *session, WT_PAGE *page) { WT_BTREE_FILE_STATS *stats; WT_COL *cip; @@ -186,7 +186,7 @@ __wt_stat_page_col_var(SESSION *session, WT_PAGE *page) * Stat a WT_PAGE_ROW_LEAF page. */ static int -__wt_stat_page_row_leaf(SESSION *session, WT_PAGE *page, void *arg) +__wt_stat_page_row_leaf(WT_SESSION_IMPL *session, WT_PAGE *page, void *arg) { WT_BTREE_FILE_STATS *stats; WT_INSERT *ins; diff --git a/src/btree/bt_sync.c b/src/btree/bt_sync.c index 0d59dd14865..e7e04be3cb5 100644 --- a/src/btree/bt_sync.c +++ b/src/btree/bt_sync.c @@ -12,7 +12,7 @@ * Sync the tree. */ int -__wt_bt_sync(SESSION *session) +__wt_bt_sync(WT_SESSION_IMPL *session) { int ret; diff --git a/src/btree/bt_vrfy.c b/src/btree/bt_vrfy.c index 55d50e35076..40026f47ec8 100644 --- a/src/btree/bt_vrfy.c +++ b/src/btree/bt_vrfy.c @@ -26,24 +26,26 @@ typedef struct { uint32_t max_addr; /* Largest key page */ } WT_VSTUFF; -static int __wt_verify_addfrag(SESSION *, uint32_t, uint32_t, WT_VSTUFF *); -static int __wt_verify_checkfrag(SESSION *, WT_VSTUFF *); -static int __wt_verify_freelist(SESSION *, WT_VSTUFF *); -static int __wt_verify_overflow(SESSION *, WT_OFF *, WT_VSTUFF *); -static int __wt_verify_overflow_page(SESSION *, WT_PAGE *, WT_VSTUFF *); +static int __wt_verify_addfrag( + WT_SESSION_IMPL *, uint32_t, uint32_t, WT_VSTUFF *); +static int __wt_verify_checkfrag(WT_SESSION_IMPL *, WT_VSTUFF *); +static int __wt_verify_freelist(WT_SESSION_IMPL *, WT_VSTUFF *); +static int __wt_verify_overflow(WT_SESSION_IMPL *, WT_OFF *, WT_VSTUFF *); +static int __wt_verify_overflow_page(WT_SESSION_IMPL *, WT_PAGE *, WT_VSTUFF *); static int __wt_verify_row_int_key_order( - SESSION *, WT_PAGE *, void *, WT_VSTUFF *); -static int __wt_verify_row_leaf_key_order(SESSION *, WT_PAGE *, WT_VSTUFF *); -static int __wt_verify_tree(SESSION *, WT_REF *, uint64_t, WT_VSTUFF *); + WT_SESSION_IMPL *, WT_PAGE *, void *, WT_VSTUFF *); +static int __wt_verify_row_leaf_key_order( + WT_SESSION_IMPL *, WT_PAGE *, WT_VSTUFF *); +static int __wt_verify_tree(WT_SESSION_IMPL *, WT_REF *, uint64_t, WT_VSTUFF *); /* * __wt_verify -- * Verify a Btree, optionally dumping each page in debugging mode. */ int -__wt_verify(SESSION *session, FILE *stream, const char *config) +__wt_verify(WT_SESSION_IMPL *session, FILE *stream, const char *config) { - BTREE *btree; + WT_BTREE *btree; WT_VSTUFF *vs, _vstuff; int ret; @@ -128,7 +130,7 @@ err: if (vs != NULL) { */ static int __wt_verify_tree( - SESSION *session, /* Thread of control */ + WT_SESSION_IMPL *session, /* Thread of control */ WT_REF *ref, /* Page to verify */ uint64_t parent_recno, /* First record in this subtree */ WT_VSTUFF *vs) /* The verify package */ @@ -331,11 +333,11 @@ recno_chk: if (parent_recno != recno) { */ static int __wt_verify_row_int_key_order( - SESSION *session, WT_PAGE *page, void *rref, WT_VSTUFF *vs) + WT_SESSION_IMPL *session, WT_PAGE *page, void *rref, WT_VSTUFF *vs) { - BTREE *btree; + WT_BTREE *btree; WT_BUF *key, *tmp; - int ret, (*func)(BTREE *, const WT_ITEM *, const WT_ITEM *); + int ret, (*func)(WT_BTREE *, const WT_ITEM *, const WT_ITEM *); btree = session->btree; key = NULL; @@ -375,11 +377,12 @@ __wt_verify_row_int_key_order( * far; update the largest key we've seen so far to the last key on the page. */ static int -__wt_verify_row_leaf_key_order(SESSION *session, WT_PAGE *page, WT_VSTUFF *vs) +__wt_verify_row_leaf_key_order( + WT_SESSION_IMPL *session, WT_PAGE *page, WT_VSTUFF *vs) { - BTREE *btree; + WT_BTREE *btree; WT_BUF *key; - int ret, (*func)(BTREE *, const WT_ITEM *, const WT_ITEM *); + int ret, (*func)(WT_BTREE *, const WT_ITEM *, const WT_ITEM *); btree = session->btree; key = NULL; @@ -429,7 +432,8 @@ __wt_verify_row_leaf_key_order(SESSION *session, WT_PAGE *page, WT_VSTUFF *vs) * Verify overflow items. */ static int -__wt_verify_overflow_page(SESSION *session, WT_PAGE *page, WT_VSTUFF *vs) +__wt_verify_overflow_page( + WT_SESSION_IMPL *session, WT_PAGE *page, WT_VSTUFF *vs) { WT_CELL *cell; WT_OFF ovfl; @@ -460,7 +464,7 @@ __wt_verify_overflow_page(SESSION *session, WT_PAGE *page, WT_VSTUFF *vs) * Read in an overflow page and check it. */ static int -__wt_verify_overflow(SESSION *session, WT_OFF *ovfl, WT_VSTUFF *vs) +__wt_verify_overflow(WT_SESSION_IMPL *session, WT_OFF *ovfl, WT_VSTUFF *vs) { WT_PAGE_DISK *dsk; WT_BUF *tmp; @@ -502,9 +506,9 @@ err: __wt_scr_release(&tmp); * Add the freelist fragments to the list of verified fragments. */ static int -__wt_verify_freelist(SESSION *session, WT_VSTUFF *vs) +__wt_verify_freelist(WT_SESSION_IMPL *session, WT_VSTUFF *vs) { - BTREE *btree; + WT_BTREE *btree; WT_FREE_ENTRY *fe; int ret; @@ -524,9 +528,9 @@ __wt_verify_freelist(SESSION *session, WT_VSTUFF *vs) */ static int __wt_verify_addfrag( - SESSION *session, uint32_t addr, uint32_t size, WT_VSTUFF *vs) + WT_SESSION_IMPL *session, uint32_t addr, uint32_t size, WT_VSTUFF *vs) { - BTREE *btree; + WT_BTREE *btree; uint32_t frags, i; btree = session->btree; @@ -549,7 +553,7 @@ __wt_verify_addfrag( * Verify we've checked all the fragments in the file. */ static int -__wt_verify_checkfrag(SESSION *session, WT_VSTUFF *vs) +__wt_verify_checkfrag(WT_SESSION_IMPL *session, WT_VSTUFF *vs) { int ffc, ffc_start, ffc_end, frags, ret; diff --git a/src/btree/bt_vrfy_dsk.c b/src/btree/bt_vrfy_dsk.c index e907a9aa316..82f034cfffd 100644 --- a/src/btree/bt_vrfy_dsk.c +++ b/src/btree/bt_vrfy_dsk.c @@ -9,21 +9,22 @@ #include "cell.i" static int __wt_err_cell_vs_page( - SESSION *, uint32_t, uint32_t, WT_CELL *, WT_PAGE_DISK *); -static int __wt_err_delfmt(SESSION *, uint32_t, uint32_t); -static int __wt_err_eof(SESSION *, uint32_t, uint32_t); -static int __wt_err_eop(SESSION *, uint32_t, uint32_t); + WT_SESSION_IMPL *, uint32_t, uint32_t, WT_CELL *, WT_PAGE_DISK *); +static int __wt_err_delfmt(WT_SESSION_IMPL *, uint32_t, uint32_t); +static int __wt_err_eof(WT_SESSION_IMPL *, uint32_t, uint32_t); +static int __wt_err_eop(WT_SESSION_IMPL *, uint32_t, uint32_t); static int __wt_verify_cell( - SESSION *, WT_CELL *, uint32_t, uint32_t, uint8_t *); -static int __wt_verify_dsk_row(SESSION *, WT_PAGE_DISK *, uint32_t, uint32_t); + WT_SESSION_IMPL *, WT_CELL *, uint32_t, uint32_t, uint8_t *); +static int __wt_verify_dsk_row( + WT_SESSION_IMPL *, WT_PAGE_DISK *, uint32_t, uint32_t); static int __wt_verify_dsk_col_fix( - SESSION *, WT_PAGE_DISK *, uint32_t, uint32_t); + WT_SESSION_IMPL *, WT_PAGE_DISK *, uint32_t, uint32_t); static int __wt_verify_dsk_col_int( - SESSION *, WT_PAGE_DISK *, uint32_t, uint32_t); + WT_SESSION_IMPL *, WT_PAGE_DISK *, uint32_t, uint32_t); static int __wt_verify_dsk_col_rle( - SESSION *, WT_PAGE_DISK *, uint32_t, uint32_t); + WT_SESSION_IMPL *, WT_PAGE_DISK *, uint32_t, uint32_t); static int __wt_verify_dsk_col_var( - SESSION *, WT_PAGE_DISK *, uint32_t, uint32_t); + WT_SESSION_IMPL *, WT_PAGE_DISK *, uint32_t, uint32_t); /* * __wt_verify_dsk_page -- @@ -31,7 +32,7 @@ static int __wt_verify_dsk_col_var( */ int __wt_verify_dsk_page( - SESSION *session, WT_PAGE_DISK *dsk, uint32_t addr, uint32_t size) + WT_SESSION_IMPL *session, WT_PAGE_DISK *dsk, uint32_t addr, uint32_t size) { /* Check the page type. */ switch (dsk->type) { @@ -127,9 +128,9 @@ __wt_verify_dsk_page( */ static int __wt_verify_dsk_row( - SESSION *session, WT_PAGE_DISK *dsk, uint32_t addr, uint32_t size) + WT_SESSION_IMPL *session, WT_PAGE_DISK *dsk, uint32_t addr, uint32_t size) { - BTREE *btree; + WT_BTREE *btree; WT_BUF *current, *last, *last_pfx, *last_ovfl; WT_CELL *cell; WT_OFF off; @@ -139,7 +140,7 @@ __wt_verify_dsk_row( uint32_t cell_num, cell_type, data_size, i, prefix; uint8_t *end; int ret; - int (*func)(BTREE *, const WT_ITEM *, const WT_ITEM *); + int (*func)(WT_BTREE *, const WT_ITEM *, const WT_ITEM *); btree = session->btree; func = btree->btree_compare; @@ -384,9 +385,9 @@ err: if (ret == 0) */ static int __wt_verify_dsk_col_int( - SESSION *session, WT_PAGE_DISK *dsk, uint32_t addr, uint32_t size) + WT_SESSION_IMPL *session, WT_PAGE_DISK *dsk, uint32_t addr, uint32_t size) { - BTREE *btree; + WT_BTREE *btree; WT_OFF_RECORD *off_record; uint8_t *end; uint32_t i, entry_num; @@ -417,9 +418,9 @@ __wt_verify_dsk_col_int( */ static int __wt_verify_dsk_col_fix( - SESSION *session, WT_PAGE_DISK *dsk, uint32_t addr, uint32_t size) + WT_SESSION_IMPL *session, WT_PAGE_DISK *dsk, uint32_t addr, uint32_t size) { - BTREE *btree; + WT_BTREE *btree; u_int len; uint32_t i, j, entry_num; uint8_t *data, *end, *p; @@ -458,9 +459,9 @@ delfmt: return (__wt_err_delfmt(session, entry_num, addr)); */ static int __wt_verify_dsk_col_rle( - SESSION *session, WT_PAGE_DISK *dsk, uint32_t addr, uint32_t size) + WT_SESSION_IMPL *session, WT_PAGE_DISK *dsk, uint32_t addr, uint32_t size) { - BTREE *btree; + WT_BTREE *btree; u_int len; uint32_t i, j, entry_num; uint8_t *data, *end, *last_data, *p; @@ -528,9 +529,9 @@ delfmt: return (__wt_err_delfmt(session, entry_num, addr)); */ static int __wt_verify_dsk_col_var( - SESSION *session, WT_PAGE_DISK *dsk, uint32_t addr, uint32_t size) + WT_SESSION_IMPL *session, WT_PAGE_DISK *dsk, uint32_t addr, uint32_t size) { - BTREE *btree; + WT_BTREE *btree; WT_CELL *cell; WT_OFF off; off_t file_size; @@ -578,7 +579,7 @@ __wt_verify_dsk_col_var( */ int __wt_verify_dsk_chunk( - SESSION *session, WT_PAGE_DISK *dsk, uint32_t addr, uint32_t size) + WT_SESSION_IMPL *session, WT_PAGE_DISK *dsk, uint32_t addr, uint32_t size) { uint32_t len; uint8_t *p; @@ -614,7 +615,7 @@ __wt_verify_dsk_chunk( * Check to see if a cell is safe. */ static int -__wt_verify_cell(SESSION *session, +__wt_verify_cell(WT_SESSION_IMPL *session, WT_CELL *cell, uint32_t cell_num, uint32_t addr, uint8_t *end) { uint8_t *p; @@ -674,7 +675,7 @@ __wt_verify_cell(SESSION *session, * Generic illegal cell type for a particular page type error. */ static int -__wt_err_cell_vs_page(SESSION *session, +__wt_err_cell_vs_page(WT_SESSION_IMPL *session, uint32_t entry_num, uint32_t addr, WT_CELL *cell, WT_PAGE_DISK *dsk) { __wt_errx(session, @@ -691,7 +692,7 @@ __wt_err_cell_vs_page(SESSION *session, * Generic item extends past the end-of-page error. */ static int -__wt_err_eop(SESSION *session, uint32_t entry_num, uint32_t addr) +__wt_err_eop(WT_SESSION_IMPL *session, uint32_t entry_num, uint32_t addr) { __wt_errx(session, "item %lu on page at addr %lu extends past the end of the page", @@ -704,7 +705,7 @@ __wt_err_eop(SESSION *session, uint32_t entry_num, uint32_t addr) * Generic item references non-existent file pages error. */ static int -__wt_err_eof(SESSION *session, uint32_t entry_num, uint32_t addr) +__wt_err_eof(WT_SESSION_IMPL *session, uint32_t entry_num, uint32_t addr) { __wt_errx(session, "off-page item %lu on page at addr %lu references non-existent " @@ -719,7 +720,7 @@ __wt_err_eof(SESSION *session, uint32_t entry_num, uint32_t addr) * non-nul bytes. */ static int -__wt_err_delfmt(SESSION *session, uint32_t entry_num, uint32_t addr) +__wt_err_delfmt(WT_SESSION_IMPL *session, uint32_t entry_num, uint32_t addr) { __wt_errx(session, "deleted fixed-length entry %lu on page at addr %lu has non-nul " diff --git a/src/btree/bt_walk.c b/src/btree/bt_walk.c index 86560c02830..04a169f9943 100644 --- a/src/btree/bt_walk.c +++ b/src/btree/bt_walk.c @@ -21,7 +21,7 @@ * + to walk the tree a few pages at a time, that is, periodically wake, * visit some pages, then go back to sleep, which requires enough state * to restart the traversal at any point, - * + to walk files not associated with the current SESSION's BTREE handle, + * + to walk files not associated with the current session's WT_BTREE handle, * + and finally, it doesn't require a hazard reference. * * My guess is we'll generalize a more complicated walk at some point, which @@ -35,10 +35,10 @@ * each page. */ int -__wt_tree_walk(SESSION *session, - WT_PAGE *page, int (*work)(SESSION *, WT_PAGE *, void *), void *arg) +__wt_tree_walk(WT_SESSION_IMPL *session, + WT_PAGE *page, int (*work)(WT_SESSION_IMPL *, WT_PAGE *, void *), void *arg) { - BTREE *btree; + WT_BTREE *btree; WT_COL_REF *cref; WT_ROW_REF *rref; uint32_t i; @@ -93,9 +93,10 @@ __wt_tree_walk(SESSION *session, * Start a tree walk. */ int -__wt_walk_begin(SESSION *session, WT_PAGE *page, WT_WALK *walk, uint32_t flags) +__wt_walk_begin( + WT_SESSION_IMPL *session, WT_PAGE *page, WT_WALK *walk, uint32_t flags) { - BTREE *btree; + WT_BTREE *btree; btree = session->btree; @@ -127,7 +128,7 @@ __wt_walk_begin(SESSION *session, WT_PAGE *page, WT_WALK *walk, uint32_t flags) * End a tree walk. */ void -__wt_walk_end(SESSION *session, WT_WALK *walk) +__wt_walk_end(WT_SESSION_IMPL *session, WT_WALK *walk) { WT_WALK_ENTRY *e; @@ -148,7 +149,7 @@ __wt_walk_end(SESSION *session, WT_WALK *walk) * Return the next WT_PAGE in the tree, in a non-recursive way. */ int -__wt_walk_next(SESSION *session, WT_WALK *walk, WT_PAGE **pagep) +__wt_walk_next(WT_SESSION_IMPL *session, WT_WALK *walk, WT_PAGE **pagep) { WT_PAGE *page; WT_REF *ref; diff --git a/src/btree/col_get.c b/src/btree/col_get.c index ef0e8400abc..96f12fdf308 100644 --- a/src/btree/col_get.c +++ b/src/btree/col_get.c @@ -12,9 +12,9 @@ * Db.col_get method. */ int -__wt_btree_col_get(SESSION *session, uint64_t recno, WT_ITEM *value) +__wt_btree_col_get(WT_SESSION_IMPL *session, uint64_t recno, WT_ITEM *value) { - BTREE *btree; + WT_BTREE *btree; int ret; btree = session->btree; diff --git a/src/btree/col_put.c b/src/btree/col_put.c index 73a4557d4a0..12b4fa81dfa 100644 --- a/src/btree/col_put.c +++ b/src/btree/col_put.c @@ -7,16 +7,16 @@ #include "wt_internal.h" -static int __col_wrong_fixed_size(SESSION *, uint32_t, uint32_t); -static int __col_insert_alloc(SESSION *, uint64_t, WT_INSERT **); -static int __col_update(SESSION *, uint64_t, WT_ITEM *, int); +static int __col_wrong_fixed_size(WT_SESSION_IMPL *, uint32_t, uint32_t); +static int __col_insert_alloc(WT_SESSION_IMPL *, uint64_t, WT_INSERT **); +static int __col_update(WT_SESSION_IMPL *, uint64_t, WT_ITEM *, int); /* * __wt_btree_col_del -- * Db.col_del method. */ int -__wt_btree_col_del(SESSION *session, uint64_t recno) +__wt_btree_col_del(WT_SESSION_IMPL *session, uint64_t recno) { int ret; @@ -30,9 +30,9 @@ __wt_btree_col_del(SESSION *session, uint64_t recno) * Db.put method. */ int -__wt_btree_col_put(SESSION *session, uint64_t recno, WT_ITEM *value) +__wt_btree_col_put(WT_SESSION_IMPL *session, uint64_t recno, WT_ITEM *value) { - BTREE *btree; + WT_BTREE *btree; int ret; btree = session->btree; @@ -51,7 +51,8 @@ __wt_btree_col_put(SESSION *session, uint64_t recno, WT_ITEM *value) * Column-store delete and update. */ static int -__col_update(SESSION *session, uint64_t recno, WT_ITEM *value, int is_write) +__col_update( + WT_SESSION_IMPL *session, uint64_t recno, WT_ITEM *value, int is_write) { WT_PAGE *page; WT_INSERT **new_ins, *ins; @@ -160,13 +161,13 @@ err: if (ins != NULL) /* * __col_insert_alloc -- - * Column-store insert: allocate a WT_INSERT structure from the SESSION's + * Column-store insert: allocate a WT_INSERT structure from the session's * buffer and fill it in. */ static int -__col_insert_alloc(SESSION *session, uint64_t recno, WT_INSERT **insp) +__col_insert_alloc(WT_SESSION_IMPL *session, uint64_t recno, WT_INSERT **insp) { - SESSION_BUFFER *sb; + WT_SESSION_BUFFER *sb; WT_INSERT *ins; /* @@ -189,7 +190,8 @@ __col_insert_alloc(SESSION *session, uint64_t recno, WT_INSERT **insp) * into a fixed-size file. */ static int -__col_wrong_fixed_size(SESSION *session, uint32_t len, uint32_t config_len) +__col_wrong_fixed_size( + WT_SESSION_IMPL *session, uint32_t len, uint32_t config_len) { __wt_errx(session, "%s: length of %lu does not match fixed-length file configuration " diff --git a/src/btree/col_srch.c b/src/btree/col_srch.c index cc1590d43d0..e99959f2b08 100644 --- a/src/btree/col_srch.c +++ b/src/btree/col_srch.c @@ -13,9 +13,9 @@ * Search a column-store tree for a specific record-based key. */ int -__wt_col_search(SESSION *session, uint64_t recno, uint32_t flags) +__wt_col_search(WT_SESSION_IMPL *session, uint64_t recno, uint32_t flags) { - BTREE *btree; + WT_BTREE *btree; WT_COL *cip; WT_COL_REF *cref; WT_INSERT *ins; diff --git a/src/btree/row_get.c b/src/btree/row_get.c index 2c012eeb852..65f6ba1ca21 100644 --- a/src/btree/row_get.c +++ b/src/btree/row_get.c @@ -12,9 +12,9 @@ * Db.row_get method. */ int -__wt_btree_row_get(SESSION *session, WT_ITEM *key, WT_ITEM *value) +__wt_btree_row_get(WT_SESSION_IMPL *session, WT_ITEM *key, WT_ITEM *value) { - BTREE *btree; + WT_BTREE *btree; int ret; btree = session->btree; diff --git a/src/btree/row_key.c b/src/btree/row_key.c index cab254bce0a..ed372405de8 100644 --- a/src/btree/row_key.c +++ b/src/btree/row_key.c @@ -15,7 +15,8 @@ * is specified, instantiate the key into the in-memory page. */ int -__wt_row_key(SESSION *session, WT_PAGE *page, void *row_arg, WT_BUF *retb) +__wt_row_key( + WT_SESSION_IMPL *session, WT_PAGE *page, void *row_arg, WT_BUF *retb) { enum { FORWARD, BACKWARD } direction; WT_BUF build, tmp; @@ -266,7 +267,7 @@ err: __wt_buf_free(session, &build); * Server function to instantiate a key during a row-store search. */ int -__wt_row_key_serial_func(SESSION *session) +__wt_row_key_serial_func(WT_SESSION_IMPL *session) { WT_ROW *rip; bitstr_t *ovfl; diff --git a/src/btree/row_put.c b/src/btree/row_put.c index 79309b44d1e..39ac919523d 100644 --- a/src/btree/row_put.c +++ b/src/btree/row_put.c @@ -8,14 +8,14 @@ #include "wt_internal.h" #include "btree.i" -static int __wt_row_update(SESSION *, WT_ITEM *, WT_ITEM *, int); +static int __wt_row_update(WT_SESSION_IMPL *, WT_ITEM *, WT_ITEM *, int); /* * __wt_btree_row_del -- * Db.row_del method. */ int -__wt_btree_row_del(SESSION *session, WT_ITEM *key) +__wt_btree_row_del(WT_SESSION_IMPL *session, WT_ITEM *key) { int ret; @@ -29,7 +29,7 @@ __wt_btree_row_del(SESSION *session, WT_ITEM *key) * Db.row_put method. */ int -__wt_btree_row_put(SESSION *session, WT_ITEM *key, WT_ITEM *value) +__wt_btree_row_put(WT_SESSION_IMPL *session, WT_ITEM *key, WT_ITEM *value) { int ret; @@ -43,7 +43,8 @@ __wt_btree_row_put(SESSION *session, WT_ITEM *key, WT_ITEM *value) * Row-store delete and update. */ static int -__wt_row_update(SESSION *session, WT_ITEM *key, WT_ITEM *value, int is_write) +__wt_row_update( + WT_SESSION_IMPL *session, WT_ITEM *key, WT_ITEM *value, int is_write) { WT_INSERT **new_ins, *ins; WT_PAGE *page; @@ -137,13 +138,13 @@ err: if (ins != NULL) /* * __wt_row_insert_alloc -- - * Row-store insert: allocate a WT_INSERT structure from the SESSION's + * Row-store insert: allocate a WT_INSERT structure from the session's * buffer and fill it in. */ int -__wt_row_insert_alloc(SESSION *session, WT_ITEM *key, WT_INSERT **insp) +__wt_row_insert_alloc(WT_SESSION_IMPL *session, WT_ITEM *key, WT_INSERT **insp) { - SESSION_BUFFER *sb; + WT_SESSION_BUFFER *sb; WT_INSERT *ins; uint32_t size; @@ -168,7 +169,7 @@ __wt_row_insert_alloc(SESSION *session, WT_ITEM *key, WT_INSERT **insp) * Server function to add an WT_INSERT entry to the page tree. */ int -__wt_insert_serial_func(SESSION *session) +__wt_insert_serial_func(WT_SESSION_IMPL *session) { WT_PAGE *page; WT_INSERT **new_ins, **srch_ins, *ins; @@ -212,13 +213,13 @@ err: __wt_session_serialize_wrapup(session, page, 0); /* * __wt_update_alloc -- - * Allocate a WT_UPDATE structure and associated value from the SESSION's + * Allocate a WT_UPDATE structure and associated value from the session's * buffer and fill it in. */ int -__wt_update_alloc(SESSION *session, WT_ITEM *value, WT_UPDATE **updp) +__wt_update_alloc(WT_SESSION_IMPL *session, WT_ITEM *value, WT_UPDATE **updp) { - SESSION_BUFFER *sb; + WT_SESSION_BUFFER *sb; WT_UPDATE *upd; uint32_t size; @@ -245,7 +246,7 @@ __wt_update_alloc(SESSION *session, WT_ITEM *value, WT_UPDATE **updp) * Server function to add an WT_UPDATE entry in the page array. */ int -__wt_update_serial_func(SESSION *session) +__wt_update_serial_func(WT_SESSION_IMPL *session) { WT_PAGE *page; WT_UPDATE **new_upd, **srch_upd, *upd; diff --git a/src/btree/row_srch.c b/src/btree/row_srch.c index 536e65bfd7c..7f681f52993 100644 --- a/src/btree/row_srch.c +++ b/src/btree/row_srch.c @@ -8,22 +8,22 @@ #include "wt_internal.h" #include "btree.i" -static inline int __wt_ins_search(SESSION *, WT_INSERT *, WT_ITEM *); +static inline int __wt_ins_search(WT_SESSION_IMPL *, WT_INSERT *, WT_ITEM *); /* * __wt_row_search -- * Search a row-store tree for a specific key. */ int -__wt_row_search(SESSION *session, WT_ITEM *key, uint32_t flags) +__wt_row_search(WT_SESSION_IMPL *session, WT_ITEM *key, uint32_t flags) { - BTREE *btree; + WT_BTREE *btree; WT_INSERT *ins; WT_PAGE *page; WT_ROW *rip; WT_ROW_REF *rref; uint32_t base, indx, limit, slot, write_gen; - int cmp, ret, (*func)(BTREE *, const WT_ITEM *, const WT_ITEM *); + int cmp, ret, (*func)(WT_BTREE *, const WT_ITEM *, const WT_ITEM *); session->srch_page = NULL; /* Return values. */ session->srch_write_gen = 0; @@ -245,11 +245,11 @@ err: WT_PAGE_OUT(session, page); * Search the slot's insert list. */ static inline int -__wt_ins_search(SESSION *session, WT_INSERT *ins, WT_ITEM *key) +__wt_ins_search(WT_SESSION_IMPL *session, WT_INSERT *ins, WT_ITEM *key) { WT_ITEM insert_key; - BTREE *btree; - int cmp, (*func)(BTREE *, const WT_ITEM *, const WT_ITEM *); + WT_BTREE *btree; + int cmp, (*func)(WT_BTREE *, const WT_ITEM *, const WT_ITEM *); btree = session->btree; func = btree->btree_compare; diff --git a/src/db/db_stat.c b/src/db/db_stat.c index 52e4b000cfd..564dd8af142 100644 --- a/src/db/db_stat.c +++ b/src/db/db_stat.c @@ -12,10 +12,10 @@ * Print DB handle statistics to a stream. */ int -__wt_btree_stat_print(SESSION *session, FILE *stream) +__wt_btree_stat_print(WT_SESSION_IMPL *session, FILE *stream) { - BTREE *btree; - CONNECTION *conn; + WT_BTREE *btree; + WT_CONNECTION_IMPL *conn; btree = session->btree; conn = btree->conn; @@ -70,7 +70,7 @@ __wt_btree_stat_print(SESSION *session, FILE *stream) * Clear DB handle statistics. */ int -__wt_btree_stat_clear(BTREE *btree) +__wt_btree_stat_clear(WT_BTREE *btree) { __wt_stat_clear_btree_stats(btree->stats); __wt_stat_clear_btree_file_stats(btree->fstats); diff --git a/src/env/env_global.c b/src/env/env_global.c index a032c731f88..bc2fa830995 100644 --- a/src/env/env_global.c +++ b/src/env/env_global.c @@ -47,7 +47,7 @@ int __wt_debugger_attach; * A routine to wait for the debugging to attach. */ void -__wt_attach(SESSION *session) +__wt_attach(WT_SESSION_IMPL *session) { #ifdef HAVE_ATTACH __wt_err(session, 0, diff --git a/src/env/env_handle.c b/src/env/env_handle.c index d16fe8aebae..7b35a31c822 100644 --- a/src/env/env_handle.c +++ b/src/env/env_handle.c @@ -9,19 +9,19 @@ /* * __wt_connection_config -- - * Set configuration for a just-created CONNECTION handle. + * Set configuration for a just-created WT_CONNECTION_IMPL handle. */ int -__wt_connection_config(CONNECTION *conn) +__wt_connection_config(WT_CONNECTION_IMPL *conn) { - SESSION *session; + WT_SESSION_IMPL *session; session = &conn->default_session; /* Global mutex */ - WT_RET(__wt_mtx_alloc(session, "CONNECTION", 0, &conn->mtx)); + WT_RET(__wt_mtx_alloc(session, "WT_CONNECTION_IMPL", 0, &conn->mtx)); - TAILQ_INIT(&conn->dbqh); /* BTREE list */ + TAILQ_INIT(&conn->dbqh); /* WT_BTREE list */ TAILQ_INIT(&conn->dlhqh); /* Library list */ TAILQ_INIT(&conn->fhqh); /* File list */ @@ -36,12 +36,12 @@ __wt_connection_config(CONNECTION *conn) /* * __wt_connection_destroy -- - * Destroy the CONNECTION's underlying CONNECTION structure. + * Destroy the connection's underlying WT_CONNECTION_IMPL structure. */ int -__wt_connection_destroy(CONNECTION *conn) +__wt_connection_destroy(WT_CONNECTION_IMPL *conn) { - SESSION *session; + WT_SESSION_IMPL *session; int ret; session = &conn->default_session; diff --git a/src/env/env_msg.c b/src/env/env_msg.c index 2c4656dfb6e..c962fdad51e 100644 --- a/src/env/env_msg.c +++ b/src/env/env_msg.c @@ -12,7 +12,7 @@ * Initialize a WT_MBUF structure for message aggregation. */ void -__wt_mb_init(SESSION *session, WT_MBUF *mbp) +__wt_mb_init(WT_SESSION_IMPL *session, WT_MBUF *mbp) { mbp->session = session; mbp->first = mbp->next = NULL; diff --git a/src/env/env_open.c b/src/env/env_open.c index a741b48577a..b8b471128a2 100644 --- a/src/env/env_open.c +++ b/src/env/env_open.c @@ -12,9 +12,9 @@ * Open a Env handle. */ int -__wt_connection_open(CONNECTION *conn, const char *home, mode_t mode) +__wt_connection_open(WT_CONNECTION_IMPL *conn, const char *home, mode_t mode) { - SESSION *session; + WT_SESSION_IMPL *session; int ret; WT_UNUSED(home); @@ -26,11 +26,11 @@ __wt_connection_open(CONNECTION *conn, const char *home, mode_t mode) session = &conn->default_session; ret = 0; - /* SESSION and hazard arrays. */ + /* WT_SESSION_IMPL and hazard arrays. */ WT_RET(__wt_calloc(session, - conn->session_size, sizeof(SESSION *), &conn->sessions)); + conn->session_size, sizeof(WT_SESSION_IMPL *), &conn->sessions)); WT_RET(__wt_calloc(session, - conn->session_size, sizeof(SESSION), &conn->toc_array)); + conn->session_size, sizeof(WT_SESSION_IMPL), &conn->toc_array)); WT_RET(__wt_calloc(session, conn->session_size * conn->hazard_size, sizeof(WT_HAZARD), &conn->hazard)); @@ -59,10 +59,10 @@ err: (void)__wt_connection_close(conn); * Close a connection handle. */ int -__wt_connection_close(CONNECTION *conn) +__wt_connection_close(WT_CONNECTION_IMPL *conn) { - BTREE *btree; - SESSION *session; + WT_BTREE *btree; + WT_SESSION_IMPL *session; WT_DLH *dlh; WT_FH *fh; int ret, secondary_err; @@ -70,7 +70,7 @@ __wt_connection_close(CONNECTION *conn) session = &conn->default_session; ret = secondary_err = 0; - /* Complain if BTREE handles weren't closed. */ + /* Complain if WT_BTREE handles weren't closed. */ while ((btree = TAILQ_FIRST(&conn->dbqh)) != NULL) { __wt_errx(session, "Connection has open btree handles: %s", btree->name); diff --git a/src/env/env_session.c b/src/env/env_session.c index c9b8a9a300e..a5bed0af6fa 100644 --- a/src/env/env_session.c +++ b/src/env/env_session.c @@ -9,12 +9,12 @@ /* * __wt_connection_session -- - * CONNECTION.session method. + * WT_CONNECTION_IMPL.session method. */ int -__wt_connection_session(CONNECTION *conn, SESSION **sessionp) +__wt_connection_session(WT_CONNECTION_IMPL *conn, WT_SESSION_IMPL **sessionp) { - SESSION *session; + WT_SESSION_IMPL *session; uint32_t slot; *sessionp = NULL; @@ -57,19 +57,19 @@ __wt_connection_session(CONNECTION *conn, SESSION **sessionp) /* * __wt_session_close -- - * SESSION.close method. + * WT_SESSION_IMPL.close method. */ int -__wt_session_close(SESSION *session) +__wt_session_close(WT_SESSION_IMPL *session) { - CONNECTION *conn; - SESSION **tp; + WT_CONNECTION_IMPL *conn; + WT_SESSION_IMPL **tp; int ret; conn = S2C(session); ret = 0; - /* Unpin the current per-SESSION buffer. */ + /* Unpin the current per-WT_SESSION_IMPL buffer. */ if (session->sb != NULL) __wt_sb_decrement(session, session->sb); @@ -102,17 +102,17 @@ __wt_session_close(SESSION *session) } #ifdef HAVE_DIAGNOSTIC -static const char *__wt_session_print_state(SESSION *); +static const char *__wt_session_print_state(WT_SESSION_IMPL *); /* * __wt_session_dump -- * Dump information about open sessions. */ void -__wt_session_dump(SESSION *session) +__wt_session_dump(WT_SESSION_IMPL *session) { - CONNECTION *conn; - SESSION **tp; + WT_CONNECTION_IMPL *conn; + WT_SESSION_IMPL **tp; WT_HAZARD *hp; WT_MBUF mb; @@ -156,10 +156,10 @@ __wt_session_dump(SESSION *session) /* * __wt_session_print_state -- - * Return the SESSION state as a string. + * Return the WT_SESSION_IMPL state as a string. */ static const char * -__wt_session_print_state(SESSION *session) +__wt_session_print_state(WT_SESSION_IMPL *session) { switch (session->wq_state) { case WT_WORKQ_EVICT: diff --git a/src/env/env_stat.c b/src/env/env_stat.c index 8cfd1416dea..a84245797f1 100644 --- a/src/env/env_stat.c +++ b/src/env/env_stat.c @@ -9,15 +9,15 @@ /* * __wt_connection_stat_print -- - * Print CONNECTION handle statistics to a stream. + * Print WT_CONNECTION_IMPL handle statistics to a stream. * * XXX this will become a statistics cursor. */ int -__wt_connection_stat_print(CONNECTION *conn, FILE *stream) +__wt_connection_stat_print(WT_CONNECTION_IMPL *conn, FILE *stream) { - BTREE *btree; - SESSION *session; + WT_BTREE *btree; + WT_SESSION_IMPL *session; session = &conn->default_session; @@ -39,12 +39,12 @@ __wt_connection_stat_print(CONNECTION *conn, FILE *stream) /* * __wt_connection_stat_clear -- - * Clear CONNECTION handle statistics. + * Clear WT_CONNECTION_IMPL handle statistics. */ int -__wt_connection_stat_clear(CONNECTION *conn) +__wt_connection_stat_clear(WT_CONNECTION_IMPL *conn) { - BTREE *btree; + WT_BTREE *btree; int ret; ret = 0; diff --git a/src/env/env_workq.c b/src/env/env_workq.c index b39be702d75..5759319bb76 100644 --- a/src/env/env_workq.c +++ b/src/env/env_workq.c @@ -9,18 +9,18 @@ /* * __wt_workq_srvr -- - * Routine to process the SESSION work queue. + * Routine to process the WT_SESSION_IMPL work queue. */ void * __wt_workq_srvr(void *arg) { - CONNECTION *conn; - SESSION **tp, *session; + WT_CONNECTION_IMPL *conn; + WT_SESSION_IMPL **tp, *session; int call_evict, call_read, request; - conn = (CONNECTION *)arg; + conn = (WT_CONNECTION_IMPL *)arg; - /* Walk the SESSION list and execute requests. */ + /* Walk the WT_SESSION_IMPL list and execute requests. */ while (F_ISSET(conn, WT_WORKQ_RUN)) { ++conn->api_gen; WT_STAT_INCR(conn->stats, workq_passes); diff --git a/src/include/api.h b/src/include/api.h index dec988011f6..f3ee960ae03 100644 --- a/src/include/api.h +++ b/src/include/api.h @@ -8,7 +8,7 @@ typedef struct { WT_CURSOR iface; - BTREE *btree; + WT_BTREE *btree; WT_WALK walk; WT_PAGE *page; WT_COL *cip; @@ -78,9 +78,9 @@ typedef struct { WT_CURSOR iface; } CURSOR_STAT; -struct __btree { - CONNECTION *conn; /* Enclosing connection */ - TAILQ_ENTRY(__btree) q; /* Linked list of files */ +struct __wt_btree { + WT_CONNECTION_IMPL *conn; /* Enclosing connection */ + TAILQ_ENTRY(__wt_btree) q; /* Linked list of files */ uint32_t refcnt; /* Sessions with this tree open. */ @@ -117,7 +117,7 @@ struct __btree { int btree_compare_int; /* Integer keys */ /* Comparison function */ - int (*btree_compare)(BTREE *, const WT_ITEM *, const WT_ITEM *); + int (*btree_compare)(WT_BTREE *, const WT_ITEM *, const WT_ITEM *); uint32_t intlitemsize; /* Maximum item size for overflow */ uint32_t leafitemsize; @@ -136,13 +136,13 @@ struct __btree { uint32_t flags; }; -struct __btree_session { - BTREE *btree; +struct __wt_btree_session { + WT_BTREE *btree; const char *key_format; const char *value_format; - TAILQ_ENTRY(__btree_session) q; + TAILQ_ENTRY(__wt_btree_session) q; }; /******************************************* @@ -165,21 +165,21 @@ struct __wt_hazard { #endif }; -struct __session { +struct __wt_session_impl { WT_SESSION iface; WT_EVENT_HANDLER *event_handler; - TAILQ_ENTRY(__session) q; + TAILQ_ENTRY(__wt_session_impl) q; TAILQ_HEAD(__cursors, wt_cursor) cursors; - TAILQ_HEAD(__btrees, __btree_session) btrees; + TAILQ_HEAD(__btrees, __wt_btree_session) btrees; WT_MTX *mtx; /* Blocking mutex */ const char *name; /* Name */ - BTREE *btree; /* Current file */ + WT_BTREE *btree; /* Current file */ WT_CURSOR *cursor; /* Current cursor */ WT_BUF **scratch; /* Temporary memory for any function */ @@ -188,16 +188,16 @@ struct __session { WT_BUF logrec_buf; /* Buffer for log records */ WT_BUF logprint_buf; /* Buffer for debug log records */ - /* SESSION workQ request */ + /* WT_SESSION_IMPL workQ request */ wq_state_t volatile wq_state; /* Request state */ int wq_ret; /* Return value */ - int (*wq_func)(SESSION *); /* Function */ + int (*wq_func)(WT_SESSION_IMPL *); /* Function */ void *wq_args; /* Function argument */ int wq_sleeping; /* Thread is blocked */ WT_HAZARD *hazard; /* Hazard reference array */ - SESSION_BUFFER *sb; /* Per-thread update buffer */ + WT_SESSION_BUFFER *sb; /* Per-thread update buffer */ uint32_t update_alloc_size; /* Allocation size */ /* Search return values: */ @@ -210,7 +210,7 @@ struct __session { WT_UPDATE **srch_upd; /* WT_UPDATE insert node */ uint32_t srch_slot; /* WT_INSERT/WT_UPDATE slot */ - void (*msgcall)(const CONNECTION *, const char *); + void (*msgcall)(const WT_CONNECTION_IMPL *, const char *); FILE *msgfile; @@ -220,12 +220,12 @@ struct __session { /******************************************* * Implementation of WT_CONNECTION *******************************************/ -struct __connection { +struct __wt_connection_impl { WT_CONNECTION iface; const char *home; - SESSION default_session; /* For operations without an + WT_SESSION_IMPL default_session;/* For operations without an application-supplied session. */ WT_MTX *mtx; /* Global mutex */ @@ -234,7 +234,7 @@ struct __connection { pthread_t cache_evict_tid; /* Cache eviction server thread ID */ pthread_t cache_read_tid; /* Cache read server thread ID */ - TAILQ_HEAD(wt_btree_qh, __btree) dbqh; /* Locked: database list */ + TAILQ_HEAD(wt_btree_qh, __wt_btree) dbqh; /* Locked: database list */ u_int dbqcnt; /* Locked: database list count */ TAILQ_HEAD( @@ -252,16 +252,16 @@ struct __connection { * needs more. Growing the number of threads dynamically is possible, * but tricky since the workQ is walking the array without locking it. * - * There's an array of SESSION pointers that reference the allocated + * There's an array of WT_SESSION_IMPL pointers that reference the allocated * array; we do it that way because we want an easy way for the workQ * code to avoid walking the entire array when only a few threads are * running. */ - SESSION **sessions; /* TOC reference */ + WT_SESSION_IMPL **sessions; /* TOC reference */ uint32_t toc_cnt; /* TOC count */ void *toc_array; /* TOC array */ - TAILQ_HEAD(__sessions, __session) sessions_head; + TAILQ_HEAD(__sessions, __wt_session_impl) sessions_head; /* * WiredTiger allocates space for 15 hazard references in each thread of @@ -271,7 +271,7 @@ struct __connection { * the right change is to increase the default). The method is there * just in case an application starts failing in the field. * - * The hazard array is separate from the SESSION array because we must + * The hazard array is separate from the WT_SESSION_IMPL array because we must * be able to easily copy and search it when evicting pages from the * cache. */ @@ -292,7 +292,7 @@ struct __connection { uint32_t hazard_size; - void (*msgcall)(const CONNECTION *, const char *); + void (*msgcall)(const WT_CONNECTION_IMPL *, const char *); FILE *msgfile; @@ -330,22 +330,16 @@ struct __connection { API_CALL(s, connection, n, NULL, NULL, cfg); \ #define CURSOR_API_CALL(cur, s, n, bt) \ - (s) = (SESSION *)(cur)->session; \ + (s) = (WT_SESSION_IMPL *)(cur)->session; \ API_CALL_NOCONF(s, cursor, n, (cur), bt); \ #define CURSOR_API_CALL_CONF(cur, s, n, bt, cfg) \ - (s) = (SESSION *)(cur)->session; \ + (s) = (WT_SESSION_IMPL *)(cur)->session; \ API_CALL(s, cursor, n, cur, bt, cfg); \ /******************************************* - * Prototypes. + * Global variables. *******************************************/ -int wiredtiger_env_init(CONNECTION **, uint32_t); -void wiredtiger_err_stream(FILE *); -int wiredtiger_simple_setup( - const char *, WT_EVENT_HANDLER *, const char *, BTREE **); -int wiredtiger_simple_teardown(const char *, BTREE *); - extern WT_EVENT_HANDLER *__wt_event_handler_default; extern WT_EVENT_HANDLER *__wt_event_handler_verbose; diff --git a/src/include/btree.h b/src/include/btree.h index baac4820e03..16a6faa6e46 100644 --- a/src/include/btree.h +++ b/src/include/btree.h @@ -621,7 +621,7 @@ struct __wt_col { * list. */ struct __wt_update { - SESSION_BUFFER *sb; /* session buffer holding this update */ + WT_SESSION_BUFFER *sb; /* session buffer holding this update */ WT_UPDATE *next; /* forward-linked list */ @@ -670,7 +670,7 @@ struct __wt_update { * scale and it isn't useful enough to re-implement, IMNSHO.) */ struct __wt_insert { - SESSION_BUFFER *sb; /* session buffer holding this update */ + WT_SESSION_BUFFER *sb; /* session buffer holding this update */ WT_INSERT *next; /* forward-linked list */ diff --git a/src/include/btree.i b/src/include/btree.i index 28defcb9a13..844e76c772e 100644 --- a/src/include/btree.i +++ b/src/include/btree.i @@ -10,7 +10,7 @@ * Read pages into the cache. */ static inline void -__wt_cache_page_in(SESSION *session, WT_PAGE *page, uint32_t size) +__wt_cache_page_in(WT_SESSION_IMPL *session, WT_PAGE *page, uint32_t size) { WT_CACHE *cache; @@ -26,7 +26,7 @@ __wt_cache_page_in(SESSION *session, WT_PAGE *page, uint32_t size) * Discard pages from the cache. */ static inline void -__wt_cache_page_out(SESSION *session, WT_PAGE *page, uint32_t size) +__wt_cache_page_out(WT_SESSION_IMPL *session, WT_PAGE *page, uint32_t size) { WT_CACHE *cache; @@ -43,7 +43,7 @@ __wt_cache_page_out(SESSION *session, WT_PAGE *page, uint32_t size) } static inline uint64_t -__wt_cache_read_gen(SESSION *session) +__wt_cache_read_gen(WT_SESSION_IMPL *session) { return (++S2C(session)->cache->read_gen); } diff --git a/src/include/cache.h b/src/include/cache.h index ea07dad740b..dcdef44b62a 100644 --- a/src/include/cache.h +++ b/src/include/cache.h @@ -14,8 +14,8 @@ extern "C" { * Encapsulation of an eviction candidate. */ struct __wt_evict_list { - WT_PAGE *page; /* Page */ - BTREE *btree; /* Underlying file object */ + WT_PAGE *page; /* Page */ + WT_BTREE *btree; /* Underlying file object */ }; /* @@ -23,9 +23,9 @@ struct __wt_evict_list { * Encapsulation of a eviction request. */ struct __wt_evict_req { - SESSION *session; /* Requesting thread */ - BTREE *btree; /* Btree */ - int close_method; /* Discard pages */ + WT_SESSION_IMPL *session; /* Requesting thread */ + WT_BTREE *btree; /* Btree */ + int close_method; /* Discard pages */ WT_PAGE **retry; /* Pages to retry */ uint32_t retry_next; /* Next retry slot */ @@ -38,7 +38,7 @@ struct __wt_evict_req { * Encapsulation of a read request. */ struct __wt_read_req { - SESSION *session; /* Requesting thread */ + WT_SESSION_IMPL *session; /* Requesting thread */ WT_PAGE *parent; /* Parent */ WT_REF *ref; /* Reference/Address */ int dsk_verify; /* Verify the disk image */ diff --git a/src/include/debug.h b/src/include/debug.h index a9984ee04be..5748d1f283b 100644 --- a/src/include/debug.h +++ b/src/include/debug.h @@ -28,7 +28,7 @@ extern "C" { * dump them to the application's logging file/function. */ typedef struct __wt_mbuf { - SESSION *session; /* Enclosing environment */ + WT_SESSION_IMPL *session; /* Enclosing environment */ char *first; /* Allocated message buffer */ char *next; /* Next available byte of the buffer */ diff --git a/src/include/extern.h b/src/include/extern.h index 886179c05b1..5ebb45a7c70 100644 --- a/src/include/extern.h +++ b/src/include/extern.h @@ -24,13 +24,13 @@ int __wt_config_gets(const char **cfg, const char *key, WT_CONFIG_ITEM *value); int __wt_config_getones(const char *cfg, const char *key, WT_CONFIG_ITEM *value); -int __wt_config_checklist(SESSION *session, +int __wt_config_checklist(WT_SESSION_IMPL *session, const char **defaults, const char *config); -int __wt_config_check(SESSION *session, +int __wt_config_check( WT_SESSION_IMPL *session, const char *defaults, const char *config); -int __wt_config_collapse(SESSION *session, +int __wt_config_collapse(WT_SESSION_IMPL *session, const char **cfg, const char **config_ret); const char *__wt_confdfl_connection_add_collator; @@ -56,40 +56,42 @@ const char *__wt_confdfl_session_sync; const char *__wt_confdfl_session_truncate; const char *__wt_confdfl_session_verify; const char *__wt_confdfl_wiredtiger_open; -int __wt_curbtree_open(SESSION *session, +int __wt_curbtree_open(WT_SESSION_IMPL *session, const char *uri, const char *config, WT_CURSOR **cursorp); int __wt_curbulk_init(CURSOR_BULK *cbulk); -int __wt_curconfig_open(SESSION *session, +int __wt_curconfig_open(WT_SESSION_IMPL *session, const char *uri, const char *config, WT_CURSOR **cursorp); void __wt_curdump_init(WT_CURSOR *cursor, int printable); -int __wt_curstat_open(SESSION *session, +int __wt_curstat_open(WT_SESSION_IMPL *session, const char *uri, const char *config, WT_CURSOR **cursorp); int __wt_cursor_close(WT_CURSOR *cursor, const char *config); void __wt_cursor_init(WT_CURSOR *cursor, const char *config); -int __wt_session_add_btree(SESSION *session, BTREE_SESSION **btree_sessionp); -int __wt_session_get_btree(SESSION *session, +int __wt_session_add_btree( WT_SESSION_IMPL *session, + WT_BTREE_SESSION **btree_sessionp); +int __wt_session_get_btree(WT_SESSION_IMPL *session, const char *name, size_t namelen, - BTREE_SESSION **btree_sessionp); -int __wt_session_remove_btree(SESSION *session, BTREE_SESSION *btree_session); -int __wt_block_alloc(SESSION *session, uint32_t *addrp, uint32_t size); -int __wt_block_free(SESSION *session, uint32_t addr, uint32_t size); -int __wt_block_read(SESSION *session); -int __wt_block_write(SESSION *session); -void __wt_block_discard(SESSION *session); -void __wt_block_dump(SESSION *session); + WT_BTREE_SESSION **btree_sessionp); +int __wt_session_remove_btree( WT_SESSION_IMPL *session, + WT_BTREE_SESSION *btree_session); +int __wt_block_alloc(WT_SESSION_IMPL *session, uint32_t *addrp, uint32_t size); +int __wt_block_free(WT_SESSION_IMPL *session, uint32_t addr, uint32_t size); +int __wt_block_read(WT_SESSION_IMPL *session); +int __wt_block_write(WT_SESSION_IMPL *session); +void __wt_block_discard(WT_SESSION_IMPL *session); +void __wt_block_dump(WT_SESSION_IMPL *session); int __wt_bulk_init(CURSOR_BULK *cbulk); int __wt_bulk_insert(CURSOR_BULK *cbulk); int __wt_bulk_end(CURSOR_BULK *cbulk); -int __wt_cache_create(CONNECTION *conn); -void __wt_cache_stats_update(CONNECTION *conn); -void __wt_cache_destroy(CONNECTION *conn); +int __wt_cache_create(WT_CONNECTION_IMPL *conn); +void __wt_cache_stats_update(WT_CONNECTION_IMPL *conn); +void __wt_cache_destroy(WT_CONNECTION_IMPL *conn); void __wt_cell_set(WT_CELL *cell, u_int type, u_int prefix, @@ -98,11 +100,11 @@ void __wt_cell_set(WT_CELL *cell, void *__wt_cell_data(WT_CELL *cell); uint32_t __wt_cell_datalen(WT_CELL *cell); uint32_t __wt_cell_len(WT_CELL *cell); -int __wt_cell_copy(SESSION *session, WT_CELL *cell, WT_BUF *retb); -int __wt_bt_lex_compare( BTREE *btree, +int __wt_cell_copy(WT_SESSION_IMPL *session, WT_CELL *cell, WT_BUF *retb); +int __wt_bt_lex_compare( WT_BTREE *btree, const WT_ITEM *user_item, const WT_ITEM *tree_item); -int __wt_bt_int_compare( BTREE *btree, +int __wt_bt_int_compare( WT_BTREE *btree, const WT_ITEM *user_item, const WT_ITEM *tree_item); int __wt_btcur_first(CURSOR_BTREE *cbt); @@ -113,183 +115,206 @@ int __wt_btcur_insert(CURSOR_BTREE *cbt); int __wt_btcur_update(CURSOR_BTREE *cbt); int __wt_btcur_remove(CURSOR_BTREE *cbt); int __wt_btcur_close(CURSOR_BTREE *cbt, const char *config); -int __wt_debug_dump(SESSION *session, const char *ofile, FILE *fp); -int __wt_debug_addr( SESSION *session, +int __wt_debug_dump(WT_SESSION_IMPL *session, const char *ofile, FILE *fp); +int __wt_debug_addr(WT_SESSION_IMPL *session, uint32_t addr, uint32_t size, const char *ofile, FILE *fp); -int __wt_debug_disk( SESSION *session, +int __wt_debug_disk( WT_SESSION_IMPL *session, WT_PAGE_DISK *dsk, const char *ofile, FILE *fp); -int __wt_debug_tree_all( SESSION *session, +int __wt_debug_tree_all( WT_SESSION_IMPL *session, WT_PAGE *page, const char *ofile, FILE *fp); -int __wt_debug_tree(SESSION *session, +int __wt_debug_tree( WT_SESSION_IMPL *session, WT_PAGE *page, const char *ofile, FILE *fp); -int __wt_debug_page(SESSION *session, +int __wt_debug_page( WT_SESSION_IMPL *session, WT_PAGE *page, const char *ofile, FILE *fp); void __wt_debug_item(const char *tag, void *arg_item, FILE *fp); -int __wt_desc_read(SESSION *session); -int __wt_desc_write(SESSION *session, const char *config, WT_FH *fh); -int __wt_desc_update(SESSION *session); -void __wt_page_free( SESSION *session, +int __wt_desc_read(WT_SESSION_IMPL *session); +int __wt_desc_write(WT_SESSION_IMPL *session, const char *config, WT_FH *fh); +int __wt_desc_update(WT_SESSION_IMPL *session); +void __wt_page_free( WT_SESSION_IMPL *session, WT_PAGE *page, uint32_t addr, uint32_t size); -int __wt_btree_dump(SESSION *session, FILE *stream, uint32_t flags); +int __wt_btree_dump(WT_SESSION_IMPL *session, FILE *stream, uint32_t flags); void __wt_print_byte_string(const uint8_t *data, uint32_t size, FILE *stream); -void __wt_workq_evict_server(CONNECTION *conn, int force); -int __wt_evict_file_serial_func(SESSION *session); +void __wt_workq_evict_server(WT_CONNECTION_IMPL *conn, int force); +int __wt_evict_file_serial_func(WT_SESSION_IMPL *session); void *__wt_cache_evict_server(void *arg); -void __wt_workq_evict_server_exit(CONNECTION *conn); -int __wt_btree_create(SESSION *session, const char *name, const char *config); -int __wt_btree_open(SESSION *session, const char *name, uint32_t flags); -int __wt_btree_close(SESSION *session); -int __wt_btree_huffman_open(SESSION *session); -void __wt_btree_huffman_close(SESSION *session); +void __wt_workq_evict_server_exit(WT_CONNECTION_IMPL *conn); +int __wt_btree_create( WT_SESSION_IMPL *session, + const char *name, + const char *config); +int __wt_btree_open(WT_SESSION_IMPL *session, const char *name, uint32_t flags); +int __wt_btree_close(WT_SESSION_IMPL *session); +int __wt_btree_huffman_open(WT_SESSION_IMPL *session); +void __wt_btree_huffman_close(WT_SESSION_IMPL *session); const char *__wt_page_type_string(u_int type); const char *__wt_cell_type_string(WT_CELL *cell); -int __wt_ovfl_in(SESSION *session, WT_OFF *ovfl, WT_BUF *store); +int __wt_ovfl_in(WT_SESSION_IMPL *session, WT_OFF *ovfl, WT_BUF *store); int -__wt_page_in_func(SESSION *session, WT_PAGE *parent, WT_REF *ref, int dsk_verify +__wt_page_in_func( + WT_SESSION_IMPL *session, WT_PAGE *parent, WT_REF *ref, int dsk_verify #ifdef HAVE_DIAGNOSTIC , const char *file, int line #endif ); -int __wt_page_inmem(SESSION *session, +int __wt_page_inmem(WT_SESSION_IMPL *session, WT_PAGE *parent, WT_REF *parent_ref, WT_PAGE_DISK *dsk, WT_PAGE **pagep); -void __wt_workq_read_server(CONNECTION *conn, int force); -int __wt_cache_read_serial_func(SESSION *session); +void __wt_workq_read_server(WT_CONNECTION_IMPL *conn, int force); +int __wt_cache_read_serial_func(WT_SESSION_IMPL *session); void *__wt_cache_read_server(void *arg); -void __wt_workq_read_server_exit(CONNECTION *conn); -void __wt_rec_destroy(SESSION *session); -int __wt_page_reconcile( SESSION *session, +void __wt_workq_read_server_exit(WT_CONNECTION_IMPL *conn); +void __wt_rec_destroy(WT_SESSION_IMPL *session); +int __wt_page_reconcile( WT_SESSION_IMPL *session, WT_PAGE *page, uint32_t slvg_skip, uint32_t flags); -int __wt_return_data(SESSION *session, +int __wt_return_data( WT_SESSION_IMPL *session, WT_ITEM *key, WT_ITEM *value, int key_return); -int __wt_disk_read( SESSION *session, +int __wt_disk_read( WT_SESSION_IMPL *session, WT_PAGE_DISK *dsk, uint32_t addr, uint32_t size); -int __wt_disk_write( SESSION *session, +int __wt_disk_write( WT_SESSION_IMPL *session, WT_PAGE_DISK *dsk, uint32_t addr, uint32_t size); -int __wt_salvage(SESSION *session, const char *config); +int __wt_salvage(WT_SESSION_IMPL *session, const char *config); void __wt_trk_dump(const char *l, void *ss_arg); -int __wt_page_stat(SESSION *session, WT_PAGE *page, void *arg); -int __wt_bt_sync(SESSION *session); -int __wt_verify(SESSION *session, FILE *stream, const char *config); -int __wt_verify_dsk_page( SESSION *session, +int __wt_page_stat(WT_SESSION_IMPL *session, WT_PAGE *page, void *arg); +int __wt_bt_sync(WT_SESSION_IMPL *session); +int __wt_verify(WT_SESSION_IMPL *session, FILE *stream, const char *config); +int __wt_verify_dsk_page( WT_SESSION_IMPL *session, WT_PAGE_DISK *dsk, uint32_t addr, uint32_t size); -int __wt_verify_dsk_chunk( SESSION *session, +int __wt_verify_dsk_chunk( WT_SESSION_IMPL *session, WT_PAGE_DISK *dsk, uint32_t addr, uint32_t size); -int __wt_tree_walk(SESSION *session, +int __wt_tree_walk(WT_SESSION_IMPL *session, WT_PAGE *page, - int (*work)(SESSION *, + int (*work)(WT_SESSION_IMPL *, WT_PAGE *, void *), void *arg); -int __wt_walk_begin(SESSION *session, +int __wt_walk_begin( WT_SESSION_IMPL *session, WT_PAGE *page, WT_WALK *walk, uint32_t flags); -void __wt_walk_end(SESSION *session, WT_WALK *walk); -int __wt_walk_next(SESSION *session, WT_WALK *walk, WT_PAGE **pagep); -int __wt_btree_col_get(SESSION *session, uint64_t recno, WT_ITEM *value); -int __wt_btree_col_del(SESSION *session, uint64_t recno); -int __wt_btree_col_put(SESSION *session, uint64_t recno, WT_ITEM *value); -int __wt_col_search(SESSION *session, uint64_t recno, uint32_t flags); -int __wt_btree_row_get(SESSION *session, WT_ITEM *key, WT_ITEM *value); -int __wt_row_key(SESSION *session, WT_PAGE *page, void *row_arg, WT_BUF *retb); -int __wt_row_key_serial_func(SESSION *session); -int __wt_btree_row_del(SESSION *session, WT_ITEM *key); -int __wt_btree_row_put(SESSION *session, WT_ITEM *key, WT_ITEM *value); -int __wt_row_insert_alloc(SESSION *session, WT_ITEM *key, WT_INSERT **insp); -int __wt_insert_serial_func(SESSION *session); -int __wt_update_alloc(SESSION *session, WT_ITEM *value, WT_UPDATE **updp); -int __wt_update_serial_func(SESSION *session); -int __wt_row_search(SESSION *session, WT_ITEM *key, uint32_t flags); -int __wt_btree_stat_print(SESSION *session, FILE *stream); -int __wt_btree_stat_clear(BTREE *btree); +void __wt_walk_end(WT_SESSION_IMPL *session, WT_WALK *walk); +int __wt_walk_next(WT_SESSION_IMPL *session, WT_WALK *walk, WT_PAGE **pagep); +int __wt_btree_col_get(WT_SESSION_IMPL *session, + uint64_t recno, + WT_ITEM *value); +int __wt_btree_col_del(WT_SESSION_IMPL *session, uint64_t recno); +int __wt_btree_col_put(WT_SESSION_IMPL *session, + uint64_t recno, + WT_ITEM *value); +int __wt_col_search(WT_SESSION_IMPL *session, uint64_t recno, uint32_t flags); +int __wt_btree_row_get(WT_SESSION_IMPL *session, WT_ITEM *key, WT_ITEM *value); +int __wt_row_key( WT_SESSION_IMPL *session, + WT_PAGE *page, + void *row_arg, + WT_BUF *retb); +int __wt_row_key_serial_func(WT_SESSION_IMPL *session); +int __wt_btree_row_del(WT_SESSION_IMPL *session, WT_ITEM *key); +int __wt_btree_row_put(WT_SESSION_IMPL *session, WT_ITEM *key, WT_ITEM *value); +int __wt_row_insert_alloc(WT_SESSION_IMPL *session, + WT_ITEM *key, + WT_INSERT **insp); +int __wt_insert_serial_func(WT_SESSION_IMPL *session); +int __wt_update_alloc(WT_SESSION_IMPL *session, + WT_ITEM *value, + WT_UPDATE **updp); +int __wt_update_serial_func(WT_SESSION_IMPL *session); +int __wt_row_search(WT_SESSION_IMPL *session, WT_ITEM *key, uint32_t flags); +int __wt_btree_stat_print(WT_SESSION_IMPL *session, FILE *stream); +int __wt_btree_stat_clear(WT_BTREE *btree); int __wt_library_init(void); int __wt_breakpoint(void); -void __wt_attach(SESSION *session); -int __wt_connection_config(CONNECTION *conn); -int __wt_connection_destroy(CONNECTION *conn); -void __wt_mb_init(SESSION *session, WT_MBUF *mbp); +void __wt_attach(WT_SESSION_IMPL *session); +int __wt_connection_config(WT_CONNECTION_IMPL *conn); +int __wt_connection_destroy(WT_CONNECTION_IMPL *conn); +void __wt_mb_init(WT_SESSION_IMPL *session, WT_MBUF *mbp); void __wt_mb_discard(WT_MBUF *mbp); void __wt_mb_add(WT_MBUF *mbp, const char *fmt, ...); void __wt_mb_write(WT_MBUF *mbp); -int __wt_connection_open(CONNECTION *conn, const char *home, mode_t mode); -int __wt_connection_close(CONNECTION *conn); -int __wt_connection_session(CONNECTION *conn, SESSION **sessionp); -int __wt_session_close(SESSION *session); -void __wt_session_dump(SESSION *session); -int __wt_connection_stat_print(CONNECTION *conn, FILE *stream); -int __wt_connection_stat_clear(CONNECTION *conn); +int __wt_connection_open(WT_CONNECTION_IMPL *conn, + const char *home, + mode_t mode); +int __wt_connection_close(WT_CONNECTION_IMPL *conn); +int __wt_connection_session(WT_CONNECTION_IMPL *conn, + WT_SESSION_IMPL **sessionp); +int __wt_session_close(WT_SESSION_IMPL *session); +void __wt_session_dump(WT_SESSION_IMPL *session); +int __wt_connection_stat_print(WT_CONNECTION_IMPL *conn, FILE *stream); +int __wt_connection_stat_clear(WT_CONNECTION_IMPL *conn); void __wt_stat_print(WT_STATS *s, FILE *stream); void *__wt_workq_srvr(void *arg); -int __wt_log_put(SESSION *session, WT_LOGREC_DESC *recdesc, ...); -int __wt_log_vprintf(SESSION *session, const char *fmt, va_list ap); -int __wt_log_printf(SESSION *session, +int __wt_log_put(WT_SESSION_IMPL *session, WT_LOGREC_DESC *recdesc, ...); +int __wt_log_vprintf(WT_SESSION_IMPL *session, const char *fmt, va_list ap); +int __wt_log_printf(WT_SESSION_IMPL *session, const char *fmt, ...) WT_GCC_ATTRIBUTE ((format (printf, 2, 3))); WT_LOGREC_DESC __wt_logdesc_debug; -void __wt_abort(SESSION *session); -int __wt_calloc(SESSION *session, size_t number, size_t size, void *retp); -int __wt_realloc(SESSION *session, +void __wt_abort(WT_SESSION_IMPL *session); +int __wt_calloc(WT_SESSION_IMPL *session, + size_t number, + size_t size, + void *retp); +int __wt_realloc(WT_SESSION_IMPL *session, uint32_t *bytes_allocated_ret, size_t bytes_to_allocate, void *retp); -int __wt_strdup(SESSION *session, const char *str, void *retp); -void __wt_free_int(SESSION *session, void *p_arg); -int __wt_dlopen(SESSION *session, const char *path, WT_DLH **dlhp); -int __wt_dlsym(SESSION *session, WT_DLH *dlh, const char *name, void **sym_ret); -int __wt_dlclose(SESSION *session, WT_DLH *dlh); +int __wt_strdup(WT_SESSION_IMPL *session, const char *str, void *retp); +void __wt_free_int(WT_SESSION_IMPL *session, void *p_arg); +int __wt_dlopen(WT_SESSION_IMPL *session, const char *path, WT_DLH **dlhp); +int __wt_dlsym(WT_SESSION_IMPL *session, + WT_DLH *dlh, + const char *name, + void **sym_ret); +int __wt_dlclose(WT_SESSION_IMPL *session, WT_DLH *dlh); int __wt_exist(const char *path); -int __wt_filesize(SESSION *session, WT_FH *fh, off_t *sizep); -int __wt_fsync(SESSION *session, WT_FH *fh); -int __wt_ftruncate(SESSION *session, WT_FH *fh, off_t len); -int __wt_mtx_alloc(SESSION *session, +int __wt_filesize(WT_SESSION_IMPL *session, WT_FH *fh, off_t *sizep); +int __wt_fsync(WT_SESSION_IMPL *session, WT_FH *fh); +int __wt_ftruncate(WT_SESSION_IMPL *session, WT_FH *fh, off_t len); +int __wt_mtx_alloc(WT_SESSION_IMPL *session, const char *name, int is_locked, WT_MTX **mtxp); -void __wt_lock(SESSION *session, WT_MTX *mtx); -void __wt_unlock(SESSION *session, WT_MTX *mtx); -int __wt_mtx_destroy(SESSION *session, WT_MTX *mtx); -int __wt_open( SESSION *session, +void __wt_lock(WT_SESSION_IMPL *session, WT_MTX *mtx); +void __wt_unlock(WT_SESSION_IMPL *session, WT_MTX *mtx); +int __wt_mtx_destroy(WT_SESSION_IMPL *session, WT_MTX *mtx); +int __wt_open(WT_SESSION_IMPL *session, const char *name, mode_t mode, int ok_create, WT_FH **fhp); -int __wt_close(SESSION *session, WT_FH *fh); -int __wt_read(SESSION *session, +int __wt_close(WT_SESSION_IMPL *session, WT_FH *fh); +int __wt_read(WT_SESSION_IMPL *session, WT_FH *fh, off_t offset, uint32_t bytes, void *buf); -int __wt_write(SESSION *session, +int __wt_write(WT_SESSION_IMPL *session, WT_FH *fh, off_t offset, uint32_t bytes, @@ -299,61 +324,61 @@ int __wt_thread_create(pthread_t *tidret, void *(*func)(void *), void *arg); void __wt_thread_join(pthread_t tid); void __wt_yield(void); uint32_t __wt_cksum(const void *chunk, size_t len); -void __wt_errv(SESSION *session, +void __wt_errv(WT_SESSION_IMPL *session, int error, const char *prefix1, const char *prefix2, const char *fmt, va_list ap); -void __wt_err(SESSION *session, +void __wt_err(WT_SESSION_IMPL *session, int error, const char *fmt, ...) WT_GCC_ATTRIBUTE ((format (printf, 3, 4))); -void __wt_errx(SESSION *session, +void __wt_errx(WT_SESSION_IMPL *session, const char *fmt, ...) WT_GCC_ATTRIBUTE ((format (printf, 2, 3))); -void __wt_msgv(SESSION *session, +void __wt_msgv(WT_SESSION_IMPL *session, const char *prefix1, const char *prefix2, const char *fmt, va_list ap); -void __wt_msg(SESSION *session, +void __wt_msg(WT_SESSION_IMPL *session, const char *fmt, ...) WT_GCC_ATTRIBUTE ((format (printf, 2, 3))); -void __wt_assert( SESSION *session, +void __wt_assert( WT_SESSION_IMPL *session, const char *check, const char *file_name, int line_number); -int __wt_file_format(SESSION *session); -int __wt_file_item_too_big(SESSION *session); +int __wt_file_format(WT_SESSION_IMPL *session); +int __wt_file_item_too_big(WT_SESSION_IMPL *session); int -__wt_hazard_set(SESSION *session, WT_REF *ref +__wt_hazard_set(WT_SESSION_IMPL *session, WT_REF *ref #ifdef HAVE_DIAGNOSTIC , const char *file, int line #endif ); -void __wt_hazard_clear(SESSION *session, WT_PAGE *page); -void __wt_hazard_empty(SESSION *session, const char *name); -void __wt_hazard_validate(SESSION *session, WT_PAGE *page); -int __wt_huffman_open(SESSION *session, +void __wt_hazard_clear(WT_SESSION_IMPL *session, WT_PAGE *page); +void __wt_hazard_empty(WT_SESSION_IMPL *session, const char *name); +void __wt_hazard_validate(WT_SESSION_IMPL *session, WT_PAGE *page); +int __wt_huffman_open(WT_SESSION_IMPL *session, void *symbol_frequency_array, u_int symcnt, u_int numbytes, void *retp); -void __wt_huffman_close(SESSION *session, void *huffman_arg); +void __wt_huffman_close(WT_SESSION_IMPL *session, void *huffman_arg); int __wt_print_huffman_code(void *huffman_arg, uint16_t symbol); -int __wt_huffman_encode(SESSION *session, +int __wt_huffman_encode(WT_SESSION_IMPL *session, void *huffman_arg, const uint8_t *from_arg, uint32_t from_len, WT_BUF *to_buf); -int __wt_huffman_decode(SESSION *session, +int __wt_huffman_decode(WT_SESSION_IMPL *session, void *huffman_arg, const uint8_t *from_arg, uint32_t from_len, @@ -361,47 +386,53 @@ int __wt_huffman_decode(SESSION *session, uint32_t __wt_nlpo2_round(uint32_t v); uint32_t __wt_nlpo2(uint32_t v); int __wt_ispo2(uint32_t v); -int __wt_buf_init(SESSION *session, WT_BUF *buf, size_t size); -int __wt_buf_initsize(SESSION *session, WT_BUF *buf, size_t size); -int __wt_buf_grow(SESSION *session, WT_BUF *buf, size_t size); -int __wt_buf_set(SESSION *session, +int __wt_buf_init(WT_SESSION_IMPL *session, WT_BUF *buf, size_t size); +int __wt_buf_initsize(WT_SESSION_IMPL *session, WT_BUF *buf, size_t size); +int __wt_buf_grow(WT_SESSION_IMPL *session, WT_BUF *buf, size_t size); +int __wt_buf_set( WT_SESSION_IMPL *session, WT_BUF *buf, const void *data, uint32_t size); -void __wt_buf_steal( SESSION *session, +void __wt_buf_steal( WT_SESSION_IMPL *session, WT_BUF *buf, const void *datap, uint32_t *sizep); -void __wt_buf_free(SESSION *session, WT_BUF *buf); -int __wt_scr_alloc(SESSION *session, uint32_t size, WT_BUF **scratchp); +void __wt_buf_free(WT_SESSION_IMPL *session, WT_BUF *buf); +int __wt_scr_alloc(WT_SESSION_IMPL *session, uint32_t size, WT_BUF **scratchp); void __wt_scr_release(WT_BUF **bufp); -void __wt_scr_free(SESSION *session); -int __wt_session_serialize_func(SESSION *session, +void __wt_scr_free(WT_SESSION_IMPL *session); +int __wt_session_serialize_func(WT_SESSION_IMPL *session, wq_state_t op, int spin, - int (*func)(SESSION *), + int (*func)(WT_SESSION_IMPL *), void *args); -void __wt_session_serialize_wrapup(SESSION *session, WT_PAGE *page, int ret); -int __wt_sb_alloc(SESSION *session, +void __wt_session_serialize_wrapup(WT_SESSION_IMPL *session, + WT_PAGE *page, + int ret); +int __wt_sb_alloc( WT_SESSION_IMPL *session, size_t size, void *retp, - SESSION_BUFFER **sbp); -void __wt_sb_free(SESSION *session, SESSION_BUFFER *sb); -void __wt_sb_decrement(SESSION *session, SESSION_BUFFER *sb); -int __wt_stat_alloc_btree_stats(SESSION *session, WT_BTREE_STATS **statsp); + WT_SESSION_BUFFER **sbp); +void __wt_sb_free(WT_SESSION_IMPL *session, WT_SESSION_BUFFER *sb); +void __wt_sb_decrement(WT_SESSION_IMPL *session, WT_SESSION_BUFFER *sb); +int __wt_stat_alloc_btree_stats(WT_SESSION_IMPL *session, + WT_BTREE_STATS **statsp); void __wt_stat_clear_btree_stats(WT_BTREE_STATS *stats); void __wt_stat_print_btree_stats(WT_BTREE_STATS *stats, FILE *stream); -int __wt_stat_alloc_btree_file_stats(SESSION *session, +int __wt_stat_alloc_btree_file_stats(WT_SESSION_IMPL *session, WT_BTREE_FILE_STATS **statsp); void __wt_stat_clear_btree_file_stats(WT_BTREE_FILE_STATS *stats); void __wt_stat_print_btree_file_stats(WT_BTREE_FILE_STATS *stats, FILE *stream); -int __wt_stat_alloc_cache_stats(SESSION *session, WT_CACHE_STATS **statsp); +int __wt_stat_alloc_cache_stats(WT_SESSION_IMPL *session, + WT_CACHE_STATS **statsp); void __wt_stat_clear_cache_stats(WT_CACHE_STATS *stats); void __wt_stat_print_cache_stats(WT_CACHE_STATS *stats, FILE *stream); -int __wt_stat_alloc_conn_stats(SESSION *session, WT_CONN_STATS **statsp); +int __wt_stat_alloc_conn_stats(WT_SESSION_IMPL *session, + WT_CONN_STATS **statsp); void __wt_stat_clear_conn_stats(WT_CONN_STATS *stats); void __wt_stat_print_conn_stats(WT_CONN_STATS *stats, FILE *stream); -int __wt_stat_alloc_file_stats(SESSION *session, WT_FILE_STATS **statsp); +int __wt_stat_alloc_file_stats(WT_SESSION_IMPL *session, + WT_FILE_STATS **statsp); void __wt_stat_clear_file_stats(WT_FILE_STATS *stats); void __wt_stat_print_file_stats(WT_FILE_STATS *stats, FILE *stream); diff --git a/src/include/intpack.i b/src/include/intpack.i index e0685f72924..fa2ba304c3e 100644 --- a/src/include/intpack.i +++ b/src/include/intpack.i @@ -49,7 +49,8 @@ * Packs a positive variable-length integer in the specified location. */ static inline int -__wt_pack_posint(SESSION *session, uint8_t **pp, size_t maxlen, uint64_t x) +__wt_pack_posint( + WT_SESSION_IMPL *session, uint8_t **pp, size_t maxlen, uint64_t x) { uint8_t *p; int len, shift; @@ -76,7 +77,8 @@ __wt_pack_posint(SESSION *session, uint8_t **pp, size_t maxlen, uint64_t x) * Packs a negative variable-length integer in the specified location. */ static inline int -__wt_pack_negint(SESSION *session, uint8_t **pp, size_t maxlen, uint64_t x) +__wt_pack_negint( + WT_SESSION_IMPL *session, uint8_t **pp, size_t maxlen, uint64_t x) { uint8_t *p; int len, shift; @@ -108,7 +110,7 @@ __wt_pack_negint(SESSION *session, uint8_t **pp, size_t maxlen, uint64_t x) */ static inline int __wt_unpack_posint( - SESSION *session, uint8_t **pp, size_t maxlen, uint64_t *retp) + WT_SESSION_IMPL *session, uint8_t **pp, size_t maxlen, uint64_t *retp) { uint64_t x; uint8_t *p; @@ -134,7 +136,7 @@ __wt_unpack_posint( */ static inline int __wt_unpack_negint( - SESSION *session, uint8_t **pp, size_t maxlen, uint64_t *retp) + WT_SESSION_IMPL *session, uint8_t **pp, size_t maxlen, uint64_t *retp) { uint64_t x; uint8_t *p; @@ -159,7 +161,8 @@ __wt_unpack_negint( * Variable-sized packing for unsigned integers */ static inline int -__wt_vpack_uint(SESSION *session, uint8_t **pp, size_t maxlen, uint64_t x) +__wt_vpack_uint( + WT_SESSION_IMPL *session, uint8_t **pp, size_t maxlen, uint64_t x) { uint8_t *p; @@ -186,7 +189,7 @@ __wt_vpack_uint(SESSION *session, uint8_t **pp, size_t maxlen, uint64_t x) * Variable-sized packing for signed integers */ static inline int -__wt_vpack_int(SESSION *session, uint8_t **pp, size_t maxlen, int64_t x) +__wt_vpack_int(WT_SESSION_IMPL *session, uint8_t **pp, size_t maxlen, int64_t x) { uint8_t *p; @@ -215,7 +218,8 @@ __wt_vpack_int(SESSION *session, uint8_t **pp, size_t maxlen, int64_t x) * Variable-sized unpacking for unsigned integers */ static inline int -__wt_vunpack_uint(SESSION *session, uint8_t **pp, size_t maxlen, uint64_t *xp) +__wt_vunpack_uint( + WT_SESSION_IMPL *session, uint8_t **pp, size_t maxlen, uint64_t *xp) { uint8_t *p; @@ -251,7 +255,8 @@ __wt_vunpack_uint(SESSION *session, uint8_t **pp, size_t maxlen, uint64_t *xp) * Variable-sized packing for signed integers */ static inline int -__wt_vunpack_int(SESSION *session, uint8_t **pp, size_t maxlen, int64_t *xp) +__wt_vunpack_int( + WT_SESSION_IMPL *session, uint8_t **pp, size_t maxlen, int64_t *xp) { uint8_t *p; diff --git a/src/include/log.i b/src/include/log.i index eabdeff10f6..9ac5e04e9de 100644 --- a/src/include/log.i +++ b/src/include/log.i @@ -1,7 +1,7 @@ /* DO NOT EDIT: automatically built by dist/log.py. */ static inline int -__wt_logput_debug(SESSION *session, const char * message) +__wt_logput_debug(WT_SESSION_IMPL *session, const char * message) { return (__wt_log_put(session, &__wt_logdesc_debug, message)); } diff --git a/src/include/misc.h b/src/include/misc.h index 0b36afb55f0..996b1bb0f82 100644 --- a/src/include/misc.h +++ b/src/include/misc.h @@ -28,13 +28,13 @@ extern "C" { /* * XXX - * The server threads use their own SESSION handles because they may want to - * block (for example, the eviction server calls reconciliation, and some of - * the reconciliation diagnostic code reads pages), and the user's session - * handle is already blocking on a server thread. The problem is the server - * thread needs to reference the correct btree handle, and that's hanging off - * the application's thread of control. For now, I'm just making it obvious - * where that's getting done. + * The server threads use their own WT_SESSION_IMPL handles because they may + * want to block (for example, the eviction server calls reconciliation, and + * some of the reconciliation diagnostic code reads pages), and the user's + * session handle is already blocking on a server thread. The problem is the + * server thread needs to reference the correct btree handle, and that's + * hanging off the application's thread of control. For now, I'm just making + * it obvious where that's getting done. */ #define WT_SET_BTREE_IN_SESSION(s, b) \ ((s)->btree = (b)) diff --git a/src/include/progress.i b/src/include/progress.i index 4111357ddcc..d6969a1b073 100644 --- a/src/include/progress.i +++ b/src/include/progress.i @@ -10,7 +10,7 @@ * Send a progress message to stdout. */ static inline void -__wt_progress(SESSION *session, const char *s, uint64_t v) +__wt_progress(WT_SESSION_IMPL *session, const char *s, uint64_t v) { WT_EVENT_HANDLER *handler; diff --git a/src/include/verify_build.h b/src/include/verify_build.h index d105cbc514f..8c0f78066de 100644 --- a/src/include/verify_build.h +++ b/src/include/verify_build.h @@ -65,7 +65,7 @@ __wt_verify_build(void) /* There are also structures that must be aligned correctly. */ ALIGN_CHECK(WT_OFF, sizeof(uint32_t)); ALIGN_CHECK(WT_PAGE_DISK, sizeof(uint32_t)); - ALIGN_CHECK(SESSION_BUFFER, sizeof(uint32_t)); + ALIGN_CHECK(WT_SESSION_BUFFER, sizeof(uint32_t)); /* * We mix-and-match 32-bit unsigned values and size_t's, mostly because diff --git a/src/include/wt_internal.in b/src/include/wt_internal.in index b12597bdeeb..eec87cf9ded 100644 --- a/src/include/wt_internal.in +++ b/src/include/wt_internal.in @@ -45,20 +45,14 @@ extern "C" { * DO NOT EDIT: automatically built by dist/s_typedef. * Forward structure declarations for internal structures: BEGIN */ -struct __btree; - typedef struct __btree BTREE; -struct __btree_session; - typedef struct __btree_session BTREE_SESSION; -struct __connection; - typedef struct __connection CONNECTION; -struct __session; - typedef struct __session SESSION; -struct __session_buffer; - typedef struct __session_buffer SESSION_BUFFER; +struct __wt_btree; + typedef struct __wt_btree WT_BTREE; struct __wt_btree_desc; typedef struct __wt_btree_desc WT_BTREE_DESC; struct __wt_btree_file_stats; typedef struct __wt_btree_file_stats WT_BTREE_FILE_STATS; +struct __wt_btree_session; + typedef struct __wt_btree_session WT_BTREE_SESSION; struct __wt_btree_stats; typedef struct __wt_btree_stats WT_BTREE_STATS; struct __wt_cache; @@ -73,6 +67,8 @@ struct __wt_col_ref; typedef struct __wt_col_ref WT_COL_REF; struct __wt_conn_stats; typedef struct __wt_conn_stats WT_CONN_STATS; +struct __wt_connection_impl; + typedef struct __wt_connection_impl WT_CONNECTION_IMPL; struct __wt_dlh; typedef struct __wt_dlh WT_DLH; struct __wt_evict_list; @@ -107,6 +103,10 @@ struct __wt_row; typedef struct __wt_row WT_ROW; struct __wt_row_ref; typedef struct __wt_row_ref WT_ROW_REF; +struct __wt_session_buffer; + typedef struct __wt_session_buffer WT_SESSION_BUFFER; +struct __wt_session_impl; + typedef struct __wt_session_impl WT_SESSION_IMPL; struct __wt_stats; typedef struct __wt_stats WT_STATS; struct __wt_update; @@ -139,15 +139,15 @@ struct __wt_walk_entry; #include "stat.h" /******************************************* - * SESSION support. + * WT_SESSION_IMPL support. *******************************************/ -#define S2C(session) ((CONNECTION *)(session)->iface.connection) +#define S2C(session) ((WT_CONNECTION_IMPL *)(session)->iface.connection) /* - * SESSION_BUFFER -- + * WT_SESSION_BUFFER -- * A structure to accumulate file changes on a per-thread basis. */ -struct __session_buffer { +struct __wt_session_buffer { uint32_t len; /* Buffer original size */ uint32_t space_avail; /* Buffer's available memory */ uint8_t *first_free; /* Buffer's first free byte */ diff --git a/src/log/log.c b/src/log/log.c index 2b0961994dc..b94e120a3cd 100644 --- a/src/log/log.c +++ b/src/log/log.c @@ -8,7 +8,7 @@ #include "wt_internal.h" static int -__log_record_size(SESSION *session, +__log_record_size(WT_SESSION_IMPL *session, WT_LOGREC_DESC *recdesc, va_list ap, size_t *sizep) { WT_UNUSED(session); @@ -18,7 +18,7 @@ __log_record_size(SESSION *session, } int -__wt_log_put(SESSION *session, WT_LOGREC_DESC *recdesc, ...) +__wt_log_put(WT_SESSION_IMPL *session, WT_LOGREC_DESC *recdesc, ...) { WT_BUF *buf; va_list ap; @@ -41,9 +41,9 @@ err: va_end(ap); } int -__wt_log_vprintf(SESSION *session, const char *fmt, va_list ap) +__wt_log_vprintf(WT_SESSION_IMPL *session, const char *fmt, va_list ap) { - CONNECTION *conn; + WT_CONNECTION_IMPL *conn; WT_BUF *buf; va_list ap_copy; size_t len; @@ -77,7 +77,7 @@ __wt_log_vprintf(SESSION *session, const char *fmt, va_list ap) } int -__wt_log_printf(SESSION *session, const char *fmt, ...) +__wt_log_printf(WT_SESSION_IMPL *session, const char *fmt, ...) WT_GCC_ATTRIBUTE ((format (printf, 2, 3))) { va_list ap; diff --git a/src/os_posix/os_abort.c b/src/os_posix/os_abort.c index 3fcf7ebc287..318316e185f 100644 --- a/src/os_posix/os_abort.c +++ b/src/os_posix/os_abort.c @@ -12,7 +12,7 @@ * Abort the process, dropping core. */ void -__wt_abort(SESSION *session) +__wt_abort(WT_SESSION_IMPL *session) { __wt_msg(session, "aborting WiredTiger library"); diff --git a/src/os_posix/os_alloc.c b/src/os_posix/os_alloc.c index 272a2b701b1..e2f2cc4cc5c 100644 --- a/src/os_posix/os_alloc.c +++ b/src/os_posix/os_alloc.c @@ -21,13 +21,13 @@ * ANSI calloc function. */ int -__wt_calloc(SESSION *session, size_t number, size_t size, void *retp) +__wt_calloc(WT_SESSION_IMPL *session, size_t number, size_t size, void *retp) { void *p; /* * !!! - * This function MUST handle a NULL SESSION handle. + * This function MUST handle a NULL WT_SESSION_IMPL handle. */ WT_ASSERT(session, number != 0 && size != 0); @@ -48,7 +48,7 @@ __wt_calloc(SESSION *session, size_t number, size_t size, void *retp) * ANSI realloc function. */ int -__wt_realloc(SESSION *session, +__wt_realloc(WT_SESSION_IMPL *session, uint32_t *bytes_allocated_ret, size_t bytes_to_allocate, void *retp) { void *p; @@ -56,7 +56,7 @@ __wt_realloc(SESSION *session, /* * !!! - * This function MUST handle a NULL SESSION handle. + * This function MUST handle a NULL WT_SESSION_IMPL handle. */ WT_ASSERT(session, bytes_to_allocate != 0); @@ -105,7 +105,7 @@ __wt_realloc(SESSION *session, * ANSI strdup function. */ int -__wt_strdup(SESSION *session, const char *str, void *retp) +__wt_strdup(WT_SESSION_IMPL *session, const char *str, void *retp) { size_t len; void *p; @@ -117,7 +117,7 @@ __wt_strdup(SESSION *session, const char *str, void *retp) /* * !!! - * This function MUST handle a NULL SESSION handle. + * This function MUST handle a NULL WT_SESSION_IMPL handle. */ if (session != NULL && S2C(session)->stats != NULL) WT_STAT_INCR(S2C(session)->stats, memalloc); @@ -135,13 +135,13 @@ __wt_strdup(SESSION *session, const char *str, void *retp) * ANSI free function. */ void -__wt_free_int(SESSION *session, void *p_arg) +__wt_free_int(WT_SESSION_IMPL *session, void *p_arg) { void *p; /* * !!! - * This function MUST handle a NULL SESSION handle. + * This function MUST handle a NULL WT_SESSION_IMPL handle. */ if (session != NULL && S2C(session)->stats != NULL) WT_STAT_INCR(S2C(session)->stats, memfree); diff --git a/src/os_posix/os_dlopen.c b/src/os_posix/os_dlopen.c index 17e63754b8c..5b88eb2ba27 100644 --- a/src/os_posix/os_dlopen.c +++ b/src/os_posix/os_dlopen.c @@ -12,9 +12,9 @@ * Open a dynamic library. */ int -__wt_dlopen(SESSION *session, const char *path, WT_DLH **dlhp) +__wt_dlopen(WT_SESSION_IMPL *session, const char *path, WT_DLH **dlhp) { - CONNECTION *conn; + WT_CONNECTION_IMPL *conn; WT_DLH *dlh; int ret; @@ -50,7 +50,8 @@ err: __wt_free(session, dlh->name); * Lookup a symbol in a dynamic library. */ int -__wt_dlsym(SESSION *session, WT_DLH *dlh, const char *name, void **sym_ret) +__wt_dlsym(WT_SESSION_IMPL *session, + WT_DLH *dlh, const char *name, void **sym_ret) { void *sym; @@ -69,9 +70,9 @@ __wt_dlsym(SESSION *session, WT_DLH *dlh, const char *name, void **sym_ret) * Close a dynamic library */ int -__wt_dlclose(SESSION *session, WT_DLH *dlh) +__wt_dlclose(WT_SESSION_IMPL *session, WT_DLH *dlh) { - CONNECTION *conn; + WT_CONNECTION_IMPL *conn; int ret; conn = S2C(session); diff --git a/src/os_posix/os_filesize.c b/src/os_posix/os_filesize.c index ed7143ad398..9a247be5fb4 100644 --- a/src/os_posix/os_filesize.c +++ b/src/os_posix/os_filesize.c @@ -12,7 +12,7 @@ * Get the size of a file in bytes. */ int -__wt_filesize(SESSION *session, WT_FH *fh, off_t *sizep) +__wt_filesize(WT_SESSION_IMPL *session, WT_FH *fh, off_t *sizep) { struct stat sb; diff --git a/src/os_posix/os_fsync.c b/src/os_posix/os_fsync.c index 33e69563099..49df369cd0e 100644 --- a/src/os_posix/os_fsync.c +++ b/src/os_posix/os_fsync.c @@ -12,7 +12,7 @@ * Flush a file handle. */ int -__wt_fsync(SESSION *session, WT_FH *fh) +__wt_fsync(WT_SESSION_IMPL *session, WT_FH *fh) { WT_STAT_INCR(fh->stats, fsync); diff --git a/src/os_posix/os_ftruncate.c b/src/os_posix/os_ftruncate.c index e1e9fdf7691..a69956ec710 100644 --- a/src/os_posix/os_ftruncate.c +++ b/src/os_posix/os_ftruncate.c @@ -12,7 +12,7 @@ * Truncate a file. */ int -__wt_ftruncate(SESSION *session, WT_FH *fh, off_t len) +__wt_ftruncate(WT_SESSION_IMPL *session, WT_FH *fh, off_t len) { if (ftruncate(fh->fd, len) == 0) { fh->file_size = len; diff --git a/src/os_posix/os_mtx.c b/src/os_posix/os_mtx.c index 178ae77f725..0a0f4fcba23 100644 --- a/src/os_posix/os_mtx.c +++ b/src/os_posix/os_mtx.c @@ -12,7 +12,8 @@ * Allocate and initialize a pthread mutex. */ int -__wt_mtx_alloc(SESSION *session, const char *name, int is_locked, WT_MTX **mtxp) +__wt_mtx_alloc(WT_SESSION_IMPL *session, + const char *name, int is_locked, WT_MTX **mtxp) { WT_MTX *mtx; pthread_condattr_t condattr; @@ -22,7 +23,7 @@ __wt_mtx_alloc(SESSION *session, const char *name, int is_locked, WT_MTX **mtxp) /* * !!! - * This function MUST handle a NULL SESSION structure reference. + * This function MUST handle a NULL WT_SESSION_IMPL structure reference. * * Initialize the mutex. * Mutexes are shared between processes. @@ -68,7 +69,7 @@ err: __wt_free(session, mtx); * Lock a mutex. */ void -__wt_lock(SESSION *session, WT_MTX *mtx) +__wt_lock(WT_SESSION_IMPL *session, WT_MTX *mtx) { int ret; @@ -109,7 +110,7 @@ err: __wt_err(session, ret, "mutex lock failed"); * Release a mutex. */ void -__wt_unlock(SESSION *session, WT_MTX *mtx) +__wt_unlock(WT_SESSION_IMPL *session, WT_MTX *mtx) { int ret; @@ -133,7 +134,7 @@ err: __wt_err(session, ret, "mutex unlock failed"); * Destroy a mutex. */ int -__wt_mtx_destroy(SESSION *session, WT_MTX *mtx) +__wt_mtx_destroy(WT_SESSION_IMPL *session, WT_MTX *mtx) { int ret; diff --git a/src/os_posix/os_open.c b/src/os_posix/os_open.c index df014dd6a9b..d6bc39b6eb7 100644 --- a/src/os_posix/os_open.c +++ b/src/os_posix/os_open.c @@ -12,11 +12,11 @@ * Open a file handle. */ int -__wt_open( - SESSION *session, const char *name, mode_t mode, int ok_create, WT_FH **fhp) +__wt_open(WT_SESSION_IMPL *session, + const char *name, mode_t mode, int ok_create, WT_FH **fhp) { - BTREE *btree; - CONNECTION *conn; + WT_BTREE *btree; + WT_CONNECTION_IMPL *conn; WT_FH *fh; int f, fd, matched, ret; @@ -102,9 +102,9 @@ err: if (fh != NULL) { * Close a file handle. */ int -__wt_close(SESSION *session, WT_FH *fh) +__wt_close(WT_SESSION_IMPL *session, WT_FH *fh) { - CONNECTION *conn; + WT_CONNECTION_IMPL *conn; int ret; conn = S2C(session); diff --git a/src/os_posix/os_rw.c b/src/os_posix/os_rw.c index 6a15330a30b..bdfb830891e 100644 --- a/src/os_posix/os_rw.c +++ b/src/os_posix/os_rw.c @@ -12,7 +12,8 @@ * Read a chunk. */ int -__wt_read(SESSION *session, WT_FH *fh, off_t offset, uint32_t bytes, void *buf) +__wt_read(WT_SESSION_IMPL *session, + WT_FH *fh, off_t offset, uint32_t bytes, void *buf) { WT_STAT_INCR(fh->stats, read_io); WT_STAT_INCR(S2C(session)->stats, total_read_io); @@ -35,7 +36,8 @@ __wt_read(SESSION *session, WT_FH *fh, off_t offset, uint32_t bytes, void *buf) * Write a chunk. */ int -__wt_write(SESSION *session, WT_FH *fh, off_t offset, uint32_t bytes, void *buf) +__wt_write(WT_SESSION_IMPL *session, + WT_FH *fh, off_t offset, uint32_t bytes, void *buf) { WT_STAT_INCR(fh->stats, write_io); WT_STAT_INCR(S2C(session)->stats, total_write_io); diff --git a/src/support/cksum.c b/src/support/cksum.c index bdd1034264f..1fc08968d5d 100644 --- a/src/support/cksum.c +++ b/src/support/cksum.c @@ -21,7 +21,7 @@ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * ARISING FROM, OUT OF OR IN WT_CONNECTION_IMPL WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ diff --git a/src/support/err.c b/src/support/err.c index 0427122403b..9e4b8677cb7 100644 --- a/src/support/err.c +++ b/src/support/err.c @@ -12,7 +12,7 @@ * Report an error (va_list version). */ void -__wt_errv(SESSION *session, int error, +__wt_errv(WT_SESSION_IMPL *session, int error, const char *prefix1, const char *prefix2, const char *fmt, va_list ap) { WT_EVENT_HANDLER *handler; @@ -50,7 +50,7 @@ __wt_errv(SESSION *session, int error, * Report an error. */ void -__wt_err(SESSION *session, int error, const char *fmt, ...) +__wt_err(WT_SESSION_IMPL *session, int error, const char *fmt, ...) WT_GCC_ATTRIBUTE ((format (printf, 3, 4))) { va_list ap; @@ -68,7 +68,7 @@ __wt_err(SESSION *session, int error, const char *fmt, ...) * Report an error with no error code. */ void -__wt_errx(SESSION *session, const char *fmt, ...) +__wt_errx(WT_SESSION_IMPL *session, const char *fmt, ...) WT_GCC_ATTRIBUTE ((format (printf, 2, 3))) { va_list ap; @@ -86,7 +86,7 @@ __wt_errx(SESSION *session, const char *fmt, ...) * Pass a message to a callback function. */ void -__wt_msgv(SESSION *session, const char *prefix1, const char *prefix2, +__wt_msgv(WT_SESSION_IMPL *session, const char *prefix1, const char *prefix2, const char *fmt, va_list ap) { WT_EVENT_HANDLER *handler; @@ -120,7 +120,7 @@ __wt_msgv(SESSION *session, const char *prefix1, const char *prefix2, * Report a message. */ void -__wt_msg(SESSION *session, const char *fmt, ...) +__wt_msg(WT_SESSION_IMPL *session, const char *fmt, ...) WT_GCC_ATTRIBUTE ((format (printf, 2, 3))) { va_list ap; @@ -139,7 +139,8 @@ __wt_msg(SESSION *session, const char *fmt, ...) */ void __wt_assert( - SESSION *session, const char *check, const char *file_name, int line_number) + WT_SESSION_IMPL *session, const char *check, + const char *file_name, int line_number) { __wt_errx(session, "assertion failure: %s/%d: \"%s\"", file_name, line_number, check); @@ -155,7 +156,7 @@ __wt_assert( * discovered. */ int -__wt_file_format(SESSION *session) +__wt_file_format(WT_SESSION_IMPL *session) { __wt_errx(session, "the file is corrupted; use the Db.salvage" " method or the db_salvage utility to repair the file"); @@ -168,7 +169,7 @@ __wt_file_format(SESSION *session) * Print a standard error message when an element is too large to store. */ int -__wt_file_item_too_big(SESSION *session) +__wt_file_item_too_big(WT_SESSION_IMPL *session) { __wt_errx(session, "the item is too large for the file to store"); return (WT_ERROR); diff --git a/src/support/hazard.c b/src/support/hazard.c index 47d9d342730..6648c27cd3e 100644 --- a/src/support/hazard.c +++ b/src/support/hazard.c @@ -12,13 +12,13 @@ * Set a hazard reference. */ int -__wt_hazard_set(SESSION *session, WT_REF *ref +__wt_hazard_set(WT_SESSION_IMPL *session, WT_REF *ref #ifdef HAVE_DIAGNOSTIC , const char *file, int line #endif ) { - CONNECTION *conn; + WT_CONNECTION_IMPL *conn; WT_HAZARD *hp; conn = S2C(session); @@ -30,7 +30,7 @@ __wt_hazard_set(SESSION *session, WT_REF *ref * of WT_REF_MEM, which can be set to WT_REF_LOCKED at any time by the * page eviction server. * - * Add the WT_REF reference to the SESSION's hazard list and flush the + * Add the WT_REF reference to the session's hazard list and flush the * write, then see if the state field is still WT_REF_MEM. If it's * still WT_REF_MEM, we can use the page because the page eviction * server will see our hazard reference before it discards the buffer @@ -79,7 +79,8 @@ __wt_hazard_set(SESSION *session, WT_REF *ref return (0); } - __wt_errx(session, "SESSION has no more hazard reference slots"); + __wt_errx(session, + "There are no more hazard reference slots in the session"); WT_ASSERT(session, hp < session->hazard + conn->hazard_size); return (0); } @@ -89,9 +90,9 @@ __wt_hazard_set(SESSION *session, WT_REF *ref * Clear a hazard reference. */ void -__wt_hazard_clear(SESSION *session, WT_PAGE *page) +__wt_hazard_clear(WT_SESSION_IMPL *session, WT_PAGE *page) { - CONNECTION *conn; + WT_CONNECTION_IMPL *conn; WT_HAZARD *hp; conn = S2C(session); @@ -119,7 +120,7 @@ __wt_hazard_clear(SESSION *session, WT_PAGE *page) */ return; } - __wt_errx(session, "SESSION hazard reference not found"); + __wt_errx(session, "WT_SESSION_IMPL hazard reference not found"); WT_ASSERT(session, hp < session->hazard + conn->hazard_size); } @@ -128,22 +129,22 @@ __wt_hazard_clear(SESSION *session, WT_PAGE *page) * Verify that no hazard references are set. */ void -__wt_hazard_empty(SESSION *session, const char *name) +__wt_hazard_empty(WT_SESSION_IMPL *session, const char *name) { - CONNECTION *conn; + WT_CONNECTION_IMPL *conn; WT_HAZARD *hp; conn = S2C(session); /* - * Check for a set hazard reference and complain if we find one. Clear - * any we find because it's not a correctness problem (any hazard ref - * we find can't be real because the SESSION is being closed when we're - * called). We do this work because it's not expensive, and we don't - * want to let a hazard reference lie around, keeping a page from being - * flushed. The flush isn't necessary for correctness, but gives the - * cache eviction thread immediate access to any page our reference - * blocks. + * Check for a set hazard reference and complain if we find one. Clear + * any we find because it's not a correctness problem (any hazard ref + * we find can't be real because the session is being closed when we're + * called). We do this work because it's not expensive, and we don't + * want to let a hazard reference lie around, keeping a page from being + * flushed. The flush isn't necessary for correctness, but gives the + * cache eviction thread immediate access to any page our reference + * blocks. */ for (hp = session->hazard; hp < session->hazard + conn->hazard_size; ++hp) @@ -167,11 +168,11 @@ __wt_hazard_empty(SESSION *session, const char *name) * Confirm that a page isn't on the hazard list. */ void -__wt_hazard_validate(SESSION *session, WT_PAGE *page) +__wt_hazard_validate(WT_SESSION_IMPL *session, WT_PAGE *page) { - CONNECTION *conn; + WT_CONNECTION_IMPL *conn; WT_HAZARD *hp; - SESSION **tp; + WT_SESSION_IMPL **tp; conn = S2C(session); diff --git a/src/support/huffman.c b/src/support/huffman.c index 9678ca11e97..4227b012c50 100644 --- a/src/support/huffman.c +++ b/src/support/huffman.c @@ -105,13 +105,15 @@ typedef struct __indexed_byte { static int indexed_freq_compare(const void *, const void *); static int indexed_symbol_compare(const void *, const void *); static void make_table( - SESSION *, uint16_t *, uint16_t, WT_HUFFMAN_CODE *, u_int); -static void node_queue_close(SESSION *, NODE_QUEUE *); -static void node_queue_dequeue(SESSION *, NODE_QUEUE *, WT_FREQTREE_NODE **); -static int node_queue_enqueue(SESSION *, NODE_QUEUE *, WT_FREQTREE_NODE *); + WT_SESSION_IMPL *, uint16_t *, uint16_t, WT_HUFFMAN_CODE *, u_int); +static void node_queue_close(WT_SESSION_IMPL *, NODE_QUEUE *); +static void node_queue_dequeue( + WT_SESSION_IMPL *, NODE_QUEUE *, WT_FREQTREE_NODE **); +static int node_queue_enqueue( + WT_SESSION_IMPL *, NODE_QUEUE *, WT_FREQTREE_NODE *); static uint32_t profile_tree( WT_FREQTREE_NODE *, uint16_t, uint16_t *, uint16_t *); -static void recursive_free_node(SESSION *, WT_FREQTREE_NODE *); +static void recursive_free_node(WT_SESSION_IMPL *, WT_FREQTREE_NODE *); static void set_codes(WT_FREQTREE_NODE *, WT_HUFFMAN_CODE *, uint16_t, uint8_t); #define node_queue_is_empty(queue) \ @@ -239,7 +241,7 @@ set_codes(WT_FREQTREE_NODE *node, * decoding from a code to a symbol are simple array lookups. */ static void -make_table(SESSION *session, uint16_t *code2symbol, +make_table(WT_SESSION_IMPL *session, uint16_t *code2symbol, uint16_t max_depth, WT_HUFFMAN_CODE *codes, u_int symcnt) { uint32_t j, c1, c2; /* Exceeds uint16_t bounds at loop boundary. */ @@ -281,7 +283,7 @@ make_table(SESSION *session, uint16_t *code2symbol, * Recursively free the huffman frequency tree's nodes. */ static void -recursive_free_node(SESSION *session, WT_FREQTREE_NODE *node) +recursive_free_node(WT_SESSION_IMPL *session, WT_FREQTREE_NODE *node) { if (node != NULL) { recursive_free_node(session, node->left); @@ -295,7 +297,7 @@ recursive_free_node(SESSION *session, WT_FREQTREE_NODE *node) * Take a frequency table and return a pointer to a descriptor object. */ int -__wt_huffman_open(SESSION *session, +__wt_huffman_open(WT_SESSION_IMPL *session, void *symbol_frequency_array, u_int symcnt, u_int numbytes, void *retp) { INDEXED_SYMBOL *indexed_freqs; @@ -532,7 +534,7 @@ err: if (ret == 0) * Discard a Huffman descriptor object. */ void -__wt_huffman_close(SESSION *session, void *huffman_arg) +__wt_huffman_close(WT_SESSION_IMPL *session, void *huffman_arg) { WT_HUFFMAN_OBJ *huffman; @@ -591,7 +593,7 @@ __wt_print_huffman_code(void *huffman_arg, uint16_t symbol) * and write header bits. */ int -__wt_huffman_encode(SESSION *session, void *huffman_arg, +__wt_huffman_encode(WT_SESSION_IMPL *session, void *huffman_arg, const uint8_t *from_arg, uint32_t from_len, WT_BUF *to_buf) { WT_BUF *tmp; @@ -766,7 +768,7 @@ err: if (tmp != NULL) * Finally, subtract off these bits from the shift register. */ int -__wt_huffman_decode(SESSION *session, void *huffman_arg, +__wt_huffman_decode(WT_SESSION_IMPL *session, void *huffman_arg, const uint8_t *from_arg, uint32_t from_len, WT_BUF *to_buf) { WT_BUF *tmp; @@ -886,7 +888,7 @@ err: if (tmp != NULL) * It does not delete the pointed huffman tree nodes! */ static void -node_queue_close(SESSION *session, NODE_QUEUE *queue) +node_queue_close(WT_SESSION_IMPL *session, NODE_QUEUE *queue) { NODE_QUEUE_ELEM *elem, *next_elem; @@ -905,7 +907,8 @@ node_queue_close(SESSION *session, NODE_QUEUE *queue) * Push a tree node to the end of the queue. */ static int -node_queue_enqueue(SESSION *session, NODE_QUEUE *queue, WT_FREQTREE_NODE *node) +node_queue_enqueue( + WT_SESSION_IMPL *session, NODE_QUEUE *queue, WT_FREQTREE_NODE *node) { NODE_QUEUE_ELEM *elem; @@ -939,7 +942,8 @@ node_queue_enqueue(SESSION *session, NODE_QUEUE *queue, WT_FREQTREE_NODE *node) * pointer to the location referred by the retp parameter. */ static void -node_queue_dequeue(SESSION *session, NODE_QUEUE *queue, WT_FREQTREE_NODE **retp) +node_queue_dequeue( + WT_SESSION_IMPL *session, NODE_QUEUE *queue, WT_FREQTREE_NODE **retp) { NODE_QUEUE_ELEM *first_elem; diff --git a/src/support/scratch.c b/src/support/scratch.c index 18ce3df621b..1a03beb38ff 100644 --- a/src/support/scratch.c +++ b/src/support/scratch.c @@ -30,7 +30,7 @@ __wt_buf_clear(WT_BUF *buf) * Initialize a buffer at a specific size. */ int -__wt_buf_init(SESSION *session, WT_BUF *buf, size_t size) +__wt_buf_init(WT_SESSION_IMPL *session, WT_BUF *buf, size_t size) { WT_ASSERT(session, size <= UINT32_MAX); @@ -48,7 +48,7 @@ __wt_buf_init(SESSION *session, WT_BUF *buf, size_t size) * Initialize a buffer at a specific size, and set the data length. */ int -__wt_buf_initsize(SESSION *session, WT_BUF *buf, size_t size) +__wt_buf_initsize(WT_SESSION_IMPL *session, WT_BUF *buf, size_t size) { WT_RET(__wt_buf_init(session, buf, size)); @@ -62,7 +62,7 @@ __wt_buf_initsize(SESSION *session, WT_BUF *buf, size_t size) * Grow a buffer that's currently in-use. */ int -__wt_buf_grow(SESSION *session, WT_BUF *buf, size_t size) +__wt_buf_grow(WT_SESSION_IMPL *session, WT_BUF *buf, size_t size) { uint32_t offset; @@ -88,7 +88,8 @@ __wt_buf_grow(SESSION *session, WT_BUF *buf, size_t size) * Set the contents of the buffer. */ int -__wt_buf_set(SESSION *session, WT_BUF *buf, const void *data, uint32_t size) +__wt_buf_set( + WT_SESSION_IMPL *session, WT_BUF *buf, const void *data, uint32_t size) { /* Ensure the buffer is large enough. */ WT_RET(__wt_buf_initsize(session, buf, size)); @@ -104,7 +105,7 @@ __wt_buf_set(SESSION *session, WT_BUF *buf, const void *data, uint32_t size) */ void __wt_buf_steal( - SESSION *session, WT_BUF *buf, const void *datap, uint32_t *sizep) + WT_SESSION_IMPL *session, WT_BUF *buf, const void *datap, uint32_t *sizep) { /* * Sometimes we steal a buffer for a different purpose, for example, @@ -141,7 +142,7 @@ __wt_buf_steal( * Free a buffer. */ void -__wt_buf_free(SESSION *session, WT_BUF *buf) +__wt_buf_free(WT_SESSION_IMPL *session, WT_BUF *buf) { if (buf->mem != NULL) __wt_free(session, buf->mem); @@ -153,7 +154,7 @@ __wt_buf_free(SESSION *session, WT_BUF *buf) * Scratch buffer allocation function. */ int -__wt_scr_alloc(SESSION *session, uint32_t size, WT_BUF **scratchp) +__wt_scr_alloc(WT_SESSION_IMPL *session, uint32_t size, WT_BUF **scratchp) { WT_BUF *buf, **p, *small, **slot; uint32_t allocated; @@ -164,11 +165,12 @@ __wt_scr_alloc(SESSION *session, uint32_t size, WT_BUF **scratchp) *scratchp = NULL; /* - * There's an array of scratch buffers in each SESSION that can be used - * by any function. We use WT_BUF structures for scratch memory because - * we already have to have functions that do variable-length allocation - * on WT_BUFs. Scratch buffers are allocated only by a single thread of - * control, so no locking is necessary. + * There's an array of scratch buffers in each WT_SESSION_IMPL that can + * be used by any function. We use WT_BUF structures for scratch + * memory because we already have to have functions that do + * variable-length allocation on WT_BUFs. Scratch buffers are + * allocated only by a single thread of control, so no locking is + * necessary. * * Walk the array, looking for a buffer we can use. */ @@ -232,7 +234,7 @@ __wt_scr_alloc(SESSION *session, uint32_t size, WT_BUF **scratchp) return (__wt_scr_alloc(session, size, scratchp)); err: __wt_errx(session, - "SESSION unable to allocate more scratch buffers"); + "WT_SESSION_IMPL unable to allocate more scratch buffers"); return (ret); } @@ -256,7 +258,7 @@ __wt_scr_release(WT_BUF **bufp) * Free all memory associated with the scratch buffers. */ void -__wt_scr_free(SESSION *session) +__wt_scr_free(WT_SESSION_IMPL *session) { WT_BUF **p; u_int i; diff --git a/src/support/serial.c b/src/support/serial.c index 5ea1f6fd2de..f05d8929d49 100644 --- a/src/support/serial.c +++ b/src/support/serial.c @@ -32,16 +32,16 @@ * Schedule a serialization request, and block or spin until it completes. */ int -__wt_session_serialize_func(SESSION *session, - wq_state_t op, int spin, int (*func)(SESSION *), void *args) +__wt_session_serialize_func(WT_SESSION_IMPL *session, + wq_state_t op, int spin, int (*func)(WT_SESSION_IMPL *), void *args) { int done; /* * Threads serializing access to data using a function: - * set a function/argument pair in the SESSION handle, + * set a function/argument pair in the WT_SESSION_IMPL handle, * flush memory, - * update the SESSION workq state, and + * update the WT_SESSION_IMPL workq state, and * spins or blocks. * * The workQ thread notices the state change and calls the serialization @@ -59,9 +59,9 @@ __wt_session_serialize_func(SESSION *session, session->wq_state = op; /* - * Callers can spin on the SESSION state (implying the call is quickly - * satisfied), or block until its mutex is unlocked by another thread - * when the operation has completed. + * Callers can spin on the session state (implying the call is quickly + * satisfied), or block until its mutex is unlocked by another thread + * when the operation has completed. */ if (spin) { /* @@ -94,7 +94,7 @@ __wt_session_serialize_func(SESSION *session, * Server function cleanup. */ void -__wt_session_serialize_wrapup(SESSION *session, WT_PAGE *page, int ret) +__wt_session_serialize_wrapup(WT_SESSION_IMPL *session, WT_PAGE *page, int ret) { /* * If passed a page and the return value is good, we modified the page; diff --git a/src/support/sess_buf.c b/src/support/sess_buf.c index 403f83e20bf..a2e613aa8df 100644 --- a/src/support/sess_buf.c +++ b/src/support/sess_buf.c @@ -9,19 +9,20 @@ /* * __wt_sb_alloc -- - * Allocate memory from the SESSION's buffer and fill it in. + * Allocate memory from the WT_SESSION_IMPL's buffer and fill it in. */ int -__wt_sb_alloc(SESSION *session, size_t size, void *retp, SESSION_BUFFER **sbp) +__wt_sb_alloc( + WT_SESSION_IMPL *session, size_t size, void *retp, WT_SESSION_BUFFER **sbp) { - SESSION_BUFFER *sb; + WT_SESSION_BUFFER *sb; uint32_t alloc_size, align_size; int single_use; /* - * Allocate memory for an insert or change; there's a buffer in the - * SESSION structure for allocation of chunks of memory to hold changed - * or inserted values. + * Allocate memory for an insert or change; there's a buffer in the + * WT_SESSION_IMPL structure for allocation of chunks of memory to hold + * changed or inserted values. * * We align allocations because we directly access WT_UPDATE structure * fields in the memory (the x86 handles unaligned accesses, but I don't @@ -31,20 +32,21 @@ __wt_sb_alloc(SESSION *session, size_t size, void *retp, SESSION_BUFFER **sbp) * than with on-disk structures. Any other code allocating memory from * this buffer needs to align its allocations as well. * - * The first thing in each chunk of memory is a SESSION_BUFFER structure - * (which we check is a multiple of 4B during initialization); then one - * or more WT_UPDATE structure plus value chunk pairs. + * The first thing in each chunk of memory is a WT_SESSION_BUFFER + * structure (which we check is a multiple of 4B during + * initialization); then one or more WT_UPDATE structure plus value + * chunk pairs. * - * Figure out how much space we need: this code limits the maximum size - * of a data item stored in the file. In summary, for a big item we - * have to store a SESSION_BUFFER structure, the WT_UPDATE structure and - * the data, all in an allocated buffer. We only pass a 32-bit value - * to our allocation routine, so we can't store an item bigger than the - * maximum 32-bit value minus the sizes of those two structures, where - * the WT_UPDATE structure and data item are aligned to a 32-bit - * boundary. We could fix this, but it's unclear it's worth the effort: - * document you can store a (4GB - 512B) item max, it's insane to store - * 4GB items in the file anyway. + * Figure out how much space we need: this code limits the maximum size + * of a data item stored in the file. In summary, for a big item we + * have to store a WT_SESSION_BUFFER structure, the WT_UPDATE structure + * and the data, all in an allocated buffer. We only pass a 32-bit + * value to our allocation routine, so we can't store an item bigger + * than the maximum 32-bit value minus the sizes of those two + * structures, where the WT_UPDATE structure and data item are aligned + * to a 32-bit boundary. We could fix this, but it's unclear it's + * worth the effort: document you can store a (4GB - 512B) item max, + * it's insane to store 4GB items in the file anyway. */ if (size > WT_BTREE_OBJECT_SIZE_MAX) return (__wt_file_item_too_big(session)); @@ -71,7 +73,7 @@ __wt_sb_alloc(SESSION *session, size_t size, void *retp, SESSION_BUFFER **sbp) * than 4 times the requested size and at least the default buffer size. */ if (align_size > session->update_alloc_size) { - alloc_size = WT_SIZEOF32(SESSION_BUFFER) + align_size; + alloc_size = WT_SIZEOF32(WT_SESSION_BUFFER) + align_size; single_use = 1; } else { if (session->update_alloc_size < 8 * WT_MEGABYTE) @@ -84,20 +86,21 @@ __wt_sb_alloc(SESSION *session, size_t size, void *retp, SESSION_BUFFER **sbp) WT_RET(__wt_calloc(session, 1, alloc_size, &sb)); WT_ASSERT(session, alloc_size == (uint32_t)alloc_size); sb->len = alloc_size; - sb->space_avail = alloc_size - WT_SIZEOF32(SESSION_BUFFER); - sb->first_free = (uint8_t *)sb + sizeof(SESSION_BUFFER); + sb->space_avail = alloc_size - WT_SIZEOF32(WT_SESSION_BUFFER); + sb->first_free = (uint8_t *)sb + sizeof(WT_SESSION_BUFFER); /* - * If it's a single use allocation, ignore any current SESSION buffer; - * else, release the old SESSION buffer and replace it with the new one. + * If it's a single use allocation, ignore any current buffer in the + * session; else, release the old session buffer and replace it with + * the new one. */ if (!single_use) { /* - * The "in" reference count is artificially incremented by 1 as - * long as a SESSION buffer is referenced by the SESSION thread; - * we do not want SESSION buffers freed because a page was - * evicted and the count went to 0 while the buffer might still - * be used for future K/V inserts or modifications. + * The "in" reference count is artificially incremented by 1 as + * long as a session buffer is referenced by the session + * handle; we do not want session buffers freed because a page + * was evicted and the count went to 0 while the buffer might + * still be used for future K/V inserts or modifications. */ if (session->sb != NULL) __wt_sb_decrement(session, session->sb); @@ -120,10 +123,10 @@ no_allocation: /* * __wt_sb_free -- - * Free a chunk of memory from a per-SESSION buffer. + * Free a chunk of memory from a per-WT_SESSION_IMPL buffer. */ void -__wt_sb_free(SESSION *session, SESSION_BUFFER *sb) +__wt_sb_free(WT_SESSION_IMPL *session, WT_SESSION_BUFFER *sb) { WT_ASSERT(session, sb->out < sb->in); @@ -133,36 +136,36 @@ __wt_sb_free(SESSION *session, SESSION_BUFFER *sb) /* * __wt_sb_decrement -- - * Decrement the "insert" value of a per-SESSION buffer. + * Decrement the "insert" value of a per-WT_SESSION_IMPL buffer. */ void -__wt_sb_decrement(SESSION *session, SESSION_BUFFER *sb) +__wt_sb_decrement(WT_SESSION_IMPL *session, WT_SESSION_BUFFER *sb) { WT_ASSERT(session, sb->out < sb->in); /* * This function is used for two reasons. * - * #1: it's possible we allocated a WT_UPDATE structure and related K/V - * memory from the SESSION buffer, but then an error occurred. In this - * case we don't try and clean up the SESSION buffer, it's simpler to - * decrement the counters and pretend the memory is no longer in use. - * We're still in the allocation path, so we decrement the "in" field - * instead of incrementing the "out" field, if the eviction thread were - * to update the "out" field at the same time, we could race. + * #1: it's possible we allocated a WT_UPDATE structure and related K/V + * memory from the session buffer, but then an error occurred. In this + * case we don't try and clean up the session buffer, it's simpler to + * decrement the counters and pretend the memory is no longer in use. + * We're still in the allocation path, so we decrement the "in" field + * instead of incrementing the "out" field, if the eviction thread were + * to update the "out" field at the same time, we could race. * - * #2: the "in" reference count is artificially incremented by 1 as - * long as a SESSION buffer is referenced by the SESSION thread; we do - * not want SESSION buffers freed because a page was evicted and the - * count went to 0 while the buffer might still be used for future K/V - * inserts or modifications. + * #2: the "in" reference count is artificially incremented by 1 as + * long as a session buffer is referenced by the session handle; we do + * not want session buffers freed because a page was evicted and the + * count went to 0 while the buffer might still be used for future K/V + * inserts or modifications. */ --sb->in; /* - * In the above case #1, if the SESSION buffer was a one-off (allocated - * for a single use), we have to free it here, it's not linked to any - * WT_PAGE in the system. + * In the above case #1, if the session buffer was a one-off (allocated + * for a single use), we have to free it here, it's not linked to any + * WT_PAGE in the system. * * In the above case #2, our artificial increment might be the last * reference, if all of the WT_PAGE's referencing this buffer have been diff --git a/src/support/stat.c b/src/support/stat.c index e991a45cd37..ffcc0bfc317 100644 --- a/src/support/stat.c +++ b/src/support/stat.c @@ -3,7 +3,7 @@ #include "wt_internal.h" int -__wt_stat_alloc_btree_stats(SESSION *session, WT_BTREE_STATS **statsp) +__wt_stat_alloc_btree_stats(WT_SESSION_IMPL *session, WT_BTREE_STATS **statsp) { WT_BTREE_STATS *stats; @@ -61,7 +61,7 @@ __wt_stat_print_btree_stats(WT_BTREE_STATS *stats, FILE *stream) } int -__wt_stat_alloc_btree_file_stats(SESSION *session, WT_BTREE_FILE_STATS **statsp) +__wt_stat_alloc_btree_file_stats(WT_SESSION_IMPL *session, WT_BTREE_FILE_STATS **statsp) { WT_BTREE_FILE_STATS *stats; @@ -146,7 +146,7 @@ __wt_stat_print_btree_file_stats(WT_BTREE_FILE_STATS *stats, FILE *stream) } int -__wt_stat_alloc_cache_stats(SESSION *session, WT_CACHE_STATS **statsp) +__wt_stat_alloc_cache_stats(WT_SESSION_IMPL *session, WT_CACHE_STATS **statsp) { WT_CACHE_STATS *stats; @@ -198,7 +198,7 @@ __wt_stat_print_cache_stats(WT_CACHE_STATS *stats, FILE *stream) } int -__wt_stat_alloc_conn_stats(SESSION *session, WT_CONN_STATS **statsp) +__wt_stat_alloc_conn_stats(WT_SESSION_IMPL *session, WT_CONN_STATS **statsp) { WT_CONN_STATS *stats; @@ -244,7 +244,7 @@ __wt_stat_print_conn_stats(WT_CONN_STATS *stats, FILE *stream) } int -__wt_stat_alloc_file_stats(SESSION *session, WT_FILE_STATS **statsp) +__wt_stat_alloc_file_stats(WT_SESSION_IMPL *session, WT_FILE_STATS **statsp) { WT_FILE_STATS *stats; |