diff --git a/HISTORY.md b/HISTORY.md index 2a77b03c5..08754da7f 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -22,6 +22,7 @@ * Explicitly check for and disallow the `BlockBasedTableOptions` if insertion into one of {`block_cache`, `block_cache_compressed`, `persistent_cache`} can show up in another of these. (RocksDB expects to be able to use the same key for different physical data among tiers.) * Users who configured a dedicated thread pool for bottommost compactions by explicitly adding threads to the `Env::Priority::BOTTOM` pool will no longer see RocksDB schedule automatic compactions exceeding the DB's compaction concurrency limit. For details on per-DB compaction concurrency limit, see API docs of `max_background_compactions` and `max_background_jobs`. * Fixed a bug of background flush thread picking more memtables to flush and prematurely advancing column family's log_number. +* Fixed an assertion failure in ManifestTailer. ### Behavior Changes * `NUM_FILES_IN_SINGLE_COMPACTION` was only counting the first input level files, now it's including all input files. diff --git a/db/db_secondary_test.cc b/db/db_secondary_test.cc index 4f1a31dcf..1d6b06807 100644 --- a/db/db_secondary_test.cc +++ b/db/db_secondary_test.cc @@ -851,12 +851,14 @@ TEST_F(DBSecondaryTest, SwitchManifest) { Options options; options.env = env_; options.level0_file_num_compaction_trigger = 4; - Reopen(options); + const std::string cf1_name("test_cf"); + CreateAndReopenWithCF({cf1_name}, options); Options options1; options1.env = env_; options1.max_open_files = -1; - OpenSecondary(options1); + OpenSecondaryWithColumnFamilies({kDefaultColumnFamilyName, cf1_name}, + options1); const int kNumFiles = options.level0_file_num_compaction_trigger - 1; // Keep it smaller than 10 so that key0, key1, ..., key9 are sorted as 0, 1, @@ -890,11 +892,11 @@ TEST_F(DBSecondaryTest, SwitchManifest) { // restart primary, performs full compaction, close again, restart again so // that next time secondary tries to catch up with primary, the secondary // will skip the MANIFEST in middle. - Reopen(options); + ReopenWithColumnFamilies({kDefaultColumnFamilyName, cf1_name}, options); ASSERT_OK(dbfull()->CompactRange(CompactRangeOptions(), nullptr, nullptr)); ASSERT_OK(dbfull()->TEST_WaitForCompact()); - Reopen(options); + ReopenWithColumnFamilies({kDefaultColumnFamilyName, cf1_name}, options); ASSERT_OK(dbfull()->SetOptions({{"disable_auto_compactions", "false"}})); ASSERT_OK(db_secondary_->TryCatchUpWithPrimary()); @@ -905,12 +907,14 @@ TEST_F(DBSecondaryTest, SwitchManifestTwice) { Options options; options.env = env_; options.disable_auto_compactions = true; - Reopen(options); + const std::string cf1_name("test_cf"); + CreateAndReopenWithCF({cf1_name}, options); Options options1; options1.env = env_; options1.max_open_files = -1; - OpenSecondary(options1); + OpenSecondaryWithColumnFamilies({kDefaultColumnFamilyName, cf1_name}, + options1); ASSERT_OK(Put("0", "value0")); ASSERT_OK(Flush()); @@ -921,9 +925,9 @@ TEST_F(DBSecondaryTest, SwitchManifestTwice) { ASSERT_OK(db_secondary_->Get(ropts, "0", &value)); ASSERT_EQ("value0", value); - Reopen(options); + ReopenWithColumnFamilies({kDefaultColumnFamilyName, cf1_name}, options); ASSERT_OK(dbfull()->SetOptions({{"disable_auto_compactions", "false"}})); - Reopen(options); + ReopenWithColumnFamilies({kDefaultColumnFamilyName, cf1_name}, options); ASSERT_OK(Put("0", "value1")); ASSERT_OK(db_secondary_->TryCatchUpWithPrimary()); diff --git a/db/version_edit_handler.cc b/db/version_edit_handler.cc index 39ed82580..027813a18 100644 --- a/db/version_edit_handler.cc +++ b/db/version_edit_handler.cc @@ -638,6 +638,11 @@ void VersionEditHandlerPointInTime::CheckIterationResult( versions_.erase(v_iter); } } + } else { + for (const auto& elem : versions_) { + delete elem.second; + } + versions_.clear(); } } @@ -874,7 +879,7 @@ Status ManifestTailer::OnColumnFamilyAdd(VersionEdit& edit, #ifndef NDEBUG auto version_iter = versions_.find(edit.GetColumnFamily()); - assert(version_iter != versions_.end()); + assert(version_iter == versions_.end()); #endif // !NDEBUG return Status::OK(); }