Do not flag error if file to be deleted does not exist
Summary: Some users have observed errors in the log file when the log file or sst file is already deleted. Test Plan: Make sure that the errors do not appear for already deleted files. Reviewers: sdong Reviewed By: sdong Subscribers: anthony, kradhakrishnan, yhchiang, rven, igor, IslamAbdelRahman, dhruba, leveldb Differential Revision: https://reviews.facebook.net/D47115
This commit is contained in:
parent
a5e312a7a4
commit
51e1c11254
@ -770,6 +770,12 @@ void DBImpl::PurgeObsoleteFiles(const JobContext& state) {
|
|||||||
"[JOB %d] Delete %s type=%d #%" PRIu64 " -- %s\n", state.job_id,
|
"[JOB %d] Delete %s type=%d #%" PRIu64 " -- %s\n", state.job_id,
|
||||||
fname.c_str(), type, number,
|
fname.c_str(), type, number,
|
||||||
file_deletion_status.ToString().c_str());
|
file_deletion_status.ToString().c_str());
|
||||||
|
} else if (env_->FileExists(fname).IsNotFound()) {
|
||||||
|
Log(InfoLogLevel::INFO_LEVEL, db_options_.info_log,
|
||||||
|
"[JOB %d] Tried to delete a non-existing file %s type=%d #%" PRIu64
|
||||||
|
" -- %s\n",
|
||||||
|
state.job_id, fname.c_str(), type, number,
|
||||||
|
file_deletion_status.ToString().c_str());
|
||||||
} else {
|
} else {
|
||||||
Log(InfoLogLevel::ERROR_LEVEL, db_options_.info_log,
|
Log(InfoLogLevel::ERROR_LEVEL, db_options_.info_log,
|
||||||
"[JOB %d] Failed to delete %s type=%d #%" PRIu64 " -- %s\n",
|
"[JOB %d] Failed to delete %s type=%d #%" PRIu64 " -- %s\n",
|
||||||
@ -798,12 +804,19 @@ void DBImpl::PurgeObsoleteFiles(const JobContext& state) {
|
|||||||
full_path_to_delete.c_str());
|
full_path_to_delete.c_str());
|
||||||
Status s = env_->DeleteFile(full_path_to_delete);
|
Status s = env_->DeleteFile(full_path_to_delete);
|
||||||
if (!s.ok()) {
|
if (!s.ok()) {
|
||||||
|
if (env_->FileExists(full_path_to_delete).IsNotFound()) {
|
||||||
|
Log(InfoLogLevel::INFO_LEVEL, db_options_.info_log,
|
||||||
|
"[JOB %d] Tried to delete non-existing info log file %s FAILED "
|
||||||
|
"-- %s\n",
|
||||||
|
state.job_id, to_delete.c_str(), s.ToString().c_str());
|
||||||
|
} else {
|
||||||
Log(InfoLogLevel::ERROR_LEVEL, db_options_.info_log,
|
Log(InfoLogLevel::ERROR_LEVEL, db_options_.info_log,
|
||||||
"[JOB %d] Delete info log file %s FAILED -- %s\n", state.job_id,
|
"[JOB %d] Delete info log file %s FAILED -- %s\n", state.job_id,
|
||||||
to_delete.c_str(), s.ToString().c_str());
|
to_delete.c_str(), s.ToString().c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#ifndef ROCKSDB_LITE
|
#ifndef ROCKSDB_LITE
|
||||||
wal_manager_.PurgeObsoleteWALFiles();
|
wal_manager_.PurgeObsoleteWALFiles();
|
||||||
#endif // ROCKSDB_LITE
|
#endif // ROCKSDB_LITE
|
||||||
|
Loading…
Reference in New Issue
Block a user