From dc360df81ec48e56a5d9cee4adb7f11ef0ca82ac Mon Sep 17 00:00:00 2001 From: Yi Wu Date: Tue, 16 Jan 2018 17:26:29 -0800 Subject: [PATCH] Fix multiple build failures Summary: * Fix DBTest.CompactRangeWithEmptyBottomLevel lite build failure * Fix DBTest.AutomaticConflictsWithManualCompaction failure introduce by #3366 * Fix BlockBasedTableTest::IndexUncompressed should be disabled if snappy is disabled * Fix ASAN failure with DBBasicTest::DBClose test Closes https://github.com/facebook/rocksdb/pull/3373 Differential Revision: D6732313 Pulled By: yiwu-arbug fbshipit-source-id: 1eb9b9d9a8d795f56188fa9770db9353f6fdedc5 --- db/db_basic_test.cc | 2 ++ db/db_test.cc | 8 +++++--- db/db_test_util.cc | 4 +++- db/db_test_util.h | 4 +++- table/table_test.cc | 2 ++ 5 files changed, 15 insertions(+), 5 deletions(-) diff --git a/db/db_basic_test.cc b/db/db_basic_test.cc index c3ea831d7..92de4d5d6 100644 --- a/db/db_basic_test.cc +++ b/db/db_basic_test.cc @@ -894,6 +894,8 @@ TEST_F(DBBasicTest, DBClose) { s = db->Close(); ASSERT_EQ(s, Status::OK()); + delete db; + delete options.env; } } // namespace rocksdb diff --git a/db/db_test.cc b/db/db_test.cc index 10941204f..2a8690a56 100644 --- a/db/db_test.cc +++ b/db/db_test.cc @@ -503,7 +503,9 @@ TEST_F(DBTest, DISABLED_VeryLargeValue) { ASSERT_OK(Put(key2, raw)); dbfull()->TEST_WaitForFlushMemTable(); +#ifndef ROCKSDB_LITE ASSERT_EQ(1, NumTableFilesAtLevel(0)); +#endif // !ROCKSDB_LITE std::string value; Status s = db_->Get(ReadOptions(), key1, &value); @@ -2192,7 +2194,7 @@ class ModelDB : public DB { return Write(o, &batch); } using DB::Close; - virtual Status Close() { return Status::OK(); } + virtual Status Close() override { return Status::OK(); } using DB::Delete; virtual Status Delete(const WriteOptions& o, ColumnFamilyHandle* cf, const Slice& key) override { @@ -5056,7 +5058,6 @@ TEST_F(DBTest, PromoteL0Failure) { status = experimental::PromoteL0(db_, db_->DefaultColumnFamily()); ASSERT_TRUE(status.IsInvalidArgument()); } -#endif // ROCKSDB_LITE // Github issue #596 TEST_F(DBTest, CompactRangeWithEmptyBottomLevel) { @@ -5079,6 +5080,7 @@ TEST_F(DBTest, CompactRangeWithEmptyBottomLevel) { ASSERT_EQ(NumTableFilesAtLevel(0), 0); ASSERT_EQ(NumTableFilesAtLevel(1), kNumL0Files); } +#endif // ROCKSDB_LITE TEST_F(DBTest, AutomaticConflictsWithManualCompaction) { Options options = CurrentOptions(); @@ -5101,7 +5103,7 @@ TEST_F(DBTest, AutomaticConflictsWithManualCompaction) { [&](void* arg) { callback_count.fetch_add(1); }); rocksdb::SyncPoint::GetInstance()->EnableProcessing(); CompactRangeOptions croptions; - croptions.exclusive_manual_compaction = false; + croptions.exclusive_manual_compaction = true; ASSERT_OK(db_->CompactRange(croptions, nullptr, nullptr)); ASSERT_GE(callback_count.load(), 1); rocksdb::SyncPoint::GetInstance()->DisableProcessing(); diff --git a/db/db_test_util.cc b/db/db_test_util.cc index 3091d77c2..6bdc5b9a8 100644 --- a/db/db_test_util.cc +++ b/db/db_test_util.cc @@ -867,7 +867,6 @@ size_t DBTestBase::CountLiveFiles() { db_->GetLiveFilesMetaData(&metadata); return metadata.size(); } -#endif // ROCKSDB_LITE int DBTestBase::NumTableFilesAtLevel(int level, int cf) { std::string property; @@ -928,6 +927,7 @@ std::string DBTestBase::FilesPerLevel(int cf) { result.resize(last_non_zero_offset); return result; } +#endif // !ROCKSDB_LITE size_t DBTestBase::CountFiles() { std::vector files; @@ -997,6 +997,7 @@ void DBTestBase::MoveFilesToLevel(int level, int cf) { } } +#ifndef ROCKSDB_LITE void DBTestBase::DumpFileCounts(const char* label) { fprintf(stderr, "---\n%s:\n", label); fprintf(stderr, "maxoverlap: %" PRIu64 "\n", @@ -1008,6 +1009,7 @@ void DBTestBase::DumpFileCounts(const char* label) { } } } +#endif // !ROCKSDB_LITE std::string DBTestBase::DumpSSTableList() { std::string property; diff --git a/db/db_test_util.h b/db/db_test_util.h index 0462d37c0..9b79b6759 100644 --- a/db/db_test_util.h +++ b/db/db_test_util.h @@ -863,13 +863,13 @@ class DBTestBase : public testing::Test { size_t TotalLiveFiles(int cf = 0); size_t CountLiveFiles(); -#endif // ROCKSDB_LITE int NumTableFilesAtLevel(int level, int cf = 0); double CompressionRatioAtLevel(int level, int cf = 0); int TotalTableFiles(int cf = 0, int levels = -1); +#endif // ROCKSDB_LITE // Return spread of files per level std::string FilesPerLevel(int cf = 0); @@ -897,7 +897,9 @@ class DBTestBase : public testing::Test { void MoveFilesToLevel(int level, int cf = 0); +#ifndef ROCKSDB_LITE void DumpFileCounts(const char* label); +#endif // ROCKSDB_LITE std::string DumpSSTableList(); diff --git a/table/table_test.cc b/table/table_test.cc index a48567582..855bbd82a 100644 --- a/table/table_test.cc +++ b/table/table_test.cc @@ -1101,6 +1101,7 @@ TEST_F(BlockBasedTableTest, BasicBlockBasedTableProperties) { c.ResetTableReader(); } +#ifdef SNAPPY uint64_t BlockBasedTableTest::IndexUncompressedHelper(bool compressed) { TableConstructor c(BytewiseComparator(), true /* convert_to_internal_key_ */); constexpr size_t kNumKeys = 10000; @@ -1133,6 +1134,7 @@ TEST_F(BlockBasedTableTest, IndexUncompressed) { // tbl1_compressed_cnt should include 1 index block EXPECT_EQ(tbl2_compressed_cnt + 1, tbl1_compressed_cnt); } +#endif // SNAPPY TEST_F(BlockBasedTableTest, BlockBasedTableProperties2) { TableConstructor c(&reverse_key_comparator);