Skip to content

Commit 59ab24b

Browse files
fix lock
Signed-off-by: Little-Wallace <[email protected]>
1 parent d17b969 commit 59ab24b

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

db/db_impl/db_impl_compaction_flush.cc

+4-3
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ Status DBImpl::SyncClosedLogs(JobContext* job_context) {
9898
Status s;
9999
if (!logs_to_sync.empty()) {
100100
log_write_mutex_.Unlock();
101-
mutex_.Unlock();
102101

103102
for (log::Writer* log : logs_to_sync) {
104103
ROCKS_LOG_INFO(immutable_db_options_.info_log,
@@ -125,9 +124,7 @@ Status DBImpl::SyncClosedLogs(JobContext* job_context) {
125124
// "number <= current_log_number - 1" is equivalent to
126125
// "number < current_log_number".
127126
MarkLogsSynced(current_log_number - 1, true, s);
128-
mutex_.Lock();
129127
if (!s.ok()) {
130-
error_handler_.SetBGError(s, BackgroundErrorReason::kFlush);
131128
TEST_SYNC_POINT("DBImpl::SyncClosedLogs:Failed");
132129
return s;
133130
}
@@ -177,7 +174,9 @@ Status DBImpl::FlushMemTableToOutputFile(
177174
// flushed SST may contain data from write batches whose updates to
178175
// other column families are missing.
179176
// SyncClosedLogs() may unlock and re-lock the db_mutex.
177+
mutex_.Unlock();
180178
s = SyncClosedLogs(job_context);
179+
mutex_.Lock();
181180
} else {
182181
TEST_SYNC_POINT("DBImpl::SyncClosedLogs:Skip");
183182
}
@@ -359,7 +358,9 @@ Status DBImpl::AtomicFlushMemTablesToOutputFiles(
359358
if (logfile_number_ > 0) {
360359
// TODO (yanqin) investigate whether we should sync the closed logs for
361360
// single column family case.
361+
mutex_.Unlock();
362362
s = SyncClosedLogs(job_context);
363+
mutex_.Lock();
363364
}
364365

365366
// exec_status stores the execution status of flush_jobs as

0 commit comments

Comments
 (0)