diff options
author | gabor@google.com <gabor@google.com@62dab493-f737-651d-591e-8d6aee1b9529> | 2011-07-15 00:20:57 +0000 |
---|---|---|
committer | gabor@google.com <gabor@google.com@62dab493-f737-651d-591e-8d6aee1b9529> | 2011-07-15 00:20:57 +0000 |
commit | 6699c7ebe68fba9673ea7a78b54e0eb558102301 (patch) | |
tree | acb156c19aadd00e7a14dcd26b76671d36808dae /db/version_set.cc | |
parent | ed154f6dc4f5ca82f20d2f3d4383cdbb07872594 (diff) | |
download | leveldb-6699c7ebe68fba9673ea7a78b54e0eb558102301.tar.gz |
Small tweaks and bugfixes for Issue 18 and 19.
Slight tweak to the no-overlap optimization: only push to
level 2 to reduce the amount of wasted space when the same
small key range is being repeatedly overwritten.
Fix for Issue 18: Avoid failure on Windows by avoiding
deletion of lock file until the end of DestroyDB().
Fix for Issue 19: Disregard sequence numbers when checking for
overlap in sstable ranges. This fixes issue 19: when writing
the same key over and over again, we would generate a sequence
of sstables that were never merged together since their sequence
numbers were disjoint.
Don't ignore map/unmap error checks.
Miscellaneous fixes for small problems Sanjay found while diagnosing
issue/9 and issue/16 (corruption_testr failures).
- log::Reader reports the record type when it finds an unexpected type.
- log::Reader no longer reports an error when it encounters an expected
zero record regardless of the setting of the "checksum" flag.
- Added a missing forward declaration.
- Documented a side-effects of larger write buffer sizes
(longer recovery time).
git-svn-id: https://leveldb.googlecode.com/svn/trunk@37 62dab493-f737-651d-591e-8d6aee1b9529
Diffstat (limited to 'db/version_set.cc')
-rw-r--r-- | db/version_set.cc | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/db/version_set.cc b/db/version_set.cc index 54342e4..816f189 100644 --- a/db/version_set.cc +++ b/db/version_set.cc @@ -99,11 +99,14 @@ int FindFile(const InternalKeyComparator& icmp, bool SomeFileOverlapsRange( const InternalKeyComparator& icmp, const std::vector<FileMetaData*>& files, - const InternalKey& smallest, - const InternalKey& largest) { - const int index = FindFile(icmp, files, smallest.Encode()); + const Slice& smallest_user_key, + const Slice& largest_user_key) { + // Find the earliest possible internal key for smallest_user_key + InternalKey small(smallest_user_key, kMaxSequenceNumber, kValueTypeForSeek); + const int index = FindFile(icmp, files, small.Encode()); return ((index < files.size()) && - icmp.Compare(largest, files[index]->smallest) >= 0); + icmp.user_comparator()->Compare( + largest_user_key, files[index]->smallest.user_key()) >= 0); } // An internal iterator. For a given version/level pair, yields @@ -353,9 +356,11 @@ void Version::Unref() { } bool Version::OverlapInLevel(int level, - const InternalKey& smallest, - const InternalKey& largest) { - return SomeFileOverlapsRange(vset_->icmp_, files_[level], smallest, largest); + const Slice& smallest_user_key, + const Slice& largest_user_key) { + return SomeFileOverlapsRange(vset_->icmp_, files_[level], + smallest_user_key, + largest_user_key); } std::string Version::DebugString() const { |