summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Gorrod <alexg@wiredtiger.com>2012-11-09 17:39:25 +1100
committerAlex Gorrod <alexg@wiredtiger.com>2012-11-09 17:39:25 +1100
commit85de215f21336909dd0967aec7e789c118a0e222 (patch)
treee5b9ef671ea0ee3038f04e1384d76018167c7f49
parent6dc4df748b8066f651c44fec6105f1508fe038e8 (diff)
parent40a775d5bf94e4d3b84a120bc51e2c8808ab15fc (diff)
downloadmongo-85de215f21336909dd0967aec7e789c118a0e222.tar.gz
Merge branch 'develop' into shared-cache. Manual
-rw-r--r--dist/api_data.py6
-rw-r--r--dist/s_string.ok2
-rw-r--r--examples/c/ex_test_perf.c8
-rw-r--r--src/include/wiredtiger.in6
-rw-r--r--src/lsm/lsm_tree.c2
-rw-r--r--src/lsm/lsm_worker.c71
6 files changed, 59 insertions, 36 deletions
diff --git a/dist/api_data.py b/dist/api_data.py
index a56db79e5d5..740ae834a3b 100644
--- a/dist/api_data.py
+++ b/dist/api_data.py
@@ -474,9 +474,9 @@ methods = {
'wiredtiger_open' : Method(connection_runtime_config + [
Config('buffer_alignment', '-1', r'''
- in-memory alignment (in bytes) for buffers used for I/O. By
- default, a platform-specific alignment value is used (512 bytes
- on Linux systems, zero elsewhere)''',
+ in-memory alignment (in bytes) for buffers used for I/O. The default
+ value of -1 indicates that a platform-specific alignment value should
+ be used (512 bytes on Linux systems, zero elsewhere)''',
min='-1', max='1MB'),
Config('create', 'false', r'''
create the database if it does not exist''',
diff --git a/dist/s_string.ok b/dist/s_string.ok
index 669175f3405..7e9825ef609 100644
--- a/dist/s_string.ok
+++ b/dist/s_string.ok
@@ -34,10 +34,10 @@ Bsearch
Btree
Bzip
CAS
-CDLMPRSTdehikrsuv
CELL's
CELLs
CKPT
+CLMPRSTdehikrsuv
CLR
COL's
CONCAT
diff --git a/examples/c/ex_test_perf.c b/examples/c/ex_test_perf.c
index 533717dba6b..6e686929418 100644
--- a/examples/c/ex_test_perf.c
+++ b/examples/c/ex_test_perf.c
@@ -350,8 +350,8 @@ stat_worker(void *arg)
lsm_uri = calloc(
strlen(cfg->uri) + strlen("statistics:") + 1, 1);
if (lsm_uri == NULL) {
- lprintf(cfg, ENOMEM, 0,
- "Statistics thread uri create.");
+ lprintf(
+ cfg, ENOMEM, 0, "Statistics thread uri create.");
goto err;
}
sprintf(lsm_uri, "statistics:%s", cfg->uri);
@@ -447,7 +447,7 @@ int execute_populate(CONFIG *cfg)
return (ret);
gettimeofday(&cfg->phase_start_time, NULL);
- for (cfg->elapsed_time = 0, last_ops = 0;
+ for (cfg->elapsed_time = 0, elapsed = last_ops = 0;
g_nops < cfg->icount && g_threads_quit < cfg->populate_threads;) {
/*
* Sleep for 100th of a second, report_interval is in second
@@ -848,7 +848,7 @@ void print_config(CONFIG *cfg)
void usage(void)
{
- printf("ex_perf_test [-CDLMPRSTdehikrsuv]\n");
+ printf("ex_perf_test [-CLMPRSTdehikrsuv]\n");
printf("\t-S Use a small default configuration\n");
printf("\t-M Use a medium default configuration\n");
printf("\t-L Use a large default configuration\n");
diff --git a/src/include/wiredtiger.in b/src/include/wiredtiger.in
index 0b552bb3f9a..60245a0aa05 100644
--- a/src/include/wiredtiger.in
+++ b/src/include/wiredtiger.in
@@ -1177,9 +1177,9 @@ struct __wt_connection {
* handler is installed that writes error messages to stderr
* @configstart{wiredtiger_open, see dist/api_data.py}
* @config{buffer_alignment, in-memory alignment (in bytes) for buffers used for
- * I/O. By default\, a platform-specific alignment value is used (512 bytes on
- * Linux systems\, zero elsewhere).,an integer between -1 and 1MB; default \c
- * -1.}
+ * I/O. The default value of -1 indicates that a platform-specific alignment
+ * value should be used (512 bytes on Linux systems\, zero elsewhere).,an
+ * integer between -1 and 1MB; default \c -1.}
* @config{cache_size, maximum heap memory to allocate for the cache. A database
* should configure either a cache_size or a shared_cache not both.,an integer
* between 1MB and 10TB; default \c 100MB.}
diff --git a/src/lsm/lsm_tree.c b/src/lsm/lsm_tree.c
index efdadbee498..adde8794ec9 100644
--- a/src/lsm/lsm_tree.c
+++ b/src/lsm/lsm_tree.c
@@ -180,7 +180,7 @@ __wt_lsm_tree_setup_chunk(WT_SESSION_IMPL *session,
/*
* Drop the chunk first - there may be some content hanging over from
- * an aborted merge.
+ * an aborted merge or checkpoint.
*
* Don't do this for the very first chunk: we are called during
* WT_SESSION::create, and doing a drop inside there does interesting
diff --git a/src/lsm/lsm_worker.c b/src/lsm/lsm_worker.c
index 511b75a1346..36bfdf762c9 100644
--- a/src/lsm/lsm_worker.c
+++ b/src/lsm/lsm_worker.c
@@ -85,11 +85,14 @@ __wt_lsm_checkpoint_worker(void *arg)
WT_CLEAR(cookie);
- while (F_ISSET(lsm_tree, WT_LSM_TREE_WORKING)) {
+ for (;;) {
WT_ERR(__wt_lsm_copy_chunks(session, lsm_tree, &cookie));
/* Write checkpoints in all completed files. */
for (i = 0, j = 0; i < cookie.nchunks; i++) {
+ if (!F_ISSET(lsm_tree, WT_LSM_TREE_WORKING))
+ goto err;
+
chunk = cookie.chunk_array[i];
/* Stop if a thread is still active in the chunk. */
if (chunk->ncursor != 0 ||
@@ -97,7 +100,15 @@ __wt_lsm_checkpoint_worker(void *arg)
!F_ISSET(chunk, WT_LSM_CHUNK_ONDISK)))
break;
- if (!F_ISSET(chunk, WT_LSM_CHUNK_BLOOM) &&
+ if (F_ISSET(chunk, WT_LSM_CHUNK_ONDISK) &&
+ (!FLD_ISSET(lsm_tree->bloom, WT_LSM_BLOOM_NEWEST) ||
+ F_ISSET(chunk, WT_LSM_CHUNK_BLOOM) ||
+ chunk->count == 0))
+ continue;
+
+ if (FLD_ISSET(lsm_tree->bloom, WT_LSM_BLOOM_NEWEST) &&
+ !F_ISSET(chunk, WT_LSM_CHUNK_BLOOM) &&
+ chunk->count != 0 &&
(ret = __lsm_bloom_create(
session, lsm_tree, chunk)) != 0) {
(void)__wt_err(
@@ -105,35 +116,43 @@ __wt_lsm_checkpoint_worker(void *arg)
break;
}
- if (F_ISSET(chunk, WT_LSM_CHUNK_ONDISK))
- continue;
-
/*
* NOTE: we pass a non-NULL config, because otherwise
* __wt_checkpoint thinks we're closing the file.
*/
- WT_WITH_SCHEMA_LOCK(session,
- ret = __wt_schema_worker(session, chunk->uri,
- __wt_checkpoint, cfg, 0));
- if (ret == 0) {
- ++j;
- __wt_spin_lock(session, &lsm_tree->lock);
- F_SET(chunk, WT_LSM_CHUNK_ONDISK);
- ++lsm_tree->dsk_gen;
- __wt_spin_unlock(session, &lsm_tree->lock);
- WT_VERBOSE_ERR(session, lsm,
- "LSM worker checkpointed %d.", i);
- } else {
- (void)__wt_err(
- session, ret, "LSM checkpoint failed");
+ if (!F_ISSET(chunk, WT_LSM_CHUNK_ONDISK)) {
+ WT_WITH_SCHEMA_LOCK(session,
+ ret = __wt_schema_worker(session,
+ chunk->uri, __wt_checkpoint, cfg, 0));
+
+ if (ret != 0) {
+ (void)__wt_err(session, ret,
+ "LSM checkpoint failed");
+ break;
+ }
+ }
+
+ ++j;
+ __wt_spin_lock(session, &lsm_tree->lock);
+ F_SET(chunk, WT_LSM_CHUNK_ONDISK);
+ ++lsm_tree->dsk_gen;
+ ret = __wt_lsm_meta_write(session, lsm_tree);
+ __wt_spin_unlock(session, &lsm_tree->lock);
+
+ if (ret != 0) {
+ (void)__wt_err(session, ret,
+ "LSM metadata write failed");
break;
}
+
+ WT_VERBOSE_ERR(session, lsm,
+ "LSM worker checkpointed %d.", i);
}
if (j == 0)
__wt_sleep(0, 1000);
}
-err: __wt_free(session, cookie.chunk_array);
+err: __wt_free(session, cookie.chunk_array);
return (NULL);
}
@@ -193,13 +212,10 @@ __lsm_bloom_create(WT_SESSION_IMPL *session,
WT_CURSOR *src;
WT_DECL_RET;
WT_ITEM buf, key;
+ WT_SESSION *wt_session;
const char *cur_cfg[] = API_CONF_DEFAULTS(session, open_cursor, "raw");
uint64_t insert_count;
- if (!FLD_ISSET(lsm_tree->bloom, WT_LSM_BLOOM_NEWEST) ||
- chunk->count == 0)
- return (0);
-
/*
* Normally, the Bloom URI is populated when the chunk struct is
* allocated. After an open, however, it may not have been.
@@ -212,6 +228,13 @@ __lsm_bloom_create(WT_SESSION_IMPL *session,
chunk->bloom_uri = __wt_buf_steal(session, &buf, NULL);
}
+ /*
+ * Drop the bloom filter first - there may be some content hanging over
+ * from an aborted merge or checkpoint.
+ */
+ wt_session = &session->iface;
+ WT_RET(wt_session->drop(wt_session, chunk->bloom_uri, "force"));
+
bloom = NULL;
WT_RET(__wt_bloom_create(session, chunk->bloom_uri,