diff options
Diffstat (limited to 'db')
-rw-r--r-- | db/autocompact_test.cc | 5 | ||||
-rw-r--r-- | db/corruption_test.cc | 5 | ||||
-rw-r--r-- | db/db_test.cc | 69 | ||||
-rw-r--r-- | db/dbformat_test.cc | 5 | ||||
-rw-r--r-- | db/fault_injection_test.cc | 5 | ||||
-rw-r--r-- | db/filename_test.cc | 5 | ||||
-rw-r--r-- | db/log_test.cc | 5 | ||||
-rw-r--r-- | db/recovery_test.cc | 7 | ||||
-rw-r--r-- | db/skiplist_test.cc | 5 | ||||
-rw-r--r-- | db/snapshot.h | 2 | ||||
-rw-r--r-- | db/version_edit_test.cc | 5 | ||||
-rw-r--r-- | db/version_set.cc | 2 | ||||
-rw-r--r-- | db/version_set_test.cc | 5 | ||||
-rw-r--r-- | db/write_batch_test.cc | 5 |
14 files changed, 4 insertions, 126 deletions
diff --git a/db/autocompact_test.cc b/db/autocompact_test.cc index 3b7241b..69341e3 100644 --- a/db/autocompact_test.cc +++ b/db/autocompact_test.cc @@ -108,8 +108,3 @@ TEST_F(AutoCompactTest, ReadAll) { DoReads(kCount); } TEST_F(AutoCompactTest, ReadHalf) { DoReads(kCount / 2); } } // namespace leveldb - -int main(int argc, char** argv) { - testing::InitGoogleTest(&argc, argv); - return RUN_ALL_TESTS(); -} diff --git a/db/corruption_test.cc b/db/corruption_test.cc index a31f448..dc7da76 100644 --- a/db/corruption_test.cc +++ b/db/corruption_test.cc @@ -360,8 +360,3 @@ TEST_F(CorruptionTest, UnrelatedKeys) { } } // namespace leveldb - -int main(int argc, char** argv) { - testing::InitGoogleTest(&argc, argv); - return RUN_ALL_TESTS(); -} diff --git a/db/db_test.cc b/db/db_test.cc index 908b41d..9bd6e14 100644 --- a/db/db_test.cc +++ b/db/db_test.cc @@ -9,7 +9,6 @@ #include <string> #include "gtest/gtest.h" -#include "benchmark/benchmark.h" #include "db/db_impl.h" #include "db/filename.h" #include "db/version_set.h" @@ -2295,72 +2294,4 @@ TEST_F(DBTest, Randomized) { } while (ChangeOptions()); } -std::string MakeKey(unsigned int num) { - char buf[30]; - std::snprintf(buf, sizeof(buf), "%016u", num); - return std::string(buf); -} - -static void BM_LogAndApply(benchmark::State& state) { - const int num_base_files = state.range(0); - - std::string dbname = testing::TempDir() + "leveldb_test_benchmark"; - DestroyDB(dbname, Options()); - - DB* db = nullptr; - Options opts; - opts.create_if_missing = true; - Status s = DB::Open(opts, dbname, &db); - ASSERT_LEVELDB_OK(s); - ASSERT_TRUE(db != nullptr); - - delete db; - db = nullptr; - - Env* env = Env::Default(); - - port::Mutex mu; - MutexLock l(&mu); - - InternalKeyComparator cmp(BytewiseComparator()); - Options options; - VersionSet vset(dbname, &options, nullptr, &cmp); - bool save_manifest; - ASSERT_LEVELDB_OK(vset.Recover(&save_manifest)); - VersionEdit vbase; - uint64_t fnum = 1; - for (int i = 0; i < num_base_files; i++) { - InternalKey start(MakeKey(2 * fnum), 1, kTypeValue); - InternalKey limit(MakeKey(2 * fnum + 1), 1, kTypeDeletion); - vbase.AddFile(2, fnum++, 1 /* file size */, start, limit); - } - ASSERT_LEVELDB_OK(vset.LogAndApply(&vbase, &mu)); - - uint64_t start_micros = env->NowMicros(); - - for (auto st : state) { - VersionEdit vedit; - vedit.RemoveFile(2, fnum); - InternalKey start(MakeKey(2 * fnum), 1, kTypeValue); - InternalKey limit(MakeKey(2 * fnum + 1), 1, kTypeDeletion); - vedit.AddFile(2, fnum++, 1 /* file size */, start, limit); - vset.LogAndApply(&vedit, &mu); - } - uint64_t stop_micros = env->NowMicros(); - unsigned int us = stop_micros - start_micros; - char buf[16]; - std::snprintf(buf, sizeof(buf), "%d", num_base_files); - std::fprintf(stderr, - "BM_LogAndApply/%-6s %8" PRIu64 - " iters : %9u us (%7.0f us / iter)\n", - buf, state.iterations(), us, ((float)us) / state.iterations()); -} - -BENCHMARK(BM_LogAndApply)->Arg(1)->Arg(100)->Arg(10000)->Arg(100000); } // namespace leveldb - -int main(int argc, char** argv) { - testing::InitGoogleTest(&argc, argv); - benchmark::RunSpecifiedBenchmarks(); - return RUN_ALL_TESTS(); -} diff --git a/db/dbformat_test.cc b/db/dbformat_test.cc index 4a11c4a..7f3f81a 100644 --- a/db/dbformat_test.cc +++ b/db/dbformat_test.cc @@ -126,8 +126,3 @@ TEST(FormatTest, InternalKeyDebugString) { } } // namespace leveldb - -int main(int argc, char** argv) { - testing::InitGoogleTest(&argc, argv); - return RUN_ALL_TESTS(); -} diff --git a/db/fault_injection_test.cc b/db/fault_injection_test.cc index 6eebafa..ef864a4 100644 --- a/db/fault_injection_test.cc +++ b/db/fault_injection_test.cc @@ -548,8 +548,3 @@ TEST_F(FaultInjectionTest, FaultTestWithLogReuse) { } } // namespace leveldb - -int main(int argc, char** argv) { - testing::InitGoogleTest(&argc, argv); - return RUN_ALL_TESTS(); -} diff --git a/db/filename_test.cc b/db/filename_test.cc index f291d72..9ac0111 100644 --- a/db/filename_test.cc +++ b/db/filename_test.cc @@ -125,8 +125,3 @@ TEST(FileNameTest, Construction) { } } // namespace leveldb - -int main(int argc, char** argv) { - testing::InitGoogleTest(&argc, argv); - return RUN_ALL_TESTS(); -} diff --git a/db/log_test.cc b/db/log_test.cc index 346b19c..d55d4dd 100644 --- a/db/log_test.cc +++ b/db/log_test.cc @@ -556,8 +556,3 @@ TEST_F(LogTest, ReadPastEnd) { CheckOffsetPastEndReturnsNoRecords(5); } } // namespace log } // namespace leveldb - -int main(int argc, char** argv) { - testing::InitGoogleTest(&argc, argv); - return RUN_ALL_TESTS(); -} diff --git a/db/recovery_test.cc b/db/recovery_test.cc index 3db817e..1d9f621 100644 --- a/db/recovery_test.cc +++ b/db/recovery_test.cc @@ -18,7 +18,7 @@ namespace leveldb { class RecoveryTest : public testing::Test { public: RecoveryTest() : env_(Env::Default()), db_(nullptr) { - dbname_ = testing::TempDir() + "/recovery_test"; + dbname_ = testing::TempDir() + "recovery_test"; DestroyDB(dbname_, Options()); Open(); } @@ -332,8 +332,3 @@ TEST_F(RecoveryTest, ManifestMissing) { } } // namespace leveldb - -int main(int argc, char** argv) { - testing::InitGoogleTest(&argc, argv); - return RUN_ALL_TESTS(); -} diff --git a/db/skiplist_test.cc b/db/skiplist_test.cc index 79a5b86..1d355cb 100644 --- a/db/skiplist_test.cc +++ b/db/skiplist_test.cc @@ -366,8 +366,3 @@ TEST(SkipTest, Concurrent4) { RunConcurrent(4); } TEST(SkipTest, Concurrent5) { RunConcurrent(5); } } // namespace leveldb - -int main(int argc, char** argv) { - testing::InitGoogleTest(&argc, argv); - return RUN_ALL_TESTS(); -} diff --git a/db/snapshot.h b/db/snapshot.h index 9f1d664..817bb7b 100644 --- a/db/snapshot.h +++ b/db/snapshot.h @@ -25,7 +25,7 @@ class SnapshotImpl : public Snapshot { friend class SnapshotList; // SnapshotImpl is kept in a doubly-linked circular list. The SnapshotList - // implementation operates on the next/previous fields direcly. + // implementation operates on the next/previous fields directly. SnapshotImpl* prev_; SnapshotImpl* next_; diff --git a/db/version_edit_test.cc b/db/version_edit_test.cc index acafab0..a108c15 100644 --- a/db/version_edit_test.cc +++ b/db/version_edit_test.cc @@ -39,8 +39,3 @@ TEST(VersionEditTest, EncodeDecode) { } } // namespace leveldb - -int main(int argc, char** argv) { - testing::InitGoogleTest(&argc, argv); - return RUN_ALL_TESTS(); -} diff --git a/db/version_set.cc b/db/version_set.cc index 1963353..8d85fce 100644 --- a/db/version_set.cc +++ b/db/version_set.cc @@ -1392,6 +1392,7 @@ void VersionSet::SetupOtherInputs(Compaction* c) { current_->GetOverlappingInputs(level + 1, &smallest, &largest, &c->inputs_[1]); + AddBoundaryInputs(icmp_, current_->files_[level + 1], &c->inputs_[1]); // Get entire range covered by compaction InternalKey all_start, all_limit; @@ -1414,6 +1415,7 @@ void VersionSet::SetupOtherInputs(Compaction* c) { std::vector<FileMetaData*> expanded1; current_->GetOverlappingInputs(level + 1, &new_start, &new_limit, &expanded1); + AddBoundaryInputs(icmp_, current_->files_[level + 1], &expanded1); if (expanded1.size() == c->inputs_[1].size()) { Log(options_->info_log, "Expanding@%d %d+%d (%ld+%ld bytes) to %d+%d (%ld+%ld bytes)\n", diff --git a/db/version_set_test.cc b/db/version_set_test.cc index dee6b4c..64bb983 100644 --- a/db/version_set_test.cc +++ b/db/version_set_test.cc @@ -329,8 +329,3 @@ TEST_F(AddBoundaryInputsTest, TestDisjoinFilePointers) { } } // namespace leveldb - -int main(int argc, char** argv) { - testing::InitGoogleTest(&argc, argv); - return RUN_ALL_TESTS(); -} diff --git a/db/write_batch_test.cc b/db/write_batch_test.cc index 64df9b8..1a3ea8f 100644 --- a/db/write_batch_test.cc +++ b/db/write_batch_test.cc @@ -130,8 +130,3 @@ TEST(WriteBatchTest, ApproximateSize) { } } // namespace leveldb - -int main(int argc, char** argv) { - testing::InitGoogleTest(&argc, argv); - return RUN_ALL_TESTS(); -} |