|
38 | 38 | #include "runtime/workload_management/io_throttle.h" |
39 | 39 | #include "runtime/workload_management/resource_context.h" |
40 | 40 | #include "service/backend_options.h" |
| 41 | +#include "util/bvar_helper.h" |
41 | 42 |
|
42 | 43 | namespace doris::io { |
43 | 44 |
|
@@ -164,8 +165,12 @@ Status HdfsFileReader::do_read_at_impl(size_t offset, Slice result, size_t* byte |
164 | 165 | int64_t max_to_read = bytes_req - has_read; |
165 | 166 | tSize to_read = static_cast<tSize>( |
166 | 167 | std::min(max_to_read, static_cast<int64_t>(std::numeric_limits<tSize>::max()))); |
167 | | - tSize loop_read = hdfsPread(_handle->fs(), _handle->file(), offset + has_read, |
168 | | - to + has_read, to_read); |
| 168 | + tSize loop_read; |
| 169 | + { |
| 170 | + SCOPED_BVAR_LATENCY(hdfs_bvar::hdfs_read_latency); |
| 171 | + loop_read = hdfsPread(_handle->fs(), _handle->file(), offset + has_read, |
| 172 | + to + has_read, to_read); |
| 173 | + } |
169 | 174 | { |
170 | 175 | [[maybe_unused]] Status error_ret; |
171 | 176 | TEST_INJECTION_POINT_RETURN_WITH_VALUE("HdfsFileReader:read_error", error_ret); |
@@ -230,8 +235,12 @@ Status HdfsFileReader::do_read_at_impl(size_t offset, Slice result, size_t* byte |
230 | 235 |
|
231 | 236 | size_t has_read = 0; |
232 | 237 | while (has_read < bytes_req) { |
233 | | - int64_t loop_read = hdfsRead(_handle->fs(), _handle->file(), to + has_read, |
234 | | - static_cast<int32_t>(bytes_req - has_read)); |
| 238 | + int64_t loop_read; |
| 239 | + { |
| 240 | + SCOPED_BVAR_LATENCY(hdfs_bvar::hdfs_read_latency); |
| 241 | + loop_read = hdfsRead(_handle->fs(), _handle->file(), to + has_read, |
| 242 | + static_cast<int32_t>(bytes_req - has_read)); |
| 243 | + } |
235 | 244 | if (loop_read < 0) { |
236 | 245 | // invoker maybe just skip Status.NotFound and continue |
237 | 246 | // so we need distinguish between it and other kinds of errors |
|
0 commit comments