summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSusan LoVerso <sue@wiredtiger.com>2014-02-26 10:31:55 -0500
committerSusan LoVerso <sue@wiredtiger.com>2014-02-26 10:31:55 -0500
commit88e8a5eed0f77cbbd99e1819e39c820627841a1b (patch)
tree19b16c6549ebd573470b39a38ad6f902077a1cd1
parent6565f622fe9acdfa80471264b1013665b5f54641 (diff)
parent758f7cd142a266a68569cbc1dd86d4ab1b6d129d (diff)
downloadmongo-88e8a5eed0f77cbbd99e1819e39c820627841a1b.tar.gz
Merge branch 'develop' into lsm-fixes
-rw-r--r--bench/wtperf/runners/multi-btree.wtperf8
-rw-r--r--bench/wtperf/wtperf.c58
-rw-r--r--ext/datasources/helium/helium.c12
-rw-r--r--src/lsm/lsm_stat.c2
-rw-r--r--src/support/scratch.c3
5 files changed, 51 insertions, 32 deletions
diff --git a/bench/wtperf/runners/multi-btree.wtperf b/bench/wtperf/runners/multi-btree.wtperf
index 350321f5607..831aa71cdd2 100644
--- a/bench/wtperf/runners/multi-btree.wtperf
+++ b/bench/wtperf/runners/multi-btree.wtperf
@@ -1,8 +1,9 @@
-# wtperf options file: small btree configuration
+# wtperf options file: small btree multi-database configuration
+# Original cache was 500MB. Shared cache is 500MB * database_count.
conn_config="shared_cache=(enable=true,size=2500MB,chunk=10M)"
-#conn_config="cache_size=500MB"
-table_config="leaf_page_max=4k,internal_page_max=16k,leaf_item_max=1433,internal_item_max=3100,type=file"
database_count=5
+table_config="leaf_page_max=4k,internal_page_max=16k,leaf_item_max=1433,internal_item_max=3100,type=file"
+# Likewise, divide original icount by database_count.
icount=50000
populate_threads=1
random_range=100000000
@@ -10,4 +11,3 @@ report_interval=5
run_time=3000
threads=((count=1,reads=1),(count=1,inserts=1))
value_sz=1024
-
diff --git a/bench/wtperf/wtperf.c b/bench/wtperf/wtperf.c
index c52dbd6cd96..d0e0b0cd51c 100644
--- a/bench/wtperf/wtperf.c
+++ b/bench/wtperf/wtperf.c
@@ -71,16 +71,16 @@ static const char * const debug_tconfig = "";
#endif
static void *checkpoint_worker(void *);
-static int create_tables(CONFIG *);
-static int create_uris(CONFIG *);
+static int create_tables(CONFIG *);
+static int create_uris(CONFIG *);
static int execute_populate(CONFIG *);
static int execute_workload(CONFIG *);
static int find_table_count(CONFIG *);
static void *monitor(void *);
static void *populate_thread(void *);
-static void randomize_value(CONFIG *, char *);
-static int start_all_runs(CONFIG *);
-static int start_run(CONFIG *);
+static void randomize_value(CONFIG *, char *);
+static int start_all_runs(CONFIG *);
+static int start_run(CONFIG *);
static int start_threads(CONFIG *,
WORKLOAD *, CONFIG_THREAD *, u_int, void *(*)(void *));
static int stop_threads(CONFIG *, u_int, CONFIG_THREAD *);
@@ -1122,13 +1122,18 @@ find_table_count(CONFIG *cfg)
if (table_icount > max_icount)
max_icount = table_icount;
-err: if ((t_ret = session->close(session, NULL)) != 0) {
- if (ret == 0)
- ret = t_ret;
+ if ((ret = cursor->close(cursor)) != 0) {
lprintf(cfg, ret, 0,
- "find_table_count: session close failed");
+ "find_table_count: cursor close failed");
+ goto err;
}
}
+err: if ((t_ret = session->close(session, NULL)) != 0) {
+ if (ret == 0)
+ ret = t_ret;
+ lprintf(cfg, ret, 0,
+ "find_table_count: session close failed");
+ }
cfg->icount = max_icount;
out: return (ret);
}
@@ -1217,10 +1222,11 @@ start_all_runs(CONFIG *cfg)
{
CONFIG *next_cfg, **configs;
char *cmd_buf, *new_home;
- int ret;
+ int ret, t_ret;
size_t cmd_len, home_len, i;
pthread_t *threads;
+ ret = 0;
configs = NULL;
cmd_buf = NULL;
@@ -1252,7 +1258,12 @@ start_all_runs(CONFIG *cfg)
goto err;
/* Setup a unique home directory for each database. */
+ configs[i] = next_cfg;
new_home = malloc(home_len + 5);
+ if (new_home == NULL) {
+ ret = ENOMEM;
+ goto err;
+ }
sprintf(new_home, "%s/D%02d", cfg->home, (int)i);
next_cfg->home = (const char *)new_home;
@@ -1272,20 +1283,21 @@ start_all_runs(CONFIG *cfg)
lprintf(cfg, ret, 0, "Error creating thread");
goto err;
}
- configs[i] = next_cfg;
}
/* Wait for threads to finish. */
for (i = 0; i < cfg->database_count; i++) {
- if ((ret = pthread_join(threads[i], NULL)) != 0) {
+ if ((t_ret = pthread_join(threads[i], NULL)) != 0) {
lprintf(cfg, ret, 0, "Error joining thread");
- return (ret);
+ if (ret == 0)
+ ret = t_ret;
}
}
err: for (i = 0; i < cfg->database_count && configs[i] != NULL; i++) {
free((char *)configs[i]->home);
config_free(configs[i]);
+ free(configs[i]);
}
free(configs);
free(threads);
@@ -1343,7 +1355,8 @@ start_run(CONFIG *cfg)
goto err;
if ((ret = create_tables(cfg)) != 0)
goto err;
- /* Start the monitor thread. */
+
+ /* Start the monitor thread. */
if (cfg->sample_interval != 0) {
if ((ret = pthread_create(
&monitor_thread, NULL, monitor, cfg)) != 0) {
@@ -1353,15 +1366,17 @@ start_run(CONFIG *cfg)
}
monitor_created = 1;
}
- /* If creating, populate the table. */
+
+ /* If creating, populate the table. */
if (cfg->create != 0 && execute_populate(cfg) != 0)
goto err;
- /* Optional workload. */
+
+ /* Optional workload. */
if (cfg->run_time != 0 || cfg->run_ops != 0) {
- /* Didn't create, set insert count. */
+ /* Didn't create, set insert count. */
if (cfg->create == 0 && find_table_count(cfg) != 0)
goto err;
- /* Start the checkpoint thread. */
+ /* Start the checkpoint thread. */
if (cfg->checkpoint_threads != 0) {
lprintf(cfg, 0, 1,
"Starting %" PRIu32 " checkpoint thread(s)",
@@ -1376,7 +1391,7 @@ start_run(CONFIG *cfg)
cfg->checkpoint_threads, checkpoint_worker) != 0)
goto err;
}
- /* Execute the workload. */
+ /* Execute the workload. */
if ((ret = execute_workload(cfg)) != 0)
goto err;
@@ -1594,11 +1609,12 @@ main(int argc, char *argv[])
goto err;
}
- /* Sanity-check the configuration */
+ /* Sanity-check the configuration. */
if (config_sanity(cfg) != 0)
goto err;
- if (cfg->verbose > 1) /* Display the configuration. */
+ /* Display the configuration. */
+ if (cfg->verbose > 1)
config_print(cfg);
if ((ret = start_all_runs(cfg)) != 0)
diff --git a/ext/datasources/helium/helium.c b/ext/datasources/helium/helium.c
index c8a6fe99bb0..cc420c89999 100644
--- a/ext/datasources/helium/helium.c
+++ b/ext/datasources/helium/helium.c
@@ -2102,7 +2102,7 @@ helium_session_open_cursor(WT_DATA_SOURCE *wtds, WT_SESSION *session,
WT_CURSOR *wtcursor;
WT_EXTENSION_API *wtext;
WT_SOURCE *ws;
- int locked, ret, t_ret;
+ int locked, ret, tret;
const char *value;
*new_cursor = NULL;
@@ -2113,7 +2113,7 @@ helium_session_open_cursor(WT_DATA_SOURCE *wtds, WT_SESSION *session,
wtext = ds->wtext;
ws = NULL;
locked = 0;
- ret = t_ret = 0;
+ ret = tret = 0;
value = NULL;
/* Allocate and initialize a cursor. */
@@ -2227,9 +2227,11 @@ err: if (ws != NULL && locked)
ESET(unlock(wtext, session, &ws->lock));
cursor_destroy(cursor);
}
- if (config_parser != NULL && (t_ret =
- (void)config_parser->close(config_parser)) != 0 && ret == 0)
- ret = t_ret;
+ if (config_parser != NULL &&
+ (tret = config_parser->close(config_parser)) != 0)
+ EMSG(wtext, session, tret,
+ "WT_CONFIG_PARSER.close: %s", wtext->strerror(tret));
+
free((void *)value);
return (ret);
}
diff --git a/src/lsm/lsm_stat.c b/src/lsm/lsm_stat.c
index 30148de9a9f..a626032fe8a 100644
--- a/src/lsm/lsm_stat.c
+++ b/src/lsm/lsm_stat.c
@@ -39,7 +39,7 @@ __lsm_stat_init(WT_SESSION_IMPL *session, const char *uri, WT_CURSOR_STAT *cst)
"statistics=(%s%s%s)",
cst->stat_clear ? "clear," : "",
cst->stat_all ? "all," : "",
- cst->stat_fast ? "fast," : "");
+ !cst->stat_all && cst->stat_fast ? "fast," : "");
cfg[1] = disk_cfg[1] = config;
}
diff --git a/src/support/scratch.c b/src/support/scratch.c
index 4b342977372..1aae8649901 100644
--- a/src/support/scratch.c
+++ b/src/support/scratch.c
@@ -127,7 +127,8 @@ __wt_buf_set(
/* Ensure the buffer is large enough. */
WT_RET(__wt_buf_initsize(session, buf, size));
- memcpy(buf->mem, data, size);
+ /* Copy, allowing for overlapping strings. */
+ memmove(buf->mem, data, size);
return (0);
}