summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Cahill <michael.cahill@wiredtiger.com>2012-11-21 14:45:14 +1100
committerMichael Cahill <michael.cahill@wiredtiger.com>2012-11-21 14:45:14 +1100
commit7c5fec29f30e7e7c6e1f4b3668b5d663fbff4cce (patch)
treeec65a384eb9db548f654a2007fc53c102fe55ff5
parentc12bc238b0bf8f3cb73341274d9a4a1eb6c037e5 (diff)
downloadmongo-7c5fec29f30e7e7c6e1f4b3668b5d663fbff4cce.tar.gz
Don't try to merge with a chunk that is much larger than a small chunk.
-rw-r--r--src/lsm/lsm_merge.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/lsm/lsm_merge.c b/src/lsm/lsm_merge.c
index b8054e70b0a..d554f6311cb 100644
--- a/src/lsm/lsm_merge.c
+++ b/src/lsm/lsm_merge.c
@@ -136,10 +136,18 @@ __wt_lsm_merge(
break;
/*
+ * Only merge across more than 2 generations if there are no
+ * new chunks being created.
+ */
+ if (stalls < 50 && chunk->generation >=
+ lsm_tree->chunk[end_chunk]->generation + 2)
+ break;
+
+ /*
* If the next chunk is more than double the average size of
* the chunks we have so far, stop.
*/
- if (nchunks > 2 && chunk->count > 2 * record_count / nchunks)
+ if (nchunks > 1 && chunk->count > 2 * record_count / nchunks)
break;
/*
@@ -188,8 +196,9 @@ __wt_lsm_merge(
dest_id = WT_ATOMIC_ADD(lsm_tree->last, 1);
WT_VERBOSE_RET(session, lsm,
- "Merging chunks %d-%d into %d (%" PRIu64 " records)\n",
- start_chunk, end_chunk, dest_id, record_count);
+ "Merging chunks %d-%d into %d (%" PRIu64 " records)"
+ ", generation %d\n",
+ start_chunk, end_chunk, dest_id, record_count, generation);
WT_RET(__wt_calloc_def(session, 1, &chunk));
chunk->id = dest_id;