Move a function to critical section (#4752)

Summary:
Test plan
```
$make clean && make -j32 all check
```
Pull Request resolved: https://github.com/facebook/rocksdb/pull/4752

Differential Revision: D13344705

Pulled By: riversand963

fbshipit-source-id: fc3a43174d09d70ccc2b09decd78e1da1b6ba9d1
main
Yanqin Jin 6 years ago committed by Facebook Github Bot
parent e58d76955a
commit b96fccb1e6
  1. 5
      db/db_impl.cc
  2. 2
      db/db_impl_compaction_flush.cc

@ -3131,20 +3131,19 @@ Status DBImpl::IngestExternalFile(
&need_flush);
if (status.ok() && need_flush) {
if (immutable_db_options_.atomic_flush) {
mutex_.Unlock();
autovector<ColumnFamilyData*> cfds;
SelectColumnFamiliesForAtomicFlush(&cfds);
mutex_.Unlock();
status = AtomicFlushMemTables(cfds, FlushOptions(),
FlushReason::kExternalFileIngestion,
true /* writes_stopped */);
mutex_.Lock();
} else {
mutex_.Unlock();
status = FlushMemTable(cfd, FlushOptions(),
FlushReason::kExternalFileIngestion,
true /* writes_stopped */);
mutex_.Lock();
}
mutex_.Lock();
}
}

@ -588,7 +588,9 @@ Status DBImpl::CompactRange(const CompactRangeOptions& options,
fo.allow_write_stall = options.allow_write_stall;
if (immutable_db_options_.atomic_flush) {
autovector<ColumnFamilyData*> cfds;
mutex_.Lock();
SelectColumnFamiliesForAtomicFlush(&cfds);
mutex_.Unlock();
s = AtomicFlushMemTables(cfds, fo, FlushReason::kManualCompaction,
false /* writes_stopped */);
} else {

Loading…
Cancel
Save