Skip to content

Commit

Permalink
fix checkpoint again (tikv#342)
Browse files Browse the repository at this point in the history
Signed-off-by: Yang Zhang <[email protected]>
  • Loading branch information
tabokie authored and v01dstar committed Oct 2, 2024
1 parent de03a33 commit bc7cc71
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions db/db_filesnapshot.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ namespace ROCKSDB_NAMESPACE {
Status DBImpl::FlushForGetLiveFiles() {
FlushOptions flush_options;
flush_options.allow_write_stall = true;
flush_options.check_if_compaction_disabled = true;
return DBImpl::FlushAllColumnFamilies(flush_options,
FlushReason::kGetLiveFiles);
}
Expand Down
7 changes: 6 additions & 1 deletion db/db_impl/db_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,7 @@ Status DBImpl::ResumeImpl(DBRecoverContext context) {
FlushOptions flush_opts;
// We allow flush to stall write since we are trying to resume from error.
flush_opts.allow_write_stall = true;
flush_opts.check_if_compaction_disabled = true;
s = FlushAllColumnFamilies(flush_opts, context.flush_reason);
}
if (!s.ok()) {
Expand Down Expand Up @@ -491,7 +492,10 @@ void DBImpl::CancelAllBackgroundWork(bool wait) {
if (!shutting_down_.load(std::memory_order_acquire) &&
has_unpersisted_data_.load(std::memory_order_relaxed) &&
!mutable_db_options_.avoid_flush_during_shutdown) {
s = DBImpl::FlushAllColumnFamilies(FlushOptions(), FlushReason::kShutDown);
FlushOptions flush_opts;
flush_opts.allow_write_stall = true;
flush_opts.check_if_compaction_disabled = true;
s = DBImpl::FlushAllColumnFamilies(flush_opts, FlushReason::kShutDown);
s.PermitUncheckedError(); //**TODO: What to do on error?
}

Expand Down Expand Up @@ -5862,6 +5866,7 @@ Status DBImpl::IngestExternalFiles(
if (status.ok() && at_least_one_cf_need_flush) {
FlushOptions flush_opts;
flush_opts.allow_write_stall = true;
flush_opts.check_if_compaction_disabled = true;
if (immutable_db_options_.atomic_flush) {
mutex_.Unlock();
status = AtomicFlushMemTables(
Expand Down
1 change: 1 addition & 0 deletions db/db_impl/db_impl_compaction_flush.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1135,6 +1135,7 @@ Status DBImpl::CompactRangeInternal(const CompactRangeOptions& options,
if (s.ok() && flush_needed) {
FlushOptions fo;
fo.allow_write_stall = options.allow_write_stall;
fo.check_if_compaction_disabled = true;
if (immutable_db_options_.atomic_flush) {
s = AtomicFlushMemTables(fo, FlushReason::kManualCompaction);
} else {
Expand Down

0 comments on commit bc7cc71

Please sign in to comment.