summaryrefslogtreecommitdiff
path: root/db/version_set.cc
diff options
context:
space:
mode:
authorDavid Grogan <dgrogan@chromium.org>2013-06-13 16:14:06 -0700
committerDavid Grogan <dgrogan@chromium.org>2013-06-13 16:14:06 -0700
commit7b094f12e46a45b911f20f7bd2ca96f83e272d91 (patch)
treea1ab034dfa283ad46d3b543c7e5b152b77fb8a46 /db/version_set.cc
parent28dad918f2ffb80fd70110ed5cd47744339649f2 (diff)
downloadleveldb-7b094f12e46a45b911f20f7bd2ca96f83e272d91.tar.gz
Release leveldb 1.11v1.11
Fixes issues 161 174 178 As well as the issue reported by edouarda14@gmail.com about MissingSSTFile unit test failing on windows.
Diffstat (limited to 'db/version_set.cc')
-rw-r--r--db/version_set.cc21
1 files changed, 13 insertions, 8 deletions
diff --git a/db/version_set.cc b/db/version_set.cc
index 7d0a5de..4fd1dde 100644
--- a/db/version_set.cc
+++ b/db/version_set.cc
@@ -1331,14 +1331,19 @@ Compaction* VersionSet::CompactRange(
}
// Avoid compacting too much in one shot in case the range is large.
- const uint64_t limit = MaxFileSizeForLevel(level);
- uint64_t total = 0;
- for (size_t i = 0; i < inputs.size(); i++) {
- uint64_t s = inputs[i]->file_size;
- total += s;
- if (total >= limit) {
- inputs.resize(i + 1);
- break;
+ // But we cannot do this for level-0 since level-0 files can overlap
+ // and we must not pick one file and drop another older file if the
+ // two files overlap.
+ if (level > 0) {
+ const uint64_t limit = MaxFileSizeForLevel(level);
+ uint64_t total = 0;
+ for (size_t i = 0; i < inputs.size(); i++) {
+ uint64_t s = inputs[i]->file_size;
+ total += s;
+ if (total >= limit) {
+ inputs.resize(i + 1);
+ break;
+ }
}
}