diff --git a/db/db_impl_compaction_flush.cc b/db/db_impl_compaction_flush.cc index 01f606465..48ca4be89 100644 --- a/db/db_impl_compaction_flush.cc +++ b/db/db_impl_compaction_flush.cc @@ -79,6 +79,9 @@ Status DBImpl::SyncClosedLogs(JobContext* job_context) { "[JOB %d] Syncing log #%" PRIu64, job_context->job_id, log->get_log_number()); s = log->file()->Sync(immutable_db_options_.use_fsync); + if (!s.ok()) { + break; + } } if (s.ok()) { s = directories_.GetWalDir()->Fsync(); diff --git a/db/log_writer.cc b/db/log_writer.cc index a767f1916..999f9c580 100644 --- a/db/log_writer.cc +++ b/db/log_writer.cc @@ -57,9 +57,11 @@ Status Writer::AddRecord(const Slice& slice) { // Fill the trailer (literal below relies on kHeaderSize and // kRecyclableHeaderSize being <= 11) assert(header_size <= 11); - dest_->Append( - Slice("\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", - static_cast(leftover))); + s = dest_->Append(Slice("\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", + static_cast(leftover))); + if (!s.ok()) { + break; + } } block_offset_ = 0; } diff --git a/util/file_util.cc b/util/file_util.cc index 19465efbc..ba7e54fa5 100644 --- a/util/file_util.cc +++ b/util/file_util.cc @@ -62,8 +62,7 @@ Status CopyFile(Env* env, const std::string& source, } size -= slice.size(); } - dest_writer->Sync(use_fsync); - return Status::OK(); + return dest_writer->Sync(use_fsync); } // Utility function to create a file with the provided contents