static_cast<int>(compaction_job_info.input_files.size()));
}
}
+
+TEST_F(TimestampCompatibleCompactionTest, EmptyCompactionOutput) {
+ Options options = CurrentOptions();
+ options.env = env_;
+ options.comparator = test::BytewiseComparatorWithU64TsWrapper();
+ DestroyAndReopen(options);
+
+ std::string ts_str = Timestamp(1);
+ WriteOptions wopts;
+ ASSERT_OK(
+ db_->DeleteRange(wopts, db_->DefaultColumnFamily(), "k1", "k3", ts_str));
+ ASSERT_OK(Flush());
+
+ ts_str = Timestamp(3);
+ Slice ts = ts_str;
+ CompactRangeOptions cro;
+ // range tombstone will be dropped during compaction
+ cro.full_history_ts_low = &ts;
+ cro.bottommost_level_compaction = BottommostLevelCompaction::kForce;
+ ASSERT_OK(db_->CompactRange(cro, nullptr, nullptr));
+}
#endif // !ROCKSDB_LITE
} // namespace ROCKSDB_NAMESPACE
}
Status Finish(UserCollectedProperties* properties) override {
+ // timestamp is empty is table is empty
assert(timestamp_min_.size() == timestamp_max_.size() &&
- timestamp_max_.size() == cmp_->timestamp_size());
+ (timestamp_min_.empty() ||
+ timestamp_max_.size() == cmp_->timestamp_size()));
properties->insert({"rocksdb.timestamp_min", timestamp_min_});
properties->insert({"rocksdb.timestamp_max", timestamp_max_});
return Status::OK();