Skip to content

Commit d399620

Browse files
fix conflict
Signed-off-by: Little-Wallace <[email protected]>
1 parent 8dab46e commit d399620

File tree

4 files changed

+19
-46
lines changed

4 files changed

+19
-46
lines changed

db/db_impl/db_impl.cc

Lines changed: 5 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -271,15 +271,11 @@ DBImpl::DBImpl(const DBOptions& options, const std::string& dbname,
271271
mutable_db_options_.Dump(immutable_db_options_.info_log.get());
272272
DumpSupportInfo(immutable_db_options_.info_log.get());
273273

274-
// always open the DB with 0 here, which means if preserve_deletes_==true
275-
// we won't drop any deletion markers until SetPreserveDeletesSequenceNumber()
276-
// is called by client and this seqnum is advanced.
277-
preserve_deletes_seqnum_.store(0);
278274
max_total_wal_size_.store(mutable_db_options_.max_total_wal_size,
279275
std::memory_order_relaxed);
280-
/*if (write_buffer_manager_) {
276+
if (write_buffer_manager_) {
281277
wbm_stall_.reset(new WBMStallInterface());
282-
}*/
278+
}
283279
}
284280

285281
Status DBImpl::Resume() {
@@ -633,25 +629,7 @@ Status DBImpl::CloseHelper() {
633629
job_context.Clean();
634630
mutex_.Lock();
635631
}
636-
{
637-
InstrumentedMutexLock lock(&log_write_mutex_);
638-
for (auto l : logs_to_free_) {
639-
delete l;
640-
}
641-
for (auto& log : logs_) {
642-
uint64_t log_number = log.writer->get_log_number();
643-
Status s = log.ClearWriter();
644-
if (!s.ok()) {
645-
ROCKS_LOG_WARN(
646-
immutable_db_options_.info_log,
647-
"Unable to Sync WAL file %s with error -- %s",
648-
LogFileName(immutable_db_options_.wal_dir, log_number).c_str(),
649-
s.ToString().c_str());
650-
// Retain the first error
651-
if (ret.ok()) {
652-
ret = s;
653-
}
654-
/*
632+
log_write_mutex_.Lock();
655633
for (auto l : logs_to_free_) {
656634
delete l;
657635
}
@@ -667,11 +645,11 @@ Status DBImpl::CloseHelper() {
667645
// Retain the first error
668646
if (ret.ok()) {
669647
ret = s;
670-
*/
671648
}
672649
}
673-
logs_.clear();
674650
}
651+
logs_.clear();
652+
log_write_mutex_.Unlock();
675653

676654
// Table cache may have table handles holding blocks from the block cache.
677655
// We need to release them before the block cache is destroyed. The block

db/db_impl/db_impl_open.cc

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1363,7 +1363,12 @@ Status DBImpl::RestoreAliveLogFiles(const std::vector<uint64_t>& wal_numbers) {
13631363
break;
13641364
}
13651365
total_log_size_ += log.size;
1366-
alive_log_files_.push_back(log);
1366+
if (two_write_queues_) {
1367+
alive_log_files_.push_back(log);
1368+
} else {
1369+
InstrumentedMutexLock l(&log_write_mutex_);
1370+
alive_log_files_.push_back(log);
1371+
}
13671372
}
13681373
if (two_write_queues_) {
13691374
log_write_mutex_.Unlock();
@@ -1697,14 +1702,10 @@ Status DBImpl::Open(const DBOptions& db_options, const std::string& dbname,
16971702
cfd, &sv_context, *cfd->GetLatestMutableCFOptions());
16981703
}
16991704
sv_context.Clean();
1700-
if (impl->two_write_queues_) {
1701-
impl->log_write_mutex_.Lock();
1702-
}
1705+
impl->log_write_mutex_.Lock();
17031706
impl->alive_log_files_.push_back(
17041707
DBImpl::LogFileNumberSize(impl->logfile_number_));
1705-
if (impl->two_write_queues_) {
1706-
impl->log_write_mutex_.Unlock();
1707-
}
1708+
impl->log_write_mutex_.Unlock();
17081709
}
17091710
if (s.ok()) {
17101711
// In WritePrepared there could be gap in sequence numbers. This breaks

db/db_impl/db_impl_write.cc

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -275,8 +275,8 @@ Status DBImpl::WriteImpl(const WriteOptions& write_options,
275275
bool in_parallel_group = false;
276276
uint64_t last_sequence = kMaxSequenceNumber;
277277

278-
// The writer will only be used when two_write_queues_ is false.
279-
if (!two_write_queues_ || !disable_memtable) {
278+
assert(!two_write_queues_ || !disable_memtable);
279+
{
280280
// With concurrent writes we do preprocess only in the write thread that
281281
// also does write to memtable to avoid sync issue on shared data structure
282282
// with the other thread
@@ -294,7 +294,6 @@ Status DBImpl::WriteImpl(const WriteOptions& write_options,
294294
PERF_TIMER_START(write_pre_and_post_process_time);
295295
}
296296

297-
298297
// Add to log and apply to memtable. We can release the lock
299298
// during this phase since &w is currently responsible for logging
300299
// and protects against concurrent loggers and concurrent writes

db/error_handler.cc

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -412,15 +412,7 @@ const Status& ErrorHandler::SetBGError(const IOStatus& bg_io_err,
412412
// it can directly overwrite any existing bg_error_.
413413
bool auto_recovery = false;
414414
Status bg_err(new_bg_io_err, Status::Severity::kUnrecoverableError);
415-
bg_error_ = bg_err;
416-
if (bg_error_.severity() >= Status::Severity::kHardError) {
417-
stop_state_.store(true, std::memory_order_release);
418-
}
419-
420-
if (recovery_in_prog_ && recovery_error_.ok()) {
421-
recovery_error_ = bg_err;
422-
}
423-
//CheckAndSetRecoveryAndBGError(bg_err);
415+
CheckAndSetRecoveryAndBGError(bg_err);
424416
if (bg_error_stats_ != nullptr) {
425417
RecordTick(bg_error_stats_.get(), ERROR_HANDLER_BG_ERROR_COUNT);
426418
RecordTick(bg_error_stats_.get(), ERROR_HANDLER_BG_IO_ERROR_COUNT);
@@ -806,6 +798,9 @@ void ErrorHandler::CheckAndSetRecoveryAndBGError(const Status& bg_err) {
806798
if (bg_err.severity() > bg_error_.severity()) {
807799
bg_error_ = bg_err;
808800
}
801+
if (bg_error_.severity() >= Status::Severity::kHardError) {
802+
stop_state_.store(true, std::memory_order_release);
803+
}
809804
return;
810805
}
811806

0 commit comments

Comments
 (0)