Skip to content

Commit

Permalink
[opt](s3filewriter) Optimize exception handling when put object
Browse files Browse the repository at this point in the history
  • Loading branch information
gavinchou committed Nov 12, 2024
1 parent ffe6650 commit 801f46b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion be/src/io/fs/s3_file_writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,12 @@ Status S3FileWriter::_set_upload_to_remote_less_than_buffer_size() {
}

void S3FileWriter::_put_object(UploadFileBuffer& buf) {
DCHECK(state() != State::CLOSED) << fmt::format("state is {}", state());
if (state() == State::CLOSED) {
DCHECK_NE(state(), State::CLOSED) << _obj_storage_path_opts.path.native();
LOG_WARNING("failed to put object because file closed, file path {}",
_obj_storage_path_opts.path.native());
buf.set_status(Status::InternalError<false>("try to put closed file")) return;
}
const auto& client = _obj_client->get();
if (nullptr == client) {
buf.set_status(Status::InternalError<false>("invalid obj storage client"));
Expand Down

0 comments on commit 801f46b

Please sign in to comment.