diff --git a/src/storage/ob_storage_rpc.cpp b/src/storage/ob_storage_rpc.cpp index 508656173a..ed5eafc10d 100644 --- a/src/storage/ob_storage_rpc.cpp +++ b/src/storage/ob_storage_rpc.cpp @@ -2926,6 +2926,20 @@ ObLobQueryP::ObLobQueryP(common::ObInOutBandwidthThrottle *bandwidth_throttle) set_preserve_recv_data(); } +int64_t ObLobQueryP::get_timeout() const +{ + int64_t timeout = 0; + const int64_t rpc_timeout = rpc_pkt_->get_timeout(); + const int64_t send_timestamp = get_send_timestamp(); + // oversize int64_t if rpc_timeout + send_timestamp > INT64_MAX + if (INT64_MAX - rpc_timeout - send_timestamp < 0) { + timeout = INT64_MAX; + } else { + timeout = rpc_timeout + send_timestamp; + } + return timeout; +} + int ObLobQueryP::process_read() { int ret = OB_SUCCESS; @@ -2943,7 +2957,7 @@ int ObLobQueryP::process_read() param.scan_backward_ = arg_.scan_backward_; param.from_rpc_ = true; ObLobQueryIter *iter = nullptr; - int64_t timeout = rpc_pkt_->get_timeout() + get_send_timestamp(); + int64_t timeout = get_timeout(); if (OB_FAIL(lob_mngr->build_lob_param(param, allocator_, arg_.cs_type_, arg_.offset_, arg_.len_, timeout, arg_.lob_locator_))) { LOG_WARN("failed to build lob param", K(ret)); @@ -2990,7 +3004,7 @@ int ObLobQueryP::process_getlength() param.from_rpc_ = true; header.reset(); uint64_t len = 0; - int64_t timeout = rpc_pkt_->get_timeout() + get_send_timestamp(); + int64_t timeout = get_timeout(); if (OB_FAIL(lob_mngr->build_lob_param(param, allocator_, arg_.cs_type_, arg_.offset_, arg_.len_, timeout, arg_.lob_locator_))) { LOG_WARN("failed to build lob param", K(ret)); diff --git a/src/storage/ob_storage_rpc.h b/src/storage/ob_storage_rpc.h index 53ea6320c7..46f0183a46 100755 --- a/src/storage/ob_storage_rpc.h +++ b/src/storage/ob_storage_rpc.h @@ -1292,6 +1292,7 @@ protected: private: int process_read(); int process_getlength(); + int64_t get_timeout() const; }; // Stream get ls meta and all tablet meta