diff options
author | ijon <ijon@ydb.tech> | 2023-12-27 13:35:54 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-27 13:35:54 +0300 |
commit | 74f9996fd8d73c80efe3898402f5d0c847726b32 (patch) | |
tree | 10e96e58fa64d27e07416a026d55accd39d0a47e | |
parent | a07542ede0c7714213cc01bece1022ea212c5f14 (diff) | |
download | ydb-74f9996fd8d73c80efe3898402f5d0c847726b32.tar.gz |
Remove node identifier (deprecated) (#688)
Also free IO pool from this unneeded actor.
KIKIMR-20497
-rw-r--r-- | ydb/core/actorlib_impl/CMakeLists.darwin-arm64.txt | 1 | ||||
-rw-r--r-- | ydb/core/actorlib_impl/CMakeLists.darwin-x86_64.txt | 1 | ||||
-rw-r--r-- | ydb/core/actorlib_impl/CMakeLists.linux-aarch64.txt | 1 | ||||
-rw-r--r-- | ydb/core/actorlib_impl/CMakeLists.linux-x86_64.txt | 1 | ||||
-rw-r--r-- | ydb/core/actorlib_impl/CMakeLists.windows-x86_64.txt | 1 | ||||
-rw-r--r-- | ydb/core/actorlib_impl/node_identifier.cpp | 165 | ||||
-rw-r--r-- | ydb/core/actorlib_impl/node_identifier.h | 13 | ||||
-rw-r--r-- | ydb/core/actorlib_impl/ya.make | 2 | ||||
-rw-r--r-- | ydb/core/driver_lib/run/config.h | 2 | ||||
-rw-r--r-- | ydb/core/driver_lib/run/kikimr_services_initializers.cpp | 16 | ||||
-rw-r--r-- | ydb/core/driver_lib/run/kikimr_services_initializers.h | 7 |
11 files changed, 1 insertions, 209 deletions
diff --git a/ydb/core/actorlib_impl/CMakeLists.darwin-arm64.txt b/ydb/core/actorlib_impl/CMakeLists.darwin-arm64.txt index 30b6cda4b7f..5255accbc3e 100644 --- a/ydb/core/actorlib_impl/CMakeLists.darwin-arm64.txt +++ b/ydb/core/actorlib_impl/CMakeLists.darwin-arm64.txt @@ -44,7 +44,6 @@ target_sources(ydb-core-actorlib_impl PRIVATE ${CMAKE_SOURCE_DIR}/ydb/core/actorlib_impl/mad_squirrel.cpp ${CMAKE_SOURCE_DIR}/ydb/core/actorlib_impl/melancholic_gopher.cpp ${CMAKE_SOURCE_DIR}/ydb/core/actorlib_impl/name_service_client_protocol.cpp - ${CMAKE_SOURCE_DIR}/ydb/core/actorlib_impl/node_identifier.cpp ${CMAKE_SOURCE_DIR}/ydb/core/actorlib_impl/read_data_protocol.cpp ${CMAKE_SOURCE_DIR}/ydb/core/actorlib_impl/read_http_reply_protocol.cpp ${CMAKE_SOURCE_DIR}/ydb/core/actorlib_impl/send_data_protocol.cpp diff --git a/ydb/core/actorlib_impl/CMakeLists.darwin-x86_64.txt b/ydb/core/actorlib_impl/CMakeLists.darwin-x86_64.txt index 30b6cda4b7f..5255accbc3e 100644 --- a/ydb/core/actorlib_impl/CMakeLists.darwin-x86_64.txt +++ b/ydb/core/actorlib_impl/CMakeLists.darwin-x86_64.txt @@ -44,7 +44,6 @@ target_sources(ydb-core-actorlib_impl PRIVATE ${CMAKE_SOURCE_DIR}/ydb/core/actorlib_impl/mad_squirrel.cpp ${CMAKE_SOURCE_DIR}/ydb/core/actorlib_impl/melancholic_gopher.cpp ${CMAKE_SOURCE_DIR}/ydb/core/actorlib_impl/name_service_client_protocol.cpp - ${CMAKE_SOURCE_DIR}/ydb/core/actorlib_impl/node_identifier.cpp ${CMAKE_SOURCE_DIR}/ydb/core/actorlib_impl/read_data_protocol.cpp ${CMAKE_SOURCE_DIR}/ydb/core/actorlib_impl/read_http_reply_protocol.cpp ${CMAKE_SOURCE_DIR}/ydb/core/actorlib_impl/send_data_protocol.cpp diff --git a/ydb/core/actorlib_impl/CMakeLists.linux-aarch64.txt b/ydb/core/actorlib_impl/CMakeLists.linux-aarch64.txt index 5a2e32fee1a..039f2bbc20c 100644 --- a/ydb/core/actorlib_impl/CMakeLists.linux-aarch64.txt +++ b/ydb/core/actorlib_impl/CMakeLists.linux-aarch64.txt @@ -45,7 +45,6 @@ target_sources(ydb-core-actorlib_impl PRIVATE ${CMAKE_SOURCE_DIR}/ydb/core/actorlib_impl/mad_squirrel.cpp ${CMAKE_SOURCE_DIR}/ydb/core/actorlib_impl/melancholic_gopher.cpp ${CMAKE_SOURCE_DIR}/ydb/core/actorlib_impl/name_service_client_protocol.cpp - ${CMAKE_SOURCE_DIR}/ydb/core/actorlib_impl/node_identifier.cpp ${CMAKE_SOURCE_DIR}/ydb/core/actorlib_impl/read_data_protocol.cpp ${CMAKE_SOURCE_DIR}/ydb/core/actorlib_impl/read_http_reply_protocol.cpp ${CMAKE_SOURCE_DIR}/ydb/core/actorlib_impl/send_data_protocol.cpp diff --git a/ydb/core/actorlib_impl/CMakeLists.linux-x86_64.txt b/ydb/core/actorlib_impl/CMakeLists.linux-x86_64.txt index 5a2e32fee1a..039f2bbc20c 100644 --- a/ydb/core/actorlib_impl/CMakeLists.linux-x86_64.txt +++ b/ydb/core/actorlib_impl/CMakeLists.linux-x86_64.txt @@ -45,7 +45,6 @@ target_sources(ydb-core-actorlib_impl PRIVATE ${CMAKE_SOURCE_DIR}/ydb/core/actorlib_impl/mad_squirrel.cpp ${CMAKE_SOURCE_DIR}/ydb/core/actorlib_impl/melancholic_gopher.cpp ${CMAKE_SOURCE_DIR}/ydb/core/actorlib_impl/name_service_client_protocol.cpp - ${CMAKE_SOURCE_DIR}/ydb/core/actorlib_impl/node_identifier.cpp ${CMAKE_SOURCE_DIR}/ydb/core/actorlib_impl/read_data_protocol.cpp ${CMAKE_SOURCE_DIR}/ydb/core/actorlib_impl/read_http_reply_protocol.cpp ${CMAKE_SOURCE_DIR}/ydb/core/actorlib_impl/send_data_protocol.cpp diff --git a/ydb/core/actorlib_impl/CMakeLists.windows-x86_64.txt b/ydb/core/actorlib_impl/CMakeLists.windows-x86_64.txt index 30b6cda4b7f..5255accbc3e 100644 --- a/ydb/core/actorlib_impl/CMakeLists.windows-x86_64.txt +++ b/ydb/core/actorlib_impl/CMakeLists.windows-x86_64.txt @@ -44,7 +44,6 @@ target_sources(ydb-core-actorlib_impl PRIVATE ${CMAKE_SOURCE_DIR}/ydb/core/actorlib_impl/mad_squirrel.cpp ${CMAKE_SOURCE_DIR}/ydb/core/actorlib_impl/melancholic_gopher.cpp ${CMAKE_SOURCE_DIR}/ydb/core/actorlib_impl/name_service_client_protocol.cpp - ${CMAKE_SOURCE_DIR}/ydb/core/actorlib_impl/node_identifier.cpp ${CMAKE_SOURCE_DIR}/ydb/core/actorlib_impl/read_data_protocol.cpp ${CMAKE_SOURCE_DIR}/ydb/core/actorlib_impl/read_http_reply_protocol.cpp ${CMAKE_SOURCE_DIR}/ydb/core/actorlib_impl/send_data_protocol.cpp diff --git a/ydb/core/actorlib_impl/node_identifier.cpp b/ydb/core/actorlib_impl/node_identifier.cpp deleted file mode 100644 index bcc824e1128..00000000000 --- a/ydb/core/actorlib_impl/node_identifier.cpp +++ /dev/null @@ -1,165 +0,0 @@ -#include <ydb/library/actors/core/actorsystem.h> -#include <ydb/library/actors/core/actor_bootstrapped.h> -#include <ydb/library/actors/core/log.h> -#include <ydb/core/node_whiteboard/node_whiteboard.h> -#include <ydb/library/services/services.pb.h> -#include <library/cpp/json/json_reader.h> -#include <library/cpp/http/io/stream.h> -#include <library/cpp/openssl/init/init.h> -#include <library/cpp/openssl/io/stream.h> -#include <util/network/sock.h> -#include <util/system/hostname.h> - -using namespace NActors; - -namespace NKikimr { - -class TNodeIdentifier : public TActorBootstrapped<TNodeIdentifier> { - using TThis = TNodeIdentifier; - using TBase = TActorBootstrapped<TNodeIdentifier>; - - struct TEvPrivate { - enum EEv { - EvUpdateNodeInfo = EventSpaceBegin(TEvents::ES_PRIVATE), - EvEnd - }; - - static_assert(EvEnd < EventSpaceEnd(TEvents::ES_PRIVATE), "expected EvEnd < EventSpaceEnd"); - - struct TEvUpdateNodeInfo : TEventLocal<TEvUpdateNodeInfo, EvUpdateNodeInfo> {}; - }; - - static const NJson::TJsonReaderConfig& GetJsonConfig() { - static NJson::TJsonReaderConfig jsonConfig; - return jsonConfig; - } - - const TString& GetWallEServiceHost() const { - static const TString host("api.wall-e.yandex-team.ru"); - return host; - } - - const TNetworkAddress& GetWallENetworkAddress() const { - static const TNetworkAddress address(GetWallEServiceHost(), 443); - return address; - } - - const TString& GetConductorServiceHost() const { - static const TString host("c.yandex-team.ru"); - return host; - } - - const TNetworkAddress& GetConductorNetworkAddress() const { - static const TNetworkAddress address(GetConductorServiceHost(), 443); - return address; - } - - TDuration GetTimeout() const { - return TDuration::Seconds(10); - } - - void Handle(TEvPrivate::TEvUpdateNodeInfo::TPtr&, const TActorContext& ctx) { - NKikimrWhiteboard::TSystemStateInfo systemStateInfo; - TString hostname = FQDNHostName(); - systemStateInfo.SetHost(hostname); - - try { - TSocket s(GetWallENetworkAddress(), GetTimeout()); - s.SetSocketTimeout(GetTimeout().Seconds()); - TSocketOutput so(s); - TSocketInput si(s); - TOpenSslClientIO ssl(&si, &so); - THttpOutput output(&ssl); - output << "GET /v1/hosts/" << hostname << "?fields=location HTTP/1.1\r\n" - << "Host: " << GetWallEServiceHost() << "\r\n" - << "\r\n"; - output.Finish(); - THttpInput input(&ssl); - unsigned status = ParseHttpRetCode(input.FirstLine()); - if (status == 200) { - NJson::TJsonValue response; - bool success = NJson::ReadJsonTree(input.ReadAll(), &GetJsonConfig(), &response); - if (success) { - NJson::TJsonValue* jsonLocation; - if (response.GetValuePointer("location", &jsonLocation)) { - NJson::TJsonValue* jsonValue; - if (jsonLocation->GetValuePointer("short_datacenter_name", &jsonValue)) { - if (jsonValue->GetType() == NJson::EJsonValueType::JSON_STRING) { - systemStateInfo.SetDataCenter(jsonValue->GetStringRobust()); - } - } - if (jsonLocation->GetValuePointer("queue", &jsonValue)) { - systemStateInfo.SetDataCenterDescription(jsonValue->GetStringRobust()); - } - if (jsonLocation->GetValuePointer("rack", &jsonValue)) { - systemStateInfo.SetRack(jsonValue->GetStringRobust()); - } - } - - } - } - } - catch (const std::exception&) { - } - - try { - TSocket s(GetConductorNetworkAddress(), GetTimeout()); - s.SetSocketTimeout(GetTimeout().Seconds()); - TSocketOutput so(s); - TSocketInput si(s); - TOpenSslClientIO ssl(&si, &so); - THttpOutput output(&ssl); - - output << "GET /api/hosts/" << hostname << "?format=json HTTP/1.1\r\n" - << "Host: " << GetConductorServiceHost() << "\r\n" - << "\r\n"; - output.Finish(); - THttpInput input(&ssl); - unsigned status = ParseHttpRetCode(input.FirstLine()); - if (status == 200) { - NJson::TJsonValue response; - bool success = NJson::ReadJsonTree(input.ReadAll(), &GetJsonConfig(), &response); - if (success && response.IsArray()) { - const NJson::TJsonValue& first = response.GetArray().front(); - const NJson::TJsonValue* jsonGroup; - if (first.GetValuePointer("group", &jsonGroup)) { - systemStateInfo.SetClusterName(jsonGroup->GetStringRobust()); - } - const NJson::TJsonValue* jsonRootDatacenter; - if (!systemStateInfo.HasDataCenter() && first.GetValuePointer("root_datacenter", &jsonRootDatacenter)) { - if (jsonRootDatacenter->GetType() == NJson::EJsonValueType::JSON_STRING) { - systemStateInfo.SetDataCenter(jsonRootDatacenter->GetStringRobust()); - } - } - } - } - } - catch (const std::exception&) { - } - - TActorId whiteboardServiceId = NNodeWhiteboard::MakeNodeWhiteboardServiceId(ctx.SelfID.NodeId()); - ctx.Send(whiteboardServiceId, new NNodeWhiteboard::TEvWhiteboard::TEvSystemStateUpdate(systemStateInfo)); - } - -public: - static constexpr NKikimrServices::TActivity::EType ActorActivityType() { return NKikimrServices::TActivity::NODE_IDENTIFIER; } - - void StateWork(TAutoPtr<IEventHandle>& ev) { - switch (ev->GetTypeRewrite()) { - HFunc(TEvPrivate::TEvUpdateNodeInfo, Handle); - CFunc(TEvents::TSystem::PoisonPill, Die); - } - } - - void Bootstrap(const TActorContext& ctx) { - ctx.Send(ctx.SelfID, new TEvPrivate::TEvUpdateNodeInfo()); - Become(&TThis::StateWork); - } -}; - -IActor* CreateNodeIdentifier() { - InitOpenSSL(); - return new TNodeIdentifier(); -} - -} diff --git a/ydb/core/actorlib_impl/node_identifier.h b/ydb/core/actorlib_impl/node_identifier.h deleted file mode 100644 index 90a06946c5b..00000000000 --- a/ydb/core/actorlib_impl/node_identifier.h +++ /dev/null @@ -1,13 +0,0 @@ -#pragma once -#include <ydb/library/actors/core/actor.h> - -namespace NKikimr { - -inline NActors::TActorId MakeNodeIdentifierServiceId() { - char x[12] = {'n','o','d','e','i','d','e','n','t','i','f','r'}; - return TActorId(0, TStringBuf(x, 12)); -} - -NActors::IActor* CreateNodeIdentifier(); - -} diff --git a/ydb/core/actorlib_impl/ya.make b/ydb/core/actorlib_impl/ya.make index d577b65fb7a..76aec96a549 100644 --- a/ydb/core/actorlib_impl/ya.make +++ b/ydb/core/actorlib_impl/ya.make @@ -18,8 +18,6 @@ SRCS( melancholic_gopher.cpp name_service_client_protocol.cpp name_service_client_protocol.h - node_identifier.cpp - node_identifier.h proto_ready_actor.h read_data_protocol.cpp read_data_protocol.h diff --git a/ydb/core/driver_lib/run/config.h b/ydb/core/driver_lib/run/config.h index f71205fecce..7a5aae7eb3b 100644 --- a/ydb/core/driver_lib/run/config.h +++ b/ydb/core/driver_lib/run/config.h @@ -44,7 +44,7 @@ union TBasicKikimrServicesMask { bool EnableKqp:1; bool EnableMemoryLog:1; bool EnableGRpcService:1; - bool EnableNodeIdentifier:1; + bool UNUSED_EnableNodeIdentifier:1; bool EnableCms:1; bool EnableNodeTable:1; bool EnableGRpcProxyStatus:1; diff --git a/ydb/core/driver_lib/run/kikimr_services_initializers.cpp b/ydb/core/driver_lib/run/kikimr_services_initializers.cpp index 9728fff071d..7c5357e91bb 100644 --- a/ydb/core/driver_lib/run/kikimr_services_initializers.cpp +++ b/ydb/core/driver_lib/run/kikimr_services_initializers.cpp @@ -6,7 +6,6 @@ #include <ydb/core/actorlib_impl/destruct_actor.h> #include <ydb/core/actorlib_impl/load_network.h> #include <ydb/core/actorlib_impl/mad_squirrel.h> -#include <ydb/core/actorlib_impl/node_identifier.h> #include "ydb/core/audit/audit_log.h" @@ -1798,21 +1797,6 @@ void TWhiteBoardServiceInitializer::InitializeServices(NActors::TActorSystemSetu appData->SystemPoolId))); } -// TNodeIdentifierInitializer - -TNodeIdentifierInitializer::TNodeIdentifierInitializer(const TKikimrRunConfig& runConfig) - : IKikimrServicesInitializer(runConfig) { -} - -void TNodeIdentifierInitializer::InitializeServices(NActors::TActorSystemSetup* setup, - const NKikimr::TAppData* appData) { - IActor* nodeIdentifier = CreateNodeIdentifier(); - setup->LocalServices.push_back(std::pair<TActorId, TActorSetupCmd>(MakeNodeIdentifierServiceId(), - TActorSetupCmd(nodeIdentifier, - TMailboxType::Simple, - appData->IOPoolId))); -} - // TTabletMonitorInitializer TTabletMonitorInitializer::TTabletMonitorInitializer( diff --git a/ydb/core/driver_lib/run/kikimr_services_initializers.h b/ydb/core/driver_lib/run/kikimr_services_initializers.h index a15bd6c0408..645423fe8e9 100644 --- a/ydb/core/driver_lib/run/kikimr_services_initializers.h +++ b/ydb/core/driver_lib/run/kikimr_services_initializers.h @@ -289,13 +289,6 @@ public: void InitializeServices(NActors::TActorSystemSetup *setup, const NKikimr::TAppData *appData) override; }; -class TNodeIdentifierInitializer : public IKikimrServicesInitializer { -public: - TNodeIdentifierInitializer(const TKikimrRunConfig& runConfig); - - void InitializeServices(NActors::TActorSystemSetup *setup, const NKikimr::TAppData *appData) override; -}; - class TTabletMonitorInitializer : public IKikimrServicesInitializer { TIntrusivePtr<NNodeTabletMonitor::ITabletStateClassifier> TabletStateClassifier; TIntrusivePtr<NNodeTabletMonitor::ITabletListRenderer> TabletListRenderer; |