summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Bostic <keith@wiredtiger.com>2013-05-14 08:48:24 -0400
committerKeith Bostic <keith@wiredtiger.com>2013-05-14 08:48:24 -0400
commit73a0c8a509188e97cf1eaf0155448091716499de (patch)
tree3488de99afa1fa9748b7645ee566effb18fd360a
parenta317ae0d34f5ac63cdb482a0f280af12ba19ebe5 (diff)
downloadmongo-73a0c8a509188e97cf1eaf0155448091716499de.tar.gz
Change file_extend syntax from file_extend=(type=[data,log],size=XXX)
to file_extend=(data=XXX,log=XXX). Add period testing of file_extend to test/format.
-rw-r--r--dist/api_data.py17
-rw-r--r--src/config/config_def.c20
-rw-r--r--src/conn/conn_api.c14
-rw-r--r--src/include/connection.h4
-rw-r--r--src/include/wiredtiger.in15
-rw-r--r--src/os_posix/os_open.c6
-rw-r--r--test/format/config.h4
-rw-r--r--test/format/format.h1
-rw-r--r--test/format/wts.c5
9 files changed, 39 insertions, 47 deletions
diff --git a/dist/api_data.py b/dist/api_data.py
index 53524a3ded9..b87ba07719d 100644
--- a/dist/api_data.py
+++ b/dist/api_data.py
@@ -561,18 +561,11 @@ methods = {
<code>extensions=(/path/ext.so={entry=my_entry})</code>''',
type='list'),
Config('file_extend', '', r'''
- file extension configuration. If set, extend files a chunk at
- a time instead instead of a block at a time as each new block
- is written''',
- type='category', subconfig=[
- Config('size', '8MB', r'''
- granularity (in bytes) for file extension''',
- min='1MB'),
- Config('type', '', r'''
- types of files to extend. Options are given as a list, such as
- <code>"file_extend=(type=[data])"</code>''',
- type='list', choices=['data', 'log'])
- ]),
+ file extension configuration. If set, extend files of the set
+ type in allocations of the set size, instead of a block at a
+ time as each new block is written. For example,
+ <code>file_extend=(data=16MB)</code>''',
+ type='list', choices=['data', 'log']),
Config('hazard_max', '1000', r'''
maximum number of simultaneous hazard pointers per session
handle''',
diff --git a/src/config/config_def.c b/src/config/config_def.c
index a6ccd4c0ddf..c01894400c4 100644
--- a/src/config/config_def.c
+++ b/src/config/config_def.c
@@ -209,12 +209,6 @@ static const WT_CONFIG_CHECK confchk_checkpoint_subconfigs[] = {
{ NULL, NULL, NULL, NULL }
};
-static const WT_CONFIG_CHECK confchk_file_extend_subconfigs[] = {
- { "size", "int", "min=1MB", NULL },
- { "type", "list", "choices=[\"data\",\"log\"]", NULL },
- { NULL, NULL, NULL, NULL }
-};
-
static const WT_CONFIG_CHECK confchk_statistics_log_subconfigs[] = {
{ "clear", "boolean", NULL, NULL },
{ "path", "string", NULL, NULL },
@@ -235,7 +229,7 @@ static const WT_CONFIG_CHECK confchk_wiredtiger_open[] = {
{ "eviction_target", "int", "min=10,max=99", NULL},
{ "eviction_trigger", "int", "min=10,max=99", NULL},
{ "extensions", "list", NULL, NULL},
- { "file_extend", "category", NULL, confchk_file_extend_subconfigs},
+ { "file_extend", "list", "choices=[\"data\",\"log\"]", NULL},
{ "hazard_max", "int", "min=15", NULL},
{ "logging", "boolean", NULL, NULL},
{ "lsm_merge", "boolean", NULL, NULL},
@@ -398,12 +392,12 @@ static const WT_CONFIG_ENTRY config_entries[] = {
"buffer_alignment=-1,cache_size=100MB,"
"checkpoint=(name=\"WiredTigerCheckpoint\",wait=0),create=0,"
"direct_io=,error_prefix=,eviction_dirty_target=80,eviction_target=80"
- ",eviction_trigger=95,extensions=,file_extend=(size=8MB,type=),"
- "hazard_max=1000,logging=0,lsm_merge=,mmap=,multiprocess=0,"
- "session_max=50,shared_cache=(chunk=10MB,name=pool,reserve=0,"
- "size=500MB),statistics=0,statistics_log=(clear=,"
- "path=\"WiredTigerStat.%H\",sources=,timestamp=\"%b %d %H:%M:%S\","
- "wait=0),sync=,transactional=,use_environment_priv=0,verbose=",
+ ",eviction_trigger=95,extensions=,file_extend=,hazard_max=1000,"
+ "logging=0,lsm_merge=,mmap=,multiprocess=0,session_max=50,"
+ "shared_cache=(chunk=10MB,name=pool,reserve=0,size=500MB),"
+ "statistics=0,statistics_log=(clear=,path=\"WiredTigerStat.%H\","
+ "sources=,timestamp=\"%b %d %H:%M:%S\",wait=0),sync=,transactional=,"
+ "use_environment_priv=0,verbose=",
confchk_wiredtiger_open
},
{ NULL, NULL, NULL }
diff --git a/src/conn/conn_api.c b/src/conn/conn_api.c
index db8d1dd68ce..5ec60c6a524 100644
--- a/src/conn/conn_api.c
+++ b/src/conn/conn_api.c
@@ -961,17 +961,21 @@ wiredtiger_open(const char *home, WT_EVENT_HANDLER *event_handler,
goto err;
}
- WT_ERR(__wt_config_gets(session, cfg, "file_extend.type", &cval));
+ 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);
if (ret == 0) {
- if (sval.val)
- FLD_SET(conn->file_extend, ft->flag);
+ switch (ft->flag) {
+ case WT_FILE_TYPE_DATA:
+ conn->data_extend_len = sval.val;
+ break;
+ case WT_FILE_TYPE_LOG:
+ conn->log_extend_len = sval.val;
+ break;
+ }
} else if (ret != WT_NOTFOUND)
goto err;
}
- WT_ERR(__wt_config_gets(session, cfg, "file_extend.size", &cval));
- conn->file_extend_len = cval.val;
WT_ERR(__wt_config_gets(session, cfg, "mmap", &cval));
conn->mmap = cval.val == 0 ? 0 : 1;
diff --git a/src/include/connection.h b/src/include/connection.h
index b2731cbfc45..78d9431fbbe 100644
--- a/src/include/connection.h
+++ b/src/include/connection.h
@@ -185,8 +185,8 @@ struct __wt_connection_impl {
uint32_t schema_gen; /* Schema generation number */
- uint32_t file_extend; /* file_extend file type flags */
- off_t file_extend_len; /* file_extend length */
+ off_t data_extend_len; /* file_extend data length */
+ off_t log_extend_len; /* file_extend log length */
uint32_t direct_io; /* O_DIRECT file type flags */
int mmap; /* mmap configuration */
diff --git a/src/include/wiredtiger.in b/src/include/wiredtiger.in
index 2a9880f1776..412e08f1d9a 100644
--- a/src/include/wiredtiger.in
+++ b/src/include/wiredtiger.in
@@ -1357,16 +1357,11 @@ struct __wt_connection {
* WT_CONNECTION::load_extension. For example\,
* <code>extensions=(/path/ext.so={entry=my_entry})</code>., a list of strings;
* default empty.}
- * @config{file_extend = (, file extension configuration. If set\, extend files
- * a chunk at a time instead instead of a block at a time as each new block is
- * written., a set of related configuration options defined below.}
- * @config{&nbsp;&nbsp;&nbsp;&nbsp;size, granularity (in bytes) for file
- * extension., an integer greater than or equal to 1MB; default \c 8MB.}
- * @config{&nbsp;&nbsp;&nbsp;&nbsp;type, types of files to extend. Options are
- * given as a list\, such as <code>"file_extend=(type=[data])"</code>., a list\,
- * with values chosen from the following options: \c "data"\, \c "log"; default
- * empty.}
- * @config{ ),,}
+ * @config{file_extend, file extension configuration. If set\, extend files of
+ * the set type in allocations of the set size\, instead of a block at a time as
+ * each new block is written. For example\,
+ * <code>file_extend=(data=16MB)</code>., a list\, with values chosen from the
+ * following options: \c "data"\, \c "log"; default empty.}
* @config{hazard_max, maximum number of simultaneous hazard pointers per
* session handle., an integer greater than or equal to 15; default \c 1000.}
* @config{logging, enable logging., a boolean flag; default \c false.}
diff --git a/src/os_posix/os_open.c b/src/os_posix/os_open.c
index 2c1c503f2f2..c55cba4340a 100644
--- a/src/os_posix/os_open.c
+++ b/src/os_posix/os_open.c
@@ -161,10 +161,8 @@ __wt_open(WT_SESSION_IMPL *session,
WT_ERR(__wt_filesize(session, fh, &fh->size));
/* Configure file extension. */
- if (is_tree && FLD_ISSET(conn->file_extend, WT_FILE_TYPE_DATA)) {
- fh->extend_size = fh->size;
- fh->extend_len = conn->file_extend_len;
- }
+ if (is_tree)
+ fh->extend_len = conn->data_extend_len;
/* Link onto the environment's list of files. */
__wt_spin_lock(session, &conn->fh_lock);
diff --git a/test/format/config.h b/test/format/config.h
index 8a282642cb0..ef5b04363a5 100644
--- a/test/format/config.h
+++ b/test/format/config.h
@@ -82,6 +82,10 @@ static CONFIG c[] = {
"type of compression (none | bzip | lzo | raw | snappy)",
0, C_IGNORE|C_STRING, 1, 5, NULL, &g.c_compression },
+ { "data_extend",
+ "if data files are extended", /* 5% */
+ 0, C_BOOL, 5, 0, &g.c_data_extend, NULL },
+
{ "data_source",
"type of data source to create (file | kvs | lsm | table)",
0, C_IGNORE | C_STRING, 0, 0, NULL, &g.c_data_source },
diff --git a/test/format/format.h b/test/format/format.h
index 331b856ee3d..1871e425497 100644
--- a/test/format/format.h
+++ b/test/format/format.h
@@ -122,6 +122,7 @@ typedef struct {
u_int c_cache;
char *c_compression;
char *c_config_open;
+ u_int c_data_extend;
char *c_data_source;
u_int c_delete_pct;
u_int c_dictionary;
diff --git a/test/format/wts.c b/test/format/wts.c
index 78a83b0738e..03ea7de4190 100644
--- a/test/format/wts.c
+++ b/test/format/wts.c
@@ -75,13 +75,16 @@ wts_open(void)
* override the standard configuration.
*/
snprintf(config, sizeof(config),
- "create,sync=false,cache_size=%" PRIu32 "MB,"
+ "create,"
+ "sync=false,cache_size=%" PRIu32 "MB,"
"error_prefix=\"%s\","
+ "%s,"
"extensions="
"[\"%s\", \"%s\", \"%s\", \"%s\", \"%s\", \"%s\", \"%s\"],"
"%s,%s",
g.c_cache,
g.progname,
+ g.c_data_extend ? "file_extend=(data=8MB)," : "",
REVERSE_PATH,
access(BZIP_PATH, R_OK) == 0 ? BZIP_PATH : "",
access(LZO_PATH, R_OK) == 0 ? LZO_PATH : "",