summaryrefslogtreecommitdiff
path: root/db
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 /db
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 'db')
-rw-r--r--db/builder.cc2
-rw-r--r--db/builder.h2
-rw-r--r--db/corruption_test.cc2
-rw-r--r--db/db_bench.cc4
-rw-r--r--db/db_impl.cc4
-rw-r--r--db/db_impl.h2
-rw-r--r--db/db_iter.cc2
-rw-r--r--db/db_iter.h2
-rw-r--r--db/db_test.cc102
-rw-r--r--db/dbformat.cc2
-rw-r--r--db/dbformat.h4
-rw-r--r--db/dbformat_test.cc2
-rw-r--r--db/filename.cc2
-rw-r--r--db/filename.h2
-rw-r--r--db/filename_test.cc2
-rw-r--r--db/log_format.h4
-rw-r--r--db/log_reader.cc4
-rw-r--r--db/log_reader.h4
-rw-r--r--db/log_test.cc4
-rw-r--r--db/log_writer.cc4
-rw-r--r--db/log_writer.h4
-rw-r--r--db/memtable.cc2
-rw-r--r--db/memtable.h2
-rw-r--r--db/repair.cc4
-rw-r--r--db/skiplist.h2
-rw-r--r--db/skiplist_test.cc2
-rw-r--r--db/snapshot.h2
-rw-r--r--db/table_cache.cc2
-rw-r--r--db/table_cache.h2
-rw-r--r--db/version_edit.cc2
-rw-r--r--db/version_edit.h2
-rw-r--r--db/version_edit_test.cc2
-rw-r--r--db/version_set.cc36
-rw-r--r--db/version_set.h2
-rw-r--r--db/version_set_test.cc2
-rw-r--r--db/write_batch.cc4
-rw-r--r--db/write_batch_internal.h2
-rw-r--r--db/write_batch_test.cc2
38 files changed, 172 insertions, 60 deletions
diff --git a/db/builder.cc b/db/builder.cc
index 34a7b87..f419882 100644
--- a/db/builder.cc
+++ b/db/builder.cc
@@ -85,4 +85,4 @@ Status BuildTable(const std::string& dbname,
return s;
}
-}
+} // namespace leveldb
diff --git a/db/builder.h b/db/builder.h
index b2aeabf..62431fc 100644
--- a/db/builder.h
+++ b/db/builder.h
@@ -29,6 +29,6 @@ extern Status BuildTable(const std::string& dbname,
Iterator* iter,
FileMetaData* meta);
-}
+} // namespace leveldb
#endif // STORAGE_LEVELDB_DB_BUILDER_H_
diff --git a/db/corruption_test.cc b/db/corruption_test.cc
index 1edcd84..31b2d5f 100644
--- a/db/corruption_test.cc
+++ b/db/corruption_test.cc
@@ -352,7 +352,7 @@ TEST(CorruptionTest, UnrelatedKeys) {
ASSERT_EQ(Value(1000, &tmp2).ToString(), v);
}
-}
+} // namespace leveldb
int main(int argc, char** argv) {
return leveldb::test::RunAllTests();
diff --git a/db/db_bench.cc b/db/db_bench.cc
index cf9bb65..bbfd618 100644
--- a/db/db_bench.cc
+++ b/db/db_bench.cc
@@ -288,7 +288,7 @@ struct ThreadState {
}
};
-}
+} // namespace
class Benchmark {
private:
@@ -829,7 +829,7 @@ class Benchmark {
}
};
-}
+} // namespace leveldb
int main(int argc, char** argv) {
FLAGS_write_buffer_size = leveldb::Options().write_buffer_size;
diff --git a/db/db_impl.cc b/db/db_impl.cc
index 56182a0..b4df80d 100644
--- a/db/db_impl.cc
+++ b/db/db_impl.cc
@@ -985,7 +985,7 @@ static void CleanupIteratorState(void* arg1, void* arg2) {
state->mu->Unlock();
delete state;
}
-}
+} // namespace
Iterator* DBImpl::NewInternalIterator(const ReadOptions& options,
SequenceNumber* latest_snapshot) {
@@ -1378,4 +1378,4 @@ Status DestroyDB(const std::string& dbname, const Options& options) {
return result;
}
-}
+} // namespace leveldb
diff --git a/db/db_impl.h b/db/db_impl.h
index ab03181..fc40d1e 100644
--- a/db/db_impl.h
+++ b/db/db_impl.h
@@ -187,6 +187,6 @@ extern Options SanitizeOptions(const std::string& db,
const InternalKeyComparator* icmp,
const Options& src);
-}
+} // namespace leveldb
#endif // STORAGE_LEVELDB_DB_DB_IMPL_H_
diff --git a/db/db_iter.cc b/db/db_iter.cc
index 8849f92..87dca2d 100644
--- a/db/db_iter.cc
+++ b/db/db_iter.cc
@@ -296,4 +296,4 @@ Iterator* NewDBIterator(
return new DBIter(dbname, env, user_key_comparator, internal_iter, sequence);
}
-}
+} // namespace leveldb
diff --git a/db/db_iter.h b/db/db_iter.h
index 195f3d3..d9e1b17 100644
--- a/db/db_iter.h
+++ b/db/db_iter.h
@@ -21,6 +21,6 @@ extern Iterator* NewDBIterator(
Iterator* internal_iter,
const SequenceNumber& sequence);
-}
+} // namespace leveldb
#endif // STORAGE_LEVELDB_DB_DB_ITER_H_
diff --git a/db/db_test.cc b/db/db_test.cc
index ab71c51..f1cb949 100644
--- a/db/db_test.cc
+++ b/db/db_test.cc
@@ -136,6 +136,33 @@ class DBTest {
return result;
}
+ // Return a string that contains all key,value pairs in order,
+ // formatted like "(k1->v1)(k2->v2)".
+ std::string Contents() {
+ std::vector<std::string> forward;
+ std::string result;
+ Iterator* iter = db_->NewIterator(ReadOptions());
+ for (iter->SeekToFirst(); iter->Valid(); iter->Next()) {
+ std::string s = IterStatus(iter);
+ result.push_back('(');
+ result.append(s);
+ result.push_back(')');
+ forward.push_back(s);
+ }
+
+ // Check reverse iteration results are the reverse of forward results
+ int matched = 0;
+ for (iter->SeekToLast(); iter->Valid(); iter->Prev()) {
+ ASSERT_LT(matched, forward.size());
+ ASSERT_EQ(IterStatus(iter), forward[forward.size() - matched - 1]);
+ matched++;
+ }
+ ASSERT_EQ(matched, forward.size());
+
+ delete iter;
+ return result;
+ }
+
std::string AllEntriesFor(const Slice& user_key) {
Iterator* iter = dbfull()->TEST_NewInternalIterator();
InternalKey target(user_key, kMaxSequenceNumber, kTypeValue);
@@ -1048,6 +1075,49 @@ TEST(DBTest, OverlapInLevel0) {
ASSERT_EQ("NOT_FOUND", Get("600"));
}
+TEST(DBTest, L0_CompactionBug_Issue44_a) {
+ Reopen();
+ ASSERT_OK(Put("b", "v"));
+ Reopen();
+ ASSERT_OK(Delete("b"));
+ ASSERT_OK(Delete("a"));
+ Reopen();
+ ASSERT_OK(Delete("a"));
+ Reopen();
+ ASSERT_OK(Put("a", "v"));
+ Reopen();
+ Reopen();
+ ASSERT_EQ("(a->v)", Contents());
+ env_->SleepForMicroseconds(1000000); // Wait for compaction to finish
+ ASSERT_EQ("(a->v)", Contents());
+}
+
+TEST(DBTest, L0_CompactionBug_Issue44_b) {
+ Reopen();
+ Put("","");
+ Reopen();
+ Delete("e");
+ Put("","");
+ Reopen();
+ Put("c", "cv");
+ Reopen();
+ Put("","");
+ Reopen();
+ Put("","");
+ env_->SleepForMicroseconds(1000000); // Wait for compaction to finish
+ Reopen();
+ Put("d","dv");
+ Reopen();
+ Put("","");
+ Reopen();
+ Delete("d");
+ Delete("b");
+ Reopen();
+ ASSERT_EQ("(->)(c->cv)", Contents());
+ env_->SleepForMicroseconds(1000000); // Wait for compaction to finish
+ ASSERT_EQ("(->)(c->cv)", Contents());
+}
+
TEST(DBTest, ComparatorCheck) {
class NewComparator : public Comparator {
public:
@@ -1071,6 +1141,34 @@ TEST(DBTest, ComparatorCheck) {
<< s.ToString();
}
+TEST(DBTest, CustomComparator) {
+ class NumberComparator : public Comparator {
+ public:
+ virtual const char* Name() const { return "test.NumberComparator"; }
+ virtual int Compare(const Slice& a, const Slice& b) const {
+ return (strtol(a.ToString().c_str(), NULL, 0) -
+ strtol(b.ToString().c_str(), NULL, 0));
+ }
+ virtual void FindShortestSeparator(std::string* s, const Slice& l) const {}
+ virtual void FindShortSuccessor(std::string* key) const {}
+ };
+ NumberComparator cmp;
+ Options new_options;
+ new_options.create_if_missing = true;
+ new_options.comparator = &cmp;
+ DestroyAndReopen(&new_options);
+ ASSERT_OK(Put("10", "ten"));
+ ASSERT_OK(Put("0x14", "twenty"));
+ for (int i = 0; i < 2; i++) {
+ ASSERT_EQ("ten", Get("10"));
+ ASSERT_EQ("ten", Get("0xa"));
+ ASSERT_EQ("twenty", Get("20"));
+ ASSERT_EQ("twenty", Get("0x14"));
+ Compact("0", "9999");
+ fprintf(stderr, "ss\n%s\n", DumpSSTableList().c_str());
+ }
+}
+
TEST(DBTest, ManualCompaction) {
ASSERT_EQ(config::kMaxMemCompactLevel, 2)
<< "Need to update this test to match kMaxMemCompactLevel";
@@ -1207,7 +1305,7 @@ static void MTThreadBody(void* arg) {
fprintf(stderr, "... stopping thread %d after %d ops\n", t->id, int(counter));
}
-}
+} // namespace
TEST(DBTest, MultiThreaded) {
// Initialize state
@@ -1525,7 +1623,7 @@ void BM_LogAndApply(int iters, int num_base_files) {
buf, iters, us, ((float)us) / iters);
}
-}
+} // namespace leveldb
int main(int argc, char** argv) {
if (argc > 1 && std::string(argv[1]) == "--benchmark") {
diff --git a/db/dbformat.cc b/db/dbformat.cc
index 4fb3531..4594a57 100644
--- a/db/dbformat.cc
+++ b/db/dbformat.cc
@@ -115,4 +115,4 @@ LookupKey::LookupKey(const Slice& user_key, SequenceNumber s) {
end_ = dst;
}
-}
+} // namespace leveldb
diff --git a/db/dbformat.h b/db/dbformat.h
index d046990..044717d 100644
--- a/db/dbformat.h
+++ b/db/dbformat.h
@@ -37,7 +37,7 @@ static const int kL0_StopWritesTrigger = 12;
// space if the same key space is being repeatedly overwritten.
static const int kMaxMemCompactLevel = 2;
-}
+} // namespace config
class InternalKey;
@@ -210,6 +210,6 @@ inline LookupKey::~LookupKey() {
if (start_ != space_) delete[] start_;
}
-}
+} // namespace leveldb
#endif // STORAGE_LEVELDB_DB_FORMAT_H_
diff --git a/db/dbformat_test.cc b/db/dbformat_test.cc
index 57c5578..5d82f5d 100644
--- a/db/dbformat_test.cc
+++ b/db/dbformat_test.cc
@@ -105,7 +105,7 @@ TEST(FormatTest, InternalKeyShortestSuccessor) {
ShortSuccessor(IKey("\xff\xff", 100, kTypeValue)));
}
-}
+} // namespace leveldb
int main(int argc, char** argv) {
return leveldb::test::RunAllTests();
diff --git a/db/filename.cc b/db/filename.cc
index b3a917c..24fd140 100644
--- a/db/filename.cc
+++ b/db/filename.cc
@@ -132,4 +132,4 @@ Status SetCurrentFile(Env* env, const std::string& dbname,
return s;
}
-}
+} // namespace leveldb
diff --git a/db/filename.h b/db/filename.h
index e9ec8a7..d5d09b1 100644
--- a/db/filename.h
+++ b/db/filename.h
@@ -75,6 +75,6 @@ extern Status SetCurrentFile(Env* env, const std::string& dbname,
uint64_t descriptor_number);
-}
+} // namespace leveldb
#endif // STORAGE_LEVELDB_DB_FILENAME_H_
diff --git a/db/filename_test.cc b/db/filename_test.cc
index 2f61e8d..47353d6 100644
--- a/db/filename_test.cc
+++ b/db/filename_test.cc
@@ -115,7 +115,7 @@ TEST(FileNameTest, Construction) {
ASSERT_EQ(kTempFile, type);
}
-}
+} // namespace leveldb
int main(int argc, char** argv) {
return leveldb::test::RunAllTests();
diff --git a/db/log_format.h b/db/log_format.h
index 353eff8..2690cb9 100644
--- a/db/log_format.h
+++ b/db/log_format.h
@@ -29,7 +29,7 @@ static const int kBlockSize = 32768;
// Header is checksum (4 bytes), type (1 byte), length (2 bytes).
static const int kHeaderSize = 4 + 1 + 2;
-}
-}
+} // namespace log
+} // namespace leveldb
#endif // STORAGE_LEVELDB_DB_LOG_FORMAT_H_
diff --git a/db/log_reader.cc b/db/log_reader.cc
index fcb3aa7..b35f115 100644
--- a/db/log_reader.cc
+++ b/db/log_reader.cc
@@ -255,5 +255,5 @@ unsigned int Reader::ReadPhysicalRecord(Slice* result) {
}
}
-}
-}
+} // namespace log
+} // namespace leveldb
diff --git a/db/log_reader.h b/db/log_reader.h
index 61cc414..82d4bee 100644
--- a/db/log_reader.h
+++ b/db/log_reader.h
@@ -102,7 +102,7 @@ class Reader {
void operator=(const Reader&);
};
-}
-}
+} // namespace log
+} // namespace leveldb
#endif // STORAGE_LEVELDB_DB_LOG_READER_H_
diff --git a/db/log_test.cc b/db/log_test.cc
index 06e0893..4c5cf87 100644
--- a/db/log_test.cc
+++ b/db/log_test.cc
@@ -492,8 +492,8 @@ TEST(LogTest, ReadPastEnd) {
CheckOffsetPastEndReturnsNoRecords(5);
}
-}
-}
+} // namespace log
+} // namespace leveldb
int main(int argc, char** argv) {
return leveldb::test::RunAllTests();
diff --git a/db/log_writer.cc b/db/log_writer.cc
index 0887f6c..2da99ac 100644
--- a/db/log_writer.cc
+++ b/db/log_writer.cc
@@ -99,5 +99,5 @@ Status Writer::EmitPhysicalRecord(RecordType t, const char* ptr, size_t n) {
return s;
}
-}
-}
+} // namespace log
+} // namespace leveldb
diff --git a/db/log_writer.h b/db/log_writer.h
index d3cf27d..a3a954d 100644
--- a/db/log_writer.h
+++ b/db/log_writer.h
@@ -42,7 +42,7 @@ class Writer {
void operator=(const Writer&);
};
-}
-}
+} // namespace log
+} // namespace leveldb
#endif // STORAGE_LEVELDB_DB_LOG_WRITER_H_
diff --git a/db/memtable.cc b/db/memtable.cc
index 4555abb..bfec0a7 100644
--- a/db/memtable.cc
+++ b/db/memtable.cc
@@ -142,4 +142,4 @@ bool MemTable::Get(const LookupKey& key, std::string* value, Status* s) {
return false;
}
-}
+} // namespace leveldb
diff --git a/db/memtable.h b/db/memtable.h
index 1898b5e..92e90bb 100644
--- a/db/memtable.h
+++ b/db/memtable.h
@@ -86,6 +86,6 @@ class MemTable {
void operator=(const MemTable&);
};
-}
+} // namespace leveldb
#endif // STORAGE_LEVELDB_DB_MEMTABLE_H_
diff --git a/db/repair.cc b/db/repair.cc
index 5bcdb56..511c66b 100644
--- a/db/repair.cc
+++ b/db/repair.cc
@@ -377,11 +377,11 @@ class Repairer {
fname.c_str(), s.ToString().c_str());
}
};
-}
+} // namespace
Status RepairDB(const std::string& dbname, const Options& options) {
Repairer repairer(dbname, options);
return repairer.Run();
}
-}
+} // namespace leveldb
diff --git a/db/skiplist.h b/db/skiplist.h
index be39354..0481575 100644
--- a/db/skiplist.h
+++ b/db/skiplist.h
@@ -375,4 +375,4 @@ bool SkipList<Key,Comparator>::Contains(const Key& key) const {
}
}
-}
+} // namespace leveldb
diff --git a/db/skiplist_test.cc b/db/skiplist_test.cc
index 2bd8d22..c78f4b4 100644
--- a/db/skiplist_test.cc
+++ b/db/skiplist_test.cc
@@ -371,7 +371,7 @@ TEST(SkipTest, Concurrent3) { RunConcurrent(3); }
TEST(SkipTest, Concurrent4) { RunConcurrent(4); }
TEST(SkipTest, Concurrent5) { RunConcurrent(5); }
-}
+} // namespace leveldb
int main(int argc, char** argv) {
return leveldb::test::RunAllTests();
diff --git a/db/snapshot.h b/db/snapshot.h
index a08dbd3..e7f8fd2 100644
--- a/db/snapshot.h
+++ b/db/snapshot.h
@@ -61,6 +61,6 @@ class SnapshotList {
SnapshotImpl list_;
};
-}
+} // namespace leveldb
#endif // STORAGE_LEVELDB_DB_SNAPSHOT_H_
diff --git a/db/table_cache.cc b/db/table_cache.cc
index 325d707..cae79bd 100644
--- a/db/table_cache.cc
+++ b/db/table_cache.cc
@@ -92,4 +92,4 @@ void TableCache::Evict(uint64_t file_number) {
cache_->Erase(Slice(buf, sizeof(buf)));
}
-}
+} // namespace leveldb
diff --git a/db/table_cache.h b/db/table_cache.h
index 5376194..0f3c73b 100644
--- a/db/table_cache.h
+++ b/db/table_cache.h
@@ -45,6 +45,6 @@ class TableCache {
Cache* cache_;
};
-}
+} // namespace leveldb
#endif // STORAGE_LEVELDB_DB_TABLE_CACHE_H_
diff --git a/db/version_edit.cc b/db/version_edit.cc
index 9891c32..f10a2d5 100644
--- a/db/version_edit.cc
+++ b/db/version_edit.cc
@@ -263,4 +263,4 @@ std::string VersionEdit::DebugString() const {
return r;
}
-}
+} // namespace leveldb
diff --git a/db/version_edit.h b/db/version_edit.h
index a069893..eaef77b 100644
--- a/db/version_edit.h
+++ b/db/version_edit.h
@@ -102,6 +102,6 @@ class VersionEdit {
std::vector< std::pair<int, FileMetaData> > new_files_;
};
-}
+} // namespace leveldb
#endif // STORAGE_LEVELDB_DB_VERSION_EDIT_H_
diff --git a/db/version_edit_test.cc b/db/version_edit_test.cc
index 67959f7..280310b 100644
--- a/db/version_edit_test.cc
+++ b/db/version_edit_test.cc
@@ -39,7 +39,7 @@ TEST(VersionEditTest, EncodeDecode) {
TestEncodeDecode(edit);
}
-}
+} // namespace leveldb
int main(int argc, char** argv) {
return leveldb::test::RunAllTests();
diff --git a/db/version_set.cc b/db/version_set.cc
index 8b96af0..7cf5197 100644
--- a/db/version_set.cc
+++ b/db/version_set.cc
@@ -61,7 +61,7 @@ std::string IntSetToString(const std::set<uint64_t>& s) {
result += "}";
return result;
}
-}
+} // namespace
Version::~Version() {
assert(refs_ == 0);
@@ -253,7 +253,8 @@ void Version::AddIterators(const ReadOptions& options,
// If "*iter" points at a value or deletion for user_key, store
// either the value, or a NotFound error and return true.
// Else return false.
-static bool GetValue(Iterator* iter, const Slice& user_key,
+static bool GetValue(const Comparator* cmp,
+ Iterator* iter, const Slice& user_key,
std::string* value,
Status* s) {
if (!iter->Valid()) {
@@ -264,7 +265,7 @@ static bool GetValue(Iterator* iter, const Slice& user_key,
*s = Status::Corruption("corrupted key for ", user_key);
return true;
}
- if (parsed_key.user_key != user_key) {
+ if (cmp->Compare(parsed_key.user_key, user_key) != 0) {
return false;
}
switch (parsed_key.type) {
@@ -360,7 +361,7 @@ Status Version::Get(const ReadOptions& options,
f->number,
f->file_size);
iter->Seek(ikey);
- const bool done = GetValue(iter, user_key, value, &s);
+ const bool done = GetValue(ucmp, iter, user_key, value, &s);
if (!iter->status().ok()) {
s = iter->status();
delete iter;
@@ -450,16 +451,29 @@ void Version::GetOverlappingInputs(
user_end = end->user_key();
}
const Comparator* user_cmp = vset_->icmp_.user_comparator();
- for (size_t i = 0; i < files_[level].size(); i++) {
- FileMetaData* f = files_[level][i];
- if (begin != NULL &&
- user_cmp->Compare(f->largest.user_key(), user_begin) < 0) {
+ for (size_t i = 0; i < files_[level].size(); ) {
+ FileMetaData* f = files_[level][i++];
+ const Slice file_start = f->smallest.user_key();
+ const Slice file_limit = f->largest.user_key();
+ if (begin != NULL && user_cmp->Compare(file_limit, user_begin) < 0) {
// "f" is completely before specified range; skip it
- } else if (end != NULL &&
- user_cmp->Compare(f->smallest.user_key(), user_end) > 0) {
+ } else if (end != NULL && user_cmp->Compare(file_start, user_end) > 0) {
// "f" is completely after specified range; skip it
} else {
inputs->push_back(f);
+ if (level == 0) {
+ // Level-0 files may overlap each other. So check if the newly
+ // added file has expanded the range. If so, restart search.
+ if (begin != NULL && user_cmp->Compare(file_start, user_begin) < 0) {
+ user_begin = file_start;
+ inputs->clear();
+ i = 0;
+ } else if (end != NULL && user_cmp->Compare(file_limit, user_end) > 0) {
+ user_end = file_limit;
+ inputs->clear();
+ i = 0;
+ }
+ }
}
}
}
@@ -1369,4 +1383,4 @@ void Compaction::ReleaseInputs() {
}
}
-}
+} // namespace leveldb
diff --git a/db/version_set.h b/db/version_set.h
index b866b2a..572602e 100644
--- a/db/version_set.h
+++ b/db/version_set.h
@@ -365,6 +365,6 @@ class Compaction {
size_t level_ptrs_[config::kNumLevels];
};
-}
+} // namespace leveldb
#endif // STORAGE_LEVELDB_DB_VERSION_SET_H_
diff --git a/db/version_set_test.cc b/db/version_set_test.cc
index 06f8bbd..501e34d 100644
--- a/db/version_set_test.cc
+++ b/db/version_set_test.cc
@@ -172,7 +172,7 @@ TEST(FindFileTest, OverlappingFiles) {
ASSERT_TRUE(Overlaps("600", "700"));
}
-}
+} // namespace leveldb
int main(int argc, char** argv) {
return leveldb::test::RunAllTests();
diff --git a/db/write_batch.cc b/db/write_batch.cc
index 4e1e899..a0e812f 100644
--- a/db/write_batch.cc
+++ b/db/write_batch.cc
@@ -120,7 +120,7 @@ class MemTableInserter : public WriteBatch::Handler {
sequence_++;
}
};
-}
+} // namespace
Status WriteBatchInternal::InsertInto(const WriteBatch* b,
MemTable* memtable) {
@@ -135,4 +135,4 @@ void WriteBatchInternal::SetContents(WriteBatch* b, const Slice& contents) {
b->rep_.assign(contents.data(), contents.size());
}
-}
+} // namespace leveldb
diff --git a/db/write_batch_internal.h b/db/write_batch_internal.h
index 6d65eed..49aeb84 100644
--- a/db/write_batch_internal.h
+++ b/db/write_batch_internal.h
@@ -41,7 +41,7 @@ class WriteBatchInternal {
static Status InsertInto(const WriteBatch* batch, MemTable* memtable);
};
-}
+} // namespace leveldb
#endif // STORAGE_LEVELDB_DB_WRITE_BATCH_INTERNAL_H_
diff --git a/db/write_batch_test.cc b/db/write_batch_test.cc
index 73d68fd..1ee6d7b 100644
--- a/db/write_batch_test.cc
+++ b/db/write_batch_test.cc
@@ -82,7 +82,7 @@ TEST(WriteBatchTest, Corruption) {
PrintContents(&batch));
}
-}
+} // namespace leveldb
int main(int argc, char** argv) {
return leveldb::test::RunAllTests();