diff --git a/be/src/cloud/injection_point_action.cpp b/be/src/cloud/injection_point_action.cpp index 2b40bd98bf7c66..d99dcfd534d6b7 100644 --- a/be/src/cloud/injection_point_action.cpp +++ b/be/src/cloud/injection_point_action.cpp @@ -78,18 +78,18 @@ void register_suites() { should_ret = true; }); sp->set_call_back("HdfsFileWriter::hdfsFlush", [](auto&& args) { - auto& [ret_value, should_ret] = *try_any_cast*>(args.back()); - ret_value = -1; + auto& [ret_value, should_ret] = *try_any_cast*>(args.back()); + ret_value = Status::InternalError("failed to flush hdfs file"); should_ret = true; }); sp->set_call_back("HdfsFileWriter::hdfsCloseFile", [](auto&& args) { - auto& [ret_value, should_ret] = *try_any_cast*>(args.back()); - ret_value = -1; + auto& [ret_value, should_ret] = *try_any_cast*>(args.back()); + ret_value = Status::InternalError("failed to flush hdfs file"); should_ret = true; }); sp->set_call_back("HdfsFileWriter::hdfeSync", [](auto&& args) { - auto& [ret_value, should_ret] = *try_any_cast*>(args.back()); - ret_value = -1; + auto& [ret_value, should_ret] = *try_any_cast*>(args.back()); + ret_value = Status::InternalError("failed to flush hdfs file"); should_ret = true; }); sp->set_call_back("HdfsFileReader:read_error", [](auto&& args) { diff --git a/be/src/io/fs/hdfs_file_reader.cpp b/be/src/io/fs/hdfs_file_reader.cpp index 3b8d76d55dc061..358663b65d0dad 100644 --- a/be/src/io/fs/hdfs_file_reader.cpp +++ b/be/src/io/fs/hdfs_file_reader.cpp @@ -129,7 +129,7 @@ Status HdfsFileReader::read_at_impl(size_t offset, Slice result, size_t* bytes_r to + has_read, bytes_req - has_read); { [[maybe_unused]] Status error_ret; - TEST_INJECTION_POINT_RETURN_WITH_VALUE("HdfsFileReader:read_error", &error_ret); + TEST_INJECTION_POINT_RETURN_WITH_VALUE("HdfsFileReader:read_error", error_ret); } if (loop_read < 0) { // invoker maybe just skip Status.NotFound and continue diff --git a/be/src/io/fs/hdfs_file_writer.cpp b/be/src/io/fs/hdfs_file_writer.cpp index 023ab008fe60c9..f0bc8332b13e1f 100644 --- a/be/src/io/fs/hdfs_file_writer.cpp +++ b/be/src/io/fs/hdfs_file_writer.cpp @@ -97,7 +97,8 @@ Status HdfsFileWriter::close() { ret = hdfsHSync(_hdfs_handler->hdfs_fs, _hdfs_file); #endif } - TEST_INJECTION_POINT_RETURN_WITH_VALUE("HdfsFileWriter::hdfeSync", &ret); + TEST_INJECTION_POINT_RETURN_WITH_VALUE("HdfsFileWriter::hdfeSync", + Status::InternalError("failed to sync hdfs file")); if (ret != 0) { return Status::InternalError("failed to sync hdfs file. fs_name={} path={} : {}", @@ -112,7 +113,8 @@ Status HdfsFileWriter::close() { ret = hdfsCloseFile(_hdfs_handler->hdfs_fs, _hdfs_file); } _hdfs_file = nullptr; - TEST_INJECTION_POINT_RETURN_WITH_VALUE("HdfsFileWriter::hdfsCloseFile", &ret); + TEST_INJECTION_POINT_RETURN_WITH_VALUE("HdfsFileWriter::hdfsCloseFile", + Status::InternalError("failed to close hdfs file")); if (ret != 0) { std::string err_msg = hdfs_error(); return Status::InternalError( @@ -193,7 +195,7 @@ Status HdfsFileWriter::append_hdfs_file(std::string_view content) { "write hdfs failed. fs_name: {}, path: {}, error: size exceeds", _fs_name, _path.native()); TEST_INJECTION_POINT_RETURN_WITH_VALUE("HdfsFileWriter::append_hdfs_file_error", - &error_ret); + error_ret); } } if (written_bytes < 0) { @@ -265,7 +267,8 @@ Status HdfsFileWriter::finalize() { // Flush buffered data to HDFS without waiting for HDFS response int ret = hdfsFlush(_hdfs_handler->hdfs_fs, _hdfs_file); - TEST_INJECTION_POINT_CALLBACK("hdfsFlush", &ret) + TEST_INJECTION_POINT_RETURN_WITH_VALUE("HdfsFileWriter::hdfsFlush", + Status::InternalError("failed to flush hdfs file")); if (ret != 0) { return Status::InternalError("failed to flush hdfs file. fs_name={} path={} : {}", _fs_name, _path.native(), hdfs_error());