summaryrefslogtreecommitdiff
path: root/table
diff options
context:
space:
mode:
authorHans Wennborg <hans@chromium.org>2011-10-31 17:22:06 +0000
committerHans Wennborg <hans@chromium.org>2011-10-31 17:22:06 +0000
commit36a5f8ed7f9fb3373236d5eace4f5fea369856ee (patch)
tree59dd30362b5471d422313b52d561c88b124a2c7a /table
parent299ccedfeca1fb3497978c288e76008a5c08e899 (diff)
downloadleveldb-36a5f8ed7f9fb3373236d5eace4f5fea369856ee.tar.gz
A number of fixes:
- Replace raw slice comparison with a call to user comparator. Added test for custom comparators. - Fix end of namespace comments. - Fixed bug in picking inputs for a level-0 compaction. When finding overlapping files, the covered range may expand as files are added to the input set. We now correctly expand the range when this happens instead of continuing to use the old range. For example, suppose L0 contains files with the following ranges: F1: a .. d F2: c .. g F3: f .. j and the initial compaction target is F3. We used to search for range f..j which yielded {F2,F3}. However we now expand the range as soon as another file is added. In this case, when F2 is added, we expand the range to c..j and restart the search. That picks up file F1 as well. This change fixes a bug related to deleted keys showing up incorrectly after a compaction as described in Issue 44. (Sync with upstream @25072954)
Diffstat (limited to 'table')
-rw-r--r--table/block.cc2
-rw-r--r--table/block.h2
-rw-r--r--table/block_builder.cc2
-rw-r--r--table/block_builder.h2
-rw-r--r--table/format.cc2
-rw-r--r--table/format.h2
-rw-r--r--table/iterator.cc4
-rw-r--r--table/merger.cc4
-rw-r--r--table/merger.h2
-rw-r--r--table/table.cc2
-rw-r--r--table/table_builder.cc2
-rw-r--r--table/table_test.cc6
-rw-r--r--table/two_level_iterator.cc4
-rw-r--r--table/two_level_iterator.h2
14 files changed, 19 insertions, 19 deletions
diff --git a/table/block.cc b/table/block.cc
index c20bb38..40aa318 100644
--- a/table/block.cc
+++ b/table/block.cc
@@ -260,4 +260,4 @@ Iterator* Block::NewIterator(const Comparator* cmp) {
}
}
-}
+} // namespace leveldb
diff --git a/table/block.h b/table/block.h
index cdf0598..9eb6f02 100644
--- a/table/block.h
+++ b/table/block.h
@@ -38,6 +38,6 @@ class Block {
class Iter;
};
-}
+} // namespace leveldb
#endif // STORAGE_LEVELDB_TABLE_BLOCK_H_
diff --git a/table/block_builder.cc b/table/block_builder.cc
index d2ffa21..db660cd 100644
--- a/table/block_builder.cc
+++ b/table/block_builder.cc
@@ -106,4 +106,4 @@ void BlockBuilder::Add(const Slice& key, const Slice& value) {
counter_++;
}
-}
+} // namespace leveldb
diff --git a/table/block_builder.h b/table/block_builder.h
index bf92a0f..5b545bd 100644
--- a/table/block_builder.h
+++ b/table/block_builder.h
@@ -52,6 +52,6 @@ class BlockBuilder {
void operator=(const BlockBuilder&);
};
-}
+} // namespace leveldb
#endif // STORAGE_LEVELDB_TABLE_BLOCK_BUILDER_H_
diff --git a/table/format.cc b/table/format.cc
index ba7838c..23728d8 100644
--- a/table/format.cc
+++ b/table/format.cc
@@ -132,4 +132,4 @@ Status ReadBlock(RandomAccessFile* file,
return Status::OK();
}
-}
+} // namespace leveldb
diff --git a/table/format.h b/table/format.h
index a6ab964..2a3e1ac 100644
--- a/table/format.h
+++ b/table/format.h
@@ -98,6 +98,6 @@ inline BlockHandle::BlockHandle()
size_(~static_cast<uint64_t>(0)) {
}
-}
+} // namespace leveldb
#endif // STORAGE_LEVELDB_TABLE_FORMAT_H_
diff --git a/table/iterator.cc b/table/iterator.cc
index 33bc8a2..3d1c87f 100644
--- a/table/iterator.cc
+++ b/table/iterator.cc
@@ -54,7 +54,7 @@ class EmptyIterator : public Iterator {
private:
Status status_;
};
-}
+} // namespace
Iterator* NewEmptyIterator() {
return new EmptyIterator(Status::OK());
@@ -64,4 +64,4 @@ Iterator* NewErrorIterator(const Status& status) {
return new EmptyIterator(status);
}
-}
+} // namespace leveldb
diff --git a/table/merger.cc b/table/merger.cc
index 6ce06bb..2dde4dc 100644
--- a/table/merger.cc
+++ b/table/merger.cc
@@ -181,7 +181,7 @@ void MergingIterator::FindLargest() {
}
current_ = largest;
}
-}
+} // namespace
Iterator* NewMergingIterator(const Comparator* cmp, Iterator** list, int n) {
assert(n >= 0);
@@ -194,4 +194,4 @@ Iterator* NewMergingIterator(const Comparator* cmp, Iterator** list, int n) {
}
}
-}
+} // namespace leveldb
diff --git a/table/merger.h b/table/merger.h
index 71d9dc5..91ddd80 100644
--- a/table/merger.h
+++ b/table/merger.h
@@ -21,6 +21,6 @@ class Iterator;
extern Iterator* NewMergingIterator(
const Comparator* comparator, Iterator** children, int n);
-}
+} // namespace leveldb
#endif // STORAGE_LEVELDB_TABLE_MERGER_H_
diff --git a/table/table.cc b/table/table.cc
index 9820753..5f9238e 100644
--- a/table/table.cc
+++ b/table/table.cc
@@ -172,4 +172,4 @@ uint64_t Table::ApproximateOffsetOf(const Slice& key) const {
return result;
}
-}
+} // namespace leveldb
diff --git a/table/table_builder.cc b/table/table_builder.cc
index 7ec7ad2..682ce5b 100644
--- a/table/table_builder.cc
+++ b/table/table_builder.cc
@@ -224,4 +224,4 @@ uint64_t TableBuilder::FileSize() const {
return rep_->offset;
}
-}
+} // namespace leveldb
diff --git a/table/table_test.cc b/table/table_test.cc
index c69a386..cd85b4b 100644
--- a/table/table_test.cc
+++ b/table/table_test.cc
@@ -60,7 +60,7 @@ class ReverseKeyComparator : public Comparator {
*key = Reverse(s);
}
};
-}
+} // namespace
static ReverseKeyComparator reverse_key_comparator;
static void Increment(const Comparator* cmp, std::string* key) {
@@ -85,7 +85,7 @@ struct STLLessThan {
return cmp->Compare(Slice(a), Slice(b)) < 0;
}
};
-}
+} // namespace
class StringSink: public WritableFile {
public:
@@ -847,7 +847,7 @@ TEST(TableTest, ApproximateOffsetOfCompressed) {
ASSERT_TRUE(Between(c.ApproximateOffsetOf("xyz"), 4000, 6000));
}
-}
+} // namespace leveldb
int main(int argc, char** argv) {
return leveldb::test::RunAllTests();
diff --git a/table/two_level_iterator.cc b/table/two_level_iterator.cc
index 24a1241..7822eba 100644
--- a/table/two_level_iterator.cc
+++ b/table/two_level_iterator.cc
@@ -169,7 +169,7 @@ void TwoLevelIterator::InitDataBlock() {
}
}
-}
+} // namespace
Iterator* NewTwoLevelIterator(
Iterator* index_iter,
@@ -179,4 +179,4 @@ Iterator* NewTwoLevelIterator(
return new TwoLevelIterator(index_iter, block_function, arg, options);
}
-}
+} // namespace leveldb
diff --git a/table/two_level_iterator.h b/table/two_level_iterator.h
index 5909e2b..629ca34 100644
--- a/table/two_level_iterator.h
+++ b/table/two_level_iterator.h
@@ -29,6 +29,6 @@ extern Iterator* NewTwoLevelIterator(
void* arg,
const ReadOptions& options);
-}
+} // namespace leveldb
#endif // STORAGE_LEVELDB_TABLE_TWO_LEVEL_ITERATOR_H_