diff options
author | Keith Bostic <keith@wiredtiger.com> | 2015-03-20 14:06:10 -0400 |
---|---|---|
committer | Keith Bostic <keith@wiredtiger.com> | 2015-03-20 14:06:10 -0400 |
commit | 006edd3c2cd8c03548bf6ea0e52df17bd91c9ebf (patch) | |
tree | ceeb62809f8181374a33c12111b7added5f5da63 /src | |
parent | 8f1f971e32bc9595e6edfd118512e2c565b9b5d3 (diff) | |
parent | c31c137853be95ac1a34a8e83c4ee399140a40e9 (diff) | |
download | mongo-006edd3c2cd8c03548bf6ea0e52df17bd91c9ebf.tar.gz |
Merge branch 'develop' into base-config-crash
Diffstat (limited to 'src')
-rw-r--r-- | src/btree/bt_delete.c | 8 | ||||
-rw-r--r-- | src/btree/bt_handle.c | 4 | ||||
-rw-r--r-- | src/btree/bt_huffman.c | 130 | ||||
-rw-r--r-- | src/btree/bt_page.c | 9 | ||||
-rw-r--r-- | src/btree/bt_read.c | 2 | ||||
-rw-r--r-- | src/btree/bt_slvg.c | 4 | ||||
-rw-r--r-- | src/btree/bt_split.c | 6 | ||||
-rw-r--r-- | src/btree/row_modify.c | 2 | ||||
-rw-r--r-- | src/config/config_check.c | 3 | ||||
-rw-r--r-- | src/config/config_def.c | 878 | ||||
-rw-r--r-- | src/conn/conn_api.c | 27 | ||||
-rw-r--r-- | src/cursor/cur_index.c | 73 | ||||
-rw-r--r-- | src/docs/upgrading.dox | 7 | ||||
-rw-r--r-- | src/evict/evict_lru.c | 18 | ||||
-rw-r--r-- | src/include/btmem.h | 11 | ||||
-rw-r--r-- | src/include/config.h | 1 | ||||
-rw-r--r-- | src/include/extern.h | 3 | ||||
-rw-r--r-- | src/include/os_windows.h | 2 | ||||
-rw-r--r-- | src/include/schema.h | 3 | ||||
-rw-r--r-- | src/include/wiredtiger.in | 4 | ||||
-rw-r--r-- | src/log/log.c | 2 | ||||
-rw-r--r-- | src/os_posix/os_alloc.c | 11 | ||||
-rw-r--r-- | src/schema/schema_list.c | 9 | ||||
-rw-r--r-- | src/schema/schema_open.c | 18 | ||||
-rw-r--r-- | src/session/session_api.c | 8 | ||||
-rw-r--r-- | src/support/huffman.c | 25 |
26 files changed, 744 insertions, 524 deletions
diff --git a/src/btree/bt_delete.c b/src/btree/bt_delete.c index 479f6547e42..8cca6328f21 100644 --- a/src/btree/bt_delete.c +++ b/src/btree/bt_delete.c @@ -264,6 +264,7 @@ __wt_delete_page_instantiate(WT_SESSION_IMPL *session, WT_REF *ref) WT_PAGE *page; WT_PAGE_DELETED *page_del; WT_UPDATE **upd_array, *upd; + size_t size; uint32_t i; btree = S2BT(session); @@ -323,7 +324,7 @@ __wt_delete_page_instantiate(WT_SESSION_IMPL *session, WT_REF *ref) * structures, fill in the per-page update array with references to * deleted items. */ - for (i = 0; i < page->pg_row_entries; ++i) { + for (i = 0, size = 0; i < page->pg_row_entries; ++i) { WT_ERR(__wt_calloc_one(session, &upd)); WT_UPDATE_DELETED_SET(upd); @@ -336,10 +337,11 @@ __wt_delete_page_instantiate(WT_SESSION_IMPL *session, WT_REF *ref) upd->next = upd_array[i]; upd_array[i] = upd; + + size += sizeof(WT_UPDATE *) + WT_UPDATE_MEMSIZE(upd); } - __wt_cache_page_inmem_incr(session, page, - page->pg_row_entries * (sizeof(WT_UPDATE *) + sizeof(WT_UPDATE))); + __wt_cache_page_inmem_incr(session, page, size); return (0); diff --git a/src/btree/bt_handle.c b/src/btree/bt_handle.c index 4d11675fd38..430795288f2 100644 --- a/src/btree/bt_handle.c +++ b/src/btree/bt_handle.c @@ -376,9 +376,9 @@ __wt_btree_tree_open( * the page steals it. */ WT_ERR(__wt_bt_read(session, &dsk, addr, addr_size)); - WT_ERR(__wt_page_inmem(session, NULL, dsk.data, + WT_ERR(__wt_page_inmem(session, NULL, dsk.data, dsk.memsize, WT_DATA_IN_ITEM(&dsk) ? - WT_PAGE_DISK_ALLOC : WT_PAGE_DISK_MAPPED , &page)); + WT_PAGE_DISK_ALLOC : WT_PAGE_DISK_MAPPED, &page)); dsk.mem = NULL; /* Finish initializing the root, root reference links. */ diff --git a/src/btree/bt_huffman.c b/src/btree/bt_huffman.c index 93e67d16abe..80352a0f56c 100644 --- a/src/btree/bt_huffman.c +++ b/src/btree/bt_huffman.c @@ -128,28 +128,66 @@ static const struct __wt_huffman_table __wt_huffman_nytenglish[] = { static int __wt_huffman_read(WT_SESSION_IMPL *, WT_CONFIG_ITEM *, struct __wt_huffman_table **, u_int *, u_int *); -#define WT_HUFFMAN_CONFIG_VALID(str, len) \ - (WT_STRING_MATCH("english", (str), (len)) || \ - WT_PREFIX_MATCH((str), "utf8") || WT_PREFIX_MATCH((str), "utf16")) - /* - * __btree_huffman_config -- - * Verify the key or value strings passed in. + * __huffman_confchk_file -- + * Check for a Huffman configuration file and return the file name. */ static int -__btree_huffman_config(WT_SESSION_IMPL *session, - WT_CONFIG_ITEM *key_conf, WT_CONFIG_ITEM *value_conf) +__huffman_confchk_file( + WT_SESSION_IMPL *session, WT_CONFIG_ITEM *v, int *is_utf8p, FILE **fpp) { - if (key_conf->len != 0 && - !WT_HUFFMAN_CONFIG_VALID(key_conf->str, key_conf->len)) - WT_RET_MSG( - session, EINVAL, "illegal Huffman key configuration"); - if (value_conf->len != 0 && - !WT_HUFFMAN_CONFIG_VALID(value_conf->str, value_conf->len)) - WT_RET_MSG( - session, EINVAL, "illegal Huffman value configuration"); + FILE *fp; + size_t len; + char *fname; + + /* Look for a prefix and file name. */ + len = 0; + if (is_utf8p != NULL) + *is_utf8p = 0; + if (WT_PREFIX_MATCH(v->str, "utf8")) { + if (is_utf8p != NULL) + *is_utf8p = 1; + len = strlen("utf8"); + } else if (WT_PREFIX_MATCH(v->str, "utf16")) + len = strlen("utf16"); + if (len == 0 || len >= v->len) + WT_RET_MSG(session, EINVAL, + "illegal Huffman configuration: %.*s", (int)v->len, v->str); + + /* Check the file exists. */ + WT_RET(__wt_strndup(session, v->str + len, v->len - len, &fname)); + fp = fopen(fname, "r"); + __wt_free(session, fname); + if (fp == NULL) + WT_RET_MSG(session, __wt_errno(), + "unable to read Huffman table file %s", fname); + + /* Optionally return the file handle. */ + if (fpp == NULL) + (void)fclose(fp); + else + *fpp = fp; + return (0); +} + +/* + * __wt_huffman_confchk -- + * Verify Huffman configuration. + */ +int +__wt_huffman_confchk(WT_SESSION_IMPL *session, WT_CONFIG_ITEM *v) +{ + if (v->len == 0) + return (0); + /* Standard Huffman encodings, no work to be done. */ + if (WT_STRING_MATCH("english", v->str, v->len)) + return (0); + if (WT_STRING_MATCH("none", v->str, v->len)) + return (0); + + return (__huffman_confchk_file(session, v, NULL, NULL)); } /* @@ -170,11 +208,12 @@ __wt_btree_huffman_open(WT_SESSION_IMPL *session) cfg = btree->dhandle->cfg; WT_RET(__wt_config_gets_none(session, cfg, "huffman_key", &key_conf)); + WT_RET(__wt_huffman_confchk(session, &key_conf)); WT_RET( __wt_config_gets_none(session, cfg, "huffman_value", &value_conf)); + WT_RET(__wt_huffman_confchk(session, &value_conf)); if (key_conf.len == 0 && value_conf.len == 0) return (0); - WT_RET(__btree_huffman_config(session, &key_conf, &value_conf)); switch (btree->type) { /* Check file type compatibility. */ case BTREE_COL_FIX: @@ -261,54 +300,37 @@ __wt_huffman_read(WT_SESSION_IMPL *session, WT_CONFIG_ITEM *ip, struct __wt_huffman_table *table, *tp; FILE *fp; WT_DECL_RET; - uint64_t symbol, frequency; + int64_t symbol, frequency; u_int entries, lineno; - char *file; + int is_utf8; *tablep = NULL; *entriesp = *numbytesp = 0; fp = NULL; - file = NULL; table = NULL; /* + * Try and open the backing file. + */ + WT_RET(__huffman_confchk_file(session, ip, &is_utf8, &fp)); + + /* * UTF-8 table is 256 bytes, with a range of 0-255. * UTF-16 is 128KB (2 * 65536) bytes, with a range of 0-65535. */ - if (strncmp(ip->str, "utf8", 4) == 0) { + if (is_utf8) { entries = UINT8_MAX; *numbytesp = 1; WT_ERR(__wt_calloc_def(session, entries, &table)); - - if (ip->len == 4) - WT_ERR_MSG(session, EINVAL, - "no Huffman table file name specified"); - WT_ERR(__wt_calloc_def(session, ip->len, &file)); - memcpy(file, ip->str + 4, ip->len - 4); - } else if (strncmp(ip->str, "utf16", 5) == 0) { + } else { entries = UINT16_MAX; *numbytesp = 2; WT_ERR(__wt_calloc_def(session, entries, &table)); - - if (ip->len == 5) - WT_ERR_MSG(session, EINVAL, - "no Huffman table file name specified"); - WT_ERR(__wt_calloc_def(session, ip->len, &file)); - memcpy(file, ip->str + 5, ip->len - 5); - } else { - WT_ERR_MSG(session, EINVAL, - "unknown Huffman configuration value %.*s", - (int)ip->len, ip->str); } - if ((fp = fopen(file, "r")) == NULL) - WT_ERR_MSG(session, __wt_errno(), - "unable to read Huffman table file %.*s", - (int)ip->len, ip->str); - for (tp = table, lineno = 1; (ret = - fscanf(fp, "%" SCNu64 " %" SCNu64, &symbol, &frequency)) != EOF; + fscanf(fp, "%" SCNi64 " %" SCNi64, &symbol, &frequency)) != EOF; ++tp, ++lineno) { if (lineno > entries) WT_ERR_MSG(session, EINVAL, @@ -320,16 +342,19 @@ __wt_huffman_read(WT_SESSION_IMPL *session, WT_CONFIG_ITEM *ip, "line %u of Huffman table file %.*s is corrupted: " "expected two unsigned integral values", lineno, (int)ip->len, ip->str); - if (symbol > entries) + if (symbol < 0 || symbol > entries) WT_ERR_MSG(session, EINVAL, - "line %u of Huffman table file %.*s is corrupted: " - "symbol larger than maximum value of %u", - lineno, (int)ip->len, ip->str, entries); - if (frequency > UINT32_MAX) + "line %u of Huffman file %.*s is corrupted; " + "symbol %" PRId64 " not in range, maximum " + "value is %u", + lineno, (int)ip->len, ip->str, symbol, entries); + if (frequency < 0 || frequency > UINT32_MAX) WT_ERR_MSG(session, EINVAL, - "line %u of Huffman table file %.*s is corrupted: " - "frequency larger than maximum value of %" PRIu32, - lineno, (int)ip->len, ip->str, UINT32_MAX); + "line %u of Huffman file %.*s is corrupted; " + "frequency %" PRId64 " not in range, maximum " + "value is %" PRIu32, + lineno, (int)ip->len, ip->str, frequency, + (uint32_t)UINT32_MAX); tp->symbol = (uint32_t)symbol; tp->frequency = (uint32_t)frequency; @@ -345,7 +370,6 @@ err: __wt_free(session, table); } if (fp != NULL) (void)fclose(fp); - __wt_free(session, file); return (ret); } diff --git a/src/btree/bt_page.c b/src/btree/bt_page.c index e177b05cd24..0b93cc981d7 100644 --- a/src/btree/bt_page.c +++ b/src/btree/bt_page.c @@ -304,8 +304,8 @@ err: if ((pindex = WT_INTL_INDEX_COPY(page)) != NULL) { * Build in-memory page information. */ int -__wt_page_inmem(WT_SESSION_IMPL *session, - WT_REF *ref, const void *image, uint32_t flags, WT_PAGE **pagep) +__wt_page_inmem(WT_SESSION_IMPL *session, WT_REF *ref, + const void *image, size_t memsize, uint32_t flags, WT_PAGE **pagep) { WT_DECL_RET; WT_PAGE *page; @@ -372,9 +372,10 @@ __wt_page_inmem(WT_SESSION_IMPL *session, /* * Track the memory allocated to build this page so we can update the - * cache statistics in a single call. + * cache statistics in a single call. If the disk image is in allocated + * memory, start with that. */ - size = LF_ISSET(WT_PAGE_DISK_ALLOC) ? dsk->mem_size : 0; + size = LF_ISSET(WT_PAGE_DISK_ALLOC) ? memsize : 0; switch (page->type) { case WT_PAGE_COL_FIX: diff --git a/src/btree/bt_read.c b/src/btree/bt_read.c index 57c482604bb..e27f7c3398c 100644 --- a/src/btree/bt_read.c +++ b/src/btree/bt_read.c @@ -61,7 +61,7 @@ __wt_cache_read(WT_SESSION_IMPL *session, WT_REF *ref) * image on return, the page steals it. */ WT_ERR(__wt_bt_read(session, &tmp, addr, addr_size)); - WT_ERR(__wt_page_inmem(session, ref, tmp.data, + WT_ERR(__wt_page_inmem(session, ref, tmp.data, tmp.memsize, WT_DATA_IN_ITEM(&tmp) ? WT_PAGE_DISK_ALLOC : WT_PAGE_DISK_MAPPED, &page)); tmp.mem = NULL; diff --git a/src/btree/bt_slvg.c b/src/btree/bt_slvg.c index d6c20556a9a..6f0d4946aa5 100644 --- a/src/btree/bt_slvg.c +++ b/src/btree/bt_slvg.c @@ -612,7 +612,7 @@ __slvg_trk_leaf(WT_SESSION_IMPL *session, * on every leaf page, and if you need to speed up the salvage, * it's probably a great place to start. */ - WT_ERR(__wt_page_inmem(session, NULL, dsk, 0, &page)); + WT_ERR(__wt_page_inmem(session, NULL, dsk, 0, 0, &page)); WT_ERR(__wt_row_leaf_key_copy(session, page, &page->pg_row_d[0], &trk->row_start)); WT_ERR(__wt_row_leaf_key_copy(session, page, @@ -1744,7 +1744,7 @@ __slvg_row_trk_update_start( */ WT_RET(__wt_scr_alloc(session, trk->trk_size, &dsk)); WT_ERR(__wt_bt_read(session, dsk, trk->trk_addr, trk->trk_addr_size)); - WT_ERR(__wt_page_inmem(session, NULL, dsk->mem, 0, &page)); + WT_ERR(__wt_page_inmem(session, NULL, dsk->mem, 0, 0, &page)); /* * Walk the page, looking for a key sorting greater than the specified diff --git a/src/btree/bt_split.c b/src/btree/bt_split.c index 84d802e0e7e..9fc567f02c1 100644 --- a/src/btree/bt_split.c +++ b/src/btree/bt_split.c @@ -646,8 +646,10 @@ __split_multi_inmem( * when discarding the original page, and our caller will discard the * allocated page on error, when discarding the allocated WT_REF. */ - WT_RET(__wt_page_inmem( - session, ref, multi->skip_dsk, WT_PAGE_DISK_ALLOC, &page)); + + WT_RET(__wt_page_inmem(session, ref, + multi->skip_dsk, ((WT_PAGE_HEADER *)multi->skip_dsk)->mem_size, + WT_PAGE_DISK_ALLOC, &page)); multi->skip_dsk = NULL; if (orig->type == WT_PAGE_ROW_LEAF) diff --git a/src/btree/row_modify.c b/src/btree/row_modify.c index 85efdc08358..0e351682e9e 100644 --- a/src/btree/row_modify.c +++ b/src/btree/row_modify.c @@ -278,7 +278,7 @@ __wt_update_alloc( } *updp = upd; - *sizep = sizeof(WT_UPDATE) + size; + *sizep = WT_UPDATE_MEMSIZE(upd); return (0); } diff --git a/src/config/config_check.c b/src/config/config_check.c index 97f46e4211c..391209104c7 100644 --- a/src/config/config_check.c +++ b/src/config/config_check.c @@ -303,6 +303,9 @@ config_check(WT_SESSION_IMPL *session, "Invalid value for key '%.*s': expected a %s", (int)k.len, k.str, checks[i].type); + if (checks[i].checkf != NULL) + WT_RET(checks[i].checkf(session, &v)); + if (checks[i].checks == NULL) continue; diff --git a/src/config/config_def.c b/src/config/config_def.c index fa876495195..92bf4b32a81 100644 --- a/src/config/config_def.c +++ b/src/config/config_def.c @@ -3,547 +3,620 @@ #include "wt_internal.h" static const WT_CONFIG_CHECK confchk_colgroup_meta[] = { - { "app_metadata", "string", NULL, NULL }, - { "columns", "list", NULL, NULL }, - { "source", "string", NULL, NULL }, - { "type", "string", NULL, NULL }, - { NULL, NULL, NULL, NULL } + { "app_metadata", "string", NULL, NULL, NULL }, + { "collator", "string", NULL, NULL, NULL }, + { "columns", "list", NULL, NULL, NULL }, + { "source", "string", NULL, NULL, NULL }, + { "type", "string", NULL, NULL, NULL }, + { NULL, NULL, NULL, NULL, NULL } }; static const WT_CONFIG_CHECK confchk_connection_async_new_op[] = { - { "append", "boolean", NULL, NULL }, - { "overwrite", "boolean", NULL, NULL }, - { "raw", "boolean", NULL, NULL }, - { "timeout", "int", NULL, NULL }, - { NULL, NULL, NULL, NULL } + { "append", "boolean", NULL, NULL, NULL }, + { "overwrite", "boolean", NULL, NULL, NULL }, + { "raw", "boolean", NULL, NULL, NULL }, + { "timeout", "int", NULL, NULL, NULL }, + { NULL, NULL, NULL, NULL, NULL } }; static const WT_CONFIG_CHECK confchk_connection_close[] = { - { "leak_memory", "boolean", NULL, NULL }, - { NULL, NULL, NULL, NULL } + { "leak_memory", "boolean", NULL, NULL, NULL }, + { NULL, NULL, NULL, NULL, NULL } }; static const WT_CONFIG_CHECK confchk_connection_load_extension[] = { - { "config", "string", NULL, NULL }, - { "entry", "string", NULL, NULL }, - { "terminate", "string", NULL, NULL }, - { NULL, NULL, NULL, NULL } + { "config", "string", NULL, NULL, NULL }, + { "entry", "string", NULL, NULL, NULL }, + { "terminate", "string", NULL, NULL, NULL }, + { NULL, NULL, NULL, NULL, NULL } }; static const WT_CONFIG_CHECK confchk_connection_open_session[] = { { "isolation", "string", - "choices=[\"read-uncommitted\",\"read-committed\",\"snapshot\"]", + NULL, "choices=[\"read-uncommitted\",\"read-committed\"," + "\"snapshot\"]", NULL }, - { NULL, NULL, NULL, NULL } + { NULL, NULL, NULL, NULL, NULL } }; static const WT_CONFIG_CHECK confchk_async_subconfigs[] = { - { "enabled", "boolean", NULL, NULL }, - { "ops_max", "int", "min=1,max=4096", NULL }, - { "threads", "int", "min=1,max=20", NULL }, - { NULL, NULL, NULL, NULL } + { "enabled", "boolean", NULL, NULL, NULL }, + { "ops_max", "int", NULL, "min=1,max=4096", NULL }, + { "threads", "int", NULL, "min=1,max=20", NULL }, + { NULL, NULL, NULL, NULL, NULL } }; static const WT_CONFIG_CHECK confchk_checkpoint_subconfigs[] = { - { "log_size", "int", "min=0,max=2GB", NULL }, - { "name", "string", NULL, NULL }, - { "wait", "int", "min=0,max=100000", NULL }, - { NULL, NULL, NULL, NULL } + { "log_size", "int", NULL, "min=0,max=2GB", NULL }, + { "name", "string", NULL, NULL, NULL }, + { "wait", "int", NULL, "min=0,max=100000", NULL }, + { NULL, NULL, NULL, NULL, NULL } }; static const WT_CONFIG_CHECK confchk_eviction_subconfigs[] = { - { "threads_max", "int", "min=1,max=20", NULL }, - { "threads_min", "int", "min=1,max=20", NULL }, - { NULL, NULL, NULL, NULL } + { "threads_max", "int", NULL, "min=1,max=20", NULL }, + { "threads_min", "int", NULL, "min=1,max=20", NULL }, + { NULL, NULL, NULL, NULL, NULL } }; static const WT_CONFIG_CHECK confchk_file_manager_subconfigs[] = { - { "close_idle_time", "int", "min=1,max=1000", NULL }, - { "close_scan_interval", "int", "min=1,max=1000", NULL }, - { NULL, NULL, NULL, NULL } + { "close_idle_time", "int", NULL, "min=1,max=1000", NULL }, + { "close_scan_interval", "int", NULL, "min=1,max=1000", NULL }, + { NULL, NULL, NULL, NULL, NULL } }; static const WT_CONFIG_CHECK confchk_lsm_manager_subconfigs[] = { - { "merge", "boolean", NULL, NULL }, - { "worker_thread_max", "int", "min=3,max=20", NULL }, - { NULL, NULL, NULL, NULL } + { "merge", "boolean", NULL, NULL, NULL }, + { "worker_thread_max", "int", NULL, "min=3,max=20", NULL }, + { NULL, NULL, NULL, NULL, NULL } }; static const WT_CONFIG_CHECK confchk_shared_cache_subconfigs[] = { - { "chunk", "int", "min=1MB,max=10TB", NULL }, - { "name", "string", NULL, NULL }, - { "reserve", "int", NULL, NULL }, - { "size", "int", "min=1MB,max=10TB", NULL }, - { NULL, NULL, NULL, NULL } + { "chunk", "int", NULL, "min=1MB,max=10TB", NULL }, + { "name", "string", NULL, NULL, NULL }, + { "reserve", "int", NULL, NULL, NULL }, + { "size", "int", NULL, "min=1MB,max=10TB", NULL }, + { NULL, NULL, NULL, NULL, NULL } }; static const WT_CONFIG_CHECK confchk_statistics_log_subconfigs[] = { - { "on_close", "boolean", NULL, NULL }, - { "path", "string", NULL, NULL }, - { "sources", "list", NULL, NULL }, - { "timestamp", "string", NULL, NULL }, - { "wait", "int", "min=0,max=100000", NULL }, - { NULL, NULL, NULL, NULL } + { "on_close", "boolean", NULL, NULL, NULL }, + { "path", "string", NULL, NULL, NULL }, + { "sources", "list", NULL, NULL, NULL }, + { "timestamp", "string", NULL, NULL, NULL }, + { "wait", "int", NULL, "min=0,max=100000", NULL }, + { NULL, NULL, NULL, NULL, NULL } }; static const WT_CONFIG_CHECK confchk_connection_reconfigure[] = { - { "async", "category", NULL, confchk_async_subconfigs }, - { "cache_overhead", "int", "min=0,max=30", NULL }, - { "cache_size", "int", "min=1MB,max=10TB", NULL }, - { "checkpoint", "category", NULL, - confchk_checkpoint_subconfigs }, - { "error_prefix", "string", NULL, NULL }, - { "eviction", "category", NULL, confchk_eviction_subconfigs }, - { "eviction_dirty_target", "int", "min=10,max=99", NULL }, - { "eviction_target", "int", "min=10,max=99", NULL }, - { "eviction_trigger", "int", "min=10,max=99", NULL }, - { "file_manager", "category", NULL, - confchk_file_manager_subconfigs }, - { "lsm_manager", "category", NULL, - confchk_lsm_manager_subconfigs }, - { "lsm_merge", "boolean", NULL, NULL }, - { "shared_cache", "category", NULL, - confchk_shared_cache_subconfigs }, + { "async", "category", NULL, NULL, confchk_async_subconfigs }, + { "cache_overhead", "int", NULL, "min=0,max=30", NULL }, + { "cache_size", "int", NULL, "min=1MB,max=10TB", NULL }, + { "checkpoint", "category", + NULL, NULL, + confchk_checkpoint_subconfigs }, + { "error_prefix", "string", NULL, NULL, NULL }, + { "eviction", "category", + NULL, NULL, + confchk_eviction_subconfigs }, + { "eviction_dirty_target", "int", + NULL, "min=10,max=99", + NULL }, + { "eviction_target", "int", NULL, "min=10,max=99", NULL }, + { "eviction_trigger", "int", NULL, "min=10,max=99", NULL }, + { "file_manager", "category", + NULL, NULL, + confchk_file_manager_subconfigs }, + { "lsm_manager", "category", + NULL, NULL, + confchk_lsm_manager_subconfigs }, + { "lsm_merge", "boolean", NULL, NULL, NULL }, + { "shared_cache", "category", + NULL, NULL, + confchk_shared_cache_subconfigs }, { "statistics", "list", - "choices=[\"all\",\"fast\",\"none\",\"clear\"]", + NULL, "choices=[\"all\",\"fast\",\"none\",\"clear\"]", NULL }, - { "statistics_log", "category", NULL, - confchk_statistics_log_subconfigs }, + { "statistics_log", "category", + NULL, NULL, + confchk_statistics_log_subconfigs }, { "verbose", "list", - "choices=[\"api\",\"block\",\"checkpoint\",\"compact\",\"evict\"" - ",\"evictserver\",\"fileops\",\"log\",\"lsm\",\"metadata\"," - "\"mutex\",\"overflow\",\"read\",\"reconcile\",\"recovery\"," - "\"salvage\",\"shared_cache\",\"split\",\"temporary\"," - "\"transaction\",\"verify\",\"version\",\"write\"]", + NULL, "choices=[\"api\",\"block\",\"checkpoint\",\"compact\"," + "\"evict\",\"evictserver\",\"fileops\",\"log\",\"lsm\"," + "\"metadata\",\"mutex\",\"overflow\",\"read\",\"reconcile\"," + "\"recovery\",\"salvage\",\"shared_cache\",\"split\"," + "\"temporary\",\"transaction\",\"verify\",\"version\",\"write\"]", NULL }, - { NULL, NULL, NULL, NULL } + { NULL, NULL, NULL, NULL, NULL } }; static const WT_CONFIG_CHECK confchk_cursor_reconfigure[] = { - { "append", "boolean", NULL, NULL }, - { "overwrite", "boolean", NULL, NULL }, - { NULL, NULL, NULL, NULL } + { "append", "boolean", NULL, NULL, NULL }, + { "overwrite", "boolean", NULL, NULL, NULL }, + { NULL, NULL, NULL, NULL, NULL } }; static const WT_CONFIG_CHECK confchk_file_meta[] = { - { "allocation_size", "int", "min=512B,max=128MB", NULL }, - { "app_metadata", "string", NULL, NULL }, + { "allocation_size", "int", NULL, "min=512B,max=128MB", NULL }, + { "app_metadata", "string", NULL, NULL, NULL }, { "block_allocation", "string", - "choices=[\"first\",\"best\"]", + NULL, "choices=[\"first\",\"best\"]", NULL }, - { "block_compressor", "string", NULL, NULL }, - { "cache_resident", "boolean", NULL, NULL }, - { "checkpoint", "string", NULL, NULL }, - { "checkpoint_lsn", "string", NULL, NULL }, + { "block_compressor", "string", NULL, NULL, NULL }, + { "cache_resident", "boolean", NULL, NULL, NULL }, + { "checkpoint", "string", NULL, NULL, NULL }, + { "checkpoint_lsn", "string", NULL, NULL, NULL }, { "checksum", "string", - "choices=[\"on\",\"off\",\"uncompressed\"]", - NULL }, - { "collator", "string", NULL, NULL }, - { "columns", "list", NULL, NULL }, - { "dictionary", "int", "min=0", NULL }, - { "format", "string", "choices=[\"btree\"]", NULL }, - { "huffman_key", "string", NULL, NULL }, - { "huffman_value", "string", NULL, NULL }, - { "id", "string", NULL, NULL }, - { "internal_item_max", "int", "min=0", NULL }, - { "internal_key_max", "int", "min=0", NULL }, - { "internal_key_truncate", "boolean", NULL, NULL }, - { "internal_page_max", "int", "min=512B,max=512MB", NULL }, - { "key_format", "format", NULL, NULL }, - { "key_gap", "int", "min=0", NULL }, - { "leaf_item_max", "int", "min=0", NULL }, - { "leaf_key_max", "int", "min=0", NULL }, - { "leaf_page_max", "int", "min=512B,max=512MB", NULL }, - { "leaf_value_max", "int", "min=0", NULL }, - { "memory_page_max", "int", "min=512B,max=10TB", NULL }, - { "os_cache_dirty_max", "int", "min=0", NULL }, - { "os_cache_max", "int", "min=0", NULL }, - { "prefix_compression", "boolean", NULL, NULL }, - { "prefix_compression_min", "int", "min=0", NULL }, - { "split_deepen_min_child", "int", NULL, NULL }, - { "split_deepen_per_child", "int", NULL, NULL }, - { "split_pct", "int", "min=25,max=100", NULL }, - { "value_format", "format", NULL, NULL }, - { "version", "string", NULL, NULL }, - { NULL, NULL, NULL, NULL } + NULL, "choices=[\"on\",\"off\",\"uncompressed\"]", + NULL }, + { "collator", "string", NULL, NULL, NULL }, + { "columns", "list", NULL, NULL, NULL }, + { "dictionary", "int", NULL, "min=0", NULL }, + { "format", "string", NULL, "choices=[\"btree\"]", NULL }, + { "huffman_key", "string", __wt_huffman_confchk, NULL, NULL }, + { "huffman_value", "string", + __wt_huffman_confchk, NULL, + NULL }, + { "id", "string", NULL, NULL, NULL }, + { "internal_item_max", "int", NULL, "min=0", NULL }, + { "internal_key_max", "int", NULL, "min=0", NULL }, + { "internal_key_truncate", "boolean", NULL, NULL, NULL }, + { "internal_page_max", "int", + NULL, "min=512B,max=512MB", + NULL }, + { "key_format", "format", NULL, NULL, NULL }, + { "key_gap", "int", NULL, "min=0", NULL }, + { "leaf_item_max", "int", NULL, "min=0", NULL }, + { "leaf_key_max", "int", NULL, "min=0", NULL }, + { "leaf_page_max", "int", NULL, "min=512B,max=512MB", NULL }, + { "leaf_value_max", "int", NULL, "min=0", NULL }, + { "memory_page_max", "int", NULL, "min=512B,max=10TB", NULL }, + { "os_cache_dirty_max", "int", NULL, "min=0", NULL }, + { "os_cache_max", "int", NULL, "min=0", NULL }, + { "prefix_compression", "boolean", NULL, NULL, NULL }, + { "prefix_compression_min", "int", NULL, "min=0", NULL }, + { "split_deepen_min_child", "int", NULL, NULL, NULL }, + { "split_deepen_per_child", "int", NULL, NULL, NULL }, + { "split_pct", "int", NULL, "min=25,max=100", NULL }, + { "value_format", "format", NULL, NULL, NULL }, + { "version", "string", NULL, NULL, NULL }, + { NULL, NULL, NULL, NULL, NULL } }; static const WT_CONFIG_CHECK confchk_index_meta[] = { - { "app_metadata", "string", NULL, NULL }, - { "columns", "list", NULL, NULL }, - { "extractor", "string", NULL, NULL }, - { "immutable", "boolean", NULL, NULL }, - { "index_key_columns", "int", NULL, NULL }, - { "key_format", "format", NULL, NULL }, - { "source", "string", NULL, NULL }, - { "type", "string", NULL, NULL }, - { "value_format", "format", NULL, NULL }, - { NULL, NULL, NULL, NULL } + { "app_metadata", "string", NULL, NULL, NULL }, + { "collator", "string", NULL, NULL, NULL }, + { "columns", "list", NULL, NULL, NULL }, + { "extractor", "string", NULL, NULL, NULL }, + { "immutable", "boolean", NULL, NULL, NULL }, + { "index_key_columns", "int", NULL, NULL, NULL }, + { "key_format", "format", NULL, NULL, NULL }, + { "source", "string", NULL, NULL, NULL }, + { "type", "string", NULL, NULL, NULL }, + { "value_format", "format", NULL, NULL, NULL }, + { NULL, NULL, NULL, NULL, NULL } }; static const WT_CONFIG_CHECK confchk_session_begin_transaction[] = { { "isolation", "string", - "choices=[\"read-uncommitted\",\"read-committed\",\"snapshot\"]", + NULL, "choices=[\"read-uncommitted\",\"read-committed\"," + "\"snapshot\"]", NULL }, - { "name", "string", NULL, NULL }, - { "priority", "int", "min=-100,max=100", NULL }, - { "sync", "boolean", NULL, NULL }, - { NULL, NULL, NULL, NULL } + { "name", "string", NULL, NULL, NULL }, + { "priority", "int", NULL, "min=-100,max=100", NULL }, + { "sync", "boolean", NULL, NULL, NULL }, + { NULL, NULL, NULL, NULL, NULL } }; static const WT_CONFIG_CHECK confchk_session_checkpoint[] = { - { "drop", "list", NULL, NULL }, - { "force", "boolean", NULL, NULL }, - { "name", "string", NULL, NULL }, - { "target", "list", NULL, NULL }, - { NULL, NULL, NULL, NULL } + { "drop", "list", NULL, NULL, NULL }, + { "force", "boolean", NULL, NULL, NULL }, + { "name", "string", NULL, NULL, NULL }, + { "target", "list", NULL, NULL, NULL }, + { NULL, NULL, NULL, NULL, NULL } }; static const WT_CONFIG_CHECK confchk_session_compact[] = { - { "timeout", "int", NULL, NULL }, - { NULL, NULL, NULL, NULL } + { "timeout", "int", NULL, NULL, NULL }, + { NULL, NULL, NULL, NULL, NULL } }; static const WT_CONFIG_CHECK confchk_lsm_subconfigs[] = { - { "auto_throttle", "boolean", NULL, NULL }, - { "bloom", "boolean", NULL, NULL }, - { "bloom_bit_count", "int", "min=2,max=1000", NULL }, - { "bloom_config", "string", NULL, NULL }, - { "bloom_hash_count", "int", "min=2,max=100", NULL }, - { "bloom_oldest", "boolean", NULL, NULL }, - { "chunk_count_limit", "int", NULL, NULL }, - { "chunk_max", "int", "min=100MB,max=10TB", NULL }, - { "chunk_size", "int", "min=512K,max=500MB", NULL }, - { "merge_max", "int", "min=2,max=100", NULL }, - { "merge_min", "int", "max=100", NULL }, - { NULL, NULL, NULL, NULL } + { "auto_throttle", "boolean", NULL, NULL, NULL }, + { "bloom", "boolean", NULL, NULL, NULL }, + { "bloom_bit_count", "int", NULL, "min=2,max=1000", NULL }, + { "bloom_config", "string", NULL, NULL, NULL }, + { "bloom_hash_count", "int", NULL, "min=2,max=100", NULL }, + { "bloom_oldest", "boolean", NULL, NULL, NULL }, + { "chunk_count_limit", "int", NULL, NULL, NULL }, + { "chunk_max", "int", NULL, "min=100MB,max=10TB", NULL }, + { "chunk_size", "int", NULL, "min=512K,max=500MB", NULL }, + { "merge_max", "int", NULL, "min=2,max=100", NULL }, + { "merge_min", "int", NULL, "max=100", NULL }, + { NULL, NULL, NULL, NULL, NULL } }; static const WT_CONFIG_CHECK confchk_session_create[] = { - { "allocation_size", "int", "min=512B,max=128MB", NULL }, - { "app_metadata", "string", NULL, NULL }, + { "allocation_size", "int", NULL, "min=512B,max=128MB", NULL }, + { "app_metadata", "string", NULL, NULL, NULL }, { "block_allocation", "string", - "choices=[\"first\",\"best\"]", + NULL, "choices=[\"first\",\"best\"]", NULL }, - { "block_compressor", "string", NULL, NULL }, - { "cache_resident", "boolean", NULL, NULL }, + { "block_compressor", "string", NULL, NULL, NULL }, + { "cache_resident", "boolean", NULL, NULL, NULL }, { "checksum", "string", - "choices=[\"on\",\"off\",\"uncompressed\"]", - NULL }, - { "colgroups", "list", NULL, NULL }, - { "collator", "string", NULL, NULL }, - { "columns", "list", NULL, NULL }, - { "dictionary", "int", "min=0", NULL }, - { "exclusive", "boolean", NULL, NULL }, - { "extractor", "string", NULL, NULL }, - { "format", "string", "choices=[\"btree\"]", NULL }, - { "huffman_key", "string", NULL, NULL }, - { "huffman_value", "string", NULL, NULL }, - { "immutable", "boolean", NULL, NULL }, - { "internal_item_max", "int", "min=0", NULL }, - { "internal_key_max", "int", "min=0", NULL }, - { "internal_key_truncate", "boolean", NULL, NULL }, - { "internal_page_max", "int", "min=512B,max=512MB", NULL }, - { "key_format", "format", NULL, NULL }, - { "key_gap", "int", "min=0", NULL }, - { "leaf_item_max", "int", "min=0", NULL }, - { "leaf_key_max", "int", "min=0", NULL }, - { "leaf_page_max", "int", "min=512B,max=512MB", NULL }, - { "leaf_value_max", "int", "min=0", NULL }, - { "lsm", "category", NULL, confchk_lsm_subconfigs }, - { "memory_page_max", "int", "min=512B,max=10TB", NULL }, - { "os_cache_dirty_max", "int", "min=0", NULL }, - { "os_cache_max", "int", "min=0", NULL }, - { "prefix_compression", "boolean", NULL, NULL }, - { "prefix_compression_min", "int", "min=0", NULL }, - { "source", "string", NULL, NULL }, - { "split_deepen_min_child", "int", NULL, NULL }, - { "split_deepen_per_child", "int", NULL, NULL }, - { "split_pct", "int", "min=25,max=100", NULL }, - { "type", "string", NULL, NULL }, - { "value_format", "format", NULL, NULL }, - { NULL, NULL, NULL, NULL } + NULL, "choices=[\"on\",\"off\",\"uncompressed\"]", + NULL }, + { "colgroups", "list", NULL, NULL, NULL }, + { "collator", "string", NULL, NULL, NULL }, + { "columns", "list", NULL, NULL, NULL }, + { "dictionary", "int", NULL, "min=0", NULL }, + { "exclusive", "boolean", NULL, NULL, NULL }, + { "extractor", "string", NULL, NULL, NULL }, + { "format", "string", NULL, "choices=[\"btree\"]", NULL }, + { "huffman_key", "string", __wt_huffman_confchk, NULL, NULL }, + { "huffman_value", "string", + __wt_huffman_confchk, NULL, + NULL }, + { "immutable", "boolean", NULL, NULL, NULL }, + { "internal_item_max", "int", NULL, "min=0", NULL }, + { "internal_key_max", "int", NULL, "min=0", NULL }, + { "internal_key_truncate", "boolean", NULL, NULL, NULL }, + { "internal_page_max", "int", + NULL, "min=512B,max=512MB", + NULL }, + { "key_format", "format", NULL, NULL, NULL }, + { "key_gap", "int", NULL, "min=0", NULL }, + { "leaf_item_max", "int", NULL, "min=0", NULL }, + { "leaf_key_max", "int", NULL, "min=0", NULL }, + { "leaf_page_max", "int", NULL, "min=512B,max=512MB", NULL }, + { "leaf_value_max", "int", NULL, "min=0", NULL }, + { "lsm", "category", NULL, NULL, confchk_lsm_subconfigs }, + { "memory_page_max", "int", NULL, "min=512B,max=10TB", NULL }, + { "os_cache_dirty_max", "int", NULL, "min=0", NULL }, + { "os_cache_max", "int", NULL, "min=0", NULL }, + { "prefix_compression", "boolean", NULL, NULL, NULL }, + { "prefix_compression_min", "int", NULL, "min=0", NULL }, + { "source", "string", NULL, NULL, NULL }, + { "split_deepen_min_child", "int", NULL, NULL, NULL }, + { "split_deepen_per_child", "int", NULL, NULL, NULL }, + { "split_pct", "int", NULL, "min=25,max=100", NULL }, + { "type", "string", NULL, NULL, NULL }, + { "value_format", "format", NULL, NULL, NULL }, + { NULL, NULL, NULL, NULL, NULL } }; static const WT_CONFIG_CHECK confchk_session_drop[] = { - { "force", "boolean", NULL, NULL }, - { "remove_files", "boolean", NULL, NULL }, - { NULL, NULL, NULL, NULL } + { "force", "boolean", NULL, NULL, NULL }, + { "remove_files", "boolean", NULL, NULL, NULL }, + { NULL, NULL, NULL, NULL, NULL } }; static const WT_CONFIG_CHECK confchk_session_open_cursor[] = { - { "append", "boolean", NULL, NULL }, - { "bulk", "string", NULL, NULL }, - { "checkpoint", "string", NULL, NULL }, + { "append", "boolean", NULL, NULL, NULL }, + { "bulk", "string", NULL, NULL, NULL }, + { "checkpoint", "string", NULL, NULL, NULL }, { "dump", "string", - "choices=[\"hex\",\"json\",\"print\"]", + NULL, "choices=[\"hex\",\"json\",\"print\"]", NULL }, - { "next_random", "boolean", NULL, NULL }, - { "overwrite", "boolean", NULL, NULL }, - { "raw", "boolean", NULL, NULL }, - { "readonly", "boolean", NULL, NULL }, - { "skip_sort_check", "boolean", NULL, NULL }, + { "next_random", "boolean", NULL, NULL, NULL }, + { "overwrite", "boolean", NULL, NULL, NULL }, + { "raw", "boolean", NULL, NULL, NULL }, + { "readonly", "boolean", NULL, NULL, NULL }, + { "skip_sort_check", "boolean", NULL, NULL, NULL }, { "statistics", "list", - "choices=[\"all\",\"fast\",\"clear\"]", + NULL, "choices=[\"all\",\"fast\",\"clear\"]", NULL }, - { "target", "list", NULL, NULL }, - { NULL, NULL, NULL, NULL } + { "target", "list", NULL, NULL, NULL }, + { NULL, NULL, NULL, NULL, NULL } }; static const WT_CONFIG_CHECK confchk_session_reconfigure[] = { { "isolation", "string", - "choices=[\"read-uncommitted\",\"read-committed\",\"snapshot\"]", + NULL, "choices=[\"read-uncommitted\",\"read-committed\"," + "\"snapshot\"]", NULL }, - { NULL, NULL, NULL, NULL } + { NULL, NULL, NULL, NULL, NULL } }; static const WT_CONFIG_CHECK confchk_session_salvage[] = { - { "force", "boolean", NULL, NULL }, - { NULL, NULL, NULL, NULL } + { "force", "boolean", NULL, NULL, NULL }, + { NULL, NULL, NULL, NULL, NULL } }; static const WT_CONFIG_CHECK confchk_session_verify[] = { - { "dump_address", "boolean", NULL, NULL }, - { "dump_blocks", "boolean", NULL, NULL }, - { "dump_offsets", "list", NULL, NULL }, - { "dump_pages", "boolean", NULL, NULL }, - { "dump_shape", "boolean", NULL, NULL }, - { NULL, NULL, NULL, NULL } + { "dump_address", "boolean", NULL, NULL, NULL }, + { "dump_blocks", "boolean", NULL, NULL, NULL }, + { "dump_offsets", "list", NULL, NULL, NULL }, + { "dump_pages", "boolean", NULL, NULL, NULL }, + { "dump_shape", "boolean", NULL, NULL, NULL }, + { NULL, NULL, NULL, NULL, NULL } }; static const WT_CONFIG_CHECK confchk_table_meta[] = { - { "app_metadata", "string", NULL, NULL }, - { "colgroups", "list", NULL, NULL }, - { "columns", "list", NULL, NULL }, - { "key_format", "format", NULL, NULL }, - { "value_format", "format", NULL, NULL }, - { NULL, NULL, NULL, NULL } + { "app_metadata", "string", NULL, NULL, NULL }, + { "colgroups", "list", NULL, NULL, NULL }, + { "collator", "string", NULL, NULL, NULL }, + { "columns", "list", NULL, NULL, NULL }, + { "key_format", "format", NULL, NULL, NULL }, + { "value_format", "format", NULL, NULL, NULL }, + { NULL, NULL, NULL, NULL, NULL } }; static const WT_CONFIG_CHECK confchk_log_subconfigs[] = { - { "archive", "boolean", NULL, NULL }, - { "compressor", "string", NULL, NULL }, - { "enabled", "boolean", NULL, NULL }, - { "file_max", "int", "min=100KB,max=2GB", NULL }, - { "path", "string", NULL, NULL }, - { "prealloc", "boolean", NULL, NULL }, - { "recover", "string", "choices=[\"error\",\"on\"]", NULL }, - { NULL, NULL, NULL, NULL } + { "archive", "boolean", NULL, NULL, NULL }, + { "compressor", "string", NULL, NULL, NULL }, + { "enabled", "boolean", NULL, NULL, NULL }, + { "file_max", "int", NULL, "min=100KB,max=2GB", NULL }, + { "path", "string", NULL, NULL, NULL }, + { "prealloc", "boolean", NULL, NULL, NULL }, + { "recover", "string", + NULL, "choices=[\"error\",\"on\"]", + NULL }, + { NULL, NULL, NULL, NULL, NULL } }; static const WT_CONFIG_CHECK confchk_transaction_sync_subconfigs[] = { - { "enabled", "boolean", NULL, NULL }, + { "enabled", "boolean", NULL, NULL, NULL }, { "method", "string", - "choices=[\"dsync\",\"fsync\",\"none\"]", + NULL, "choices=[\"dsync\",\"fsync\",\"none\"]", NULL }, - { NULL, NULL, NULL, NULL } + { NULL, NULL, NULL, NULL, NULL } }; static const WT_CONFIG_CHECK confchk_wiredtiger_open[] = { - { "async", "category", NULL, confchk_async_subconfigs }, - { "buffer_alignment", "int", "min=-1,max=1MB", NULL }, - { "cache_overhead", "int", "min=0,max=30", NULL }, - { "cache_size", "int", "min=1MB,max=10TB", NULL }, - { "checkpoint", "category", NULL, - confchk_checkpoint_subconfigs }, - { "checkpoint_sync", "boolean", NULL, NULL }, - { "config_base", "boolean", NULL, NULL }, - { "create", "boolean", NULL, NULL }, + { "async", "category", NULL, NULL, confchk_async_subconfigs }, + { "buffer_alignment", "int", NULL, "min=-1,max=1MB", NULL }, + { "cache_overhead", "int", NULL, "min=0,max=30", NULL }, + { "cache_size", "int", NULL, "min=1MB,max=10TB", NULL }, + { "checkpoint", "category", + NULL, NULL, + confchk_checkpoint_subconfigs }, + { "checkpoint_sync", "boolean", NULL, NULL, NULL }, + { "config_base", "boolean", NULL, NULL, NULL }, + { "create", "boolean", NULL, NULL, NULL }, { "direct_io", "list", - "choices=[\"checkpoint\",\"data\",\"log\"]", - NULL }, - { "error_prefix", "string", NULL, NULL }, - { "eviction", "category", NULL, confchk_eviction_subconfigs }, - { "eviction_dirty_target", "int", "min=10,max=99", NULL }, - { "eviction_target", "int", "min=10,max=99", NULL }, - { "eviction_trigger", "int", "min=10,max=99", NULL }, - { "exclusive", "boolean", NULL, NULL }, - { "extensions", "list", NULL, NULL }, - { "file_extend", "list", "choices=[\"data\",\"log\"]", NULL }, - { "file_manager", "category", NULL, - confchk_file_manager_subconfigs }, - { "hazard_max", "int", "min=15", NULL }, - { "log", "category", NULL, confchk_log_subconfigs }, - { "lsm_manager", "category", NULL, - confchk_lsm_manager_subconfigs }, - { "lsm_merge", "boolean", NULL, NULL }, - { "mmap", "boolean", NULL, NULL }, - { "multiprocess", "boolean", NULL, NULL }, - { "session_max", "int", "min=1", NULL }, - { "session_scratch_max", "int", NULL, NULL }, - { "shared_cache", "category", NULL, - confchk_shared_cache_subconfigs }, + NULL, "choices=[\"checkpoint\",\"data\",\"log\"]", + NULL }, + { "error_prefix", "string", NULL, NULL, NULL }, + { "eviction", "category", + NULL, NULL, + confchk_eviction_subconfigs }, + { "eviction_dirty_target", "int", + NULL, "min=10,max=99", + NULL }, + { "eviction_target", "int", NULL, "min=10,max=99", NULL }, + { "eviction_trigger", "int", NULL, "min=10,max=99", NULL }, + { "exclusive", "boolean", NULL, NULL, NULL }, + { "extensions", "list", NULL, NULL, NULL }, + { "file_extend", "list", + NULL, "choices=[\"data\",\"log\"]", + NULL }, + { "file_manager", "category", + NULL, NULL, + confchk_file_manager_subconfigs }, + { "hazard_max", "int", NULL, "min=15", NULL }, + { "log", "category", NULL, NULL, confchk_log_subconfigs }, + { "lsm_manager", "category", + NULL, NULL, + confchk_lsm_manager_subconfigs }, + { "lsm_merge", "boolean", NULL, NULL, NULL }, + { "mmap", "boolean", NULL, NULL, NULL }, + { "multiprocess", "boolean", NULL, NULL, NULL }, + { "session_max", "int", NULL, "min=1", NULL }, + { "session_scratch_max", "int", NULL, NULL, NULL }, + { "shared_cache", "category", + NULL, NULL, + confchk_shared_cache_subconfigs }, { "statistics", "list", - "choices=[\"all\",\"fast\",\"none\",\"clear\"]", + NULL, "choices=[\"all\",\"fast\",\"none\",\"clear\"]", NULL }, - { "statistics_log", "category", NULL, - confchk_statistics_log_subconfigs }, - { "transaction_sync", "category", NULL, - confchk_transaction_sync_subconfigs }, - { "use_environment_priv", "boolean", NULL, NULL }, + { "statistics_log", "category", + NULL, NULL, + confchk_statistics_log_subconfigs }, + { "transaction_sync", "category", + NULL, NULL, + confchk_transaction_sync_subconfigs }, + { "use_environment_priv", "boolean", NULL, NULL, NULL }, { "verbose", "list", - "choices=[\"api\",\"block\",\"checkpoint\",\"compact\",\"evict\"" - ",\"evictserver\",\"fileops\",\"log\",\"lsm\",\"metadata\"," - "\"mutex\",\"overflow\",\"read\",\"reconcile\",\"recovery\"," - "\"salvage\",\"shared_cache\",\"split\",\"temporary\"," - "\"transaction\",\"verify\",\"version\",\"write\"]", + NULL, "choices=[\"api\",\"block\",\"checkpoint\",\"compact\"," + "\"evict\",\"evictserver\",\"fileops\",\"log\",\"lsm\"," + "\"metadata\",\"mutex\",\"overflow\",\"read\",\"reconcile\"," + "\"recovery\",\"salvage\",\"shared_cache\",\"split\"," + "\"temporary\",\"transaction\",\"verify\",\"version\",\"write\"]", NULL }, - { NULL, NULL, NULL, NULL } + { NULL, NULL, NULL, NULL, NULL } }; static const WT_CONFIG_CHECK confchk_wiredtiger_open_all[] = { - { "async", "category", NULL, confchk_async_subconfigs }, - { "buffer_alignment", "int", "min=-1,max=1MB", NULL }, - { "cache_overhead", "int", "min=0,max=30", NULL }, - { "cache_size", "int", "min=1MB,max=10TB", NULL }, - { "checkpoint", "category", NULL, - confchk_checkpoint_subconfigs }, - { "checkpoint_sync", "boolean", NULL, NULL }, - { "config_base", "boolean", NULL, NULL }, - { "create", "boolean", NULL, NULL }, + { "async", "category", NULL, NULL, confchk_async_subconfigs }, + { "buffer_alignment", "int", NULL, "min=-1,max=1MB", NULL }, + { "cache_overhead", "int", NULL, "min=0,max=30", NULL }, + { "cache_size", "int", NULL, "min=1MB,max=10TB", NULL }, + { "checkpoint", "category", + NULL, NULL, + confchk_checkpoint_subconfigs }, + { "checkpoint_sync", "boolean", NULL, NULL, NULL }, + { "config_base", "boolean", NULL, NULL, NULL }, + { "create", "boolean", NULL, NULL, NULL }, { "direct_io", "list", - "choices=[\"checkpoint\",\"data\",\"log\"]", - NULL }, - { "error_prefix", "string", NULL, NULL }, - { "eviction", "category", NULL, confchk_eviction_subconfigs }, - { "eviction_dirty_target", "int", "min=10,max=99", NULL }, - { "eviction_target", "int", "min=10,max=99", NULL }, - { "eviction_trigger", "int", "min=10,max=99", NULL }, - { "exclusive", "boolean", NULL, NULL }, - { "extensions", "list", NULL, NULL }, - { "file_extend", "list", "choices=[\"data\",\"log\"]", NULL }, - { "file_manager", "category", NULL, - confchk_file_manager_subconfigs }, - { "hazard_max", "int", "min=15", NULL }, - { "log", "category", NULL, confchk_log_subconfigs }, - { "lsm_manager", "category", NULL, - confchk_lsm_manager_subconfigs }, - { "lsm_merge", "boolean", NULL, NULL }, - { "mmap", "boolean", NULL, NULL }, - { "multiprocess", "boolean", NULL, NULL }, - { "session_max", "int", "min=1", NULL }, - { "session_scratch_max", "int", NULL, NULL }, - { "shared_cache", "category", NULL, - confchk_shared_cache_subconfigs }, + NULL, "choices=[\"checkpoint\",\"data\",\"log\"]", + NULL }, + { "error_prefix", "string", NULL, NULL, NULL }, + { "eviction", "category", + NULL, NULL, + confchk_eviction_subconfigs }, + { "eviction_dirty_target", "int", + NULL, "min=10,max=99", + NULL }, + { "eviction_target", "int", NULL, "min=10,max=99", NULL }, + { "eviction_trigger", "int", NULL, "min=10,max=99", NULL }, + { "exclusive", "boolean", NULL, NULL, NULL }, + { "extensions", "list", NULL, NULL, NULL }, + { "file_extend", "list", + NULL, "choices=[\"data\",\"log\"]", + NULL }, + { "file_manager", "category", + NULL, NULL, + confchk_file_manager_subconfigs }, + { "hazard_max", "int", NULL, "min=15", NULL }, + { "log", "category", NULL, NULL, confchk_log_subconfigs }, + { "lsm_manager", "category", + NULL, NULL, + confchk_lsm_manager_subconfigs }, + { "lsm_merge", "boolean", NULL, NULL, NULL }, + { "mmap", "boolean", NULL, NULL, NULL }, + { "multiprocess", "boolean", NULL, NULL, NULL }, + { "session_max", "int", NULL, "min=1", NULL }, + { "session_scratch_max", "int", NULL, NULL, NULL }, + { "shared_cache", "category", + NULL, NULL, + confchk_shared_cache_subconfigs }, { "statistics", "list", - "choices=[\"all\",\"fast\",\"none\",\"clear\"]", + NULL, "choices=[\"all\",\"fast\",\"none\",\"clear\"]", NULL }, - { "statistics_log", "category", NULL, - confchk_statistics_log_subconfigs }, - { "transaction_sync", "category", NULL, - confchk_transaction_sync_subconfigs }, - { "use_environment_priv", "boolean", NULL, NULL }, + { "statistics_log", "category", + NULL, NULL, + confchk_statistics_log_subconfigs }, + { "transaction_sync", "category", + NULL, NULL, + confchk_transaction_sync_subconfigs }, + { "use_environment_priv", "boolean", NULL, NULL, NULL }, { "verbose", "list", - "choices=[\"api\",\"block\",\"checkpoint\",\"compact\",\"evict\"" - ",\"evictserver\",\"fileops\",\"log\",\"lsm\",\"metadata\"," - "\"mutex\",\"overflow\",\"read\",\"reconcile\",\"recovery\"," - "\"salvage\",\"shared_cache\",\"split\",\"temporary\"," - "\"transaction\",\"verify\",\"version\",\"write\"]", + NULL, "choices=[\"api\",\"block\",\"checkpoint\",\"compact\"," + "\"evict\",\"evictserver\",\"fileops\",\"log\",\"lsm\"," + "\"metadata\",\"mutex\",\"overflow\",\"read\",\"reconcile\"," + "\"recovery\",\"salvage\",\"shared_cache\",\"split\"," + "\"temporary\",\"transaction\",\"verify\",\"version\",\"write\"]", NULL }, - { "version", "string", NULL, NULL }, - { NULL, NULL, NULL, NULL } + { "version", "string", NULL, NULL, NULL }, + { NULL, NULL, NULL, NULL, NULL } }; static const WT_CONFIG_CHECK confchk_wiredtiger_open_basecfg[] = { - { "async", "category", NULL, confchk_async_subconfigs }, - { "buffer_alignment", "int", "min=-1,max=1MB", NULL }, - { "cache_overhead", "int", "min=0,max=30", NULL }, - { "cache_size", "int", "min=1MB,max=10TB", NULL }, - { "checkpoint", "category", NULL, - confchk_checkpoint_subconfigs }, - { "checkpoint_sync", "boolean", NULL, NULL }, + { "async", "category", NULL, NULL, confchk_async_subconfigs }, + { "buffer_alignment", "int", NULL, "min=-1,max=1MB", NULL }, + { "cache_overhead", "int", NULL, "min=0,max=30", NULL }, + { "cache_size", "int", NULL, "min=1MB,max=10TB", NULL }, + { "checkpoint", "category", + NULL, NULL, + confchk_checkpoint_subconfigs }, + { "checkpoint_sync", "boolean", NULL, NULL, NULL }, { "direct_io", "list", - "choices=[\"checkpoint\",\"data\",\"log\"]", - NULL }, - { "error_prefix", "string", NULL, NULL }, - { "eviction", "category", NULL, confchk_eviction_subconfigs }, - { "eviction_dirty_target", "int", "min=10,max=99", NULL }, - { "eviction_target", "int", "min=10,max=99", NULL }, - { "eviction_trigger", "int", "min=10,max=99", NULL }, - { "extensions", "list", NULL, NULL }, - { "file_extend", "list", "choices=[\"data\",\"log\"]", NULL }, - { "file_manager", "category", NULL, - confchk_file_manager_subconfigs }, - { "hazard_max", "int", "min=15", NULL }, - { "log", "category", NULL, confchk_log_subconfigs }, - { "lsm_manager", "category", NULL, - confchk_lsm_manager_subconfigs }, - { "lsm_merge", "boolean", NULL, NULL }, - { "mmap", "boolean", NULL, NULL }, - { "multiprocess", "boolean", NULL, NULL }, - { "session_max", "int", "min=1", NULL }, - { "session_scratch_max", "int", NULL, NULL }, - { "shared_cache", "category", NULL, - confchk_shared_cache_subconfigs }, + NULL, "choices=[\"checkpoint\",\"data\",\"log\"]", + NULL }, + { "error_prefix", "string", NULL, NULL, NULL }, + { "eviction", "category", + NULL, NULL, + confchk_eviction_subconfigs }, + { "eviction_dirty_target", "int", + NULL, "min=10,max=99", + NULL }, + { "eviction_target", "int", NULL, "min=10,max=99", NULL }, + { "eviction_trigger", "int", NULL, "min=10,max=99", NULL }, + { "extensions", "list", NULL, NULL, NULL }, + { "file_extend", "list", + NULL, "choices=[\"data\",\"log\"]", + NULL }, + { "file_manager", "category", + NULL, NULL, + confchk_file_manager_subconfigs }, + { "hazard_max", "int", NULL, "min=15", NULL }, + { "log", "category", NULL, NULL, confchk_log_subconfigs }, + { "lsm_manager", "category", + NULL, NULL, + confchk_lsm_manager_subconfigs }, + { "lsm_merge", "boolean", NULL, NULL, NULL }, + { "mmap", "boolean", NULL, NULL, NULL }, + { "multiprocess", "boolean", NULL, NULL, NULL }, + { "session_max", "int", NULL, "min=1", NULL }, + { "session_scratch_max", "int", NULL, NULL, NULL }, + { "shared_cache", "category", + NULL, NULL, + confchk_shared_cache_subconfigs }, { "statistics", "list", - "choices=[\"all\",\"fast\",\"none\",\"clear\"]", + NULL, "choices=[\"all\",\"fast\",\"none\",\"clear\"]", NULL }, - { "statistics_log", "category", NULL, - confchk_statistics_log_subconfigs }, - { "transaction_sync", "category", NULL, - confchk_transaction_sync_subconfigs }, + { "statistics_log", "category", + NULL, NULL, + confchk_statistics_log_subconfigs }, + { "transaction_sync", "category", + NULL, NULL, + confchk_transaction_sync_subconfigs }, { "verbose", "list", - "choices=[\"api\",\"block\",\"checkpoint\",\"compact\",\"evict\"" - ",\"evictserver\",\"fileops\",\"log\",\"lsm\",\"metadata\"," - "\"mutex\",\"overflow\",\"read\",\"reconcile\",\"recovery\"," - "\"salvage\",\"shared_cache\",\"split\",\"temporary\"," - "\"transaction\",\"verify\",\"version\",\"write\"]", + NULL, "choices=[\"api\",\"block\",\"checkpoint\",\"compact\"," + "\"evict\",\"evictserver\",\"fileops\",\"log\",\"lsm\"," + "\"metadata\",\"mutex\",\"overflow\",\"read\",\"reconcile\"," + "\"recovery\",\"salvage\",\"shared_cache\",\"split\"," + "\"temporary\",\"transaction\",\"verify\",\"version\",\"write\"]", NULL }, - { "version", "string", NULL, NULL }, - { NULL, NULL, NULL, NULL } + { "version", "string", NULL, NULL, NULL }, + { NULL, NULL, NULL, NULL, NULL } }; static const WT_CONFIG_CHECK confchk_wiredtiger_open_usercfg[] = { - { "async", "category", NULL, confchk_async_subconfigs }, - { "buffer_alignment", "int", "min=-1,max=1MB", NULL }, - { "cache_overhead", "int", "min=0,max=30", NULL }, - { "cache_size", "int", "min=1MB,max=10TB", NULL }, - { "checkpoint", "category", NULL, - confchk_checkpoint_subconfigs }, - { "checkpoint_sync", "boolean", NULL, NULL }, + { "async", "category", NULL, NULL, confchk_async_subconfigs }, + { "buffer_alignment", "int", NULL, "min=-1,max=1MB", NULL }, + { "cache_overhead", "int", NULL, "min=0,max=30", NULL }, + { "cache_size", "int", NULL, "min=1MB,max=10TB", NULL }, + { "checkpoint", "category", + NULL, NULL, + confchk_checkpoint_subconfigs }, + { "checkpoint_sync", "boolean", NULL, NULL, NULL }, { "direct_io", "list", - "choices=[\"checkpoint\",\"data\",\"log\"]", - NULL }, - { "error_prefix", "string", NULL, NULL }, - { "eviction", "category", NULL, confchk_eviction_subconfigs }, - { "eviction_dirty_target", "int", "min=10,max=99", NULL }, - { "eviction_target", "int", "min=10,max=99", NULL }, - { "eviction_trigger", "int", "min=10,max=99", NULL }, - { "extensions", "list", NULL, NULL }, - { "file_extend", "list", "choices=[\"data\",\"log\"]", NULL }, - { "file_manager", "category", NULL, - confchk_file_manager_subconfigs }, - { "hazard_max", "int", "min=15", NULL }, - { "log", "category", NULL, confchk_log_subconfigs }, - { "lsm_manager", "category", NULL, - confchk_lsm_manager_subconfigs }, - { "lsm_merge", "boolean", NULL, NULL }, - { "mmap", "boolean", NULL, NULL }, - { "multiprocess", "boolean", NULL, NULL }, - { "session_max", "int", "min=1", NULL }, - { "session_scratch_max", "int", NULL, NULL }, - { "shared_cache", "category", NULL, - confchk_shared_cache_subconfigs }, + NULL, "choices=[\"checkpoint\",\"data\",\"log\"]", + NULL }, + { "error_prefix", "string", NULL, NULL, NULL }, + { "eviction", "category", + NULL, NULL, + confchk_eviction_subconfigs }, + { "eviction_dirty_target", "int", + NULL, "min=10,max=99", + NULL }, + { "eviction_target", "int", NULL, "min=10,max=99", NULL }, + { "eviction_trigger", "int", NULL, "min=10,max=99", NULL }, + { "extensions", "list", NULL, NULL, NULL }, + { "file_extend", "list", + NULL, "choices=[\"data\",\"log\"]", + NULL }, + { "file_manager", "category", + NULL, NULL, + confchk_file_manager_subconfigs }, + { "hazard_max", "int", NULL, "min=15", NULL }, + { "log", "category", NULL, NULL, confchk_log_subconfigs }, + { "lsm_manager", "category", + NULL, NULL, + confchk_lsm_manager_subconfigs }, + { "lsm_merge", "boolean", NULL, NULL, NULL }, + { "mmap", "boolean", NULL, NULL, NULL }, + { "multiprocess", "boolean", NULL, NULL, NULL }, + { "session_max", "int", NULL, "min=1", NULL }, + { "session_scratch_max", "int", NULL, NULL, NULL }, + { "shared_cache", "category", + NULL, NULL, + confchk_shared_cache_subconfigs }, { "statistics", "list", - "choices=[\"all\",\"fast\",\"none\",\"clear\"]", + NULL, "choices=[\"all\",\"fast\",\"none\",\"clear\"]", NULL }, - { "statistics_log", "category", NULL, - confchk_statistics_log_subconfigs }, - { "transaction_sync", "category", NULL, - confchk_transaction_sync_subconfigs }, + { "statistics_log", "category", + NULL, NULL, + confchk_statistics_log_subconfigs }, + { "transaction_sync", "category", + NULL, NULL, + confchk_transaction_sync_subconfigs }, { "verbose", "list", - "choices=[\"api\",\"block\",\"checkpoint\",\"compact\",\"evict\"" - ",\"evictserver\",\"fileops\",\"log\",\"lsm\",\"metadata\"," - "\"mutex\",\"overflow\",\"read\",\"reconcile\",\"recovery\"," - "\"salvage\",\"shared_cache\",\"split\",\"temporary\"," - "\"transaction\",\"verify\",\"version\",\"write\"]", + NULL, "choices=[\"api\",\"block\",\"checkpoint\",\"compact\"," + "\"evict\",\"evictserver\",\"fileops\",\"log\",\"lsm\"," + "\"metadata\",\"mutex\",\"overflow\",\"read\",\"reconcile\"," + "\"recovery\",\"salvage\",\"shared_cache\",\"split\"," + "\"temporary\",\"transaction\",\"verify\",\"version\",\"write\"]", NULL }, - { NULL, NULL, NULL, NULL } + { NULL, NULL, NULL, NULL, NULL } }; static const WT_CONFIG_ENTRY config_entries[] = { { "colgroup.meta", - "app_metadata=,columns=,source=,type=file", + "app_metadata=,collator=,columns=,source=,type=file", confchk_colgroup_meta }, { "connection.add_collator", @@ -616,8 +689,8 @@ static const WT_CONFIG_ENTRY config_entries[] = { confchk_file_meta }, { "index.meta", - "app_metadata=,columns=,extractor=,immutable=0,index_key_columns=" - ",key_format=u,source=,type=file,value_format=u", + "app_metadata=,collator=,columns=,extractor=,immutable=0," + "index_key_columns=,key_format=u,source=,type=file,value_format=u", confchk_index_meta }, { "session.begin_transaction", @@ -704,7 +777,8 @@ static const WT_CONFIG_ENTRY config_entries[] = { confchk_session_verify }, { "table.meta", - "app_metadata=,colgroups=,columns=,key_format=u,value_format=u", + "app_metadata=,colgroups=,collator=,columns=,key_format=u," + "value_format=u", confchk_table_meta }, { "wiredtiger_open", diff --git a/src/conn/conn_api.c b/src/conn/conn_api.c index 3fb395b6ca0..056c009960c 100644 --- a/src/conn/conn_api.c +++ b/src/conn/conn_api.c @@ -1603,17 +1603,6 @@ wiredtiger_open(const char *home, WT_EVENT_HANDLER *event_handler, if (cval.val) F_SET(conn, WT_CONN_CKPT_SYNC); - WT_ERR(__wt_config_gets(session, cfg, "buffer_alignment", &cval)); - if (cval.val == -1) - conn->buffer_alignment = WT_BUFFER_ALIGNMENT_DEFAULT; - else - conn->buffer_alignment = (size_t)cval.val; -#ifndef HAVE_POSIX_MEMALIGN - if (conn->buffer_alignment != 0) - WT_ERR_MSG(session, EINVAL, - "buffer_alignment requires posix_memalign"); -#endif - WT_ERR(__wt_config_gets(session, cfg, "direct_io", &cval)); for (ft = file_types; ft->name != NULL; ft++) { ret = __wt_config_subgets(session, &cval, ft->name, &sval); @@ -1624,6 +1613,22 @@ wiredtiger_open(const char *home, WT_EVENT_HANDLER *event_handler, goto err; } + /* + * If buffer alignment is not configured, use zero unless direct I/O is + * also configured, in which case use the build-time default. + */ + WT_ERR(__wt_config_gets(session, cfg, "buffer_alignment", &cval)); + if (cval.val == -1) + conn->buffer_alignment = + (conn->direct_io == 0) ? 0 : WT_BUFFER_ALIGNMENT_DEFAULT; + else + conn->buffer_alignment = (size_t)cval.val; +#ifndef HAVE_POSIX_MEMALIGN + if (conn->buffer_alignment != 0) + WT_ERR_MSG(session, EINVAL, + "buffer_alignment requires posix_memalign"); +#endif + WT_ERR(__wt_config_gets(session, cfg, "file_extend", &cval)); for (ft = file_types; ft->name != NULL; ft++) { ret = __wt_config_subgets(session, &cval, ft->name, &sval); diff --git a/src/cursor/cur_index.c b/src/cursor/cur_index.c index bf086bcc813..7b234eab280 100644 --- a/src/cursor/cur_index.c +++ b/src/cursor/cur_index.c @@ -61,6 +61,35 @@ err: cursor->saved_err = ret; } /* + * __curindex_compare -- + * WT_CURSOR->compare method for the index cursor type. + */ +static int +__curindex_compare(WT_CURSOR *a, WT_CURSOR *b, int *cmpp) +{ + WT_CURSOR_INDEX *cindex; + WT_DECL_RET; + WT_SESSION_IMPL *session; + + cindex = (WT_CURSOR_INDEX *)a; + CURSOR_API_CALL(a, session, compare, NULL); + + /* Check both cursors are "index:" type. */ + if (!WT_PREFIX_MATCH(a->uri, "index:") || + !WT_PREFIX_MATCH(b->uri, "index:")) + WT_ERR_MSG(session, EINVAL, + "Cursors must reference the same object"); + + WT_CURSOR_CHECKKEY(a); + WT_CURSOR_CHECKKEY(b); + + ret = __wt_compare( + session, cindex->index->collator, &a->key, &b->key, cmpp); + +err: API_END_RET(session, ret); +} + +/* * __curindex_move -- * When an index cursor changes position, set the primary key in the * associated column groups and update their positions to match. @@ -189,32 +218,46 @@ __curindex_search(WT_CURSOR *cursor) WT_CURSOR *child; WT_CURSOR_INDEX *cindex; WT_DECL_RET; + WT_ITEM found_key; WT_SESSION_IMPL *session; - int exact; + int cmp; cindex = (WT_CURSOR_INDEX *)cursor; child = cindex->child; CURSOR_API_CALL(cursor, session, search, NULL); /* - * We expect partial matches, but we want the smallest item that - * matches the prefix. Fail if there is no matching item. + * We are searching using the application-specified key, which + * (usually) doesn't contain the primary key, so it is just a prefix of + * any matching index key. Do a search_near, step to the next entry if + * we land on one that is too small, then check that the prefix + * matches. */ __wt_cursor_set_raw_key(child, &cursor->key); - WT_ERR(child->search_near(child, &exact)); + WT_ERR(child->search_near(child, &cmp)); + + if (cmp < 0) + WT_ERR(child->next(child)); /* * We expect partial matches, and want the smallest record with a key - * greater than or equal to the search key. The only way for the key - * to be equal is if there is an index on the primary key, because - * otherwise the primary key columns will be appended to the index key, - * but we don't disallow that (odd) case. + * greater than or equal to the search key. + * + * If the key we find is shorter than the search key, it can't possibly + * match. + * + * The only way for the key to be exactly equal is if there is an index + * on the primary key, because otherwise the primary key columns will + * be appended to the index key, but we don't disallow that (odd) case. */ - if (exact < 0) - WT_ERR(child->next(child)); - - if (child->key.size < cursor->key.size || - memcmp(child->key.data, cursor->key.data, cursor->key.size) != 0) { + found_key = child->key; + if (found_key.size < cursor->key.size) + WT_ERR(WT_NOTFOUND); + found_key.size = cursor->key.size; + + WT_ERR(__wt_compare( + session, cindex->index->collator, &cursor->key, &found_key, &cmp)); + if (cmp != 0) { ret = WT_NOTFOUND; goto err; } @@ -342,8 +385,8 @@ __wt_curindex_open(WT_SESSION_IMPL *session, __curindex_get_value, /* get-value */ __wt_cursor_set_key, /* set-key */ __curindex_set_value, /* set-value */ - __wt_cursor_notsup, /* compare */ - __wt_cursor_notsup, /* equals */ + __curindex_compare, /* compare */ + __wt_cursor_equals, /* equals */ __curindex_next, /* next */ __curindex_prev, /* prev */ __curindex_reset, /* reset */ diff --git a/src/docs/upgrading.dox b/src/docs/upgrading.dox index 17a44f71985..e4b4cacd850 100644 --- a/src/docs/upgrading.dox +++ b/src/docs/upgrading.dox @@ -21,6 +21,13 @@ the cursor was used. In the WiredTiger 2.5.2 release, calling the WT_CURSOR::reset method to reset the cursor refreshes the statistics returned by the cursor. </dd> + +<dt>Buffer alignment on Linux</dt> +<dd> +In previous releases of WiredTiger, all buffers used for I/O were aligned +to 4KB boundaries by default. In the WiredTiger 2.5.2 release, alignment +is only enforced when direct I/O is configured. +</dd> </dl> @section version_251 Upgrading to Version 2.5.1 diff --git a/src/evict/evict_lru.c b/src/evict/evict_lru.c index 6a5f31a18a5..8e57d2c15c2 100644 --- a/src/evict/evict_lru.c +++ b/src/evict/evict_lru.c @@ -540,12 +540,18 @@ __evict_pass(WT_SESSION_IMPL *session) */ __wt_sleep(0, 1000 * (uint64_t)loop); if (loop == 100) { - F_SET(cache, WT_CACHE_STUCK); - WT_STAT_FAST_CONN_INCR( - session, cache_eviction_slow); - WT_RET(__wt_verbose( - session, WT_VERB_EVICTSERVER, - "unable to reach eviction goal")); + /* + * Mark the cache as stuck if we need space + * and aren't evicting any pages. + */ + if (!LF_ISSET(WT_EVICT_PASS_WOULD_BLOCK)) { + F_SET(cache, WT_CACHE_STUCK); + WT_STAT_FAST_CONN_INCR( + session, cache_eviction_slow); + WT_RET(__wt_verbose( + session, WT_VERB_EVICTSERVER, + "unable to reach eviction goal")); + } break; } } else { diff --git a/src/include/btmem.h b/src/include/btmem.h index 101fd450fc7..cda672bc7b4 100644 --- a/src/include/btmem.h +++ b/src/include/btmem.h @@ -847,13 +847,20 @@ WT_PACKED_STRUCT_BEGIN(__wt_update) */ #define WT_UPDATE_DELETED_ISSET(upd) ((upd)->size == UINT32_MAX) #define WT_UPDATE_DELETED_SET(upd) ((upd)->size = UINT32_MAX) -#define WT_UPDATE_MEMSIZE(upd) \ - (sizeof(WT_UPDATE) + (WT_UPDATE_DELETED_ISSET(upd) ? 0 : (upd)->size)) uint32_t size; /* update length */ /* The untyped value immediately follows the WT_UPDATE structure. */ #define WT_UPDATE_DATA(upd) \ ((void *)((uint8_t *)(upd) + sizeof(WT_UPDATE))) + + /* + * The memory size of an update: include some padding because this is + * such a common case that overhead of tiny allocations can swamp our + * cache overhead calculation. + */ +#define WT_UPDATE_MEMSIZE(upd) \ + WT_ALIGN(sizeof(WT_UPDATE) + \ + (WT_UPDATE_DELETED_ISSET(upd) ? 0 : (upd)->size), 32) }; /* diff --git a/src/include/config.h b/src/include/config.h index 046f515188c..1f30667b8d6 100644 --- a/src/include/config.h +++ b/src/include/config.h @@ -19,6 +19,7 @@ struct __wt_config { struct __wt_config_check { const char *name; const char *type; + int (*checkf)(WT_SESSION_IMPL *, WT_CONFIG_ITEM *); const char *checks; const WT_CONFIG_CHECK *subconfigs; }; diff --git a/src/include/extern.h b/src/include/extern.h index 31dfaa6348e..0db41773695 100644 --- a/src/include/extern.h +++ b/src/include/extern.h @@ -124,6 +124,7 @@ extern void __wt_root_ref_init(WT_REF *root_ref, WT_PAGE *root, int is_recno); extern int __wt_btree_tree_open( WT_SESSION_IMPL *session, const uint8_t *addr, size_t addr_size); extern int __wt_btree_new_leaf_page(WT_SESSION_IMPL *session, WT_PAGE **pagep); extern void __wt_btree_evictable(WT_SESSION_IMPL *session, int on); +extern int __wt_huffman_confchk(WT_SESSION_IMPL *session, WT_CONFIG_ITEM *v); extern int __wt_btree_huffman_open(WT_SESSION_IMPL *session); extern void __wt_btree_huffman_close(WT_SESSION_IMPL *session); extern int __wt_bt_read(WT_SESSION_IMPL *session, WT_ITEM *buf, const uint8_t *addr, size_t addr_size); @@ -142,7 +143,7 @@ __wt_page_in_func(WT_SESSION_IMPL *session, WT_REF *ref, uint32_t flags #endif ); extern int __wt_page_alloc(WT_SESSION_IMPL *session, uint8_t type, uint64_t recno, uint32_t alloc_entries, int alloc_refs, WT_PAGE **pagep); -extern int __wt_page_inmem(WT_SESSION_IMPL *session, WT_REF *ref, const void *image, uint32_t flags, WT_PAGE **pagep); +extern int __wt_page_inmem(WT_SESSION_IMPL *session, WT_REF *ref, const void *image, size_t memsize, uint32_t flags, WT_PAGE **pagep); extern int __wt_cache_read(WT_SESSION_IMPL *session, WT_REF *ref); extern int __wt_kv_return(WT_SESSION_IMPL *session, WT_CURSOR_BTREE *cbt, WT_UPDATE *upd); extern int __wt_bt_salvage(WT_SESSION_IMPL *session, WT_CKPT *ckptbase, const char *cfg[]); diff --git a/src/include/os_windows.h b/src/include/os_windows.h index adf76677646..a9c1cf5f65a 100644 --- a/src/include/os_windows.h +++ b/src/include/os_windows.h @@ -14,11 +14,13 @@ typedef CONDITION_VARIABLE wt_cond_t; typedef CRITICAL_SECTION wt_mutex_t; typedef HANDLE wt_thread_t; +#if _MSC_VER < 1900 /* Timespec is a POSIX structure not defined in Windows */ struct timespec { time_t tv_sec; /* seconds */ long tv_nsec; /* nanoseconds */ }; +#endif /* * Windows Portability stuff diff --git a/src/include/schema.h b/src/include/schema.h index 4d722a0068b..25c1baae60f 100644 --- a/src/include/schema.h +++ b/src/include/schema.h @@ -28,6 +28,9 @@ struct __wt_index { WT_CONFIG_ITEM colconf; /* List of columns from config */ + WT_COLLATOR *collator; /* Custom collator */ + int collator_owned; /* Collator is owned by this index */ + WT_EXTRACTOR *extractor; /* Custom key extractor */ int extractor_owned; /* Extractor is owned by this index */ diff --git a/src/include/wiredtiger.in b/src/include/wiredtiger.in index 2981b0578b6..97c9459c424 100644 --- a/src/include/wiredtiger.in +++ b/src/include/wiredtiger.in @@ -1901,8 +1901,8 @@ struct __wt_connection { * @config{ ),,} * @config{buffer_alignment, in-memory alignment (in bytes) for buffers used for * I/O. The default value of -1 indicates a platform-specific alignment value - * should be used (4KB on Linux systems\, zero elsewhere)., an integer between - * -1 and 1MB; default \c -1.} + * should be used (4KB on Linux systems when direct I/O is configured\, zero + * elsewhere)., an integer between -1 and 1MB; default \c -1.} * @config{cache_overhead, assume the heap allocator overhead is the specified * percentage\, and adjust the cache usage by that amount (for example\, if * there is 10GB of data in cache\, a percentage of 10 means WiredTiger treats diff --git a/src/log/log.c b/src/log/log.c index 4c0c32b8b2c..d12ac13d762 100644 --- a/src/log/log.c +++ b/src/log/log.c @@ -1382,7 +1382,7 @@ advance: WT_ERR(__wt_read(session, log_fh, rd_lsn.offset, (size_t)allocsize, buf.mem)); /* - * First 8 bytes is the real record length. See if we + * First 4 bytes is the real record length. See if we * need to read more than the allocation size. We expect * that we rarely will have to read more. Most log records * will be fairly small. diff --git a/src/os_posix/os_alloc.c b/src/os_posix/os_alloc.c index 0795fe2fe0d..d3d4fd1dbcf 100644 --- a/src/os_posix/os_alloc.c +++ b/src/os_posix/os_alloc.c @@ -134,6 +134,17 @@ __wt_realloc_aligned(WT_SESSION_IMPL *session, WT_ASSERT(session, bytes_to_allocate != 0); WT_ASSERT(session, bytes_allocated < bytes_to_allocate); + /* + * We are going to allocate an aligned buffer. When we do this + * repeatedly, the allocator is expected to start on a boundary + * each time, account for that additional space by never asking + * for less than a full alignment size. The primary use case + * for aligned buffers is Linux direct I/O, which requires that + * the size be a multiple of the alignment anyway. + */ + bytes_to_allocate = + WT_ALIGN(bytes_to_allocate, S2C(session)->buffer_alignment); + if (session != NULL) WT_STAT_FAST_CONN_INCR(session, memory_allocation); diff --git a/src/schema/schema_list.c b/src/schema/schema_list.c index 9d70e5b943a..57ea3b96647 100644 --- a/src/schema/schema_list.c +++ b/src/schema/schema_list.c @@ -139,6 +139,15 @@ __wt_schema_destroy_index(WT_SESSION_IMPL *session, WT_INDEX *idx) { WT_DECL_RET; + /* If there is a custom collator configured, terminate it. */ + if (idx->collator != NULL && + idx->collator_owned && idx->collator->terminate != NULL) { + WT_TRET(idx->collator->terminate( + idx->collator, &session->iface)); + idx->collator = NULL; + idx->collator_owned = 0; + } + /* If there is a custom extractor configured, terminate it. */ if (idx->extractor != NULL && idx->extractor_owned && idx->extractor->terminate != NULL) { diff --git a/src/schema/schema_open.c b/src/schema/schema_open.c index fa655c7108b..5bc589f0781 100644 --- a/src/schema/schema_open.c +++ b/src/schema/schema_open.c @@ -130,7 +130,7 @@ static int __open_index(WT_SESSION_IMPL *session, WT_TABLE *table, WT_INDEX *idx) { WT_CONFIG colconf; - WT_CONFIG_ITEM ckey, cval; + WT_CONFIG_ITEM ckey, cval, metadata; WT_DECL_ITEM(buf); WT_DECL_ITEM(plan); WT_DECL_RET; @@ -147,6 +147,22 @@ __open_index(WT_SESSION_IMPL *session, WT_TABLE *table, WT_INDEX *idx) if (cval.val) F_SET(idx, WT_INDEX_IMMUTABLE); + /* + * Compatibility: we didn't always maintain collator information in + * index metadata, cope when it isn't found. + */ + WT_CLEAR(cval); + WT_ERR_NOTFOUND_OK(__wt_config_getones( + session, idx->config, "collator", &cval)); + if (cval.len != 0) { + WT_CLEAR(metadata); + WT_ERR_NOTFOUND_OK(__wt_config_getones( + session, idx->config, "app_metadata", &metadata)); + WT_ERR(__wt_collator_config( + session, idx->name, &cval, &metadata, + &idx->collator, &idx->collator_owned)); + } + WT_ERR(__wt_extractor_config( session, idx->config, &idx->extractor, &idx->extractor_owned)); diff --git a/src/session/session_api.c b/src/session/session_api.c index 6573f3d286d..599c7bdf44a 100644 --- a/src/session/session_api.c +++ b/src/session/session_api.c @@ -605,9 +605,15 @@ __session_truncate(WT_SESSION *wt_session, "the truncate method should not specify any" "target after the log: URI prefix."); ret = __wt_log_truncate_files(session, start, cfg); - } else + } else { + /* Wait for checkpoints to avoid EBUSY errors. */ + __wt_spin_lock(session, + &S2C(session)->checkpoint_lock); WT_WITH_SCHEMA_LOCK(session, ret = __wt_schema_truncate(session, uri, cfg)); + __wt_spin_unlock(session, + &S2C(session)->checkpoint_lock); + } goto done; } diff --git a/src/support/huffman.c b/src/support/huffman.c index 48b31b5e299..12f98184b5c 100644 --- a/src/support/huffman.c +++ b/src/support/huffman.c @@ -302,8 +302,7 @@ __wt_huffman_open(WT_SESSION_IMPL *session, uint64_t w1, w2; uint16_t i; - indexed_freqs = symbol_frequency_array; - + indexed_freqs = NULL; combined_nodes = leaves = NULL; node = node2 = tempnode = NULL; @@ -330,26 +329,24 @@ __wt_huffman_open(WT_SESSION_IMPL *session, * Order the array by symbol and check for invalid symbols and * duplicates. */ - qsort((void *)indexed_freqs, - symcnt, sizeof(INDEXED_SYMBOL), indexed_symbol_compare); + sym = symbol_frequency_array; + qsort(sym, symcnt, sizeof(INDEXED_SYMBOL), indexed_symbol_compare); for (i = 0; i < symcnt; ++i) { - if (i > 0 && - indexed_freqs[i].symbol == indexed_freqs[i - 1].symbol) + if (i > 0 && sym[i].symbol == sym[i - 1].symbol) WT_ERR_MSG(session, EINVAL, - "duplicate symbol %" PRIx32 - " specified in a huffman table", - indexed_freqs[i].symbol); - if (indexed_freqs[i].symbol > huffman->numSymbols) + "duplicate symbol %" PRIu32 " (%#" PRIx32 ") " + "specified in a huffman table", + sym[i].symbol, sym[i].symbol); + if (sym[i].symbol > huffman->numSymbols) WT_ERR_MSG(session, EINVAL, - "illegal symbol %" PRIx32 - " specified in a huffman table", - indexed_freqs[i].symbol); + "out-of-range symbol %" PRIu32 " (%#" PRIx32 ") " + "specified in a huffman table", + sym[i].symbol, sym[i].symbol); } /* * Massage frequencies. */ - indexed_freqs = NULL; WT_ERR(__wt_calloc_def(session, 256, &indexed_freqs)); /* |