diff options
author | robot-piglet <robot-piglet@yandex-team.com> | 2024-03-07 22:57:35 +0300 |
---|---|---|
committer | robot-piglet <robot-piglet@yandex-team.com> | 2024-03-07 23:10:42 +0300 |
commit | acf76c30586f66e464c4ec86c3e78f1c62b2bf6b (patch) | |
tree | 1c4a6d7fa581e039e3ec8a42dcad60838fcc4139 | |
parent | 8e1f2488ae4aa7b6986a119d5df78fb0481ff41d (diff) | |
download | ydb-acf76c30586f66e464c4ec86c3e78f1c62b2bf6b.tar.gz |
Intermediate changes
-rw-r--r-- | contrib/python/psutil/py2/ya.make | 1 | ||||
-rw-r--r-- | contrib/python/psutil/py3/ya.make | 1 | ||||
-rw-r--r-- | yt/yt/client/api/admin_client.h | 4 | ||||
-rw-r--r-- | yt/yt/client/api/delegating_client.h | 4 | ||||
-rw-r--r-- | yt/yt/client/api/public.h | 8 | ||||
-rw-r--r-- | yt/yt/client/api/rpc_proxy/client_impl.cpp | 70 | ||||
-rw-r--r-- | yt/yt/client/api/rpc_proxy/client_impl.h | 4 | ||||
-rw-r--r-- | yt/yt/client/driver/admin_commands.cpp | 98 | ||||
-rw-r--r-- | yt/yt/client/driver/admin_commands.h | 4 | ||||
-rw-r--r-- | yt/yt/client/driver/driver.cpp | 4 | ||||
-rw-r--r-- | yt/yt/client/federated/client.cpp | 4 | ||||
-rw-r--r-- | yt/yt/client/hedging/hedging.cpp | 4 | ||||
-rw-r--r-- | yt/yt/client/unittests/mock/client.h | 4 | ||||
-rw-r--r-- | yt/yt_proto/yt/client/api/rpc_proxy/proto/api_service.proto | 31 |
14 files changed, 167 insertions, 74 deletions
diff --git a/contrib/python/psutil/py2/ya.make b/contrib/python/psutil/py2/ya.make index 0e3d24c4d0..6c4bb9e324 100644 --- a/contrib/python/psutil/py2/ya.make +++ b/contrib/python/psutil/py2/ya.make @@ -11,6 +11,7 @@ NO_LINT() NO_CHECK_IMPORTS( psutil._psaix psutil._psbsd + psutil._pslinux psutil._psosx psutil._pssunos psutil._psutil_bsd diff --git a/contrib/python/psutil/py3/ya.make b/contrib/python/psutil/py3/ya.make index 5ae4714a6a..3c2c3464ab 100644 --- a/contrib/python/psutil/py3/ya.make +++ b/contrib/python/psutil/py3/ya.make @@ -11,6 +11,7 @@ NO_LINT() NO_CHECK_IMPORTS( psutil._psaix psutil._psbsd + psutil._pslinux psutil._psosx psutil._pssunos psutil._psutil_bsd diff --git a/yt/yt/client/api/admin_client.h b/yt/yt/client/api/admin_client.h index f2bc941ca0..cf8d789c57 100644 --- a/yt/yt/client/api/admin_client.h +++ b/yt/yt/client/api/admin_client.h @@ -271,14 +271,14 @@ struct IAdminClient const std::vector<NObjectClient::TCellId>& cellIds, const TResumeTabletCellsOptions& options = {}) = 0; - virtual TFuture<TMaintenanceId> AddMaintenance( + virtual TFuture<TMaintenanceIdPerTarget> AddMaintenance( EMaintenanceComponent component, const TString& address, EMaintenanceType type, const TString& comment, const TAddMaintenanceOptions& options = {}) = 0; - virtual TFuture<TMaintenanceCounts> RemoveMaintenance( + virtual TFuture<TMaintenanceCountsPerTarget> RemoveMaintenance( EMaintenanceComponent component, const TString& address, const TMaintenanceFilter& filter, diff --git a/yt/yt/client/api/delegating_client.h b/yt/yt/client/api/delegating_client.h index bd7d8029fc..97d46ce93a 100644 --- a/yt/yt/client/api/delegating_client.h +++ b/yt/yt/client/api/delegating_client.h @@ -647,7 +647,7 @@ public: const TResumeTabletCellsOptions& options), (cellIds, options)) - DELEGATE_METHOD(TFuture<TMaintenanceId>, AddMaintenance, ( + DELEGATE_METHOD(TFuture<TMaintenanceIdPerTarget>, AddMaintenance, ( EMaintenanceComponent component, const TString& address, EMaintenanceType type, @@ -655,7 +655,7 @@ public: const TAddMaintenanceOptions& options), (component, address, type, comment, options)) - DELEGATE_METHOD(TFuture<TMaintenanceCounts>, RemoveMaintenance, ( + DELEGATE_METHOD(TFuture<TMaintenanceCountsPerTarget>, RemoveMaintenance, ( EMaintenanceComponent component, const TString& address, const TMaintenanceFilter& filter, diff --git a/yt/yt/client/api/public.h b/yt/yt/client/api/public.h index 5f3db2e19a..d715976292 100644 --- a/yt/yt/client/api/public.h +++ b/yt/yt/client/api/public.h @@ -15,6 +15,7 @@ #include <yt/yt/core/rpc/public.h> #include <library/cpp/yt/containers/enum_indexed_array.h> +#include <library/cpp/yt/small_containers/compact_flat_map.h> namespace NYT::NApi { @@ -221,6 +222,13 @@ DEFINE_ENUM(EMaintenanceComponent, using TMaintenanceId = TGuid; using TMaintenanceCounts = TEnumIndexedArray<EMaintenanceType, int>; +// Almost always there is single maintenance target. The exception is virtual +// "host" target which represents all nodes on a given host. +constexpr int TypicalMaintenanceTargetCount = 1; + +using TMaintenanceIdPerTarget = TCompactFlatMap<TString, TMaintenanceId, TypicalMaintenanceTargetCount>; +using TMaintenanceCountsPerTarget = TCompactFlatMap<TString, TMaintenanceCounts, TypicalMaintenanceTargetCount>; + //////////////////////////////////////////////////////////////////////////////// } // namespace NYT::NApi diff --git a/yt/yt/client/api/rpc_proxy/client_impl.cpp b/yt/yt/client/api/rpc_proxy/client_impl.cpp index 6daa563030..99706535aa 100644 --- a/yt/yt/client/api/rpc_proxy/client_impl.cpp +++ b/yt/yt/client/api/rpc_proxy/client_impl.cpp @@ -1830,7 +1830,7 @@ NProto::EMaintenanceType ConvertMaintenanceTypeToProto(EMaintenanceType type) } // namespace -TFuture<TMaintenanceId> TClient::AddMaintenance( +TFuture<TMaintenanceIdPerTarget> TClient::AddMaintenance( EMaintenanceComponent component, const TString& address, EMaintenanceType type, @@ -1848,13 +1848,28 @@ TFuture<TMaintenanceId> TClient::AddMaintenance( req->set_address(address); req->set_type(ConvertMaintenanceTypeToProto(type)); req->set_comment(comment); - - return req->Invoke().Apply(BIND([] (const TErrorOr<TApiServiceProxy::TRspAddMaintenancePtr>& rsp) { - return FromProto<TMaintenanceId>(rsp.ValueOrThrow()->id()); - })); + req->set_supports_per_target_response(true); + + return req->Invoke().Apply(BIND( + [address] (const TErrorOr<TApiServiceProxy::TRspAddMaintenancePtr>& rsp) { + const auto& value = rsp.ValueOrThrow(); + + TMaintenanceIdPerTarget result; + + // COMPAT(kvk1920): Compatibility with pre-24.2 RPC proxies. + if (value->has_id()) { + result[address] = FromProto<TMaintenanceId>(value->id()); + } else { + result.reserve(value->id_per_target_size()); + for (const auto& [target, id] : value->id_per_target()) { + result.insert({target, FromProto<TMaintenanceId>(id)}); + } + } + return result; + })); } -TFuture<TMaintenanceCounts> TClient::RemoveMaintenance( +TFuture<TMaintenanceCountsPerTarget> TClient::RemoveMaintenance( EMaintenanceComponent component, const TString& address, const TMaintenanceFilter& filter, @@ -1884,26 +1899,39 @@ TFuture<TMaintenanceCounts> TClient::RemoveMaintenance( req->set_user(user); }); - return req->Invoke().Apply(BIND([] (const TErrorOr<TApiServiceProxy::TRspRemoveMaintenancePtr>& rsp) { - auto rspValue = rsp.ValueOrThrow(); - - const auto& protoCounts = rspValue->removed_maintenance_counts(); - TMaintenanceCounts counts; + req->set_supports_per_target_response(true); - if (!rspValue->use_map_instead_of_fields()) { - counts[EMaintenanceType::Ban] = rspValue->ban(); - counts[EMaintenanceType::Decommission] = rspValue->decommission(); - counts[EMaintenanceType::DisableSchedulerJobs] = rspValue->disable_scheduler_jobs(); - counts[EMaintenanceType::DisableWriteSessions] = rspValue->disable_write_sessions(); - counts[EMaintenanceType::DisableTabletCells] = rspValue->disable_tablet_cells(); - counts[EMaintenanceType::PendingRestart] = rspValue->pending_restart(); + return req->Invoke().Apply(BIND([address] (const TErrorOr<TApiServiceProxy::TRspRemoveMaintenancePtr>& rsp) { + auto rspValue = rsp.ValueOrThrow(); + TMaintenanceCountsPerTarget result; + + // COMPAT(kvk1920): Compatibility with pre-24.2 RPC proxies. + if (!rspValue->supports_per_target_response()) { + auto& counts = result[address]; + // COMPAT(kvk1920): Compatibility with pre-23.2 RPC proxies. + if (!rspValue->use_map_instead_of_fields()) { + counts[EMaintenanceType::Ban] = rspValue->ban(); + counts[EMaintenanceType::Decommission] = rspValue->decommission(); + counts[EMaintenanceType::DisableSchedulerJobs] = rspValue->disable_scheduler_jobs(); + counts[EMaintenanceType::DisableWriteSessions] = rspValue->disable_write_sessions(); + counts[EMaintenanceType::DisableTabletCells] = rspValue->disable_tablet_cells(); + counts[EMaintenanceType::PendingRestart] = rspValue->pending_restart(); + } else { + for (const auto& [type, count] : rspValue->removed_maintenance_counts()) { + counts[CheckedEnumCast<EMaintenanceType>(type)] = count; + } + } } else { - for (auto [type, count] : protoCounts) { - counts[CheckedEnumCast<EMaintenanceType>(type)] = count; + result.reserve(rspValue->removed_maintenance_counts_per_target_size()); + for (const auto& [target, protoCounts] : rspValue->removed_maintenance_counts_per_target()) { + auto& counts = result[target]; + for (const auto& [type, count] : protoCounts.counts()) { + counts[CheckedEnumCast<EMaintenanceType>(type)] = count; + } } } - return counts; + return result; })); } diff --git a/yt/yt/client/api/rpc_proxy/client_impl.h b/yt/yt/client/api/rpc_proxy/client_impl.h index addd0e5072..8dc59e06a0 100644 --- a/yt/yt/client/api/rpc_proxy/client_impl.h +++ b/yt/yt/client/api/rpc_proxy/client_impl.h @@ -394,14 +394,14 @@ public: const std::vector<NObjectClient::TCellId>& cellIds, const TResumeTabletCellsOptions& options) override; - TFuture<TMaintenanceId> AddMaintenance( + TFuture<TMaintenanceIdPerTarget> AddMaintenance( EMaintenanceComponent component, const TString& address, EMaintenanceType type, const TString& comment, const TAddMaintenanceOptions& options) override; - TFuture<TMaintenanceCounts> RemoveMaintenance( + TFuture<TMaintenanceCountsPerTarget> RemoveMaintenance( EMaintenanceComponent component, const TString& address, const TMaintenanceFilter& filter, diff --git a/yt/yt/client/driver/admin_commands.cpp b/yt/yt/client/driver/admin_commands.cpp index 7518352825..c1af19fc13 100644 --- a/yt/yt/client/driver/admin_commands.cpp +++ b/yt/yt/client/driver/admin_commands.cpp @@ -17,6 +17,10 @@ using namespace NObjectClient; using NApi::TMaintenanceId; using NApi::TMaintenanceFilter; +using NApi::EMaintenanceType; +using NApi::TMaintenanceCounts; +using NApi::TMaintenanceCountsPerTarget; +using NApi::TMaintenanceIdPerTarget; //////////////////////////////////////////////////////////////////////////////// @@ -345,11 +349,15 @@ void TAddMaintenanceCommand::Register(TRegistrar registrar) registrar.Parameter("address", &TThis::Address_); registrar.Parameter("type", &TThis::Type_); registrar.Parameter("comment", &TThis::Comment_); + + // COMPAT(kvk1920): For compatibility with pre-24.2 HTTP clients. + registrar.Parameter("supports_per_target_response", &TThis::SupportsPerTargetResponse_) + .Default(false); } void TAddMaintenanceCommand::DoExecute(ICommandContextPtr context) { - auto id = WaitFor(context->GetClient()->AddMaintenance( + auto response = WaitFor(context->GetClient()->AddMaintenance( Component_, Address_, Type_, @@ -357,7 +365,23 @@ void TAddMaintenanceCommand::DoExecute(ICommandContextPtr context) Options)) .ValueOrThrow(); - ProduceSingleOutputValue(context, "id", id); + // COMPAT(kvk1920): Compatibility with pre-24.2 HTTP clients. + if (!SupportsPerTargetResponse_) { + ProduceSingleOutputValue( + context, + "id", + response.size() == 1 ? response.begin()->second : TMaintenanceId{}); + return; + } + + ProduceOutput(context, [&] (NYson::IYsonConsumer* consumer) { + BuildYsonFluently(consumer) + .BeginMap() + .DoFor(response, [] (auto fluent, const std::pair<TString, TMaintenanceId>& targetAndId) { + fluent.Item(targetAndId.first).Value(targetAndId.second); + }) + .EndMap(); + }); } //////////////////////////////////////////////////////////////////////////////// @@ -384,6 +408,9 @@ void TRemoveMaintenanceCommand::Register(TRegistrar registrar) registrar.Parameter("all", &TThis::All_) .Optional(); + registrar.Parameter("supports_per_target_response", &TThis::SupportsPerTargetResponse_) + .Default(false); + registrar.Postprocessor([&] (TThis* config) { THROW_ERROR_EXCEPTION_IF(config->Id_ && config->Ids_, "At most one of {\"id\", \"ids\"} can be specified at the same time"); @@ -402,30 +429,6 @@ void TRemoveMaintenanceCommand::Register(TRegistrar registrar) }); } -namespace { - -TStringBuf MaintenanceTypeToString(NApi::EMaintenanceType type) -{ - switch (type) { - case NApi::EMaintenanceType::Ban: - return "ban"; - case NApi::EMaintenanceType::Decommission: - return "decommission"; - case NApi::EMaintenanceType::DisableSchedulerJobs: - return "disable_scheduler_jobs"; - case NApi::EMaintenanceType::DisableWriteSessions: - return "disable_write_sessions"; - case NApi::EMaintenanceType::DisableTabletCells: - return "disable_tablet_cells"; - case NApi::EMaintenanceType::PendingRestart: - return "pending_restart"; - default: - YT_ABORT(); - } -} - -} // namespace - void TRemoveMaintenanceCommand::DoExecute(ICommandContextPtr context) { TMaintenanceFilter filter; @@ -448,22 +451,49 @@ void TRemoveMaintenanceCommand::DoExecute(ICommandContextPtr context) filter.Type = *Type_; } - auto removedMaintenanceCounts = WaitFor(context->GetClient()->RemoveMaintenance( + auto response = WaitFor(context->GetClient()->RemoveMaintenance( Component_, Address_, filter, Options)) .ValueOrThrow(); - ProduceOutput(context, [&] (NYson::IYsonConsumer* consumer) { - auto fluent = BuildYsonFluently(consumer) - .BeginMap(); - for (auto type : TEnumTraits<NApi::EMaintenanceType>::GetDomainValues()) { - if (removedMaintenanceCounts[type] > 0) { - fluent = fluent.Item(MaintenanceTypeToString(type)).Value(removedMaintenanceCounts[type]); + auto produceCounts = [] (auto fluent, const TMaintenanceCounts& counts) { + fluent + .BeginMap() + .DoFor( + TEnumTraits<NApi::EMaintenanceType>::GetDomainValues(), + [&] (auto fluent, EMaintenanceType type) { + if (counts[type] > 0) { + fluent.Item(Format("%lv", type)).Value(counts[type]); + } + }) + .EndMap(); + }; + + // COMPAT(kvk1920): Compatibility with pre-24.2 HTTP clients. + if (!SupportsPerTargetResponse_) { + TMaintenanceCounts totalCounts; + for (const auto& [target, counts] : response) { + for (auto type : TEnumTraits<EMaintenanceType>::GetDomainValues()) { + totalCounts[type] += counts[type]; } } - fluent.EndMap(); + ProduceOutput(context, [&] (NYson::IYsonConsumer* consumer) { + produceCounts(BuildYsonFluently(consumer), totalCounts); + }); + return; + } + + ProduceOutput(context, [&] (NYson::IYsonConsumer* consumer) { + BuildYsonFluently(consumer) + .BeginMap() + .DoFor( + response, + [&] (auto fluent, const std::pair<TString, TMaintenanceCounts>& targetWithCounts) { + produceCounts(fluent.Item(targetWithCounts.first), targetWithCounts.second); + }) + .EndMap(); }); } diff --git a/yt/yt/client/driver/admin_commands.h b/yt/yt/client/driver/admin_commands.h index 4a52a34bbf..0665eb3494 100644 --- a/yt/yt/client/driver/admin_commands.h +++ b/yt/yt/client/driver/admin_commands.h @@ -254,6 +254,8 @@ private: TString Address_; NApi::EMaintenanceType Type_; TString Comment_; + // COMPAT(kvk1920): Compatibility with pre-24.2 HTTP clients. + bool SupportsPerTargetResponse_; void DoExecute(ICommandContextPtr context) override; }; @@ -277,6 +279,8 @@ private: std::optional<NApi::TMaintenanceId> Id_; std::optional<std::vector<NApi::TMaintenanceId>> Ids_; std::optional<NApi::EMaintenanceType> Type_; + // COMPAT(kvk1920): Compatibility with pre-24.2 HTTP clients. + bool SupportsPerTargetResponse_; void DoExecute(ICommandContextPtr context) override; }; diff --git a/yt/yt/client/driver/driver.cpp b/yt/yt/client/driver/driver.cpp index dfc733e56c..94fd78bdf6 100644 --- a/yt/yt/client/driver/driver.cpp +++ b/yt/yt/client/driver/driver.cpp @@ -332,8 +332,8 @@ public: REGISTER_ALL(TSuspendTabletCellsCommand, "suspend_tablet_cells", Null, Structured, false, false); REGISTER_ALL(TResumeTabletCellsCommand, "resume_tablet_cells", Null, Structured, false, false); - REGISTER_ALL(TAddMaintenanceCommand, "add_maintenance", Null, Structured, true, false); - REGISTER_ALL(TRemoveMaintenanceCommand, "remove_maintenance", Null, Structured, true, false); + REGISTER (TAddMaintenanceCommand, "add_maintenance", Null, Structured, true, false, ApiVersion4); + REGISTER (TRemoveMaintenanceCommand, "remove_maintenance", Null, Structured, true, false, ApiVersion4); REGISTER_ALL(TDisableChunkLocationsCommand, "disable_chunk_locations", Null, Structured, false, false); REGISTER_ALL(TDestroyChunkLocationsCommand, "destroy_chunk_locations", Null, Structured, false, false); REGISTER_ALL(TResurrectChunkLocationsCommand, "resurrect_chunk_locations", Null, Structured, false, false); diff --git a/yt/yt/client/federated/client.cpp b/yt/yt/client/federated/client.cpp index f5ad0c462c..dad29ee6a5 100644 --- a/yt/yt/client/federated/client.cpp +++ b/yt/yt/client/federated/client.cpp @@ -405,8 +405,8 @@ public: UNIMPLEMENTED_METHOD(TFuture<void>, SuspendTabletCells, (const std::vector<NObjectClient::TCellId>&, const TSuspendTabletCellsOptions&)); UNIMPLEMENTED_METHOD(TFuture<void>, ResumeTabletCells, (const std::vector<NObjectClient::TCellId>&, const TResumeTabletCellsOptions&)); UNIMPLEMENTED_METHOD(TFuture<void>, UpdateChaosTableReplicaProgress, (NChaosClient::TReplicaId, const TUpdateChaosTableReplicaProgressOptions&)); - UNIMPLEMENTED_METHOD(TFuture<TMaintenanceId>, AddMaintenance, (EMaintenanceComponent, const TString&, EMaintenanceType, const TString&, const TAddMaintenanceOptions&)); - UNIMPLEMENTED_METHOD(TFuture<TMaintenanceCounts>, RemoveMaintenance, (EMaintenanceComponent, const TString&, const TMaintenanceFilter&, const TRemoveMaintenanceOptions&)); + UNIMPLEMENTED_METHOD(TFuture<TMaintenanceIdPerTarget>, AddMaintenance, (EMaintenanceComponent, const TString&, EMaintenanceType, const TString&, const TAddMaintenanceOptions&)); + UNIMPLEMENTED_METHOD(TFuture<TMaintenanceCountsPerTarget>, RemoveMaintenance, (EMaintenanceComponent, const TString&, const TMaintenanceFilter&, const TRemoveMaintenanceOptions&)); UNIMPLEMENTED_METHOD(TFuture<TDisableChunkLocationsResult>, DisableChunkLocations, (const TString&, const std::vector<TGuid>&, const TDisableChunkLocationsOptions&)); UNIMPLEMENTED_METHOD(TFuture<TDestroyChunkLocationsResult>, DestroyChunkLocations, (const TString&, bool, const std::vector<TGuid>&, const TDestroyChunkLocationsOptions&)); UNIMPLEMENTED_METHOD(TFuture<TResurrectChunkLocationsResult>, ResurrectChunkLocations, (const TString&, const std::vector<TGuid>&, const TResurrectChunkLocationsOptions&)); diff --git a/yt/yt/client/hedging/hedging.cpp b/yt/yt/client/hedging/hedging.cpp index 2baa914e95..0be20d47af 100644 --- a/yt/yt/client/hedging/hedging.cpp +++ b/yt/yt/client/hedging/hedging.cpp @@ -193,8 +193,8 @@ public: UNSUPPORTED_METHOD(TFuture<void>, ResumeTabletCells, (const std::vector<NObjectClient::TCellId>&, const TResumeTabletCellsOptions&)); UNSUPPORTED_METHOD(TFuture<NChaosClient::TReplicationCardPtr>, GetReplicationCard, (NChaosClient::TReplicationCardId, const TGetReplicationCardOptions&)); UNSUPPORTED_METHOD(TFuture<void>, UpdateChaosTableReplicaProgress, (NChaosClient::TReplicaId, const TUpdateChaosTableReplicaProgressOptions&)); - UNSUPPORTED_METHOD(TFuture<TMaintenanceId>, AddMaintenance, (EMaintenanceComponent, const TString&, EMaintenanceType, const TString&, const TAddMaintenanceOptions&)); - UNSUPPORTED_METHOD(TFuture<TMaintenanceCounts>, RemoveMaintenance, (EMaintenanceComponent, const TString&, const TMaintenanceFilter&, const TRemoveMaintenanceOptions&)); + UNSUPPORTED_METHOD(TFuture<TMaintenanceIdPerTarget>, AddMaintenance, (EMaintenanceComponent, const TString&, EMaintenanceType, const TString&, const TAddMaintenanceOptions&)); + UNSUPPORTED_METHOD(TFuture<TMaintenanceCountsPerTarget>, RemoveMaintenance, (EMaintenanceComponent, const TString&, const TMaintenanceFilter&, const TRemoveMaintenanceOptions&)); UNSUPPORTED_METHOD(TFuture<TDisableChunkLocationsResult>, DisableChunkLocations, (const TString&, const std::vector<TGuid>&, const TDisableChunkLocationsOptions&)); UNSUPPORTED_METHOD(TFuture<TDestroyChunkLocationsResult>, DestroyChunkLocations, (const TString&, bool, const std::vector<TGuid>&, const TDestroyChunkLocationsOptions&)); UNSUPPORTED_METHOD(TFuture<TResurrectChunkLocationsResult>, ResurrectChunkLocations, (const TString&, const std::vector<TGuid>&, const TResurrectChunkLocationsOptions&)); diff --git a/yt/yt/client/unittests/mock/client.h b/yt/yt/client/unittests/mock/client.h index c299bc01e9..4d081f3620 100644 --- a/yt/yt/client/unittests/mock/client.h +++ b/yt/yt/client/unittests/mock/client.h @@ -327,7 +327,7 @@ public: const TResumeTabletCellsOptions& options), (override)); - MOCK_METHOD(TFuture<TMaintenanceId>, AddMaintenance, ( + MOCK_METHOD(TFuture<TMaintenanceIdPerTarget>, AddMaintenance, ( EMaintenanceComponent component, const TString& address, EMaintenanceType type, @@ -335,7 +335,7 @@ public: const TAddMaintenanceOptions& options), (override)); - MOCK_METHOD(TFuture<TMaintenanceCounts>, RemoveMaintenance, ( + MOCK_METHOD(TFuture<TMaintenanceCountsPerTarget>, RemoveMaintenance, ( EMaintenanceComponent component, const TString& address, const TMaintenanceFilter& filter, diff --git a/yt/yt_proto/yt/client/api/rpc_proxy/proto/api_service.proto b/yt/yt_proto/yt/client/api/rpc_proxy/proto/api_service.proto index f8977a71a4..860672c48f 100644 --- a/yt/yt_proto/yt/client/api/rpc_proxy/proto/api_service.proto +++ b/yt/yt_proto/yt/client/api/rpc_proxy/proto/api_service.proto @@ -1059,11 +1059,19 @@ message TReqAddMaintenance required string address = 2; required EMaintenanceType type = 3; required string comment = 4; + + // COMPAT(kvk1920): For compatibility with pre-24.2 RPC clients. + optional bool supports_per_target_response = 5 [default = false]; } message TRspAddMaintenance { - required NYT.NProto.TGuid id = 1; // TMaintenanceId + // COMPAT(kvk1920): For compatibility with pre-24.2 RPC clients. + optional NYT.NProto.TGuid id = 1; // TMaintenanceId + + // Key: component address + // Value: TMaintenanceId + map<string, NYT.NProto.TGuid> id_per_target = 2; } //////////////////////////////////////////////////////////////////////////////// @@ -1076,22 +1084,35 @@ message TReqRemoveMaintenance optional EMaintenanceType type = 4; optional string user = 5; optional bool mine = 6 [default = false]; + + // COMPAT(kvk1920): Compatibility with pre-24.2 RPC clients. + optional bool supports_per_target_response = 7 [default = false]; } message TRspRemoveMaintenance { - // COMPAT(kvk1920): Can be removed after all clients, proxies and masters will be updated. + // COMPAT(kvk1920): For compatibility with pre-23.2. optional int32 ban = 1; optional int32 decommission = 2; optional int32 disable_scheduler_jobs = 3; optional int32 disable_write_sessions = 4; optional int32 disable_tablet_cells = 5; - - // COMPAT(kvk1920) + optional int32 pending_restart = 8; optional bool use_map_instead_of_fields = 6 [default = false]; + + // COMPAT(kvk1920): For compatibility with pre-24.2 RPC clients. map<int32, int32> removed_maintenance_counts = 7; // Key: EMaintenanceType - optional int32 pending_restart = 8; + // COMPAT(kvk1920): For compatibility with pre-24.2 RPC proxies. + optional bool supports_per_target_response = 9 [default = false]; + + message TMaintenanceCounts + { + map<int32, int32> counts = 1; // Key: EMaintenanceType + } + + // Key: component address + map<string, TMaintenanceCounts> removed_maintenance_counts_per_target = 10; } //////////////////////////////////////////////////////////////////////////////// |