diff --git a/db/db_impl.cc b/db/db_impl.cc index a948965ec..1cadb4b0a 100644 --- a/db/db_impl.cc +++ b/db/db_impl.cc @@ -6542,10 +6542,15 @@ Status DBImpl::IngestExternalFile( immutable_db_options_, env_options_, &snapshots_, ingestion_options); - // Make sure that bg cleanup wont delete the files that we are ingesting std::list::iterator pending_output_elem; { InstrumentedMutexLock l(&mutex_); + if (!bg_error_.ok()) { + // Don't ingest files when there is a bg_error + return bg_error_; + } + + // Make sure that bg cleanup wont delete the files that we are ingesting pending_output_elem = CaptureCurrentFileNumberInPendingOutputs(); }