diff options
-rw-r--r-- | src/lsm/lsm_tree.c | 12 | ||||
-rw-r--r-- | src/lsm/lsm_work_unit.c | 4 |
2 files changed, 16 insertions, 0 deletions
diff --git a/src/lsm/lsm_tree.c b/src/lsm/lsm_tree.c index 97360089d48..b8aecfc89b6 100644 --- a/src/lsm/lsm_tree.c +++ b/src/lsm/lsm_tree.c @@ -1222,6 +1222,18 @@ __wt_lsm_compact(WT_SESSION_IMPL *session, const char *name, int *skip) WT_ERR_MSG(session, EINVAL, "LSM compaction requires active merge threads"); + /* + * We are done if there is a single chunk in the tree and we have + * already created a bloom filter for it or we are configured not to. + */ + if (lsm_tree->nchunks == 1 && + ((FLD_ISSET(lsm_tree->bloom, WT_LSM_BLOOM_OLDEST) && + F_ISSET(lsm_tree->chunk[0], WT_LSM_CHUNK_BLOOM)) || + !FLD_ISSET(lsm_tree->bloom, WT_LSM_BLOOM_OLDEST))) { + __wt_lsm_tree_release(session, lsm_tree); + return (0); + } + WT_ERR(__wt_seconds(session, &begin)); /* diff --git a/src/lsm/lsm_work_unit.c b/src/lsm/lsm_work_unit.c index 33174c2d40d..7a2c0ebb190 100644 --- a/src/lsm/lsm_work_unit.c +++ b/src/lsm/lsm_work_unit.c @@ -215,6 +215,10 @@ __wt_lsm_work_bloom(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree) chunk->count == 0) continue; + /* Never create a bloom filter on the oldest chunk */ + if (chunk == lsm_tree->chunk[0] && + !FLD_ISSET(lsm_tree->bloom, WT_LSM_BLOOM_OLDEST)) + continue; /* * See if we win the race to switch on the "busy" flag and * recheck that the chunk still needs a Bloom filter. |