From 112da1337eccb9b0ca85c9ef5f7c75625c083459 Mon Sep 17 00:00:00 2001 From: shengjh <1572099106@qq.com> Date: Sat, 5 Sep 2020 09:58:12 +0800 Subject: [PATCH] Change timestamp type to uint64 Signed-off-by: shengjh <1572099106@qq.com> --- proxy/src/grpc/gen-milvus/suvlim.pb.cc | 60 +++++++++---------- proxy/src/grpc/gen-milvus/suvlim.pb.h | 48 +++++++-------- proxy/src/grpc/suvlim.proto | 6 +- .../server/grpc_impl/GrpcRequestHandler.cpp | 42 ------------- proxy/src/version.h | 5 +- 5 files changed, 60 insertions(+), 101 deletions(-) diff --git a/proxy/src/grpc/gen-milvus/suvlim.pb.cc b/proxy/src/grpc/gen-milvus/suvlim.pb.cc index c3ec6810d4..0440b710ac 100644 --- a/proxy/src/grpc/gen-milvus/suvlim.pb.cc +++ b/proxy/src/grpc/gen-milvus/suvlim.pb.cc @@ -1514,17 +1514,17 @@ const char descriptor_table_protodef_suvlim_2eproto[] PROTOBUF_SECTION_VARIABLE( "\"\231\002\n\021InsertOrDeleteMsg\022\027\n\017collection_nam" "e\030\001 \001(\t\022\'\n\trows_data\030\002 \001(\0132\024.milvus.grpc" ".RowData\022\013\n\003uid\030\003 \001(\003\022\025\n\rpartition_tag\030\004" - " \001(\t\022\021\n\ttimestamp\030\005 \001(\003\022\022\n\nsegment_id\030\006 " + " \001(\t\022\021\n\ttimestamp\030\005 \001(\004\022\022\n\nsegment_id\030\006 " "\001(\003\022\022\n\nchannel_id\030\007 \001(\003\022\037\n\002op\030\010 \001(\0162\023.mi" "lvus.grpc.OpType\022\021\n\tclient_id\030\t \001(\003\022/\n\014e" "xtra_params\030\n \003(\0132\031.milvus.grpc.KeyValue" "Pair\"\316\001\n\tSearchMsg\022\027\n\017collection_name\030\001 " "\001(\t\022-\n\007records\030\002 \001(\0132\034.milvus.grpc.Vecto" "rRowRecord\022\025\n\rpartition_tag\030\003 \001(\t\022\013\n\003uid" - "\030\004 \001(\003\022\021\n\ttimestamp\030\005 \001(\003\022\021\n\tclient_id\030\006" + "\030\004 \001(\003\022\021\n\ttimestamp\030\005 \001(\004\022\021\n\tclient_id\030\006" " \001(\003\022/\n\014extra_params\030\007 \003(\0132\031.milvus.grpc" ".KeyValuePair\"[\n\013TimeSyncMsg\022\017\n\007peer_Id\030" - "\001 \001(\003\022\021\n\tTimestamp\030\002 \001(\003\022(\n\tsync_type\030\003 " + "\001 \001(\003\022\021\n\tTimestamp\030\002 \001(\004\022(\n\tsync_type\030\003 " "\001(\0162\025.milvus.grpc.SyncType\"0\n\rSegmentRec" "ord\022\013\n\003uid\030\001 \001(\003\022\022\n\nsegment_id\030\002 \003(\003\"L\n\n" "Key2SegMsg\022\021\n\tclient_id\030\001 \001(\003\022+\n\007records" @@ -17221,7 +17221,7 @@ const char* InsertOrDeleteMsg::_InternalParse(const char* ptr, ::PROTOBUF_NAMESP CHK_(ptr); } else goto handle_unusual; continue; - // int64 timestamp = 5; + // uint64 timestamp = 5; case 5: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 40)) { timestamp_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint(&ptr); @@ -17353,12 +17353,12 @@ bool InsertOrDeleteMsg::MergePartialFromCodedStream( break; } - // int64 timestamp = 5; + // uint64 timestamp = 5; case 5: { if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (40 & 0xFF)) { DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive< - ::PROTOBUF_NAMESPACE_ID::int64, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_INT64>( + ::PROTOBUF_NAMESPACE_ID::uint64, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_UINT64>( input, ×tamp_))); } else { goto handle_unusual; @@ -17488,9 +17488,9 @@ void InsertOrDeleteMsg::SerializeWithCachedSizes( 4, this->partition_tag(), output); } - // int64 timestamp = 5; + // uint64 timestamp = 5; if (this->timestamp() != 0) { - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64(5, this->timestamp(), output); + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteUInt64(5, this->timestamp(), output); } // int64 segment_id = 6; @@ -17570,9 +17570,9 @@ void InsertOrDeleteMsg::SerializeWithCachedSizes( 4, this->partition_tag(), target); } - // int64 timestamp = 5; + // uint64 timestamp = 5; if (this->timestamp() != 0) { - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64ToArray(5, this->timestamp(), target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteUInt64ToArray(5, this->timestamp(), target); } // int64 segment_id = 6; @@ -17664,10 +17664,10 @@ size_t InsertOrDeleteMsg::ByteSizeLong() const { this->uid()); } - // int64 timestamp = 5; + // uint64 timestamp = 5; if (this->timestamp() != 0) { total_size += 1 + - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64Size( + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::UInt64Size( this->timestamp()); } @@ -17925,7 +17925,7 @@ const char* SearchMsg::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID:: CHK_(ptr); } else goto handle_unusual; continue; - // int64 timestamp = 5; + // uint64 timestamp = 5; case 5: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 40)) { timestamp_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint(&ptr); @@ -18035,12 +18035,12 @@ bool SearchMsg::MergePartialFromCodedStream( break; } - // int64 timestamp = 5; + // uint64 timestamp = 5; case 5: { if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (40 & 0xFF)) { DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive< - ::PROTOBUF_NAMESPACE_ID::int64, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_INT64>( + ::PROTOBUF_NAMESPACE_ID::uint64, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_UINT64>( input, ×tamp_))); } else { goto handle_unusual; @@ -18130,9 +18130,9 @@ void SearchMsg::SerializeWithCachedSizes( ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64(4, this->uid(), output); } - // int64 timestamp = 5; + // uint64 timestamp = 5; if (this->timestamp() != 0) { - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64(5, this->timestamp(), output); + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteUInt64(5, this->timestamp(), output); } // int64 client_id = 6; @@ -18196,9 +18196,9 @@ void SearchMsg::SerializeWithCachedSizes( target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64ToArray(4, this->uid(), target); } - // int64 timestamp = 5; + // uint64 timestamp = 5; if (this->timestamp() != 0) { - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64ToArray(5, this->timestamp(), target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteUInt64ToArray(5, this->timestamp(), target); } // int64 client_id = 6; @@ -18274,10 +18274,10 @@ size_t SearchMsg::ByteSizeLong() const { this->uid()); } - // int64 timestamp = 5; + // uint64 timestamp = 5; if (this->timestamp() != 0) { total_size += 1 + - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64Size( + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::UInt64Size( this->timestamp()); } @@ -18448,7 +18448,7 @@ const char* TimeSyncMsg::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID CHK_(ptr); } else goto handle_unusual; continue; - // int64 Timestamp = 2; + // uint64 Timestamp = 2; case 2: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 16)) { timestamp_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint(&ptr); @@ -18506,12 +18506,12 @@ bool TimeSyncMsg::MergePartialFromCodedStream( break; } - // int64 Timestamp = 2; + // uint64 Timestamp = 2; case 2: { if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (16 & 0xFF)) { DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive< - ::PROTOBUF_NAMESPACE_ID::int64, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_INT64>( + ::PROTOBUF_NAMESPACE_ID::uint64, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_UINT64>( input, ×tamp_))); } else { goto handle_unusual; @@ -18565,9 +18565,9 @@ void TimeSyncMsg::SerializeWithCachedSizes( ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64(1, this->peer_id(), output); } - // int64 Timestamp = 2; + // uint64 Timestamp = 2; if (this->timestamp() != 0) { - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64(2, this->timestamp(), output); + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteUInt64(2, this->timestamp(), output); } // .milvus.grpc.SyncType sync_type = 3; @@ -18594,9 +18594,9 @@ void TimeSyncMsg::SerializeWithCachedSizes( target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64ToArray(1, this->peer_id(), target); } - // int64 Timestamp = 2; + // uint64 Timestamp = 2; if (this->timestamp() != 0) { - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64ToArray(2, this->timestamp(), target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteUInt64ToArray(2, this->timestamp(), target); } // .milvus.grpc.SyncType sync_type = 3; @@ -18633,10 +18633,10 @@ size_t TimeSyncMsg::ByteSizeLong() const { this->peer_id()); } - // int64 Timestamp = 2; + // uint64 Timestamp = 2; if (this->timestamp() != 0) { total_size += 1 + - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64Size( + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::UInt64Size( this->timestamp()); } diff --git a/proxy/src/grpc/gen-milvus/suvlim.pb.h b/proxy/src/grpc/gen-milvus/suvlim.pb.h index 2e6ff383f3..2054127225 100644 --- a/proxy/src/grpc/gen-milvus/suvlim.pb.h +++ b/proxy/src/grpc/gen-milvus/suvlim.pb.h @@ -7148,10 +7148,10 @@ class InsertOrDeleteMsg : ::PROTOBUF_NAMESPACE_ID::int64 uid() const; void set_uid(::PROTOBUF_NAMESPACE_ID::int64 value); - // int64 timestamp = 5; + // uint64 timestamp = 5; void clear_timestamp(); - ::PROTOBUF_NAMESPACE_ID::int64 timestamp() const; - void set_timestamp(::PROTOBUF_NAMESPACE_ID::int64 value); + ::PROTOBUF_NAMESPACE_ID::uint64 timestamp() const; + void set_timestamp(::PROTOBUF_NAMESPACE_ID::uint64 value); // int64 segment_id = 6; void clear_segment_id(); @@ -7183,7 +7183,7 @@ class InsertOrDeleteMsg : ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr partition_tag_; ::milvus::grpc::RowData* rows_data_; ::PROTOBUF_NAMESPACE_ID::int64 uid_; - ::PROTOBUF_NAMESPACE_ID::int64 timestamp_; + ::PROTOBUF_NAMESPACE_ID::uint64 timestamp_; ::PROTOBUF_NAMESPACE_ID::int64 segment_id_; ::PROTOBUF_NAMESPACE_ID::int64 channel_id_; ::PROTOBUF_NAMESPACE_ID::int64 client_id_; @@ -7360,10 +7360,10 @@ class SearchMsg : ::PROTOBUF_NAMESPACE_ID::int64 uid() const; void set_uid(::PROTOBUF_NAMESPACE_ID::int64 value); - // int64 timestamp = 5; + // uint64 timestamp = 5; void clear_timestamp(); - ::PROTOBUF_NAMESPACE_ID::int64 timestamp() const; - void set_timestamp(::PROTOBUF_NAMESPACE_ID::int64 value); + ::PROTOBUF_NAMESPACE_ID::uint64 timestamp() const; + void set_timestamp(::PROTOBUF_NAMESPACE_ID::uint64 value); // int64 client_id = 6; void clear_client_id(); @@ -7380,7 +7380,7 @@ class SearchMsg : ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr partition_tag_; ::milvus::grpc::VectorRowRecord* records_; ::PROTOBUF_NAMESPACE_ID::int64 uid_; - ::PROTOBUF_NAMESPACE_ID::int64 timestamp_; + ::PROTOBUF_NAMESPACE_ID::uint64 timestamp_; ::PROTOBUF_NAMESPACE_ID::int64 client_id_; mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; friend struct ::TableStruct_suvlim_2eproto; @@ -7509,10 +7509,10 @@ class TimeSyncMsg : ::PROTOBUF_NAMESPACE_ID::int64 peer_id() const; void set_peer_id(::PROTOBUF_NAMESPACE_ID::int64 value); - // int64 Timestamp = 2; + // uint64 Timestamp = 2; void clear_timestamp(); - ::PROTOBUF_NAMESPACE_ID::int64 timestamp() const; - void set_timestamp(::PROTOBUF_NAMESPACE_ID::int64 value); + ::PROTOBUF_NAMESPACE_ID::uint64 timestamp() const; + void set_timestamp(::PROTOBUF_NAMESPACE_ID::uint64 value); // .milvus.grpc.SyncType sync_type = 3; void clear_sync_type(); @@ -7525,7 +7525,7 @@ class TimeSyncMsg : ::PROTOBUF_NAMESPACE_ID::internal::InternalMetadataWithArena _internal_metadata_; ::PROTOBUF_NAMESPACE_ID::int64 peer_id_; - ::PROTOBUF_NAMESPACE_ID::int64 timestamp_; + ::PROTOBUF_NAMESPACE_ID::uint64 timestamp_; int sync_type_; mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; friend struct ::TableStruct_suvlim_2eproto; @@ -12545,15 +12545,15 @@ inline void InsertOrDeleteMsg::set_allocated_partition_tag(std::string* partitio // @@protoc_insertion_point(field_set_allocated:milvus.grpc.InsertOrDeleteMsg.partition_tag) } -// int64 timestamp = 5; +// uint64 timestamp = 5; inline void InsertOrDeleteMsg::clear_timestamp() { - timestamp_ = PROTOBUF_LONGLONG(0); + timestamp_ = PROTOBUF_ULONGLONG(0); } -inline ::PROTOBUF_NAMESPACE_ID::int64 InsertOrDeleteMsg::timestamp() const { +inline ::PROTOBUF_NAMESPACE_ID::uint64 InsertOrDeleteMsg::timestamp() const { // @@protoc_insertion_point(field_get:milvus.grpc.InsertOrDeleteMsg.timestamp) return timestamp_; } -inline void InsertOrDeleteMsg::set_timestamp(::PROTOBUF_NAMESPACE_ID::int64 value) { +inline void InsertOrDeleteMsg::set_timestamp(::PROTOBUF_NAMESPACE_ID::uint64 value) { timestamp_ = value; // @@protoc_insertion_point(field_set:milvus.grpc.InsertOrDeleteMsg.timestamp) @@ -12816,15 +12816,15 @@ inline void SearchMsg::set_uid(::PROTOBUF_NAMESPACE_ID::int64 value) { // @@protoc_insertion_point(field_set:milvus.grpc.SearchMsg.uid) } -// int64 timestamp = 5; +// uint64 timestamp = 5; inline void SearchMsg::clear_timestamp() { - timestamp_ = PROTOBUF_LONGLONG(0); + timestamp_ = PROTOBUF_ULONGLONG(0); } -inline ::PROTOBUF_NAMESPACE_ID::int64 SearchMsg::timestamp() const { +inline ::PROTOBUF_NAMESPACE_ID::uint64 SearchMsg::timestamp() const { // @@protoc_insertion_point(field_get:milvus.grpc.SearchMsg.timestamp) return timestamp_; } -inline void SearchMsg::set_timestamp(::PROTOBUF_NAMESPACE_ID::int64 value) { +inline void SearchMsg::set_timestamp(::PROTOBUF_NAMESPACE_ID::uint64 value) { timestamp_ = value; // @@protoc_insertion_point(field_set:milvus.grpc.SearchMsg.timestamp) @@ -12892,15 +12892,15 @@ inline void TimeSyncMsg::set_peer_id(::PROTOBUF_NAMESPACE_ID::int64 value) { // @@protoc_insertion_point(field_set:milvus.grpc.TimeSyncMsg.peer_Id) } -// int64 Timestamp = 2; +// uint64 Timestamp = 2; inline void TimeSyncMsg::clear_timestamp() { - timestamp_ = PROTOBUF_LONGLONG(0); + timestamp_ = PROTOBUF_ULONGLONG(0); } -inline ::PROTOBUF_NAMESPACE_ID::int64 TimeSyncMsg::timestamp() const { +inline ::PROTOBUF_NAMESPACE_ID::uint64 TimeSyncMsg::timestamp() const { // @@protoc_insertion_point(field_get:milvus.grpc.TimeSyncMsg.Timestamp) return timestamp_; } -inline void TimeSyncMsg::set_timestamp(::PROTOBUF_NAMESPACE_ID::int64 value) { +inline void TimeSyncMsg::set_timestamp(::PROTOBUF_NAMESPACE_ID::uint64 value) { timestamp_ = value; // @@protoc_insertion_point(field_set:milvus.grpc.TimeSyncMsg.Timestamp) diff --git a/proxy/src/grpc/suvlim.proto b/proxy/src/grpc/suvlim.proto index b1acb2b60a..cafaf0eb10 100644 --- a/proxy/src/grpc/suvlim.proto +++ b/proxy/src/grpc/suvlim.proto @@ -679,7 +679,7 @@ message InsertOrDeleteMsg { RowData rows_data = 2; int64 uid = 3; //optional string partition_tag = 4; - int64 timestamp =5; + uint64 timestamp =5; int64 segment_id = 6; int64 channel_id = 7; OpType op = 8; @@ -692,7 +692,7 @@ message SearchMsg { VectorRowRecord records = 2; string partition_tag = 3; int64 uid = 4; - int64 timestamp =5; + uint64 timestamp =5; int64 client_id = 6; repeated KeyValuePair extra_params = 7; } @@ -703,7 +703,7 @@ enum SyncType { } message TimeSyncMsg{ int64 peer_Id = 1; - int64 Timestamp = 2; + uint64 Timestamp = 2; SyncType sync_type = 3; } diff --git a/proxy/src/server/grpc_impl/GrpcRequestHandler.cpp b/proxy/src/server/grpc_impl/GrpcRequestHandler.cpp index e218639d2e..142e2174d1 100644 --- a/proxy/src/server/grpc_impl/GrpcRequestHandler.cpp +++ b/proxy/src/server/grpc_impl/GrpcRequestHandler.cpp @@ -465,48 +465,6 @@ GrpcRequestHandler::DescribeCollection(::grpc::ServerContext* context, const ::m ::milvus::grpc::Mapping* response) { LOG_SERVER_INFO_ << LogOut("Request [%s] %s begin.", GetContext(context)->ReqID().c_str(), __func__); CHECK_NULLPTR_RETURN(request); - try { - milvus::server::CollectionSchema collection_schema; - Status status = - req_handler_.GetCollectionInfo(GetContext(context), request->collection_name(), collection_schema); - if (!status.ok()) { - SET_RESPONSE(response->mutable_status(), status, context); - return ::grpc::Status::OK; - } - - response->set_collection_name(request->collection_name()); - for (auto& field_kv : collection_schema.fields_) { - auto field = response->add_fields(); - auto& field_name = field_kv.first; - auto& field_schema = field_kv.second; - - field->set_name(field_name); - field->set_type((milvus::grpc::DataType)field_schema.field_type_); - - auto grpc_field_param = field->add_extra_params(); - grpc_field_param->set_key(EXTRA_PARAM_KEY); - grpc_field_param->set_value(field_schema.field_params_.dump()); - - for (auto& item : field_schema.index_params_.items()) { - auto grpc_index_param = field->add_index_params(); - grpc_index_param->set_key(item.key()); - if (item.value().is_object()) { - grpc_index_param->set_value(item.value().dump()); - } else { - grpc_index_param->set_value(item.value()); - } - } - } - - auto grpc_extra_param = response->add_extra_params(); - grpc_extra_param->set_key(EXTRA_PARAM_KEY); - grpc_extra_param->set_value(collection_schema.extra_params_.dump()); - LOG_SERVER_INFO_ << LogOut("Request [%s] %s end.", GetContext(context)->ReqID().c_str(), __func__); - SET_RESPONSE(response->mutable_status(), status, context); - } catch (std::exception& ex) { - Status status = Status{SERVER_UNEXPECTED_ERROR, "Parsing json string wrong"}; - SET_RESPONSE(response->mutable_status(), status, context); - } return ::grpc::Status::OK; } diff --git a/proxy/src/version.h b/proxy/src/version.h index e947b11780..d55216cbc6 100644 --- a/proxy/src/version.h +++ b/proxy/src/version.h @@ -11,5 +11,6 @@ #define MILVUS_VERSION "0.10.0" #define BUILD_TYPE "Debug" -#define BUILD_TIME "2020-09-04 17:57.24" -#define LAST_COMMIT_ID "6ec32687abd8678576faddd67a5e9431c509ab26" + +#define BUILD_TIME "2020-09-03 16:41.13" +#define LAST_COMMIT_ID "a97d3e925e993f4a2a7409a9734dcc788f109767" \ No newline at end of file