virtual void Refresh(std::vector<SequenceNumber>* snapshots,
SequenceNumber max) = 0;
inline bool TimeToRefresh(const size_t key_index) {
+ assert(snap_refresh_nanos_ != 0);
// skip the key if key_index % every_nth_key (which is of power 2) is not 0.
if ((key_index & every_nth_key_minus_one_) != 0) {
return false;
public:
SnapshotListFetchCallbackTest(Env* env, Random64& rand,
std::vector<SequenceNumber>* snapshots)
- : SnapshotListFetchCallback(env, 0 /*no time delay*/,
+ : SnapshotListFetchCallback(env, 1 /*short time delay*/,
1 /*fetch after each key*/),
rand_(rand),
snapshots_(snapshots) {}
c->mutable_cf_options()->paranoid_file_checks,
c->mutable_cf_options()->report_bg_io_stats, dbname_,
&compaction_job_stats, Env::Priority::USER,
- immutable_db_options_.max_subcompactions <= 1 ? &fetch_callback
- : nullptr);
+ immutable_db_options_.max_subcompactions <= 1 &&
+ c->mutable_cf_options()->snap_refresh_nanos > 0
+ ? &fetch_callback
+ : nullptr);
// Creating a compaction influences the compaction score because the score
// takes running compactions into account (by skipping files that are already
&event_logger_, c->mutable_cf_options()->paranoid_file_checks,
c->mutable_cf_options()->report_bg_io_stats, dbname_,
&compaction_job_stats, thread_pri,
- immutable_db_options_.max_subcompactions <= 1 ? &fetch_callback
- : nullptr);
+ immutable_db_options_.max_subcompactions <= 1 &&
+ c->mutable_cf_options()->snap_refresh_nanos > 0
+ ? &fetch_callback
+ : nullptr);
compaction_job.Prepare();
NotifyOnCompactionBegin(c->column_family_data(), c.get(), status,