Skip to content

Commit f6841d1

Browse files
anand1976facebook-github-bot
authored andcommitted
Fix DeleteFile error handling in SstFileWriter::Finish (facebook#13776)
Summary: In SstFileWriter::Finish, the call to DeleteFile to delete the output file in case of an error may fail. The current behavior is to ignore the error. In stress tests, there may be expected failures due to error injection. Not acting on the return status will cause the ASSERT_STATUS_CHECKED test to fail, so silence it. Pull Request resolved: facebook#13776 Reviewed By: mszeszko-meta Differential Revision: D78307124 Pulled By: anand1976 fbshipit-source-id: d27d9397c15cac5cb33b27094c9123a3fde7fa24
1 parent 60a0172 commit f6841d1

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

table/sst_file_writer.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -497,9 +497,9 @@ Status SstFileWriter::Finish(ExternalSstFileInfo* file_info) {
497497
}
498498
if (!s.ok()) {
499499
Status status = r->ioptions.env->DeleteFile(r->file_info.file_path);
500-
// Silence ASSERT_STATUS_CHECKED warning
501-
assert(status.ok());
502-
;
500+
// Silence ASSERT_STATUS_CHECKED warning, since DeleteFile may fail under
501+
// some error injection, and we can just ignore the failure
502+
status.PermitUncheckedError();
503503
}
504504

505505
if (file_info != nullptr) {

0 commit comments

Comments
 (0)