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
This commit is contained in:
Yanqin Jin 2018-12-05 13:08:46 -08:00 committed by Facebook Github Bot
parent e58d76955a
commit b96fccb1e6
2 changed files with 4 additions and 3 deletions

View File

@ -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();
}
}

View File

@ -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 {