summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael Cahill <michael.cahill@wiredtiger.com>2011-04-25 13:54:49 +1000
committerMichael Cahill <michael.cahill@wiredtiger.com>2011-04-25 13:54:49 +1000
commitb9eb1bbb21ff0109b3e28045ca9e86d59ea1ce62 (patch)
tree54c34370693cbca68a7230a516858773a80d8705 /src
parentfade055c508735bff9b3d99c7a634289ec0bb5fc (diff)
downloadmongo-b9eb1bbb21ff0109b3e28045ca9e86d59ea1ce62.tar.gz
Remove the internal API, move automatically generated code to the public API.
refs #28 --HG-- rename : dist/api_class.py => dist/api_data.py
Diffstat (limited to 'src')
-rw-r--r--src/api/api.c187
-rw-r--r--src/api/api_int.c1149
-rw-r--r--src/api/config_def.c56
-rw-r--r--src/api/cur_btree.c69
-rw-r--r--src/btree/bt_evict.c6
-rw-r--r--src/btree/bt_read.c7
-rw-r--r--src/db/db_getset.c58
-rw-r--r--src/db/db_handle.c4
-rw-r--r--src/db/db_huffman.c2
-rw-r--r--src/db/db_open.c12
-rw-r--r--src/db/db_sync.c20
-rw-r--r--src/env/env_getset.c69
-rw-r--r--src/env/env_handle.c4
-rw-r--r--src/env/env_open.c12
-rw-r--r--src/env/env_session.c55
-rw-r--r--src/env/env_stat.c11
-rw-r--r--src/env/env_sync.c26
-rw-r--r--src/include/api.h232
-rw-r--r--src/include/extern.h86
-rw-r--r--src/include/misc.h20
-rw-r--r--src/include/wiredtiger.in35
-rw-r--r--src/support/err.c33
-rw-r--r--src/utilities/util_dump.c15
-rw-r--r--src/utilities/util_salvage.c48
-rw-r--r--src/utilities/util_stat.c67
-rw-r--r--src/utilities/util_verify.c46
26 files changed, 439 insertions, 1890 deletions
diff --git a/src/api/api.c b/src/api/api.c
index fd1836d6b46..320facb7dac 100644
--- a/src/api/api.c
+++ b/src/api/api.c
@@ -7,12 +7,6 @@
#include "wt_internal.h"
-#define SESSION_API_CALL(s, n) do { \
- (s)->cursor = NULL; \
- (s)->btree = NULL; \
- (s)->name = (n); \
-} while (0)
-
/*
* __session_close --
* WT_SESSION->close method.
@@ -31,20 +25,26 @@ __session_close(WT_SESSION *wt_session, const char *config)
session = (SESSION *)wt_session;
ret = 0;
- SESSION_API_CALL(session, "WT_SESSION->close");
+ SESSION_API_CALL(session, close, config);
while ((cursor = TAILQ_FIRST(&session->cursors)) != NULL)
WT_TRET(cursor->close(cursor, config));
+ __wt_lock(session, conn->mtx);
+
while ((btree_session = TAILQ_FIRST(&session->btrees)) != NULL) {
TAILQ_REMOVE(&session->btrees, btree_session, q);
btree = btree_session->btree;
- WT_TRET(btree->close(btree, session, 0));
__wt_free(session, btree_session);
+ session->btree = btree;
+ WT_TRET(__wt_btree_close(session));
}
TAILQ_REMOVE(&conn->sessions_head, session, q);
- WT_TRET(session->close(session, 0));
+ WT_TRET(__wt_session_close(session));
+ __wt_unlock(session, conn->mtx);
+
+ API_END();
return (0);
}
@@ -62,7 +62,7 @@ __session_open_cursor(WT_SESSION *wt_session,
WT_UNUSED(to_dup);
session = (SESSION *)wt_session;
- SESSION_API_CALL(session, "WT_SESSION->open_cursor");
+ SESSION_API_CALL(session, open_cursor, config);
if (strncmp(uri, "config:", 6) == 0)
return (__wt_curconfig_open(session, uri, config, cursorp));
@@ -70,6 +70,8 @@ __session_open_cursor(WT_SESSION *wt_session,
return (__wt_cursor_open(session, uri, config, cursorp));
__wt_err(session, 0, "Unknown cursor type '%s'\n", uri);
+
+ API_END();
return (EINVAL);
}
@@ -86,19 +88,14 @@ __session_create_table(WT_SESSION *wt_session,
SESSION *session;
WT_CONFIG_ITEM cval;
const char *key_format, *value_format;
- uint32_t alloc_size, column_flags, fixed_len, huffman_flags;
- uint32_t intl_node_max, intl_node_min, leaf_node_max, leaf_node_min;
- const char *cfg[] = { __wt_config_def_create_table, config, NULL };
-
- WT_UNUSED(config);
+ uint32_t column_flags, fixed_len, huffman_flags;
session = (SESSION *)wt_session;
conn = (CONNECTION *)wt_session->connection;
- SESSION_API_CALL(session, "WT_SESSION->create_table");
+ SESSION_API_CALL(session, create_table, config);
- WT_RET(__wt_config_check(session,
- __wt_config_def_create_table, config));
+ /* XXX need check whether the table already exists. */
/*
* Key / value formats.
@@ -109,7 +106,7 @@ __session_create_table(WT_SESSION *wt_session,
*/
fixed_len = 0;
- WT_RET(__wt_config_gets(cfg, "key_format", &cval));
+ WT_RET(__wt_config_gets(__cfg, "key_format", &cval));
if (strncmp(cval.str, "r", cval.len) == 0)
key_format = "r";
else if (strncmp(cval.str, "S", cval.len) == 0)
@@ -122,7 +119,7 @@ __session_create_table(WT_SESSION *wt_session,
return (EINVAL);
}
- WT_RET(__wt_config_gets(cfg, "value_format", &cval));
+ WT_RET(__wt_config_gets(__cfg, "value_format", &cval));
if (strncmp(cval.str, "S", cval.len) == 0)
value_format = "S";
else if (strncmp(cval.str, "u", cval.len) == 0)
@@ -137,41 +134,54 @@ __session_create_table(WT_SESSION *wt_session,
}
column_flags = 0;
- WT_RET(__wt_config_gets(cfg, "runlength_encoding", &cval));
+ WT_RET(__wt_config_gets(__cfg, "runlength_encoding", &cval));
if (cval.val != 0)
column_flags |= WT_RLE;
huffman_flags = 0;
- WT_RET(__wt_config_gets(cfg, "huffman_key", &cval));
+ WT_RET(__wt_config_gets(__cfg, "huffman_key", &cval));
if (cval.len > 0 && strncasecmp(cval.str, "english", cval.len) == 0)
huffman_flags |= WT_ASCII_ENGLISH | WT_HUFFMAN_KEY;
- WT_RET(__wt_config_gets(cfg, "huffman_value", &cval));
+ WT_RET(__wt_config_gets(__cfg, "huffman_value", &cval));
if (cval.len > 0 && strncasecmp(cval.str, "english", cval.len) == 0)
huffman_flags |= WT_ASCII_ENGLISH | WT_HUFFMAN_VALUE;
- WT_RET(__wt_config_gets(cfg, "allocation_size", &cval));
- alloc_size = (uint32_t)cval.val;
- WT_RET(__wt_config_gets(cfg, "intl_node_max", &cval));
- intl_node_max = (uint32_t)cval.val;
- WT_RET(__wt_config_gets(cfg, "intl_node_min", &cval));
- intl_node_min = (uint32_t)cval.val;
- WT_RET(__wt_config_gets(cfg, "leaf_node_max", &cval));
- leaf_node_max = (uint32_t)cval.val;
- WT_RET(__wt_config_gets(cfg, "leaf_node_min", &cval));
- leaf_node_min = (uint32_t)cval.val;
-
- WT_RET(conn->btree(conn, 0, &btree));
- WT_RET(btree->btree_pagesize_set(btree, alloc_size,
- intl_node_min, intl_node_max, leaf_node_min, leaf_node_max));
- if (key_format[0] == 'r')
- WT_RET(btree->column_set(btree, fixed_len, NULL, column_flags));
+ /* Allocate a BTREE handle. */
+ WT_RET(__wt_connection_btree(conn, &btree));
+
+ WT_RET(__wt_config_gets(__cfg, "allocation_size", &cval));
+ btree->allocsize = (uint32_t)cval.val;
+ WT_RET(__wt_config_gets(__cfg, "intl_node_max", &cval));
+ btree->intlmax = (uint32_t)cval.val;
+ WT_RET(__wt_config_gets(__cfg, "intl_node_min", &cval));
+ btree->intlmin = (uint32_t)cval.val;
+ WT_RET(__wt_config_gets(__cfg, "leaf_node_max", &cval));
+ btree->leafmax = (uint32_t)cval.val;
+ WT_RET(__wt_config_gets(__cfg, "leaf_node_min", &cval));
+ btree->leafmin = (uint32_t)cval.val;
+
+ if (key_format[0] == 'r') {
+ /* Run-length encoding required fixed-length records. */
+ if (fixed_len == 0 && FLD_ISSET(column_flags, WT_RLE)) {
+ __wt_errx(session,
+ "Run-length encoding is incompatible with "
+ "variable length column-store records");
+ return (WT_ERROR);
+ }
+
+ btree->fixed_len = fixed_len;
+ F_SET(btree, WT_COLUMN | column_flags);
+ }
if (huffman_flags != 0)
- WT_RET(btree->huffman_set(btree, NULL, 0, huffman_flags));
- WT_RET(btree->open(btree, session, name, 0666, WT_CREATE));
+ WT_RET(__wt_btree_huffman_set(btree, NULL, 0, huffman_flags));
+
+ session->btree = btree;
+ WT_RET(__wt_btree_open(session, name, 0666, WT_CREATE));
WT_RET(__wt_session_add_btree(session,
btree, key_format, value_format));
+ API_END();
return (0);
}
@@ -312,9 +322,14 @@ __session_checkpoint(WT_SESSION *wt_session, const char *config)
static int
__conn_load_extension(WT_CONNECTION *wt_conn, const char *path, const char *config)
{
- WT_UNUSED(wt_conn);
+ CONNECTION *conn;
+ SESSION *session;
+
WT_UNUSED(path);
- WT_UNUSED(config);
+
+ conn = (CONNECTION *)wt_conn;
+ CONNECTION_API_CALL(conn, session, load_extension, config);
+ API_END();
return (ENOTSUP);
}
@@ -327,10 +342,15 @@ static int
__conn_add_cursor_type(WT_CONNECTION *wt_conn,
const char *prefix, WT_CURSOR_TYPE *ctype, const char *config)
{
- WT_UNUSED(wt_conn);
+ CONNECTION *conn;
+ SESSION *session;
+
WT_UNUSED(prefix);
WT_UNUSED(ctype);
- WT_UNUSED(config);
+
+ conn = (CONNECTION *)wt_conn;
+ CONNECTION_API_CALL(conn, session, add_cursor_type, config);
+ API_END();
return (ENOTSUP);
}
@@ -343,10 +363,15 @@ static int
__conn_add_collator(WT_CONNECTION *wt_conn,
const char *name, WT_COLLATOR *collator, const char *config)
{
- WT_UNUSED(wt_conn);
+ CONNECTION *conn;
+ SESSION *session;
+
WT_UNUSED(name);
WT_UNUSED(collator);
- WT_UNUSED(config);
+
+ conn = (CONNECTION *)wt_conn;
+ CONNECTION_API_CALL(conn, session, add_collator, config);
+ API_END();
return (ENOTSUP);
}
@@ -359,10 +384,15 @@ static int
__conn_add_extractor(WT_CONNECTION *wt_conn,
const char *name, WT_EXTRACTOR *extractor, const char *config)
{
- WT_UNUSED(wt_conn);
+ CONNECTION *conn;
+ SESSION *session;
+
WT_UNUSED(name);
WT_UNUSED(extractor);
- WT_UNUSED(config);
+
+ conn = (CONNECTION *)wt_conn;
+ CONNECTION_API_CALL(conn, session, add_collator, config);
+ API_END();
return (ENOTSUP);
}
@@ -399,9 +429,8 @@ __conn_close(WT_CONNECTION *wt_conn, const char *config)
ret = 0;
conn = (CONNECTION *)wt_conn;
- session = &conn->default_session;
- SESSION_API_CALL(session, "WT_CONNECTION->close");
+ CONNECTION_API_CALL(conn, session, close, config);
while ((s = TAILQ_FIRST(&conn->sessions_head)) != NULL) {
wt_session = &s->iface;
@@ -412,7 +441,9 @@ __conn_close(WT_CONNECTION *wt_conn, const char *config)
WT_TRET(__wt_close(session, conn->log_fh));
conn->log_fh = NULL;
}
- WT_TRET(conn->close(conn, 0));
+ WT_TRET(__wt_connection_close(conn));
+ API_END();
+
return (ret);
}
@@ -443,13 +474,12 @@ __conn_open_session(WT_CONNECTION *wt_conn,
SESSION *session, *session_ret;
int ret;
- WT_UNUSED(config);
-
conn = (CONNECTION *)wt_conn;
- session = &conn->default_session;
- SESSION_API_CALL(session, "WT_CONNECTION->open_session");
+ CONNECTION_API_CALL(conn, session, open_session, config);
+
+ __wt_lock(session, conn->mtx);
+ WT_ERR(__wt_connection_session(conn, &session_ret));
- WT_ERR(conn->session(conn, 0, &session_ret));
/*
* XXX
* Kludge while there is a separate __wt_conection_session method.
@@ -465,6 +495,7 @@ __conn_open_session(WT_CONNECTION *wt_conn,
session_ret->event_handler = event_handler;
TAILQ_INSERT_HEAD(&conn->sessions_head, session_ret, q);
+ __wt_unlock(session, conn->mtx);
STATIC_ASSERT(offsetof(CONNECTION, iface) == 0);
*wt_sessionp = &session_ret->iface;
@@ -472,8 +503,10 @@ __conn_open_session(WT_CONNECTION *wt_conn,
if (0) {
err: if (session_ret != NULL)
(void)__wt_session_close(session_ret);
+ __wt_unlock(session, conn->mtx);
__wt_free(session, session_ret);
}
+ API_END();
return (0);
}
@@ -510,10 +543,10 @@ wiredtiger_open(const char *home, WT_EVENT_HANDLER *event_handler,
{ NULL, 0 }
};
CONNECTION *conn;
+ SESSION *session;
WT_CONFIG vconfig;
WT_CONFIG_ITEM cval, vkey, vval;
- const char *cfg[] = { __wt_config_def_wiredtiger_open, config, NULL };
- uint32_t verbose;
+ const char *__cfg[] = { __wt_confdfl_wiredtiger_open, config, NULL };
int opened, ret;
opened = 0;
@@ -541,48 +574,48 @@ wiredtiger_open(const char *home, WT_EVENT_HANDLER *event_handler,
WT_ERR(__wt_strdup(NULL, home, &conn->home));
TAILQ_INIT(&conn->sessions_head);
- conn->default_session.iface.connection = &conn->iface;
- conn->default_session.event_handler = event_handler;
+ session = &conn->default_session;
+ session->iface.connection = &conn->iface;
+ session->event_handler = event_handler;
+ session->name = "wiredtiger_open";
WT_ERR(__wt_connection_config(conn));
- WT_ERR(__wt_config_check(&conn->default_session,
- __wt_config_def_wiredtiger_open, config));
+ WT_ERR(__wt_config_check(session, __cfg[0], config));
- WT_ERR(__wt_config_gets(cfg, "cache_size", &cval));
- WT_ERR(conn->cache_size_set(conn, (uint32_t)cval.val));
+ WT_ERR(__wt_config_gets(__cfg, "cache_size", &cval));
+ WT_ERR(__wt_api_arg_min(session, "cache size", cval.val,
+ 1 * WT_MEGABYTE));
+ conn->cache_size = cval.val;
- verbose = 0;
- WT_ERR(__wt_config_gets(cfg, "verbose", &cval));
+ conn->verbose = 0;
+#ifdef HAVE_VERBOSE
+ WT_ERR(__wt_config_gets(__cfg, "verbose", &cval));
for (vt = verbtypes; vt->vname != NULL; vt++) {
WT_ERR(__wt_config_initn(&vconfig, cval.str, cval.len));
vkey.str = vt->vname;
vkey.len = strlen(vt->vname);
ret = __wt_config_getraw(&vconfig, &vkey, &vval);
if (ret == 0 && vval.val)
- verbose |= vt->vflag;
+ FLD_SET(conn->verbose, vt->vflag);
else if (ret != WT_NOTFOUND)
goto err;
}
- if (verbose != 0)
- WT_ERR(conn->verbose_set(conn, verbose));
-
- /* XXX conn flags, including WT_MEMORY_CHECK */
+#endif
- WT_ERR(conn->open(conn, home, 0644, 0));
+ WT_ERR(__wt_connection_open(conn, home, 0644));
opened = 1;
- WT_ERR(__wt_config_gets(cfg, "logging", &cval));
+ WT_ERR(__wt_config_gets(__cfg, "logging", &cval));
if (cval.val != 0)
- WT_ERR(__wt_open(&conn->default_session,
- "__wt.log", 0666, 1, &conn->log_fh));
+ WT_ERR(__wt_open(session, "__wt.log", 0666, 1, &conn->log_fh));
STATIC_ASSERT(offsetof(CONNECTION, iface) == 0);
*wt_connp = &conn->iface;
if (0) {
err: if (opened)
- conn->close(conn, 0);
+ __wt_connection_close(conn);
else
__wt_connection_destroy(conn);
}
diff --git a/src/api/api_int.c b/src/api/api_int.c
deleted file mode 100644
index 8c631377150..00000000000
--- a/src/api/api_int.c
+++ /dev/null
@@ -1,1149 +0,0 @@
-/* DO NOT EDIT: automatically built by dist/api.py. */
-
-#include "wt_internal.h"
-
-static int __wt_api_btree_btree_compare_get(
- BTREE *btree,
- int (**btree_compare)(BTREE *, const WT_ITEM *, const WT_ITEM *));
-static int __wt_api_btree_btree_compare_get(
- BTREE *btree,
- int (**btree_compare)(BTREE *, const WT_ITEM *, const WT_ITEM *))
-{
- CONNECTION *connection = btree->conn;
- SESSION *session = &connection->default_session;
-
- __wt_lock(session, connection->mtx);
- *btree_compare = btree->btree_compare;
- __wt_unlock(session, connection->mtx);
- return (0);
-}
-
-static int __wt_api_btree_btree_compare_int_get(
- BTREE *btree,
- int *btree_compare_int);
-static int __wt_api_btree_btree_compare_int_get(
- BTREE *btree,
- int *btree_compare_int)
-{
- CONNECTION *connection = btree->conn;
- SESSION *session = &connection->default_session;
-
- __wt_lock(session, connection->mtx);
- *btree_compare_int = btree->btree_compare_int;
- __wt_unlock(session, connection->mtx);
- return (0);
-}
-
-static int __wt_api_btree_btree_compare_int_set(
- BTREE *btree,
- int btree_compare_int);
-static int __wt_api_btree_btree_compare_int_set(
- BTREE *btree,
- int btree_compare_int)
-{
- CONNECTION *connection = btree->conn;
- SESSION *session = &connection->default_session;
-
- WT_RET((__wt_btree_btree_compare_int_set_verify(
- btree, btree_compare_int)));
- __wt_lock(session, connection->mtx);
- btree->btree_compare_int = btree_compare_int;
- __wt_unlock(session, connection->mtx);
- return (0);
-}
-
-static int __wt_api_btree_btree_compare_set(
- BTREE *btree,
- int (*btree_compare)(BTREE *, const WT_ITEM *, const WT_ITEM *));
-static int __wt_api_btree_btree_compare_set(
- BTREE *btree,
- int (*btree_compare)(BTREE *, const WT_ITEM *, const WT_ITEM *))
-{
- CONNECTION *connection = btree->conn;
- SESSION *session = &connection->default_session;
-
- __wt_lock(session, connection->mtx);
- btree->btree_compare = btree_compare;
- __wt_unlock(session, connection->mtx);
- return (0);
-}
-
-static int __wt_api_btree_btree_itemsize_get(
- BTREE *btree,
- uint32_t *intlitemsize,
- uint32_t *leafitemsize);
-static int __wt_api_btree_btree_itemsize_get(
- BTREE *btree,
- uint32_t *intlitemsize,
- uint32_t *leafitemsize)
-{
- CONNECTION *connection = btree->conn;
- SESSION *session = &connection->default_session;
-
- __wt_lock(session, connection->mtx);
- *intlitemsize = btree->intlitemsize;
- *leafitemsize = btree->leafitemsize;
- __wt_unlock(session, connection->mtx);
- return (0);
-}
-
-static int __wt_api_btree_btree_itemsize_set(
- BTREE *btree,
- uint32_t intlitemsize,
- uint32_t leafitemsize);
-static int __wt_api_btree_btree_itemsize_set(
- BTREE *btree,
- uint32_t intlitemsize,
- uint32_t leafitemsize)
-{
- CONNECTION *connection = btree->conn;
- SESSION *session = &connection->default_session;
-
- __wt_lock(session, connection->mtx);
- btree->intlitemsize = intlitemsize;
- btree->leafitemsize = leafitemsize;
- __wt_unlock(session, connection->mtx);
- return (0);
-}
-
-static int __wt_api_btree_btree_pagesize_get(
- BTREE *btree,
- uint32_t *allocsize,
- uint32_t *intlmin,
- uint32_t *intlmax,
- uint32_t *leafmin,
- uint32_t *leafmax);
-static int __wt_api_btree_btree_pagesize_get(
- BTREE *btree,
- uint32_t *allocsize,
- uint32_t *intlmin,
- uint32_t *intlmax,
- uint32_t *leafmin,
- uint32_t *leafmax)
-{
- CONNECTION *connection = btree->conn;
- SESSION *session = &connection->default_session;
-
- __wt_lock(session, connection->mtx);
- *allocsize = btree->allocsize;
- *intlmin = btree->intlmin;
- *intlmax = btree->intlmax;
- *leafmin = btree->leafmin;
- *leafmax = btree->leafmax;
- __wt_unlock(session, connection->mtx);
- return (0);
-}
-
-static int __wt_api_btree_btree_pagesize_set(
- BTREE *btree,
- uint32_t allocsize,
- uint32_t intlmin,
- uint32_t intlmax,
- uint32_t leafmin,
- uint32_t leafmax);
-static int __wt_api_btree_btree_pagesize_set(
- BTREE *btree,
- uint32_t allocsize,
- uint32_t intlmin,
- uint32_t intlmax,
- uint32_t leafmin,
- uint32_t leafmax)
-{
- CONNECTION *connection = btree->conn;
- SESSION *session = &connection->default_session;
-
- __wt_lock(session, connection->mtx);
- btree->allocsize = allocsize;
- btree->intlmin = intlmin;
- btree->intlmax = intlmax;
- btree->leafmin = leafmin;
- btree->leafmax = leafmax;
- __wt_unlock(session, connection->mtx);
- return (0);
-}
-
-static int __wt_api_btree_bulk_load(
- BTREE *btree,
- int (*cb)(BTREE *, WT_ITEM **, WT_ITEM **));
-static int __wt_api_btree_bulk_load(
- BTREE *btree,
- int (*cb)(BTREE *, WT_ITEM **, WT_ITEM **))
-{
- const char *method_name = "BTREE.bulk_load";
- CONNECTION *connection = btree->conn;
- SESSION *session = NULL;
- int islocal;
- int ret;
-
- WT_DB_RDONLY(session, btree, method_name);
- WT_RET(__wt_session_api_set(connection, method_name, btree, &session, &islocal));
- ret = __wt_btree_bulk_load(session, cb);
- WT_TRET(__wt_session_api_clr(session, method_name, islocal));
- return (ret);
-}
-
-static int __wt_api_btree_close(
- BTREE *btree,
- SESSION *session,
- uint32_t flags);
-static int __wt_api_btree_close(
- BTREE *btree,
- SESSION *session,
- uint32_t flags)
-{
- const char *method_name = "BTREE.close";
- CONNECTION *connection = btree->conn;
- int islocal;
- int ret;
-
- WT_RET(__wt_session_api_set(connection, method_name, btree, &session, &islocal));
- WT_CONN_FCHK(connection, method_name, flags, WT_APIMASK_BTREE_CLOSE);
- ret = __wt_btree_close(session, flags);
- WT_TRET(__wt_session_api_clr(session, method_name, islocal));
- return (ret);
-}
-
-static int __wt_api_btree_col_del(
- BTREE *btree,
- SESSION *session,
- uint64_t recno,
- uint32_t flags);
-static int __wt_api_btree_col_del(
- BTREE *btree,
- SESSION *session,
- uint64_t recno,
- uint32_t flags)
-{
- const char *method_name = "BTREE.col_del";
- CONNECTION *connection = btree->conn;
- int islocal;
- int ret;
-
- WT_DB_COL_ONLY(session, btree, method_name);
- WT_DB_RDONLY(session, btree, method_name);
- WT_RET(__wt_session_api_set(connection, method_name, btree, &session, &islocal));
- WT_CONN_FCHK(connection, method_name, flags, WT_APIMASK_BTREE_COL_DEL);
- while ((ret = __wt_btree_col_del(session, recno)) == WT_RESTART)
- ;
- WT_TRET(__wt_session_api_clr(session, method_name, islocal));
- return (ret);
-}
-
-static int __wt_api_btree_col_put(
- BTREE *btree,
- SESSION *session,
- uint64_t recno,
- WT_ITEM *value,
- uint32_t flags);
-static int __wt_api_btree_col_put(
- BTREE *btree,
- SESSION *session,
- uint64_t recno,
- WT_ITEM *value,
- uint32_t flags)
-{
- const char *method_name = "BTREE.col_put";
- CONNECTION *connection = btree->conn;
- int islocal;
- int ret;
-
- WT_DB_COL_ONLY(session, btree, method_name);
- WT_DB_RDONLY(session, btree, method_name);
- WT_RET(__wt_session_api_set(connection, method_name, btree, &session, &islocal));
- WT_CONN_FCHK(connection, method_name, flags, WT_APIMASK_BTREE_COL_PUT);
- while ((ret = __wt_btree_col_put(session, recno, value)) == WT_RESTART)
- ;
- WT_TRET(__wt_session_api_clr(session, method_name, islocal));
- return (ret);
-}
-
-static int __wt_api_btree_column_set(
- BTREE *btree,
- uint32_t fixed_len,
- const char *dictionary,
- uint32_t flags);
-static int __wt_api_btree_column_set(
- BTREE *btree,
- uint32_t fixed_len,
- const char *dictionary,
- uint32_t flags)
-{
- CONNECTION *connection = btree->conn;
- SESSION *session = &connection->default_session;
-
- WT_CONN_FCHK(connection, "BTREE.column_set",
- flags, WT_APIMASK_BTREE_COLUMN_SET);
-
- WT_RET((__wt_btree_column_set_verify(
- btree, fixed_len, dictionary, flags)));
- __wt_lock(session, connection->mtx);
- btree->fixed_len = fixed_len;
- btree->dictionary = dictionary;
- F_SET(btree, flags);
- __wt_unlock(session, connection->mtx);
- return (0);
-}
-
-static int __wt_api_btree_dump(
- BTREE *btree,
- FILE *stream,
- uint32_t flags);
-static int __wt_api_btree_dump(
- BTREE *btree,
- FILE *stream,
- uint32_t flags)
-{
- const char *method_name = "BTREE.dump";
- CONNECTION *connection = btree->conn;
- SESSION *session = NULL;
- int islocal;
- int ret;
-
- WT_RET(__wt_session_api_set(connection, method_name, btree, &session, &islocal));
- WT_CONN_FCHK(connection, method_name, flags, WT_APIMASK_BTREE_DUMP);
- ret = __wt_btree_dump(session, stream, flags);
- WT_TRET(__wt_session_api_clr(session, method_name, islocal));
- return (ret);
-}
-
-static int __wt_api_btree_huffman_set(
- BTREE *btree,
- uint8_t const *huffman_table,
- u_int huffman_table_size,
- uint32_t huffman_flags);
-static int __wt_api_btree_huffman_set(
- BTREE *btree,
- uint8_t const *huffman_table,
- u_int huffman_table_size,
- uint32_t huffman_flags)
-{
- CONNECTION *connection = btree->conn;
- SESSION *session = &connection->default_session;
- int ret;
-
- WT_CONN_FCHK(connection, "BTREE.huffman_set",
- huffman_flags, WT_APIMASK_BTREE_HUFFMAN_SET);
-
- __wt_lock(session, connection->mtx);
- ret = __wt_btree_huffman_set(
- btree, huffman_table, huffman_table_size, huffman_flags);
- __wt_unlock(session, connection->mtx);
- return (ret);
-}
-
-static int __wt_api_btree_open(
- BTREE *btree,
- SESSION *session,
- const char *name,
- mode_t mode,
- uint32_t flags);
-static int __wt_api_btree_open(
- BTREE *btree,
- SESSION *session,
- const char *name,
- mode_t mode,
- uint32_t flags)
-{
- const char *method_name = "BTREE.open";
- CONNECTION *connection = btree->conn;
- int islocal;
- int ret;
-
- WT_RET(__wt_session_api_set(connection, method_name, btree, &session, &islocal));
- WT_CONN_FCHK(connection, method_name, flags, WT_APIMASK_BTREE_OPEN);
- ret = __wt_btree_open(session, name, mode, flags);
- WT_TRET(__wt_session_api_clr(session, method_name, islocal));
- return (ret);
-}
-
-static int __wt_api_btree_row_del(
- BTREE *btree,
- SESSION *session,
- WT_ITEM *key,
- uint32_t flags);
-static int __wt_api_btree_row_del(
- BTREE *btree,
- SESSION *session,
- WT_ITEM *key,
- uint32_t flags)
-{
- const char *method_name = "BTREE.row_del";
- CONNECTION *connection = btree->conn;
- int islocal;
- int ret;
-
- WT_DB_ROW_ONLY(session, btree, method_name);
- WT_DB_RDONLY(session, btree, method_name);
- WT_RET(__wt_session_api_set(connection, method_name, btree, &session, &islocal));
- WT_CONN_FCHK(connection, method_name, flags, WT_APIMASK_BTREE_ROW_DEL);
- while ((ret = __wt_btree_row_del(session, key)) == WT_RESTART)
- ;
- WT_TRET(__wt_session_api_clr(session, method_name, islocal));
- return (ret);
-}
-
-static int __wt_api_btree_row_put(
- BTREE *btree,
- SESSION *session,
- WT_ITEM *key,
- WT_ITEM *value,
- uint32_t flags);
-static int __wt_api_btree_row_put(
- BTREE *btree,
- SESSION *session,
- WT_ITEM *key,
- WT_ITEM *value,
- uint32_t flags)
-{
- const char *method_name = "BTREE.row_put";
- CONNECTION *connection = btree->conn;
- int islocal;
- int ret;
-
- WT_DB_ROW_ONLY(session, btree, method_name);
- WT_DB_RDONLY(session, btree, method_name);
- WT_RET(__wt_session_api_set(connection, method_name, btree, &session, &islocal));
- WT_CONN_FCHK(connection, method_name, flags, WT_APIMASK_BTREE_ROW_PUT);
- while ((ret = __wt_btree_row_put(session, key, value)) == WT_RESTART)
- ;
- WT_TRET(__wt_session_api_clr(session, method_name, islocal));
- return (ret);
-}
-
-static int __wt_api_btree_salvage(
- BTREE *btree,
- SESSION *session,
- uint32_t flags);
-static int __wt_api_btree_salvage(
- BTREE *btree,
- SESSION *session,
- uint32_t flags)
-{
- const char *method_name = "BTREE.salvage";
- CONNECTION *connection = btree->conn;
- int islocal;
- int ret;
-
- WT_RET(__wt_session_api_set(connection, method_name, btree, &session, &islocal));
- WT_CONN_FCHK(connection, method_name, flags, WT_APIMASK_BTREE_SALVAGE);
- ret = __wt_btree_salvage(session);
- WT_TRET(__wt_session_api_clr(session, method_name, islocal));
- return (ret);
-}
-
-static int __wt_api_btree_stat_clear(
- BTREE *btree,
- uint32_t flags);
-static int __wt_api_btree_stat_clear(
- BTREE *btree,
- uint32_t flags)
-{
- const char *method_name = "BTREE.stat_clear";
- CONNECTION *connection = btree->conn;
- int ret;
-
- WT_CONN_FCHK(connection, method_name, flags, WT_APIMASK_BTREE_STAT_CLEAR);
- ret = __wt_btree_stat_clear(btree);
- return (ret);
-}
-
-static int __wt_api_btree_stat_print(
- BTREE *btree,
- FILE *stream,
- uint32_t flags);
-static int __wt_api_btree_stat_print(
- BTREE *btree,
- FILE *stream,
- uint32_t flags)
-{
- const char *method_name = "BTREE.stat_print";
- CONNECTION *connection = btree->conn;
- SESSION *session = NULL;
- int islocal;
- int ret;
-
- WT_RET(__wt_session_api_set(connection, method_name, btree, &session, &islocal));
- WT_CONN_FCHK(connection, method_name, flags, WT_APIMASK_BTREE_STAT_PRINT);
- ret = __wt_btree_stat_print(session, stream);
- WT_TRET(__wt_session_api_clr(session, method_name, islocal));
- return (ret);
-}
-
-static int __wt_api_btree_sync(
- BTREE *btree,
- SESSION *session,
- uint32_t flags);
-static int __wt_api_btree_sync(
- BTREE *btree,
- SESSION *session,
- uint32_t flags)
-{
- const char *method_name = "BTREE.sync";
- CONNECTION *connection = btree->conn;
- int islocal;
- int ret;
-
- WT_DB_RDONLY(session, btree, method_name);
- WT_RET(__wt_session_api_set(connection, method_name, btree, &session, &islocal));
- WT_CONN_FCHK(connection, method_name, flags, WT_APIMASK_BTREE_SYNC);
- ret = __wt_btree_sync(session, flags);
- WT_TRET(__wt_session_api_clr(session, method_name, islocal));
- return (ret);
-}
-
-static int __wt_api_btree_verify(
- BTREE *btree,
- SESSION *session,
- uint32_t flags);
-static int __wt_api_btree_verify(
- BTREE *btree,
- SESSION *session,
- uint32_t flags)
-{
- const char *method_name = "BTREE.verify";
- CONNECTION *connection = btree->conn;
- int islocal;
- int ret;
-
- WT_RET(__wt_session_api_set(connection, method_name, btree, &session, &islocal));
- WT_CONN_FCHK(connection, method_name, flags, WT_APIMASK_BTREE_VERIFY);
- ret = __wt_btree_verify(session);
- WT_TRET(__wt_session_api_clr(session, method_name, islocal));
- return (ret);
-}
-
-static int __wt_api_connection_btree(
- CONNECTION *connection,
- uint32_t flags,
- BTREE **btreep);
-static int __wt_api_connection_btree(
- CONNECTION *connection,
- uint32_t flags,
- BTREE **btreep)
-{
- const char *method_name = "CONNECTION.btree";
- int ret;
-
- WT_CONN_FCHK(connection, method_name, flags, WT_APIMASK_CONNECTION_BTREE);
- ret = __wt_connection_btree(connection, btreep);
- return (ret);
-}
-
-static int __wt_api_connection_cache_size_get(
- CONNECTION *connection,
- uint32_t *cache_size);
-static int __wt_api_connection_cache_size_get(
- CONNECTION *connection,
- uint32_t *cache_size)
-{
- SESSION *session = &connection->default_session;
- __wt_lock(session, connection->mtx);
- *cache_size = connection->cache_size;
- __wt_unlock(session, connection->mtx);
- return (0);
-}
-
-static int __wt_api_connection_cache_size_set(
- CONNECTION *connection,
- uint32_t cache_size);
-static int __wt_api_connection_cache_size_set(
- CONNECTION *connection,
- uint32_t cache_size)
-{
- SESSION *session = &connection->default_session;
- WT_RET((__wt_connection_cache_size_set_verify(
- connection, cache_size)));
- __wt_lock(session, connection->mtx);
- connection->cache_size = cache_size;
- __wt_unlock(session, connection->mtx);
- return (0);
-}
-
-static int __wt_api_connection_close(
- CONNECTION *connection,
- uint32_t flags);
-static int __wt_api_connection_close(
- CONNECTION *connection,
- uint32_t flags)
-{
- const char *method_name = "CONNECTION.close";
- int ret;
-
- WT_CONN_FCHK(connection, method_name, flags, WT_APIMASK_CONNECTION_CLOSE);
- ret = __wt_connection_close(connection);
- return (ret);
-}
-
-static int __wt_api_connection_data_update_max_get(
- CONNECTION *connection,
- uint32_t *data_update_max);
-static int __wt_api_connection_data_update_max_get(
- CONNECTION *connection,
- uint32_t *data_update_max)
-{
- SESSION *session = &connection->default_session;
- __wt_lock(session, connection->mtx);
- *data_update_max = connection->data_update_max;
- __wt_unlock(session, connection->mtx);
- return (0);
-}
-
-static int __wt_api_connection_data_update_max_set(
- CONNECTION *connection,
- uint32_t data_update_max);
-static int __wt_api_connection_data_update_max_set(
- CONNECTION *connection,
- uint32_t data_update_max)
-{
- SESSION *session = &connection->default_session;
- __wt_lock(session, connection->mtx);
- connection->data_update_max = data_update_max;
- __wt_unlock(session, connection->mtx);
- return (0);
-}
-
-static int __wt_api_connection_data_update_min_get(
- CONNECTION *connection,
- uint32_t *data_update_min);
-static int __wt_api_connection_data_update_min_get(
- CONNECTION *connection,
- uint32_t *data_update_min)
-{
- SESSION *session = &connection->default_session;
- __wt_lock(session, connection->mtx);
- *data_update_min = connection->data_update_min;
- __wt_unlock(session, connection->mtx);
- return (0);
-}
-
-static int __wt_api_connection_data_update_min_set(
- CONNECTION *connection,
- uint32_t data_update_min);
-static int __wt_api_connection_data_update_min_set(
- CONNECTION *connection,
- uint32_t data_update_min)
-{
- SESSION *session = &connection->default_session;
- __wt_lock(session, connection->mtx);
- connection->data_update_min = data_update_min;
- __wt_unlock(session, connection->mtx);
- return (0);
-}
-
-static int __wt_api_connection_hazard_size_get(
- CONNECTION *connection,
- uint32_t *hazard_size);
-static int __wt_api_connection_hazard_size_get(
- CONNECTION *connection,
- uint32_t *hazard_size)
-{
- SESSION *session = &connection->default_session;
- __wt_lock(session, connection->mtx);
- *hazard_size = connection->hazard_size;
- __wt_unlock(session, connection->mtx);
- return (0);
-}
-
-static int __wt_api_connection_hazard_size_set(
- CONNECTION *connection,
- uint32_t hazard_size);
-static int __wt_api_connection_hazard_size_set(
- CONNECTION *connection,
- uint32_t hazard_size)
-{
- SESSION *session = &connection->default_session;
- WT_RET((__wt_connection_hazard_size_set_verify(
- connection, hazard_size)));
- __wt_lock(session, connection->mtx);
- connection->hazard_size = hazard_size;
- __wt_unlock(session, connection->mtx);
- return (0);
-}
-
-static int __wt_api_connection_msgcall_get(
- CONNECTION *connection,
- void (**msgcall)(const CONNECTION *, const char *));
-static int __wt_api_connection_msgcall_get(
- CONNECTION *connection,
- void (**msgcall)(const CONNECTION *, const char *))
-{
- SESSION *session = &connection->default_session;
- __wt_lock(session, connection->mtx);
- *msgcall = connection->msgcall;
- __wt_unlock(session, connection->mtx);
- return (0);
-}
-
-static int __wt_api_connection_msgcall_set(
- CONNECTION *connection,
- void (*msgcall)(const CONNECTION *, const char *));
-static int __wt_api_connection_msgcall_set(
- CONNECTION *connection,
- void (*msgcall)(const CONNECTION *, const char *))
-{
- SESSION *session = &connection->default_session;
- __wt_lock(session, connection->mtx);
- connection->msgcall = msgcall;
- __wt_unlock(session, connection->mtx);
- return (0);
-}
-
-static int __wt_api_connection_msgfile_get(
- CONNECTION *connection,
- FILE **msgfile);
-static int __wt_api_connection_msgfile_get(
- CONNECTION *connection,
- FILE **msgfile)
-{
- SESSION *session = &connection->default_session;
- __wt_lock(session, connection->mtx);
- *msgfile = connection->msgfile;
- __wt_unlock(session, connection->mtx);
- return (0);
-}
-
-static int __wt_api_connection_msgfile_set(
- CONNECTION *connection,
- FILE *msgfile);
-static int __wt_api_connection_msgfile_set(
- CONNECTION *connection,
- FILE *msgfile)
-{
- SESSION *session = &connection->default_session;
- __wt_lock(session, connection->mtx);
- connection->msgfile = msgfile;
- __wt_unlock(session, connection->mtx);
- return (0);
-}
-
-static int __wt_api_connection_open(
- CONNECTION *connection,
- const char *home,
- mode_t mode,
- uint32_t flags);
-static int __wt_api_connection_open(
- CONNECTION *connection,
- const char *home,
- mode_t mode,
- uint32_t flags)
-{
- const char *method_name = "CONNECTION.open";
- int ret;
-
- WT_CONN_FCHK(connection, method_name, flags, WT_APIMASK_CONNECTION_OPEN);
- ret = __wt_connection_open(connection, home, mode);
- return (ret);
-}
-
-static int __wt_api_connection_session(
- CONNECTION *connection,
- uint32_t flags,
- SESSION **sessionp);
-static int __wt_api_connection_session(
- CONNECTION *connection,
- uint32_t flags,
- SESSION **sessionp)
-{
- const char *method_name = "CONNECTION.session";
- SESSION *session = &connection->default_session;
- int ret;
-
- WT_CONN_FCHK(connection, method_name, flags, WT_APIMASK_CONNECTION_SESSION);
- __wt_lock(session, connection->mtx);
- ret = __wt_connection_session(connection, sessionp);
- __wt_unlock(session, connection->mtx);
- return (ret);
-}
-
-static int __wt_api_connection_session_size_get(
- CONNECTION *connection,
- uint32_t *session_size);
-static int __wt_api_connection_session_size_get(
- CONNECTION *connection,
- uint32_t *session_size)
-{
- SESSION *session = &connection->default_session;
- __wt_lock(session, connection->mtx);
- *session_size = connection->session_size;
- __wt_unlock(session, connection->mtx);
- return (0);
-}
-
-static int __wt_api_connection_session_size_set(
- CONNECTION *connection,
- uint32_t session_size);
-static int __wt_api_connection_session_size_set(
- CONNECTION *connection,
- uint32_t session_size)
-{
- SESSION *session = &connection->default_session;
- WT_RET((__wt_connection_session_size_set_verify(
- connection, session_size)));
- __wt_lock(session, connection->mtx);
- connection->session_size = session_size;
- __wt_unlock(session, connection->mtx);
- return (0);
-}
-
-static int __wt_api_connection_stat_clear(
- CONNECTION *connection,
- uint32_t flags);
-static int __wt_api_connection_stat_clear(
- CONNECTION *connection,
- uint32_t flags)
-{
- const char *method_name = "CONNECTION.stat_clear";
- int ret;
-
- WT_CONN_FCHK(connection, method_name, flags, WT_APIMASK_CONNECTION_STAT_CLEAR);
- ret = __wt_connection_stat_clear(connection);
- return (ret);
-}
-
-static int __wt_api_connection_stat_print(
- CONNECTION *connection,
- FILE *stream,
- uint32_t flags);
-static int __wt_api_connection_stat_print(
- CONNECTION *connection,
- FILE *stream,
- uint32_t flags)
-{
- const char *method_name = "CONNECTION.stat_print";
- int ret;
-
- WT_CONN_FCHK(connection, method_name, flags, WT_APIMASK_CONNECTION_STAT_PRINT);
- ret = __wt_connection_stat_print(connection, stream);
- return (ret);
-}
-
-static int __wt_api_connection_sync(
- CONNECTION *connection,
- uint32_t flags);
-static int __wt_api_connection_sync(
- CONNECTION *connection,
- uint32_t flags)
-{
- const char *method_name = "CONNECTION.sync";
- int ret;
-
- WT_CONN_FCHK(connection, method_name, flags, WT_APIMASK_CONNECTION_SYNC);
- ret = __wt_connection_sync(connection);
- return (ret);
-}
-
-static int __wt_api_connection_verbose_get(
- CONNECTION *connection,
- uint32_t *verbose);
-static int __wt_api_connection_verbose_get(
- CONNECTION *connection,
- uint32_t *verbose)
-{
- SESSION *session = &connection->default_session;
- __wt_lock(session, connection->mtx);
- *verbose = connection->verbose;
- __wt_unlock(session, connection->mtx);
- return (0);
-}
-
-static int __wt_api_connection_verbose_set(
- CONNECTION *connection,
- uint32_t verbose);
-static int __wt_api_connection_verbose_set(
- CONNECTION *connection,
- uint32_t verbose)
-{
- SESSION *session = &connection->default_session;
- WT_RET((__wt_connection_verbose_set_verify(
- connection, verbose)));
- __wt_lock(session, connection->mtx);
- connection->verbose = verbose;
- __wt_unlock(session, connection->mtx);
- return (0);
-}
-
-static int __wt_api_session_close(
- SESSION *session,
- uint32_t flags);
-static int __wt_api_session_close(
- SESSION *session,
- uint32_t flags)
-{
- const char *method_name = "SESSION.close";
- CONNECTION *connection = S2C(session);
- int ret;
-
- WT_CONN_FCHK(connection, method_name, flags, WT_APIMASK_SESSION_CLOSE);
- __wt_lock(session, connection->mtx);
- ret = __wt_session_close(session);
- session = &connection->default_session;
- __wt_unlock(session, connection->mtx);
- return (ret);
-}
-
-void
-__wt_methods_btree_config_default(BTREE *btree)
-{
- btree->btree_compare = __wt_bt_lex_compare;
-}
-
-void
-__wt_methods_btree_lockout(BTREE *btree)
-{
- btree->btree_compare_get = (int (*)
- (BTREE *, int (**)(BTREE *, const WT_ITEM *, const WT_ITEM *)))
- __wt_btree_lockout;
- btree->btree_compare_int_get = (int (*)
- (BTREE *, int *))
- __wt_btree_lockout;
- btree->btree_compare_int_set = (int (*)
- (BTREE *, int ))
- __wt_btree_lockout;
- btree->btree_compare_set = (int (*)
- (BTREE *, int (*)(BTREE *, const WT_ITEM *, const WT_ITEM *)))
- __wt_btree_lockout;
- btree->btree_itemsize_get = (int (*)
- (BTREE *, uint32_t *, uint32_t *))
- __wt_btree_lockout;
- btree->btree_itemsize_set = (int (*)
- (BTREE *, uint32_t , uint32_t ))
- __wt_btree_lockout;
- btree->btree_pagesize_get = (int (*)
- (BTREE *, uint32_t *, uint32_t *, uint32_t *, uint32_t *, uint32_t *))
- __wt_btree_lockout;
- btree->btree_pagesize_set = (int (*)
- (BTREE *, uint32_t , uint32_t , uint32_t , uint32_t , uint32_t ))
- __wt_btree_lockout;
- btree->bulk_load = (int (*)
- (BTREE *, int (*)(BTREE *, WT_ITEM **, WT_ITEM **)))
- __wt_btree_lockout;
- btree->col_del = (int (*)
- (BTREE *, SESSION *, uint64_t , uint32_t ))
- __wt_btree_lockout;
- btree->col_put = (int (*)
- (BTREE *, SESSION *, uint64_t , WT_ITEM *, uint32_t ))
- __wt_btree_lockout;
- btree->column_set = (int (*)
- (BTREE *, uint32_t , const char *, uint32_t ))
- __wt_btree_lockout;
- btree->dump = (int (*)
- (BTREE *, FILE *, uint32_t ))
- __wt_btree_lockout;
- btree->huffman_set = (int (*)
- (BTREE *, uint8_t const *, u_int , uint32_t ))
- __wt_btree_lockout;
- btree->open = (int (*)
- (BTREE *, SESSION *, const char *, mode_t , uint32_t ))
- __wt_btree_lockout;
- btree->row_del = (int (*)
- (BTREE *, SESSION *, WT_ITEM *, uint32_t ))
- __wt_btree_lockout;
- btree->row_put = (int (*)
- (BTREE *, SESSION *, WT_ITEM *, WT_ITEM *, uint32_t ))
- __wt_btree_lockout;
- btree->salvage = (int (*)
- (BTREE *, SESSION *, uint32_t ))
- __wt_btree_lockout;
- btree->stat_clear = (int (*)
- (BTREE *, uint32_t ))
- __wt_btree_lockout;
- btree->stat_print = (int (*)
- (BTREE *, FILE *, uint32_t ))
- __wt_btree_lockout;
- btree->sync = (int (*)
- (BTREE *, SESSION *, uint32_t ))
- __wt_btree_lockout;
- btree->verify = (int (*)
- (BTREE *, SESSION *, uint32_t ))
- __wt_btree_lockout;
-}
-
-void
-__wt_methods_btree_init_transition(BTREE *btree)
-{
- btree->btree_compare_get = __wt_api_btree_btree_compare_get;
- btree->btree_compare_int_get = __wt_api_btree_btree_compare_int_get;
- btree->btree_compare_int_set = __wt_api_btree_btree_compare_int_set;
- btree->btree_compare_set = __wt_api_btree_btree_compare_set;
- btree->btree_itemsize_get = __wt_api_btree_btree_itemsize_get;
- btree->btree_itemsize_set = __wt_api_btree_btree_itemsize_set;
- btree->btree_pagesize_get = __wt_api_btree_btree_pagesize_get;
- btree->btree_pagesize_set = __wt_api_btree_btree_pagesize_set;
- btree->close = __wt_api_btree_close;
- btree->column_set = __wt_api_btree_column_set;
- btree->huffman_set = __wt_api_btree_huffman_set;
- btree->open = __wt_api_btree_open;
-}
-
-void
-__wt_methods_btree_open_transition(BTREE *btree)
-{
- btree->btree_compare_int_set = (int (*)
- (BTREE *, int ))
- __wt_btree_lockout;
- btree->btree_compare_set = (int (*)
- (BTREE *, int (*)(BTREE *, const WT_ITEM *, const WT_ITEM *)))
- __wt_btree_lockout;
- btree->btree_itemsize_set = (int (*)
- (BTREE *, uint32_t , uint32_t ))
- __wt_btree_lockout;
- btree->btree_pagesize_set = (int (*)
- (BTREE *, uint32_t , uint32_t , uint32_t , uint32_t , uint32_t ))
- __wt_btree_lockout;
- btree->column_set = (int (*)
- (BTREE *, uint32_t , const char *, uint32_t ))
- __wt_btree_lockout;
- btree->huffman_set = (int (*)
- (BTREE *, uint8_t const *, u_int , uint32_t ))
- __wt_btree_lockout;
- btree->bulk_load = __wt_api_btree_bulk_load;
- btree->col_del = __wt_api_btree_col_del;
- btree->col_put = __wt_api_btree_col_put;
- btree->dump = __wt_api_btree_dump;
- btree->row_del = __wt_api_btree_row_del;
- btree->row_put = __wt_api_btree_row_put;
- btree->salvage = __wt_api_btree_salvage;
- btree->stat_clear = __wt_api_btree_stat_clear;
- btree->stat_print = __wt_api_btree_stat_print;
- btree->sync = __wt_api_btree_sync;
- btree->verify = __wt_api_btree_verify;
-}
-
-void
-__wt_methods_connection_config_default(CONNECTION *connection)
-{
- connection->cache_size = 20;
- connection->data_update_max = 32 * 1024;
- connection->data_update_min = 8 * 1024;
- connection->hazard_size = 15;
- connection->session_size = 50;
-}
-
-void
-__wt_methods_connection_lockout(CONNECTION *connection)
-{
- connection->btree = (int (*)
- (CONNECTION *, uint32_t , BTREE **))
- __wt_connection_lockout;
- connection->cache_size_get = (int (*)
- (CONNECTION *, uint32_t *))
- __wt_connection_lockout;
- connection->cache_size_set = (int (*)
- (CONNECTION *, uint32_t ))
- __wt_connection_lockout;
- connection->data_update_max_get = (int (*)
- (CONNECTION *, uint32_t *))
- __wt_connection_lockout;
- connection->data_update_max_set = (int (*)
- (CONNECTION *, uint32_t ))
- __wt_connection_lockout;
- connection->data_update_min_get = (int (*)
- (CONNECTION *, uint32_t *))
- __wt_connection_lockout;
- connection->data_update_min_set = (int (*)
- (CONNECTION *, uint32_t ))
- __wt_connection_lockout;
- connection->hazard_size_get = (int (*)
- (CONNECTION *, uint32_t *))
- __wt_connection_lockout;
- connection->hazard_size_set = (int (*)
- (CONNECTION *, uint32_t ))
- __wt_connection_lockout;
- connection->msgcall_get = (int (*)
- (CONNECTION *, void (**)(const CONNECTION *, const char *)))
- __wt_connection_lockout;
- connection->msgcall_set = (int (*)
- (CONNECTION *, void (*)(const CONNECTION *, const char *)))
- __wt_connection_lockout;
- connection->msgfile_get = (int (*)
- (CONNECTION *, FILE **))
- __wt_connection_lockout;
- connection->msgfile_set = (int (*)
- (CONNECTION *, FILE *))
- __wt_connection_lockout;
- connection->open = (int (*)
- (CONNECTION *, const char *, mode_t , uint32_t ))
- __wt_connection_lockout;
- connection->session = (int (*)
- (CONNECTION *, uint32_t , SESSION **))
- __wt_connection_lockout;
- connection->session_size_get = (int (*)
- (CONNECTION *, uint32_t *))
- __wt_connection_lockout;
- connection->session_size_set = (int (*)
- (CONNECTION *, uint32_t ))
- __wt_connection_lockout;
- connection->stat_clear = (int (*)
- (CONNECTION *, uint32_t ))
- __wt_connection_lockout;
- connection->stat_print = (int (*)
- (CONNECTION *, FILE *, uint32_t ))
- __wt_connection_lockout;
- connection->sync = (int (*)
- (CONNECTION *, uint32_t ))
- __wt_connection_lockout;
- connection->verbose_get = (int (*)
- (CONNECTION *, uint32_t *))
- __wt_connection_lockout;
- connection->verbose_set = (int (*)
- (CONNECTION *, uint32_t ))
- __wt_connection_lockout;
-}
-
-void
-__wt_methods_connection_open_transition(CONNECTION *connection)
-{
- connection->cache_size_set = (int (*)
- (CONNECTION *, uint32_t ))
- __wt_connection_lockout;
- connection->hazard_size_set = (int (*)
- (CONNECTION *, uint32_t ))
- __wt_connection_lockout;
- connection->open = (int (*)
- (CONNECTION *, const char *, mode_t , uint32_t ))
- __wt_connection_lockout;
- connection->session_size_set = (int (*)
- (CONNECTION *, uint32_t ))
- __wt_connection_lockout;
- connection->btree = __wt_api_connection_btree;
- connection->session = __wt_api_connection_session;
- connection->sync = __wt_api_connection_sync;
-}
-
-void
-__wt_methods_connection_init_transition(CONNECTION *connection)
-{
- connection->cache_size_get = __wt_api_connection_cache_size_get;
- connection->cache_size_set = __wt_api_connection_cache_size_set;
- connection->close = __wt_api_connection_close;
- connection->data_update_max_get = __wt_api_connection_data_update_max_get;
- connection->data_update_max_set = __wt_api_connection_data_update_max_set;
- connection->data_update_min_get = __wt_api_connection_data_update_min_get;
- connection->data_update_min_set = __wt_api_connection_data_update_min_set;
- connection->hazard_size_get = __wt_api_connection_hazard_size_get;
- connection->hazard_size_set = __wt_api_connection_hazard_size_set;
- connection->msgcall_get = __wt_api_connection_msgcall_get;
- connection->msgcall_set = __wt_api_connection_msgcall_set;
- connection->msgfile_get = __wt_api_connection_msgfile_get;
- connection->msgfile_set = __wt_api_connection_msgfile_set;
- connection->open = __wt_api_connection_open;
- connection->session_size_get = __wt_api_connection_session_size_get;
- connection->session_size_set = __wt_api_connection_session_size_set;
- connection->stat_clear = __wt_api_connection_stat_clear;
- connection->stat_print = __wt_api_connection_stat_print;
- connection->verbose_get = __wt_api_connection_verbose_get;
- connection->verbose_set = __wt_api_connection_verbose_set;
-}
-
-void
-__wt_methods_session_lockout(SESSION *session)
-{
- WT_UNUSED(session);
-}
-
-void
-__wt_methods_session_init_transition(SESSION *session)
-{
- session->close = __wt_api_session_close;
-}
-
diff --git a/src/api/config_def.c b/src/api/config_def.c
index 0506297b1bb..8080292780b 100644
--- a/src/api/config_def.c
+++ b/src/api/config_def.c
@@ -3,75 +3,79 @@
#include "wt_internal.h"
const char *
-__wt_config_def_add_collator =
+__wt_confdfl_connection_add_collator =
"";
const char *
-__wt_config_def_add_cursor_type =
+__wt_confdfl_connection_add_cursor_type =
"";
const char *
-__wt_config_def_add_extractor =
+__wt_confdfl_connection_add_extractor =
"";
const char *
-__wt_config_def_begin_transaction =
+__wt_confdfl_connection_close =
+ "";
+
+const char *
+__wt_confdfl_connection_load_extension =
+ "entry=wiredtiger_extension_init,prefix=";
+
+const char *
+__wt_confdfl_connection_open_session =
+ "";
+
+const char *
+__wt_confdfl_cursor_close =
+ "";
+
+const char *
+__wt_confdfl_session_begin_transaction =
"isolation=read-committed,name=,sync=full,priority=0";
const char *
-__wt_config_def_checkpoint =
+__wt_confdfl_session_checkpoint =
"archive=false,force=false,flush_cache=true,flush_log=true,log_size=0,"
"timeout=0";
const char *
-__wt_config_def_commit_transaction =
+__wt_confdfl_session_close =
"";
const char *
-__wt_config_def_connection_close =
+__wt_confdfl_session_commit_transaction =
"";
const char *
-__wt_config_def_create_table =
+__wt_confdfl_session_create_table =
"allocation_size=512B,columns=,colgroup.name=,exclusive=false,"
"huffman_key=,huffman_value=,index.name=,intl_node_max=2KB,"
"intl_node_min=2KB,key_format=u,leaf_node_max=1MB,leaf_node_min=32KB,"
"runlength_encoding=false,value_format=u";
const char *
-__wt_config_def_cursor_close =
- "";
-
-const char *
-__wt_config_def_load_extension =
- "entry=wiredtiger_extension_init,prefix=";
-
-const char *
-__wt_config_def_open_cursor =
+__wt_confdfl_session_open_cursor =
"isolation=read-committed,overwrite=false,raw=false";
const char *
-__wt_config_def_rename_table =
- "";
-
-const char *
-__wt_config_def_rollback_transaction =
+__wt_confdfl_session_rename_table =
"";
const char *
-__wt_config_def_session_close =
+__wt_confdfl_session_rollback_transaction =
"";
const char *
-__wt_config_def_truncate_table =
+__wt_confdfl_session_truncate_table =
"";
const char *
-__wt_config_def_verify_table =
+__wt_confdfl_session_verify_table =
"";
const char *
-__wt_config_def_wiredtiger_open =
+__wt_confdfl_wiredtiger_open =
"cache_size=20MB,create=false,data_update_min=8KB,data_update_max=32KB,"
"exclusive=false,error_prefix=,hazard_size=15,logging=false,"
"session_max=50,multiprocess=false,verbose=";
diff --git a/src/api/cur_btree.c b/src/api/cur_btree.c
index 7391b9a24b8..e745d99f832 100644
--- a/src/api/cur_btree.c
+++ b/src/api/cur_btree.c
@@ -7,13 +7,6 @@
#include "wt_internal.h"
-#define CURSOR_API_CALL(c, s, n) do { \
- (s) = (SESSION *)(c)->session; \
- (s)->cursor = (c); \
- (s)->btree = ((CURSOR_BTREE *)(c))->btree; \
- (s)->name = (n); \
-} while (0)
-
/*
* __curbtree_first --
* WT_CURSOR->first method for the btree cursor type.
@@ -22,10 +15,13 @@ static int
__curbtree_first(WT_CURSOR *cursor)
{
SESSION *session;
+ int ret;
- CURSOR_API_CALL(cursor, session, "first");
+ CURSOR_API_CALL(cursor, session, first);
+ ret = __wt_btcur_first((CURSOR_BTREE *)cursor);
+ API_END();
- return (__wt_btcur_first((CURSOR_BTREE *)cursor));
+ return (ret);
}
/*
@@ -35,7 +31,10 @@ __curbtree_first(WT_CURSOR *cursor)
static int
__curbtree_last(WT_CURSOR *cursor)
{
- WT_UNUSED(cursor);
+ SESSION *session;
+
+ CURSOR_API_CALL(cursor, session, last);
+ API_END();
return (ENOTSUP);
}
@@ -48,9 +47,13 @@ static int
__curbtree_next(WT_CURSOR *cursor)
{
SESSION *session;
+ int ret;
- CURSOR_API_CALL(cursor, session, "next");
- return (__wt_btcur_next((CURSOR_BTREE *)cursor));
+ CURSOR_API_CALL(cursor, session, next);
+ ret = __wt_btcur_next((CURSOR_BTREE *)cursor);
+ API_END();
+
+ return (ret);
}
/*
@@ -60,7 +63,10 @@ __curbtree_next(WT_CURSOR *cursor)
static int
__curbtree_prev(WT_CURSOR *cursor)
{
- WT_UNUSED(cursor);
+ SESSION *session;
+
+ CURSOR_API_CALL(cursor, session, prev);
+ API_END();
return (ENOTSUP);
}
@@ -73,10 +79,13 @@ static int
__curbtree_search_near(WT_CURSOR *cursor, int *lastcmp)
{
SESSION *session;
+ int ret;
- CURSOR_API_CALL(cursor, session, "search_near");
- WT_RET(__wt_btcur_search_near((CURSOR_BTREE *)cursor, lastcmp));
- return (0);
+ CURSOR_API_CALL(cursor, session, search_near);
+ ret = __wt_btcur_search_near((CURSOR_BTREE *)cursor, lastcmp);
+ API_END();
+
+ return (ret);
}
/*
@@ -87,10 +96,13 @@ static int
__curbtree_insert(WT_CURSOR *cursor)
{
SESSION *session;
+ int ret;
- /* Only support exact searches for now */
- CURSOR_API_CALL(cursor, session, "insert");
- return (__wt_btcur_insert((CURSOR_BTREE *)cursor));
+ CURSOR_API_CALL(cursor, session, insert);
+ ret = __wt_btcur_insert((CURSOR_BTREE *)cursor);
+ API_END();
+
+ return (ret);
}
/*
@@ -100,7 +112,10 @@ __curbtree_insert(WT_CURSOR *cursor)
static int
__curbtree_update(WT_CURSOR *cursor)
{
- WT_UNUSED(cursor);
+ SESSION *session;
+
+ CURSOR_API_CALL(cursor, session, insert);
+ API_END();
return (ENOTSUP);
}
@@ -112,7 +127,10 @@ __curbtree_update(WT_CURSOR *cursor)
static int
__curbtree_remove(WT_CURSOR *cursor)
{
- WT_UNUSED(cursor);
+ SESSION *session;
+
+ CURSOR_API_CALL(cursor, session, insert);
+ API_END();
return (ENOTSUP);
}
@@ -124,11 +142,15 @@ __curbtree_remove(WT_CURSOR *cursor)
static int
__curbtree_close(WT_CURSOR *cursor, const char *config)
{
+ SESSION *session;
int ret;
+ CURSOR_API_CALL(cursor, session, close);
ret = 0;
WT_TRET(__wt_btcur_close((CURSOR_BTREE *)cursor, config));
WT_TRET(__wt_cursor_close(cursor, config));
+ API_END();
+
return (ret);
}
@@ -228,8 +250,9 @@ __wt_cursor_open(SESSION *session,
tablename, strlen(tablename), &btree_session);
if (ret == WT_NOTFOUND) {
ret = 0;
- WT_RET(conn->btree(conn, 0, &btree));
- WT_RET(btree->open(btree, session, tablename, 0666, 0));
+ WT_RET(__wt_connection_btree(conn, &btree));
+ session->btree = btree;
+ WT_RET(__wt_btree_open(session, tablename, 0666, 0));
/*
* !!! TODO read key / value formats from a table-of-tables.
diff --git a/src/btree/bt_evict.c b/src/btree/bt_evict.c
index 1f553db406b..c2ce52b0454 100644
--- a/src/btree/bt_evict.c
+++ b/src/btree/bt_evict.c
@@ -169,6 +169,7 @@ __wt_cache_evict_server(void *arg)
{
CONNECTION *conn;
SESSION *session;
+ WT_SESSION *wt_session;
WT_CACHE *cache;
WT_EVICT_REQ *er, *er_end;
int ret;
@@ -188,7 +189,8 @@ __wt_cache_evict_server(void *arg)
* handles are closed.
*/
session = &conn->default_session;
- WT_ERR(conn->session(conn, 0, &session));
+ wt_session = NULL;
+ WT_ERR(conn->iface.open_session(&conn->iface, NULL, NULL, &wt_session));
for (;;) {
WT_VERBOSE(conn,
@@ -226,7 +228,7 @@ err: __wt_err(session, ret, "cache eviction server error");
__wt_free(session, er->retry);
if (session != &conn->default_session)
- (void)__wt_session_close(session);
+ (void)wt_session->close(wt_session, NULL);
return (NULL);
}
diff --git a/src/btree/bt_read.c b/src/btree/bt_read.c
index 212aae8139a..467f3375234 100644
--- a/src/btree/bt_read.c
+++ b/src/btree/bt_read.c
@@ -125,9 +125,10 @@ void *
__wt_cache_read_server(void *arg)
{
CONNECTION *conn;
+ SESSION *session, *request_session;
WT_CACHE *cache;
WT_READ_REQ *rr, *rr_end;
- SESSION *session, *request_session;
+ WT_SESSION *wt_session;
int didwork, ret;
conn = arg;
@@ -145,10 +146,12 @@ __wt_cache_read_server(void *arg)
* handles are closed.
*/
session = &conn->default_session;
- if ((ret = conn->session(conn, 0, &session)) != 0) {
+ if ((ret = conn->iface.open_session(&conn->iface,
+ NULL, NULL, &wt_session)) != 0) {
__wt_err(session, ret, "cache read server error");
return (NULL);
}
+ session = (SESSION *)wt_session;
for (;;) {
WT_VERBOSE(conn,
diff --git a/src/db/db_getset.c b/src/db/db_getset.c
deleted file mode 100644
index 7867a70b32a..00000000000
--- a/src/db/db_getset.c
+++ /dev/null
@@ -1,58 +0,0 @@
-/*-
- * See the file LICENSE for redistribution information.
- *
- * Copyright (c) 2008-2011 WiredTiger, Inc.
- * All rights reserved.
- */
-
-#include "wt_internal.h"
-
-/*
- * __wt_btree_btree_compare_int_set_verify --
- * Verify arguments to the Db.btree_compare_int_set method.
- */
-int
-__wt_btree_btree_compare_int_set_verify(BTREE *btree, int btree_compare_int)
-{
- if (btree_compare_int >= 0 && btree_compare_int <= 8)
- return (0);
-
- __wt_errx(&btree->conn->default_session,
- "The number of bytes must be an integral value between 1 and 8");
- return (WT_ERROR);
-}
-
-/*
- * __wt_btree_column_set_verify --
- * Verify arguments to the Db.column_set method.
- */
-int
-__wt_btree_column_set_verify(
- BTREE *btree, uint32_t fixed_len, const char *dictionary, uint32_t flags)
-{
- SESSION *session;
-
- WT_UNUSED(dictionary);
-
- session = &btree->conn->default_session;
-
- /*
- * The fixed-length number of bytes is stored in a single byte, which
- * limits the size to 255 bytes.
- */
- WT_RET(__wt_api_arg_max(
- session, "BTREE.column_set", "fixed_len", fixed_len, 255));
-
- /* Run-length encoding is incompatible with variable length records. */
- if (fixed_len == 0 && LF_ISSET(WT_RLE)) {
- __wt_errx(session,
- "Run-length encoding is incompatible with variable length "
- "column-store records");
- return (WT_ERROR);
- }
-
- if (LF_ISSET(WT_RLE))
- F_SET(btree, WT_RLE);
- F_SET(btree, WT_COLUMN);
- return (0);
-}
diff --git a/src/db/db_handle.c b/src/db/db_handle.c
index 8a27e820539..a20390c2c73 100644
--- a/src/db/db_handle.c
+++ b/src/db/db_handle.c
@@ -64,10 +64,6 @@ __wt_btree_config(BTREE *btree)
WT_RET(__wt_stat_alloc_btree_stats(session, &btree->stats));
WT_RET(__wt_stat_alloc_btree_file_stats(session, &btree->fstats));
- __wt_methods_btree_config_default(btree);
- __wt_methods_btree_lockout(btree);
- __wt_methods_btree_init_transition(btree);
-
return (0);
}
diff --git a/src/db/db_huffman.c b/src/db/db_huffman.c
index ee5c2ccccc3..e5303423c8a 100644
--- a/src/db/db_huffman.c
+++ b/src/db/db_huffman.c
@@ -193,7 +193,7 @@ __wt_btree_huffman_set(BTREE *btree,
huffman_table_size = sizeof(phone);
break;
default:
-err: return (__wt_api_args(session, "Db.huffman_set"));
+err: return (__wt_api_args(session));
}
/*
diff --git a/src/db/db_open.c b/src/db/db_open.c
index 6fc001e8234..3799ab4f93a 100644
--- a/src/db/db_open.c
+++ b/src/db/db_open.c
@@ -43,9 +43,6 @@ __wt_btree_open(SESSION *session, const char *name, mode_t mode, uint32_t flags)
/* Open the underlying Btree. */
WT_RET(__wt_bt_open(session, LF_ISSET(WT_CREATE) ? 1 : 0));
- /* Turn on the methods that require open. */
- __wt_methods_btree_open_transition(btree);
-
return (0);
}
@@ -54,19 +51,20 @@ __wt_btree_open(SESSION *session, const char *name, mode_t mode, uint32_t flags)
* Db.close method (BTREE close & handle destructor).
*/
int
-__wt_btree_close(SESSION *session, uint32_t flags)
+__wt_btree_close(SESSION *session)
{
BTREE *btree;
int ret;
- WT_UNUSED(flags);
-
btree = session->btree;
ret = 0;
+ WT_ASSERT(session, btree->refcnt > 0);
+ if (--btree->refcnt > 0)
+ return (0);
+
/* Close the underlying Btree. */
ret = __wt_bt_close(session);
-
WT_TRET(__wt_btree_destroy(btree));
return (ret);
diff --git a/src/db/db_sync.c b/src/db/db_sync.c
deleted file mode 100644
index 9c8e33d697c..00000000000
--- a/src/db/db_sync.c
+++ /dev/null
@@ -1,20 +0,0 @@
-/*-
- * See the file LICENSE for redistribution information.
- *
- * Copyright (c) 2008-2011 WiredTiger, Inc.
- * All rights reserved.
- */
-
-#include "wt_internal.h"
-
-/*
- * __wt_btree_sync --
- * Flush pages to the backing file.
- */
-int
-__wt_btree_sync(SESSION *session, uint32_t flags)
-{
- WT_UNUSED(flags);
-
- return (__wt_bt_sync(session));
-}
diff --git a/src/env/env_getset.c b/src/env/env_getset.c
deleted file mode 100644
index eb92411b591..00000000000
--- a/src/env/env_getset.c
+++ /dev/null
@@ -1,69 +0,0 @@
-/*-
- * See the file LICENSE for redistribution information.
- *
- * Copyright (c) 2008-2011 WiredTiger, Inc.
- * All rights reserved.
- */
-
-#include "wt_internal.h"
-
-/*
- * __wt_connection_cache_cache_size_set_verify --
- * Verify an argument to the Env.cache_size_set method.
- */
-int
-__wt_connection_cache_size_set_verify(CONNECTION *conn, uint32_t cache_size)
-{
- return (__wt_api_arg_min(&conn->default_session,
- "Env.cache_size_set", "cache size", cache_size, 1));
-}
-
-/*
- * __wt_connection_cache_hash_size_set_verify --
- * Verify an argument to the Env.hash_size_set method.
- */
-int
-__wt_connection_cache_hash_size_set_verify(CONNECTION *conn, uint32_t hash_size)
-{
- return (__wt_api_arg_min(&conn->default_session,
- "Env.hash_size_set", "hash size", hash_size, 1));
-}
-
-/*
- * __wt_connection_cache_hazard_size_set_verify --
- * Verify an argument to the Env.hazard_size_set method.
- */
-int
-__wt_connection_hazard_size_set_verify(CONNECTION *conn, uint32_t hazard_size)
-{
- return (__wt_api_arg_min(&conn->default_session,
- "Env.hazard_size_set", "hazard size", hazard_size, 1));
-}
-
-/*
- * __wt_connection_session_size_set_verify --
- * Verify an argument to the Env.toc_size_set method.
- */
-int
-__wt_connection_session_size_set_verify(CONNECTION *conn, uint32_t toc_size)
-{
- return (__wt_api_arg_min(&conn->default_session,
- "Env.toc_size_set", "session size", toc_size, 1));
-}
-
-/*
- * __wt_connection_verbose_set_verify --
- * Verify an argument to the Env.verbose_set method.
- */
-int
-__wt_connection_verbose_set_verify(CONNECTION *conn, uint32_t verbose)
-{
-#ifdef HAVE_VERBOSE
- WT_CONN_FCHK(conn,
- "Env.verbose_set", verbose, WT_APIMASK_CONNECTION_VERBOSE_SET);
- return (0);
-#else
- return (__wt_api_config(&conn->default_session,
- "Env.verbose_set", "--enable-verbose"));
-#endif
-}
diff --git a/src/env/env_handle.c b/src/env/env_handle.c
index 7a7f187b574..585fab3d8d8 100644
--- a/src/env/env_handle.c
+++ b/src/env/env_handle.c
@@ -18,10 +18,6 @@ __wt_connection_config(CONNECTION *conn)
session = &conn->default_session;
- __wt_methods_connection_config_default(conn);
- __wt_methods_connection_lockout(conn);
- __wt_methods_connection_init_transition(conn);
-
/* Global mutex */
WT_RET(__wt_mtx_alloc(session, "CONNECTION", 0, &conn->mtx));
diff --git a/src/env/env_open.c b/src/env/env_open.c
index 845eaa85cc5..f947ba017c7 100644
--- a/src/env/env_open.c
+++ b/src/env/env_open.c
@@ -38,9 +38,6 @@ __wt_connection_open(CONNECTION *conn, const char *home, mode_t mode)
/* Create the cache. */
WT_RET(__wt_cache_create(conn));
- /* Transition to the open state. */
- __wt_methods_connection_open_transition(conn);
-
/* Start worker threads. */
F_SET(conn, WT_WORKQ_RUN | WT_SERVER_RUN);
WT_MEMORY_FLUSH;
@@ -65,18 +62,21 @@ int
__wt_connection_close(CONNECTION *conn)
{
BTREE *btree;
+ SESSION *session;
WT_FH *fh;
int ret, secondary_err;
WT_CONN_FCHK_RET(conn, "Env.close", conn->flags, WT_APIMASK_CONN, ret);
+ session = &conn->default_session;
ret = secondary_err = 0;
/* Complain if BTREE handles weren't closed. */
while ((btree = TAILQ_FIRST(&conn->dbqh)) != NULL) {
- __wt_errx(&conn->default_session,
- "Env handle has open Db handles: %s", btree->name);
- WT_TRET(btree->close(btree, &conn->default_session, 0));
+ __wt_errx(session,
+ "Connection has open btree handles: %s", btree->name);
+ session->btree = btree;
+ WT_TRET(__wt_btree_close(session));
secondary_err = WT_ERROR;
}
diff --git a/src/env/env_session.c b/src/env/env_session.c
index 8dcdf7a1901..bf9dea380bc 100644
--- a/src/env/env_session.c
+++ b/src/env/env_session.c
@@ -47,9 +47,6 @@ __wt_connection_session(CONNECTION *conn, SESSION **sessionp)
WT_RET(__wt_mtx_alloc(
&conn->default_session, "session", 1, &session->mtx));
- __wt_methods_session_lockout(session);
- __wt_methods_session_init_transition(session);
-
/* Make the entry visible to the workQ. */
conn->sessions[conn->toc_cnt++] = session;
WT_MEMORY_FLUSH;
@@ -104,58 +101,6 @@ __wt_session_close(SESSION *session)
return (ret);
}
-/*
- * __wt_session_api_set --
- * Pair SESSION and BTREE handle, allocating the SESSION as necessary.
- */
-int
-__wt_session_api_set(CONNECTION *conn, const char *name, BTREE *btree,
- SESSION **sessionp, int *islocal)
-{
- SESSION *session;
-
- /*
- * We pass around sessions internally in the Btree, (rather than a
- * BTREE), because the BTREE's are free-threaded, and the sessions are
- * per-thread. Lots of the API calls don't require the application to
- * allocate and manage the session, which means we have to do it for
- * them.
- *
- * SESSIONs always reference a BTREE handle, and we do that here, as
- * well.
- */
- if ((session = *sessionp) == NULL) {
- WT_RET(conn->session(conn, 0, sessionp));
- session = *sessionp;
- *islocal = 1;
- } else
- *islocal = 0;
- session->btree = btree;
- session->name = name;
- return (0);
-}
-
-/*
- * __wt_session_api_clr --
- * Clear the SESSION, freeing it if it was allocated by the library.
- */
-int
-__wt_session_api_clr(SESSION *session, const char *name, int islocal)
-{
- /*
- * The session should hold no more hazard references; this is a
- * diagnostic check, but it's cheap so we do it all the time.
- */
- __wt_hazard_empty(session, name);
-
- if (islocal)
- return (session->close(session, 0));
-
- session->btree = NULL;
- session->name = NULL;
- return (0);
-}
-
#ifdef HAVE_DIAGNOSTIC
static const char *__wt_session_print_state(SESSION *);
diff --git a/src/env/env_stat.c b/src/env/env_stat.c
index f5205d71f73..8cfd1416dea 100644
--- a/src/env/env_stat.c
+++ b/src/env/env_stat.c
@@ -10,11 +10,16 @@
/*
* __wt_connection_stat_print --
* Print CONNECTION handle statistics to a stream.
+ *
+ * XXX this will become a statistics cursor.
*/
int
__wt_connection_stat_print(CONNECTION *conn, FILE *stream)
{
BTREE *btree;
+ SESSION *session;
+
+ session = &conn->default_session;
fprintf(stream, "Database statistics:\n");
__wt_stat_print_conn_stats(conn->stats, stream);
@@ -25,8 +30,10 @@ __wt_connection_stat_print(CONNECTION *conn, FILE *stream)
__wt_stat_print_cache_stats(conn->cache->stats, stream);
fprintf(stream, "%s\n", conn->sep);
- TAILQ_FOREACH(btree, &conn->dbqh, q)
- WT_RET(btree->stat_print(btree, stream, 0));
+ TAILQ_FOREACH(btree, &conn->dbqh, q) {
+ session->btree = btree;
+ WT_RET(__wt_btree_stat_print(session, stream));
+ }
return (0);
}
diff --git a/src/env/env_sync.c b/src/env/env_sync.c
deleted file mode 100644
index 6868ac4e993..00000000000
--- a/src/env/env_sync.c
+++ /dev/null
@@ -1,26 +0,0 @@
-/*-
- * See the file LICENSE for redistribution information.
- *
- * Copyright (c) 2008-2011 WiredTiger, Inc.
- * All rights reserved.
- */
-
-#include "wt_internal.h"
-
-/*
- * __wt_connection_sync --
- * Flush the environment's cache.
- */
-int
-__wt_connection_sync(CONNECTION *conn)
-{
- BTREE *btree;
- int ret;
-
- ret = 0;
-
- TAILQ_FOREACH(btree, &conn->dbqh, q)
- WT_TRET(btree->sync(btree, &conn->default_session, 0));
-
- return (ret);
-}
diff --git a/src/include/api.h b/src/include/api.h
index bcc3f80f3b5..a2ac9eef5c7 100644
--- a/src/include/api.h
+++ b/src/include/api.h
@@ -54,6 +54,7 @@ typedef struct {
struct __btree {
CONNECTION *conn; /* Enclosing connection */
+ uint32_t refcnt; /* Sessions with this tree open. */
TAILQ_ENTRY(__btree) q; /* Linked list of databases */
@@ -113,83 +114,6 @@ struct __btree {
* DO NOT EDIT: automatically built by dist/api.py.
*/
- /*
- * DO NOT EDIT: automatically built by dist/api.py.
- * BTREE methods: BEGIN
- */
- int (*btree_compare_get)(
- BTREE *, int (**)(BTREE *, const WT_ITEM *, const WT_ITEM *));
-
- int (*btree_compare_int_get)(
- BTREE *, int *);
-
- int (*btree_compare_int_set)(
- BTREE *, int );
-
- int (*btree_compare_set)(
- BTREE *, int (*)(BTREE *, const WT_ITEM *, const WT_ITEM *));
-
- int (*btree_itemsize_get)(
- BTREE *, uint32_t *, uint32_t *);
-
- int (*btree_itemsize_set)(
- BTREE *, uint32_t , uint32_t );
-
- int (*btree_pagesize_get)(
- BTREE *, uint32_t *, uint32_t *, uint32_t *, uint32_t *, uint32_t *);
-
- int (*btree_pagesize_set)(
- BTREE *, uint32_t , uint32_t , uint32_t , uint32_t , uint32_t );
-
- int (*bulk_load)(
- BTREE *, int (*)(BTREE *, WT_ITEM **, WT_ITEM **));
-
- int (*close)(
- BTREE *, SESSION *, uint32_t );
-
- int (*col_del)(
- BTREE *, SESSION *, uint64_t , uint32_t );
-
- int (*col_put)(
- BTREE *, SESSION *, uint64_t , WT_ITEM *, uint32_t );
-
- int (*column_set)(
- BTREE *, uint32_t , const char *, uint32_t );
-
- int (*dump)(
- BTREE *, FILE *, uint32_t );
-
- int (*huffman_set)(
- BTREE *, uint8_t const *, u_int , uint32_t );
-
- int (*open)(
- BTREE *, SESSION *, const char *, mode_t , uint32_t );
-
- int (*row_del)(
- BTREE *, SESSION *, WT_ITEM *, uint32_t );
-
- int (*row_put)(
- BTREE *, SESSION *, WT_ITEM *, WT_ITEM *, uint32_t );
-
- int (*salvage)(
- BTREE *, SESSION *, uint32_t );
-
- int (*stat_clear)(
- BTREE *, uint32_t );
-
- int (*stat_print)(
- BTREE *, FILE *, uint32_t );
-
- int (*sync)(
- BTREE *, SESSION *, uint32_t );
-
- int (*verify)(
- BTREE *, SESSION *, uint32_t );
- /*
- * BTREE methods: END
- * DO NOT EDIT: automatically built by dist/api.py.
- */
-
uint32_t flags;
};
@@ -270,23 +194,6 @@ struct __session {
void (*msgcall)(const CONNECTION *, const char *);
FILE *msgfile;
-
- /*
- * DO NOT EDIT: automatically built by dist/api.py.
- * SESSION getter/setter variables: BEGIN
- */ /*
- * SESSION getter/setter variables: END
- */
- /*
- * DO NOT EDIT: automatically built by dist/api.py.
- * SESSION methods: BEGIN
- */
- int (*close)(
- SESSION *, uint32_t );
- /*
- * SESSION methods: END
- * DO NOT EDIT: automatically built by dist/api.py.
- */
};
/*******************************************
@@ -353,13 +260,11 @@ struct __connection {
WT_FH *log_fh; /* Logging file handle */
const char *sep; /* Display separator line */
- uint32_t flags;
-
/*
* DO NOT EDIT: automatically built by dist/api.py.
* CONNECTION getter/setter variables: BEGIN
*/
- uint32_t cache_size;
+ uint64_t cache_size;
uint32_t data_update_max;
@@ -379,83 +284,44 @@ struct __connection {
* DO NOT EDIT: automatically built by dist/api.py.
*/
- /*
- * DO NOT EDIT: automatically built by dist/api.py.
- * CONNECTION methods: BEGIN
- */
- int (*btree)(
- CONNECTION *, uint32_t , BTREE **);
-
- int (*cache_size_get)(
- CONNECTION *, uint32_t *);
-
- int (*cache_size_set)(
- CONNECTION *, uint32_t );
-
- int (*close)(
- CONNECTION *, uint32_t );
-
- int (*data_update_max_get)(
- CONNECTION *, uint32_t *);
-
- int (*data_update_max_set)(
- CONNECTION *, uint32_t );
-
- int (*data_update_min_get)(
- CONNECTION *, uint32_t *);
-
- int (*data_update_min_set)(
- CONNECTION *, uint32_t );
-
- int (*hazard_size_get)(
- CONNECTION *, uint32_t *);
-
- int (*hazard_size_set)(
- CONNECTION *, uint32_t );
-
- int (*msgcall_get)(
- CONNECTION *, void (**)(const CONNECTION *, const char *));
-
- int (*msgcall_set)(
- CONNECTION *, void (*)(const CONNECTION *, const char *));
-
- int (*msgfile_get)(
- CONNECTION *, FILE **);
-
- int (*msgfile_set)(
- CONNECTION *, FILE *);
+ uint32_t flags;
+};
- int (*open)(
- CONNECTION *, const char *, mode_t , uint32_t );
+#define API_CONF_INIT(h, n, cfg) const char *__cfg[] = \
+ { __wt_confdfl_##h##_##n, (cfg), NULL }
- int (*session)(
- CONNECTION *, uint32_t , SESSION **);
+#define API_SESSION_INIT(s, h, n, cur, bt) \
+ (s)->cursor = (cur); \
+ (s)->btree = (bt); \
+ (s)->name = #h "." #n; \
- int (*session_size_get)(
- CONNECTION *, uint32_t *);
+#define API_CALL_NOCONF(s, h, n, cur, bt) do { \
+ API_SESSION_INIT(s, h, n, cur, bt)
- int (*session_size_set)(
- CONNECTION *, uint32_t );
+#define API_CALL(s, h, n, cur, bt, cfg) do { \
+ API_CONF_INIT(h, n, cfg); \
+ API_SESSION_INIT(s, h, n, cur, bt); \
+ if (cfg != NULL) \
+ WT_RET(__wt_config_check((s), __cfg[0], (cfg)))
- int (*stat_clear)(
- CONNECTION *, uint32_t );
+#define API_END() } while (0)
- int (*stat_print)(
- CONNECTION *, FILE *, uint32_t );
+#define SESSION_API_CALL(s, n, cfg) \
+ API_CALL(s, session, n, NULL, NULL, cfg);
- int (*sync)(
- CONNECTION *, uint32_t );
+#define CONNECTION_API_CALL(conn, s, n, cfg) \
+ s = &conn->default_session; \
+ API_CALL(s, connection, n, NULL, NULL, cfg); \
- int (*verbose_get)(
- CONNECTION *, uint32_t *);
+#define CURSOR_API_CALL(cur, s, n) \
+ (s) = (SESSION *)(cur)->session; \
+ API_CALL_NOCONF(s, cursor, n, (cur), \
+ ((CURSOR_BTREE *)(cur))->btree); \
- int (*verbose_set)(
- CONNECTION *, uint32_t );
- /*
- * CONNECTION methods: END
- * DO NOT EDIT: automatically built by dist/api.py.
- */
-};
+#define CURSOR_API_CALL_CONF(cur, s, n, cfg) \
+ (s) = (SESSION *)(c)->session; \
+ API_CALL(s, cursor, n, cur, \
+ ((CURSOR_BTREE *)cursor)->btree, cfg); \
/*******************************************
* Prototypes.
@@ -480,53 +346,31 @@ extern WT_EVENT_HANDLER *__wt_event_handler_verbose;
#define WT_DEBUG 0x00000002
#define WT_HUFFMAN_KEY 0x00000004
#define WT_HUFFMAN_VALUE 0x00000002
-#define WT_MEMORY_CHECK 0x00000001
-#define WT_OSWRITE 0x00000001
+#define WT_MEMORY_CHECK 0x00000004
#define WT_PRINTABLES 0x00000001
#define WT_RDONLY 0x00000002
#define WT_RLE 0x00000001
-#define WT_SERVER_RUN 0x00000004
+#define WT_SERVER_RUN 0x00000002
#define WT_TELEPHONE 0x00000001
-#define WT_VERB_ALL 0x00000020
#define WT_VERB_EVICT 0x00000010
#define WT_VERB_FILEOPS 0x00000008
#define WT_VERB_HAZARD 0x00000004
#define WT_VERB_MUTEX 0x00000002
#define WT_VERB_READ 0x00000001
#define WT_WALK_CACHE 0x00000001
-#define WT_WORKQ_RUN 0x00000002
+#define WT_WORKQ_RUN 0x00000001
#define WT_WRITE 0x00000001
+#define WT_APIMASK_BT_DUMP 0x00000003
+#define WT_APIMASK_BT_OPEN 0x00000001
#define WT_APIMASK_BT_SEARCH_COL 0x00000001
#define WT_APIMASK_BT_SEARCH_KEY_ROW 0x00000001
#define WT_APIMASK_BT_TREE_WALK 0x00000001
#define WT_APIMASK_BTREE 0x00000007
-#define WT_APIMASK_BTREE_CLOSE 0x00000001
-#define WT_APIMASK_BTREE_COL_DEL 0x00000000
-#define WT_APIMASK_BTREE_COL_PUT 0x00000000
-#define WT_APIMASK_BTREE_COLUMN_SET 0x00000001
-#define WT_APIMASK_BTREE_DUMP 0x00000003
-#define WT_APIMASK_BTREE_HUFFMAN_SET 0x0000000f
-#define WT_APIMASK_BTREE_OPEN 0x00000003
-#define WT_APIMASK_BTREE_ROW_DEL 0x00000000
-#define WT_APIMASK_BTREE_ROW_PUT 0x00000000
-#define WT_APIMASK_BTREE_SALVAGE 0x00000000
-#define WT_APIMASK_BTREE_STAT_CLEAR 0x00000000
-#define WT_APIMASK_BTREE_STAT_PRINT 0x00000000
-#define WT_APIMASK_BTREE_SYNC 0x00000001
-#define WT_APIMASK_BTREE_VERIFY 0x00000000
#define WT_APIMASK_BUF 0x00000001
#define WT_APIMASK_CONN 0x00000007
-#define WT_APIMASK_CONNECTION_BTREE 0x00000000
-#define WT_APIMASK_CONNECTION_CLOSE 0x00000000
-#define WT_APIMASK_CONNECTION_OPEN 0x00000000
-#define WT_APIMASK_CONNECTION_SESSION 0x00000000
-#define WT_APIMASK_CONNECTION_STAT_CLEAR 0x00000000
-#define WT_APIMASK_CONNECTION_STAT_PRINT 0x00000000
-#define WT_APIMASK_CONNECTION_SYNC 0x00000000
-#define WT_APIMASK_CONNECTION_VERBOSE_SET 0x0000003f
-#define WT_APIMASK_SESSION_CLOSE 0x00000000
-#define WT_APIMASK_WIREDTIGER_CONN_INIT 0x00000001
+#define WT_APIMASK_HUFFMAN_SET 0x0000000f
+#define WT_APIMASK_VERBOSE 0x0000001f
/*
* API flags section: END
* DO NOT EDIT: automatically built by dist/api_flags.py.
diff --git a/src/include/extern.h b/src/include/extern.h
index 12d3091d18f..7c853ebffe6 100644
--- a/src/include/extern.h
+++ b/src/include/extern.h
@@ -6,16 +6,6 @@
#define WT_GCC_ATTRIBUTE(x)
#endif
-void __wt_methods_btree_config_default(BTREE *btree);
-void __wt_methods_btree_lockout(BTREE *btree);
-void __wt_methods_btree_init_transition(BTREE *btree);
-void __wt_methods_btree_open_transition(BTREE *btree);
-void __wt_methods_connection_config_default(CONNECTION *connection);
-void __wt_methods_connection_lockout(CONNECTION *connection);
-void __wt_methods_connection_open_transition(CONNECTION *connection);
-void __wt_methods_connection_init_transition(CONNECTION *connection);
-void __wt_methods_session_lockout(SESSION *session);
-void __wt_methods_session_init_transition(SESSION *session);
int __wt_config_initn(WT_CONFIG *conf, const char *str, size_t len);
int __wt_config_init(WT_CONFIG *conf, const char *str);
int __wt_config_next(WT_CONFIG *conf,
@@ -40,23 +30,24 @@ int __wt_config_checklist(SESSION *session,
int __wt_config_check(SESSION *session,
const char *defaults,
const char *config);
-const char *__wt_config_def_add_collator;
-const char *__wt_config_def_add_cursor_type;
-const char *__wt_config_def_add_extractor;
-const char *__wt_config_def_begin_transaction;
-const char *__wt_config_def_checkpoint;
-const char *__wt_config_def_commit_transaction;
-const char *__wt_config_def_connection_close;
-const char *__wt_config_def_create_table;
-const char *__wt_config_def_cursor_close;
-const char *__wt_config_def_load_extension;
-const char *__wt_config_def_open_cursor;
-const char *__wt_config_def_rename_table;
-const char *__wt_config_def_rollback_transaction;
-const char *__wt_config_def_session_close;
-const char *__wt_config_def_truncate_table;
-const char *__wt_config_def_verify_table;
-const char *__wt_config_def_wiredtiger_open;
+const char *__wt_confdfl_connection_add_collator;
+const char *__wt_confdfl_connection_add_cursor_type;
+const char *__wt_confdfl_connection_add_extractor;
+const char *__wt_confdfl_connection_close;
+const char *__wt_confdfl_connection_load_extension;
+const char *__wt_confdfl_connection_open_session;
+const char *__wt_confdfl_cursor_close;
+const char *__wt_confdfl_session_begin_transaction;
+const char *__wt_confdfl_session_checkpoint;
+const char *__wt_confdfl_session_close;
+const char *__wt_confdfl_session_commit_transaction;
+const char *__wt_confdfl_session_create_table;
+const char *__wt_confdfl_session_open_cursor;
+const char *__wt_confdfl_session_rename_table;
+const char *__wt_confdfl_session_rollback_transaction;
+const char *__wt_confdfl_session_truncate_table;
+const char *__wt_confdfl_session_verify_table;
+const char *__wt_confdfl_wiredtiger_open;
int __wt_session_add_btree(SESSION *session,
BTREE *btree,
const char *key_format,
@@ -224,12 +215,6 @@ 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_btree_compare_int_set_verify(BTREE *btree,
- int btree_compare_int);
-int __wt_btree_column_set_verify( BTREE *btree,
- uint32_t fixed_len,
- const char *dictionary,
- uint32_t flags);
int __wt_connection_btree(CONNECTION *conn, BTREE **btreep);
int __wt_btree_destroy(BTREE *btree);
int __wt_btree_lockout_err(BTREE *btree);
@@ -242,19 +227,9 @@ int __wt_btree_open(SESSION *session,
const char *name,
mode_t mode,
uint32_t flags);
-int __wt_btree_close(SESSION *session, uint32_t flags);
+int __wt_btree_close(SESSION *session);
int __wt_btree_stat_print(SESSION *session, FILE *stream);
int __wt_btree_stat_clear(BTREE *btree);
-int __wt_btree_sync(SESSION *session, uint32_t flags);
-int __wt_connection_cache_size_set_verify(CONNECTION *conn,
- uint32_t cache_size);
-int __wt_connection_cache_hash_size_set_verify(CONNECTION *conn,
- uint32_t hash_size);
-int __wt_connection_hazard_size_set_verify(CONNECTION *conn,
- uint32_t hazard_size);
-int __wt_connection_session_size_set_verify(CONNECTION *conn,
- uint32_t toc_size);
-int __wt_connection_verbose_set_verify(CONNECTION *conn, uint32_t verbose);
int __wt_library_init(void);
int __wt_breakpoint(void);
void __wt_attach(SESSION *session);
@@ -268,17 +243,10 @@ 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);
-int __wt_session_api_set(CONNECTION *conn,
- const char *name,
- BTREE *btree,
- SESSION **sessionp,
- int *islocal);
-int __wt_session_api_clr(SESSION *session, const char *name, int islocal);
void __wt_session_dump(SESSION *session);
int __wt_connection_stat_print(CONNECTION *conn, FILE *stream);
int __wt_connection_stat_clear(CONNECTION *conn);
void __wt_stat_print(WT_STATS *s, FILE *stream);
-int __wt_connection_sync(CONNECTION *conn);
void *__wt_workq_srvr(void *arg);
int __wt_log_put(SESSION *session, WT_LOGREC_DESC *recdesc, ...);
int __wt_log_printf(SESSION *session,
@@ -336,22 +304,20 @@ void __wt_assert( SESSION *session,
const char *check,
const char *file_name,
int line_number);
-int __wt_api_args(SESSION *session, const char *name);
+int __wt_api_args(SESSION *session);
int __wt_api_arg_min(SESSION *session,
- const char *name,
const char *arg_name,
- uint32_t v,
- uint32_t min);
+ uint64_t v,
+ uint64_t min);
int __wt_api_arg_max(SESSION *session,
- const char *name,
const char *arg_name,
- uint32_t v,
- uint32_t max);
-int __wt_file_method_type(SESSION *session, const char *name, int column_err);
+ uint64_t v,
+ uint64_t max);
+int __wt_file_method_type(SESSION *session, int column_err);
int __wt_file_wrong_fixed_size(SESSION *session,
uint32_t len,
uint32_t config_len);
-int __wt_file_readonly(SESSION *session, const char *name);
+int __wt_file_readonly(SESSION *session);
int __wt_file_format(SESSION *session);
int __wt_file_item_too_big(SESSION *session);
int __wt_session_lockout(SESSION *session);
diff --git a/src/include/misc.h b/src/include/misc.h
index 57dc36ffacf..cfeb31c75ed 100644
--- a/src/include/misc.h
+++ b/src/include/misc.h
@@ -89,12 +89,18 @@ extern "C" {
* about implicit conversions of integers. Using the largest unsigned type,
* there's no defined bit mask type or maximum value.
*/
-#define WT_CONN_FCHK_RET(conn, name, f, mask, ret) \
- if ((f) & ~((uintmax_t)(mask))) \
- ret = __wt_api_args(&(conn)->default_session, (name));
-#define WT_CONN_FCHK(conn, name, f, mask) \
- if ((f) & ~((uintmax_t)(mask))) \
- return (__wt_api_args(&(conn)->default_session, (name)));
+#define WT_CONN_FCHK_RET(conn, n, f, mask, ret) do { \
+ if ((f) & ~((uintmax_t)(mask))) { \
+ (conn)->default_session.name = (n); \
+ ret = __wt_api_args(&(conn)->default_session); \
+ } \
+} while (0)
+#define WT_CONN_FCHK(conn, n, f, mask) do { \
+ if ((f) & ~((uintmax_t)(mask))) { \
+ (conn)->default_session.name = (n); \
+ return (__wt_api_args(&(conn)->default_session)); \
+ } \
+} while (0)
#define WT_DB_FCHK(btree, name, f, mask) \
WT_CONN_FCHK((btree)->conn, (name), (f), (mask))
@@ -137,7 +143,7 @@ extern "C" {
/* Output a verbose message. */
#ifdef HAVE_VERBOSE
#define WT_VERBOSE(conn, f, msg) do { \
- if (FLD_ISSET((conn)->verbose, WT_VERB_ALL | (f))) \
+ if (FLD_ISSET((conn)->verbose, (f))) \
__wt_msg msg; \
} while (0)
#else
diff --git a/src/include/wiredtiger.in b/src/include/wiredtiger.in
index 8a01a384122..6d351a00ef9 100644
--- a/src/include/wiredtiger.in
+++ b/src/include/wiredtiger.in
@@ -124,6 +124,7 @@ typedef struct {
uint32_t mem_size;
void *mem;
+#define WT_BUF_INUSE 0x00000001
uint32_t flags;
} WT_BUF;
/*!
@@ -344,7 +345,7 @@ struct wt_cursor {
* @skipline cursor->close
*
* @param cursor the cursor handle
- * @configstart{cursor_close, maintained in dist/config_data.py}
+ * @configstart{cursor.close, maintained in dist/config_data.py}
* @configend
* @errors
*/
@@ -401,7 +402,7 @@ struct wt_session {
* @skipline session->close
*
* @param session the session handle
- * @configstart{session_close, maintained in dist/config_data.py}
+ * @configstart{session.close, maintained in dist/config_data.py}
* @configend
* @errors
*/
@@ -454,7 +455,7 @@ struct wt_session {
* @param uri the data source on which the cursor operates
* @param to_dup a cursor to duplicate
* @param session the session handle
- * @configstart{open_cursor, maintained in dist/config_data.py}
+ * @configstart{session.open_cursor, maintained in dist/config_data.py}
* @config{isolation, the isolation level for this cursor\, one of
* "snapshot" or "read-committed" or "read-uncommitted". Ignored for
* transactional cursors}
@@ -483,7 +484,7 @@ struct wt_session {
*
* @param session the session handle
* @param name the name of the table
- * @configstart{create_table, maintained in dist/config_data.py}
+ * @configstart{session.create_table, maintained in dist/config_data.py}
* @config{allocation_size, file unit allocation size\, in bytes}
* @config{columns, list of the column names. Comma-separated list of
* the form <code>(column[\,...])</code>. The number of entries must
@@ -531,7 +532,7 @@ struct wt_session {
* @param session the session handle
* @param oldname the current name of the table
* @param newname the new name of the table
- * @configstart{rename_table, maintained in dist/config_data.py}
+ * @configstart{session.rename_table, maintained in dist/config_data.py}
* @configend
* @errors
*/
@@ -545,7 +546,7 @@ struct wt_session {
*
* @param session the session handle
* @param name the name of the table
- * @configstart{rename_table, maintained in dist/config_data.py}
+ * @configstart{session.rename_table, maintained in dist/config_data.py}
* @configend
* @errors
*/
@@ -566,7 +567,7 @@ struct wt_session {
* operation. If <code>NULL</code>, the truncate continues to the end
* of the table
* @param name the name of the table
- * @configstart{truncate_table, maintained in dist/config_data.py}
+ * @configstart{session.truncate_table, maintained in dist/config_data.py}
* @configend
* @errors
*/
@@ -582,7 +583,7 @@ struct wt_session {
*
* @param session the session handle
* @param name the name of the table
- * @configstart{verify_table, maintained in dist/config_data.py}
+ * @configstart{session.verify_table, maintained in dist/config_data.py}
* @configend
* @errors
*/
@@ -608,7 +609,7 @@ struct wt_session {
* @skipline ->begin_transaction
*
* @param session the session handle
- * @configstart{begin_transaction, maintained in dist/config_data.py}
+ * @configstart{session.begin_transaction, maintained in dist/config_data.py}
* @config{isolation, the isolation level for this transaction\, one of
* "serializable"\, "snapshot"\, "read-committed" or "read-uncommitted";
* default "serializable"}
@@ -634,7 +635,7 @@ struct wt_session {
* @skipline ->commit_transaction
*
* @param session the session handle
- * @configstart{commit_transaction, maintained in dist/config_data.py}
+ * @configstart{session.commit_transaction, maintained in dist/config_data.py}
* @configend
* @errors
*/
@@ -651,7 +652,7 @@ struct wt_session {
* @skipline ->rollback_transaction
*
* @param session the session handle
- * @configstart{rollback_transaction, maintained in dist/config_data.py}
+ * @configstart{session.rollback_transaction, maintained in dist/config_data.py}
* @configend
* @errors
*/
@@ -663,7 +664,7 @@ struct wt_session {
* @skipline ->checkpoint
*
* @param session the session handle
- * @configstart{checkpoint, maintained in dist/config_data.py}
+ * @configstart{session.checkpoint, maintained in dist/config_data.py}
* @config{archive, remove log files no longer required for
* transactional durabilty}
* @config{force, write a new checkpoint even if nothing has changed
@@ -699,7 +700,7 @@ struct wt_connection {
*
* @param connection the connection handle
* @param path the filename of the extension module
- * @configstart{load_extension, maintained in dist/config_data.py}
+ * @configstart{connection.load_extension, maintained in dist/config_data.py}
* @config{entry, the entry point of the extension}
* @config{prefix, a prefix for all names registered by this extension
* (e.g.\, to make namespaces distinct or during upgrades}
@@ -727,7 +728,7 @@ struct wt_connection {
* WT_SESSION::open_cursor
* @param ctype the application-supplied code to manage cursors of
* this type
- * @configstart{add_cursor_type, maintained in dist/config_data.py}
+ * @configstart{connection.add_cursor_type, maintained in dist/config_data.py}
* @configend
* @errors
*/
@@ -751,7 +752,7 @@ struct wt_connection {
* @param name the name of the collation to be used in calls to
* WT_SESSION::create_table
* @param collator the application-supplied collation handler
- * @configstart{add_collator, maintained in dist/config_data.py}
+ * @configstart{connection.add_collator, maintained in dist/config_data.py}
* @configend
* @errors
*/
@@ -775,7 +776,7 @@ struct wt_connection {
* @param name the name of the extractor to be used in calls to
* WT_SESSION::create_table
* @param extractor the application-supplied extractor
- * @configstart{add_extractor, maintained in dist/config_data.py}
+ * @configstart{connection.add_extractor, maintained in dist/config_data.py}
* @configend
* @errors
*/
@@ -790,7 +791,7 @@ struct wt_connection {
* @skipline conn->close
*
* @param connection the connection handle
- * @configstart{connection_close, maintained in dist/config_data.py}
+ * @configstart{connection.close, maintained in dist/config_data.py}
* @configend
* @errors
*/
diff --git a/src/support/err.c b/src/support/err.c
index 8c7f84191a5..875b7d40754 100644
--- a/src/support/err.c
+++ b/src/support/err.c
@@ -80,10 +80,9 @@ __wt_assert(
* arguments.
*/
int
-__wt_api_args(SESSION *session, const char *name)
+__wt_api_args(SESSION *session)
{
- __wt_errx(session,
- "%s: illegal API arguments or flag values specified", name);
+ __wt_errx(session, "illegal API arguments or flag values specified");
return (WT_ERROR);
}
@@ -93,15 +92,14 @@ __wt_api_args(SESSION *session, const char *name)
* too-small argument.
*/
int
-__wt_api_arg_min(SESSION *session,
- const char *name, const char *arg_name, uint32_t v, uint32_t min)
+__wt_api_arg_min(SESSION *session, const char *arg_name,
+ uint64_t v, uint64_t min)
{
if (v >= min)
return (0);
- __wt_errx(session,
- "%s: %s argument less than minimum value of %lu",
- name, arg_name, (u_long)min);
+ __wt_errx(session, "%s argument %llu less than minimum value of %llu",
+ arg_name, (unsigned long long)v, (unsigned long long)min);
return (WT_ERROR);
}
@@ -111,15 +109,14 @@ __wt_api_arg_min(SESSION *session,
* too-large argument.
*/
int
-__wt_api_arg_max(SESSION *session,
- const char *name, const char *arg_name, uint32_t v, uint32_t max)
+__wt_api_arg_max(SESSION *session, const char *arg_name,
+ uint64_t v, uint64_t max)
{
if (v <= max)
return (0);
- __wt_errx(session,
- "%s: %s argument larger than maximum value of %lu",
- name, arg_name, (u_long)max);
+ __wt_errx(session, "%s argument %llu larger than maximum value of %llu",
+ arg_name, (unsigned long long)v, (unsigned long long)max);
return (WT_ERROR);
}
@@ -129,11 +126,11 @@ __wt_api_arg_max(SESSION *session,
* for a file type.
*/
int
-__wt_file_method_type(SESSION *session, const char *name, int column_err)
+__wt_file_method_type(SESSION *session, int column_err)
{
__wt_errx(session,
- "%s: this method is not supported for a %s file",
- name, column_err ? "column-store" : "row-store");
+ "this method is not supported for a %s file",
+ column_err ? "column-store" : "row-store");
return (WT_ERROR);
}
@@ -157,10 +154,10 @@ __wt_file_wrong_fixed_size(SESSION *session, uint32_t len, uint32_t config_len)
* Print a standard error message on attempts to modify a read-only file.
*/
int
-__wt_file_readonly(SESSION *session, const char *name)
+__wt_file_readonly(SESSION *session)
{
__wt_errx(session,
- "%s: the file was opened read-only and may not be modified", name);
+ "the file was opened read-only and may not be modified");
return (WT_READONLY);
}
diff --git a/src/utilities/util_dump.c b/src/utilities/util_dump.c
index 88caaee6e9a..15293236500 100644
--- a/src/utilities/util_dump.c
+++ b/src/utilities/util_dump.c
@@ -9,6 +9,7 @@
#include "util.h"
const char *progname;
+extern WT_EVENT_HANDLER *__wt_event_handler_verbose;
int usage(void);
@@ -19,17 +20,17 @@ main(int argc, char *argv[])
WT_SESSION *session;
WT_CURSOR *cursor;
WT_ITEM key, value;
- const char *tablename, *home;
+ const char *home, *tablename;
char cursor_config[100], datasrc[100];
- int ch, debug, printable, ret, tret;
+ int ch, debug, printable, ret, tret, verbose;
WT_UTILITY_INTRO(progname, argv);
conn = NULL;
home = NULL;
- debug = printable = 0;
+ debug = printable = verbose = 0;
- while ((ch = getopt(argc, argv, "df:h:p")) != EOF)
+ while ((ch = getopt(argc, argv, "df:h:pVv")) != EOF)
switch (ch) {
case 'd':
debug = 1;
@@ -50,6 +51,9 @@ main(int argc, char *argv[])
case 'V': /* version */
printf("%s\n", wiredtiger_version(NULL, NULL, NULL));
return (EXIT_SUCCESS);
+ case 'v': /* version */
+ verbose = 1;
+ break;
case '?':
default:
return (usage());
@@ -62,7 +66,8 @@ main(int argc, char *argv[])
return (usage());
tablename = *argv;
- if ((ret = wiredtiger_open(home, NULL, NULL, &conn)) != 0 ||
+ if ((ret = wiredtiger_open(home, verbose ?
+ __wt_event_handler_verbose : NULL, NULL, &conn)) != 0 ||
(ret = conn->open_session(conn, NULL, NULL, &session)) != 0)
goto err;
diff --git a/src/utilities/util_salvage.c b/src/utilities/util_salvage.c
index d55a65804b4..9462c844fa2 100644
--- a/src/utilities/util_salvage.c
+++ b/src/utilities/util_salvage.c
@@ -15,14 +15,22 @@ int usage(void);
int
main(int argc, char *argv[])
{
- BTREE *btree;
- int ch, ret, tret, verbose;
+ WT_CONNECTION *conn;
+ WT_SESSION *session;
+ const char *home, *tablename;
+ int ch, debug, ret, tret, verbose;
WT_UTILITY_INTRO(progname, argv);
- verbose = 0;
- while ((ch = getopt(argc, argv, "Vv")) != EOF)
+ debug = verbose = 0;
+ while ((ch = getopt(argc, argv, "dh:Vv")) != EOF)
switch (ch) {
+ case 'd':
+ debug = 1;
+ break;
+ case 'h': /* home directory */
+ home = optarg;
+ break;
case 'v': /* verbose */
verbose = 1;
break;
@@ -39,28 +47,26 @@ main(int argc, char *argv[])
/* The remaining argument is the file name. */
if (argc != 1)
return (usage());
+ tablename = *argv;
- if ((ret = wiredtiger_simple_setup(progname, verbose ?
- __wt_event_handler_verbose : NULL, NULL, &btree)) == 0) {
- if ((ret = btree->open(btree, NULL, *argv, 0, 0)) != 0) {
- fprintf(stderr, "%s: btree.open(%s): %s\n",
- progname, *argv, wiredtiger_strerror(ret));
- goto err;
- }
- /* XXX verbose */
- if ((ret = btree->salvage(btree, NULL, 0)) != 0) {
- fprintf(stderr, "%s: btree.salvage(%s): %s\n",
- progname, *argv, wiredtiger_strerror(ret));
- goto err;
- }
- if (verbose)
- printf("\n");
+ if ((ret = wiredtiger_open(home, verbose ?
+ __wt_event_handler_verbose : NULL, NULL, &conn)) != 0 ||
+ (ret = conn->open_session(conn, NULL, NULL, &session)) != 0)
+ goto err;
+
+ if ((ret = session->verify_table(session,
+ tablename, "salvage")) != 0) {
+ fprintf(stderr, "%s: salvage(%s): %s\n",
+ progname, tablename, wiredtiger_strerror(ret));
+ goto err;
}
+ if (verbose)
+ printf("\n");
if (0) {
err: ret = 1;
}
- if ((tret = wiredtiger_simple_teardown(progname, btree)) != 0 && ret == 0)
+ if (conn != NULL && (tret = conn->close(conn, NULL)) != 0 && ret == 0)
ret = tret;
return (ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
}
@@ -68,6 +74,6 @@ err: ret = 1;
int
usage(void)
{
- (void)fprintf(stderr, "usage: %s [-Vv] file\n", progname);
+ (void)fprintf(stderr, "usage: %s [-dVv] [-h home] file\n", progname);
return (EXIT_FAILURE);
}
diff --git a/src/utilities/util_stat.c b/src/utilities/util_stat.c
index 1123fd0e728..765126960de 100644
--- a/src/utilities/util_stat.c
+++ b/src/utilities/util_stat.c
@@ -15,14 +15,28 @@ int usage(void);
int
main(int argc, char *argv[])
{
- BTREE *btree;
- int ch, ret, tret, verbose;
+ WT_CONNECTION *conn;
+ WT_SESSION *session;
+ WT_CURSOR *cursor;
+ WT_ITEM key, value;
+ const char *home, *srcname;
+ char cursor_config[100], datasrc[100];
+ int ch, debug, ret, tret, verbose;
WT_UTILITY_INTRO(progname, argv);
- verbose = 0;
- while ((ch = getopt(argc, argv, "Vv")) != EOF)
+ conn = NULL;
+ home = NULL;
+ debug = verbose = 0;
+
+ while ((ch = getopt(argc, argv, "dh:Vv")) != EOF)
switch (ch) {
+ case 'd':
+ debug = 1;
+ break;
+ case 'h': /* home directory */
+ home = optarg;
+ break;
case 'V': /* version */
printf("%s\n", wiredtiger_version(NULL, NULL, NULL));
return (EXIT_SUCCESS);
@@ -39,25 +53,44 @@ main(int argc, char *argv[])
/* The remaining argument is the file name. */
if (argc != 1)
return (usage());
+ srcname = *argv;
- if ((ret = wiredtiger_simple_setup(progname, verbose ?
- __wt_event_handler_verbose : NULL, NULL, &btree)) == 0) {
- if ((ret = btree->open(btree, NULL, *argv, 0, 0)) != 0) {
- fprintf(stderr, "%s: db.open(%s): %s\n",
- progname, *argv, wiredtiger_strerror(ret));
- goto err;
- }
- if ((ret = btree->stat_print(btree, stdout, 0)) != 0) {
- fprintf(stderr, "%s: db.stat(%s): %s\n",
- progname, *argv, wiredtiger_strerror(ret));
- goto err;
- }
+ if ((ret = wiredtiger_open(home, verbose ?
+ __wt_event_handler_verbose : NULL, NULL, &conn)) != 0 ||
+ (ret = conn->open_session(conn, NULL, NULL, &session)) != 0)
+ goto err;
+
+ snprintf(datasrc, sizeof(datasrc), "stat:%s", srcname);
+ snprintf(cursor_config, sizeof(cursor_config), "dump=print%s",
+ debug ? ",debug" : "");
+
+
+ if ((ret = session->open_cursor(session, datasrc, NULL,
+ cursor_config, &cursor)) != 0) {
+ fprintf(stderr, "%s: cursor open(%s) failed: %s\n",
+ progname, datasrc, wiredtiger_strerror(ret));
+ goto err;
+ }
+
+ while ((ret = cursor->next(cursor)) == 0) {
+ cursor->get_key(cursor, &key);
+ fwrite(key.data, key.size, 1, stdout);
+ fwrite("\n", 1, 1, stdout);
+ cursor->get_value(cursor, &value);
+ fwrite(value.data, value.size, 1, stdout);
+ fwrite("\n", 1, 1, stdout);
+ }
+
+ if (ret != WT_NOTFOUND) {
+ fprintf(stderr, "%s: cursor get(%s) failed: %s\n",
+ progname, datasrc, wiredtiger_strerror(ret));
+ goto err;
}
if (0) {
err: ret = 1;
}
- if ((tret = wiredtiger_simple_teardown(progname, btree)) != 0 && ret == 0)
+ if (conn != NULL && (tret = conn->close(conn, NULL)) != 0 && ret == 0)
ret = tret;
return (ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
}
diff --git a/src/utilities/util_verify.c b/src/utilities/util_verify.c
index 73fc7ba5252..12caddeca54 100644
--- a/src/utilities/util_verify.c
+++ b/src/utilities/util_verify.c
@@ -15,14 +15,23 @@ int usage(void);
int
main(int argc, char *argv[])
{
- BTREE *btree;
- int ch, ret, tret, verbose;
+ WT_CONNECTION *conn;
+ WT_SESSION *session;
+ const char *home, *tablename;
+ int ch, debug, ret, tret, verbose;
WT_UTILITY_INTRO(progname, argv);
- verbose = 0;
- while ((ch = getopt(argc, argv, "Vv")) != EOF)
+ home = NULL;
+ debug = verbose = 0;
+ while ((ch = getopt(argc, argv, "dh:Vv")) != EOF)
switch (ch) {
+ case 'd':
+ debug = 1;
+ break;
+ case 'h': /* home directory */
+ home = optarg;
+ break;
case 'v': /* verbose */
verbose = 1;
break;
@@ -39,28 +48,25 @@ main(int argc, char *argv[])
/* The remaining argument is the file name. */
if (argc != 1)
return (usage());
+ tablename = *argv;
- if ((ret = wiredtiger_simple_setup(progname, verbose ?
- __wt_event_handler_verbose : NULL, NULL, &btree)) == 0) {
- if ((ret = btree->open(btree, NULL, *argv, 0, 0)) != 0) {
- fprintf(stderr, "%s: btree.open(%s): %s\n",
- progname, *argv, wiredtiger_strerror(ret));
- goto err;
- }
- /* XXX verbose */
- if ((ret = btree->verify(btree, NULL, 0)) != 0) {
- fprintf(stderr, "%s: btree.verify(%s): %s\n",
- progname, *argv, wiredtiger_strerror(ret));
- goto err;
- }
- if (verbose)
- printf("\n");
+ if ((ret = wiredtiger_open(home, verbose ?
+ __wt_event_handler_verbose : NULL, NULL, &conn)) != 0 ||
+ (ret = conn->open_session(conn, NULL, NULL, &session)) != 0)
+ goto err;
+
+ if ((ret = session->verify_table(session, tablename, NULL)) != 0) {
+ fprintf(stderr, "%s: salvage(%s): %s\n",
+ progname, tablename, wiredtiger_strerror(ret));
+ goto err;
}
+ if (verbose)
+ printf("\n");
if (0) {
err: ret = 1;
}
- if ((tret = wiredtiger_simple_teardown(progname, btree)) != 0 && ret == 0)
+ if (conn != NULL && (tret = conn->close(conn, NULL)) != 0 && ret == 0)
ret = tret;
return (ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
}