diff options
author | Alexander Rutkovsky <alexvru@mail.ru> | 2022-03-23 22:30:28 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-03-23 22:30:28 +0300 |
commit | de5efc9b59e9644050802bbebb921abef8c2ac49 (patch) | |
tree | 67009d05b70e15d1d15e53e24523bf2662839970 | |
parent | 8a3ca10f886cf06d5e30c408d1e18cc1998e7238 (diff) | |
download | ydb-de5efc9b59e9644050802bbebb921abef8c2ac49.tar.gz |
Fix location issue KIKIMR-14513
REVIEW: 2387500
REVIEW: 2387634
x-ydb-stable-ref: 4be7269017153c1f164810bd373c63283b9c308b
-rw-r--r-- | library/cpp/actors/core/interconnect.cpp | 7 | ||||
-rw-r--r-- | library/cpp/actors/core/interconnect.h | 3 | ||||
-rw-r--r-- | ydb/core/client/server/msgbus_server_node_registration.cpp | 2 | ||||
-rw-r--r-- | ydb/core/mind/bscontroller/cmds_storage_pool.cpp | 2 | ||||
-rw-r--r-- | ydb/core/mind/hive/hive_statics.cpp | 2 | ||||
-rw-r--r-- | ydb/core/mind/hive/tx__status.cpp | 2 | ||||
-rw-r--r-- | ydb/core/mind/node_broker.cpp | 2 | ||||
-rw-r--r-- | ydb/core/node_whiteboard/node_whiteboard.h | 2 | ||||
-rw-r--r-- | ydb/public/lib/deprecated/kicli/kikimr.cpp | 3 |
9 files changed, 14 insertions, 11 deletions
diff --git a/library/cpp/actors/core/interconnect.cpp b/library/cpp/actors/core/interconnect.cpp index a42278e669..9b377cbb00 100644 --- a/library/cpp/actors/core/interconnect.cpp +++ b/library/cpp/actors/core/interconnect.cpp @@ -106,7 +106,7 @@ namespace NActors { return res; } - void TNodeLocation::Serialize(NActorsInterconnect::TNodeLocation *pb) const { + void TNodeLocation::Serialize(NActorsInterconnect::TNodeLocation *pb, bool compatibleWithOlderVersions) const { const NProtoBuf::Descriptor *descriptor = NActorsInterconnect::TNodeLocation::descriptor(); const NProtoBuf::Reflection *reflection = pb->GetReflection(); NProtoBuf::UnknownFieldSet *unknown = pb->mutable_unknown_fields(); @@ -117,11 +117,14 @@ namespace NActors { unknown->AddLengthDelimited(key)->assign(value); } } + if (compatibleWithOlderVersions) { + GetLegacyValue().Serialize(pb); + } } TString TNodeLocation::GetSerializedLocation() const { NActorsInterconnect::TNodeLocation pb; - Serialize(&pb); + Serialize(&pb, false); TString s; const bool success = pb.SerializeToString(&s); Y_VERIFY(success); diff --git a/library/cpp/actors/core/interconnect.h b/library/cpp/actors/core/interconnect.h index 679a4b8cc6..5ecac1deec 100644 --- a/library/cpp/actors/core/interconnect.h +++ b/library/cpp/actors/core/interconnect.h @@ -72,7 +72,8 @@ namespace NActors { TNodeLocation& operator =(const TNodeLocation&) = default; TNodeLocation& operator =(TNodeLocation&&) = default; - void Serialize(NActorsInterconnect::TNodeLocation *pb) const; + // compatibleWithOlderVersions should be set to true when this protobuf is possibly going to be delivered to 21-4 + void Serialize(NActorsInterconnect::TNodeLocation *pb, bool compatibleWithOlderVersions) const; TString GetSerializedLocation() const; TString GetDataCenterId() const { return ToStringUpTo(TKeys::DataCenter); } diff --git a/ydb/core/client/server/msgbus_server_node_registration.cpp b/ydb/core/client/server/msgbus_server_node_registration.cpp index a3dda6092d..49433dd594 100644 --- a/ydb/core/client/server/msgbus_server_node_registration.cpp +++ b/ydb/core/client/server/msgbus_server_node_registration.cpp @@ -114,7 +114,7 @@ public: info.SetAddress(node.Address); info.SetResolveHost(node.ResolveHost); info.SetPort(node.Port); - node.Location.Serialize(info.MutableLocation()); + node.Location.Serialize(info.MutableLocation(), true); } } diff --git a/ydb/core/mind/bscontroller/cmds_storage_pool.cpp b/ydb/core/mind/bscontroller/cmds_storage_pool.cpp index 7a61ac078c..51bacc0571 100644 --- a/ydb/core/mind/bscontroller/cmds_storage_pool.cpp +++ b/ydb/core/mind/bscontroller/cmds_storage_pool.cpp @@ -515,7 +515,7 @@ namespace NKikimr::NBsController { auto& node = nodes[record.NodeId]; node.SetNodeId(record.NodeId); node.SetPhysicalLocation(s.Str()); - record.Location.Serialize(node.MutableLocation()); + record.Location.Serialize(node.MutableLocation(), false); // this field has been introduced recently, so it doesn't have compatibility format auto *key = node.MutableHostKey(); key->SetFqdn(std::get<0>(hostId)); key->SetIcPort(std::get<1>(hostId)); diff --git a/ydb/core/mind/hive/hive_statics.cpp b/ydb/core/mind/hive/hive_statics.cpp index 4203678956..1f5e264393 100644 --- a/ydb/core/mind/hive/hive_statics.cpp +++ b/ydb/core/mind/hive/hive_statics.cpp @@ -336,7 +336,7 @@ TString LongToShortTabletName(const TString& longTabletName) { TString GetLocationString(const NActors::TNodeLocation& location) { NActorsInterconnect::TNodeLocation proto; - location.Serialize(&proto); + location.Serialize(&proto, false); return proto.ShortDebugString(); } diff --git a/ydb/core/mind/hive/tx__status.cpp b/ydb/core/mind/hive/tx__status.cpp index e45fa5055a..361b9b080e 100644 --- a/ydb/core/mind/hive/tx__status.cpp +++ b/ydb/core/mind/hive/tx__status.cpp @@ -31,7 +31,7 @@ public: if (node.LocationAcquired) { NIceDb::TNiceDb db(txc.DB); NActorsInterconnect::TNodeLocation location; - node.Location.Serialize(&location); + node.Location.Serialize(&location, false); db.Table<Schema::Node>().Key(nodeId).Update<Schema::Node::Location>(location); Self->UpdateRegisteredDataCenters(node.Location.GetDataCenterId()); } diff --git a/ydb/core/mind/node_broker.cpp b/ydb/core/mind/node_broker.cpp index 355074b33f..c4ad7d0ae9 100644 --- a/ydb/core/mind/node_broker.cpp +++ b/ydb/core/mind/node_broker.cpp @@ -298,7 +298,7 @@ void TNodeBroker::FillNodeInfo(const TNodeInfo &node, info.SetResolveHost(node.ResolveHost); info.SetAddress(node.Address); info.SetExpire(node.Expire.GetValue()); - node.Location.Serialize(info.MutableLocation()); + node.Location.Serialize(info.MutableLocation(), true); } void TNodeBroker::ComputeNextEpochDiff(TStateDiff &diff) diff --git a/ydb/core/node_whiteboard/node_whiteboard.h b/ydb/core/node_whiteboard/node_whiteboard.h index cdf7601807..a726c7ad98 100644 --- a/ydb/core/node_whiteboard/node_whiteboard.h +++ b/ydb/core/node_whiteboard/node_whiteboard.h @@ -295,7 +295,7 @@ struct TEvWhiteboard{ } TEvSystemStateUpdate(const TNodeLocation& systemLocation) { - systemLocation.Serialize(Record.MutableLocation()); + systemLocation.Serialize(Record.MutableLocation(), false); const auto& x = systemLocation.GetLegacyValue(); auto *pb = Record.MutableSystemLocation(); pb->SetDataCenter(x.DataCenter); diff --git a/ydb/public/lib/deprecated/kicli/kikimr.cpp b/ydb/public/lib/deprecated/kicli/kikimr.cpp index 4156d72d4b..5918646833 100644 --- a/ydb/public/lib/deprecated/kicli/kikimr.cpp +++ b/ydb/public/lib/deprecated/kicli/kikimr.cpp @@ -584,8 +584,7 @@ NThreading::TFuture<TResult> TKikimr::RegisterNode(const TString& domainPath, co request->Record.SetPort(port); request->Record.SetAddress(address); request->Record.SetResolveHost(resolveHost); - location.Serialize(request->Record.MutableLocation()); - location.GetLegacyValue().Serialize(request->Record.MutableLocation()); + location.Serialize(request->Record.MutableLocation(), true); request->Record.SetDomainPath(domainPath); request->Record.SetFixedNodeId(fixedNodeId); if (path) { |