From 79e059a1897484ec3e5e61f24d9aea08565f2323 Mon Sep 17 00:00:00 2001 From: nebula-bots <88429921+nebula-bots@users.noreply.github.com> Date: Thu, 9 Dec 2021 11:25:03 +0800 Subject: [PATCH] Fix the latency type in the executionResponse (#355) * Fix the latency type in the executionResponse * Fix compilation * Fix comment Co-authored-by: Yichen Wang <18348405+Aiee@users.noreply.github.com> --- src/common/graph/ExecutionResponseOps-inl.h | 18 +++++++++--------- src/common/graph/Response.h | 2 +- src/interface/storage.thrift | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/common/graph/ExecutionResponseOps-inl.h b/src/common/graph/ExecutionResponseOps-inl.h index ee46d3f197f..e5b1987b408 100644 --- a/src/common/graph/ExecutionResponseOps-inl.h +++ b/src/common/graph/ExecutionResponseOps-inl.h @@ -37,7 +37,7 @@ struct TccStructTraits<::nebula::ExecutionResponse> { _ftype = apache::thrift::protocol::T_I32; } else if (_fname == "latency_in_us") { fid = 2; - _ftype = apache::thrift::protocol::T_I32; + _ftype = apache::thrift::protocol::T_I64; } else if (_fname == "data") { fid = 3; _ftype = apache::thrift::protocol::T_STRUCT; @@ -75,9 +75,9 @@ uint32_t Cpp2Ops<::nebula::ExecutionResponse>::write(Protocol* proto, ::nebula::ErrorCode>::write(*proto, obj->errorCode); xfer += proto->writeFieldEnd(); - xfer += proto->writeFieldBegin("latency_in_us", apache::thrift::protocol::T_I32, 2); + xfer += proto->writeFieldBegin("latency_in_us", apache::thrift::protocol::T_I64, 2); xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::integral, - int32_t>::write(*proto, obj->latencyInUs); + int64_t>::write(*proto, obj->latencyInUs); xfer += proto->writeFieldEnd(); if (obj->data != nullptr) { xfer += proto->writeFieldBegin("data", apache::thrift::protocol::T_STRUCT, 3); @@ -134,7 +134,7 @@ _readField_error_code : { } _readField_latency_in_us : { ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::integral, - int32_t>::read(*proto, obj->latencyInUs); + int64_t>::read(*proto, obj->latencyInUs); isset_latency_in_us = true; } @@ -216,7 +216,7 @@ _readField_comment : { } } case 2: { - if (LIKELY(_readState.fieldType == apache::thrift::protocol::T_I32)) { + if (LIKELY(_readState.fieldType == apache::thrift::protocol::T_I64)) { goto _readField_latency_in_us; } else { goto _skip; @@ -276,9 +276,9 @@ uint32_t Cpp2Ops<::nebula::ExecutionResponse>::serializedSize( xfer += ::apache::thrift::detail::pm::protocol_methods< ::apache::thrift::type_class::enumeration, ::nebula::ErrorCode>::serializedSize(*proto, obj->errorCode); - xfer += proto->serializedFieldSize("latency_in_us", apache::thrift::protocol::T_I32, 2); + xfer += proto->serializedFieldSize("latency_in_us", apache::thrift::protocol::T_I64, 2); xfer += ::apache::thrift::detail::pm:: - protocol_methods<::apache::thrift::type_class::integral, int32_t>::serializedSize( + protocol_methods<::apache::thrift::type_class::integral, int64_t>::serializedSize( *proto, obj->latencyInUs); if (obj->data != nullptr) { xfer += proto->serializedFieldSize("data", apache::thrift::protocol::T_STRUCT, 3); @@ -314,9 +314,9 @@ uint32_t Cpp2Ops<::nebula::ExecutionResponse>::serializedSizeZC( xfer += ::apache::thrift::detail::pm::protocol_methods< ::apache::thrift::type_class::enumeration, ::nebula::ErrorCode>::serializedSize(*proto, obj->errorCode); - xfer += proto->serializedFieldSize("latency_in_us", apache::thrift::protocol::T_I32, 2); + xfer += proto->serializedFieldSize("latency_in_us", apache::thrift::protocol::T_I64, 2); xfer += ::apache::thrift::detail::pm:: - protocol_methods<::apache::thrift::type_class::integral, int32_t>::serializedSize( + protocol_methods<::apache::thrift::type_class::integral, int64_t>::serializedSize( *proto, obj->latencyInUs); if (obj->data != nullptr) { xfer += proto->serializedFieldSize("data", apache::thrift::protocol::T_STRUCT, 3); diff --git a/src/common/graph/Response.h b/src/common/graph/Response.h index 51ad260240d..ba97cb29ce2 100644 --- a/src/common/graph/Response.h +++ b/src/common/graph/Response.h @@ -468,7 +468,7 @@ struct ExecutionResponse { } ErrorCode errorCode{ErrorCode::SUCCEEDED}; - int32_t latencyInUs{0}; + int64_t latencyInUs{0}; std::unique_ptr data{nullptr}; std::unique_ptr spaceName{nullptr}; std::unique_ptr errorMsg{nullptr}; diff --git a/src/interface/storage.thrift b/src/interface/storage.thrift index 516fb1e469b..2a701849e1d 100644 --- a/src/interface/storage.thrift +++ b/src/interface/storage.thrift @@ -39,7 +39,7 @@ struct ResponseCommon { // Only contains the partition that returns error 1: required list failed_parts, // Query latency from storage service - 2: required i32 latency_in_us, + 2: required i64 latency_in_us, 3: optional map latency_detail_us, }