Store the return value of Fsync for check

Summary: Pull Request resolved: https://github.com/facebook/rocksdb/pull/4361

Differential Revision: D9803723

Pulled By: riversand963

fbshipit-source-id: 5a0d4cd3e57fd195571dcd5822895ee00547fa6a
main
Yanqin Jin 6 years ago committed by Facebook Github Bot
parent 82057b0d8f
commit 8959063c9c
  1. 8
      db/compaction_job.cc
  2. 4
      db/flush_job.cc
  3. 2
      util/filename.cc
  4. 18
      utilities/backupable/backupable_db.cc
  5. 6
      utilities/blob_db/blob_db_impl.cc

@ -593,10 +593,6 @@ Status CompactionJob::Run() {
thread.join();
}
if (output_directory_) {
output_directory_->Fsync();
}
compaction_stats_.micros = env_->NowMicros() - start_micros;
MeasureTime(stats_, COMPACTION_TIME, compaction_stats_.micros);
@ -611,6 +607,10 @@ Status CompactionJob::Run() {
}
}
if (status.ok() && output_directory_) {
status = output_directory_->Fsync();
}
if (status.ok()) {
thread_pool.clear();
std::vector<const FileMetaData*> files_meta;

@ -371,8 +371,8 @@ Status FlushJob::WriteLevel0Table() {
s.ToString().c_str(),
meta_.marked_for_compaction ? " (needs compaction)" : "");
if (output_file_directory_ != nullptr) {
output_file_directory_->Fsync();
if (s.ok() && output_file_directory_ != nullptr) {
s = output_file_directory_->Fsync();
}
TEST_SYNC_POINT("FlushJob::WriteLevel0Table");
db_mutex_->Lock();

@ -377,7 +377,7 @@ Status SetCurrentFile(Env* env, const std::string& dbname,
}
if (s.ok()) {
if (directory_to_fsync != nullptr) {
directory_to_fsync->Fsync();
s = directory_to_fsync->Fsync();
}
} else {
env->DeleteFile(tmp);

@ -874,19 +874,19 @@ Status BackupEngineImpl::CreateNewBackupWithMetadata(
GetAbsolutePath(GetPrivateFileRel(new_backup_id, false)),
&backup_private_directory);
if (backup_private_directory != nullptr) {
backup_private_directory->Fsync();
s = backup_private_directory->Fsync();
}
if (private_directory_ != nullptr) {
private_directory_->Fsync();
if (s.ok() && private_directory_ != nullptr) {
s = private_directory_->Fsync();
}
if (meta_directory_ != nullptr) {
meta_directory_->Fsync();
if (s.ok() && meta_directory_ != nullptr) {
s = meta_directory_->Fsync();
}
if (shared_directory_ != nullptr) {
shared_directory_->Fsync();
if (s.ok() && shared_directory_ != nullptr) {
s = shared_directory_->Fsync();
}
if (backup_directory_ != nullptr) {
backup_directory_->Fsync();
if (s.ok() && backup_directory_ != nullptr) {
s = backup_directory_->Fsync();
}
}

@ -1732,7 +1732,11 @@ std::pair<bool, int64_t> BlobDBImpl::DeleteObsoleteFiles(bool aborted) {
// directory change. Fsync
if (file_deleted) {
dir_ent_->Fsync();
Status s = dir_ent_->Fsync();
if (!s.ok()) {
ROCKS_LOG_ERROR(db_options_.info_log, "Failed to sync dir %s: %s",
blob_dir_.c_str(), s.ToString().c_str());
}
}
// put files back into obsolete if for some reason, delete failed

Loading…
Cancel
Save