diff options
author | uzhas <uzhas@ydb.tech> | 2023-03-15 10:49:39 +0300 |
---|---|---|
committer | uzhas <uzhas@ydb.tech> | 2023-03-15 10:49:39 +0300 |
commit | 4f94beafb7da0a39f5289ccceee9b72c65de1aee (patch) | |
tree | 35a858d3181d67008fa0595dbc738fd2d9771d8c | |
parent | f55b9038e0feec4dd7bd21d380d941384a3543e9 (diff) | |
download | ydb-4f94beafb7da0a39f5289ccceee9b72c65de1aee.tar.gz |
remove yq.proto
108 files changed, 991 insertions, 6943 deletions
diff --git a/ydb/core/driver_lib/run/CMakeLists.darwin-x86_64.txt b/ydb/core/driver_lib/run/CMakeLists.darwin-x86_64.txt index a08d5d9d87..70f0bff5be 100644 --- a/ydb/core/driver_lib/run/CMakeLists.darwin-x86_64.txt +++ b/ydb/core/driver_lib/run/CMakeLists.darwin-x86_64.txt @@ -137,7 +137,6 @@ target_link_libraries(run PUBLIC ydb-services-persqueue_v1 ydb-services-rate_limiter ydb-services-ydb - ydb-services-yq ) target_sources(run PRIVATE ${CMAKE_SOURCE_DIR}/ydb/core/driver_lib/run/config.cpp diff --git a/ydb/core/driver_lib/run/CMakeLists.linux-aarch64.txt b/ydb/core/driver_lib/run/CMakeLists.linux-aarch64.txt index 15d3892351..b52eabd1c7 100644 --- a/ydb/core/driver_lib/run/CMakeLists.linux-aarch64.txt +++ b/ydb/core/driver_lib/run/CMakeLists.linux-aarch64.txt @@ -138,7 +138,6 @@ target_link_libraries(run PUBLIC ydb-services-persqueue_v1 ydb-services-rate_limiter ydb-services-ydb - ydb-services-yq ) target_sources(run PRIVATE ${CMAKE_SOURCE_DIR}/ydb/core/driver_lib/run/config.cpp diff --git a/ydb/core/driver_lib/run/CMakeLists.linux-x86_64.txt b/ydb/core/driver_lib/run/CMakeLists.linux-x86_64.txt index 15d3892351..b52eabd1c7 100644 --- a/ydb/core/driver_lib/run/CMakeLists.linux-x86_64.txt +++ b/ydb/core/driver_lib/run/CMakeLists.linux-x86_64.txt @@ -138,7 +138,6 @@ target_link_libraries(run PUBLIC ydb-services-persqueue_v1 ydb-services-rate_limiter ydb-services-ydb - ydb-services-yq ) target_sources(run PRIVATE ${CMAKE_SOURCE_DIR}/ydb/core/driver_lib/run/config.cpp diff --git a/ydb/core/driver_lib/run/CMakeLists.windows-x86_64.txt b/ydb/core/driver_lib/run/CMakeLists.windows-x86_64.txt index a08d5d9d87..70f0bff5be 100644 --- a/ydb/core/driver_lib/run/CMakeLists.windows-x86_64.txt +++ b/ydb/core/driver_lib/run/CMakeLists.windows-x86_64.txt @@ -137,7 +137,6 @@ target_link_libraries(run PUBLIC ydb-services-persqueue_v1 ydb-services-rate_limiter ydb-services-ydb - ydb-services-yq ) target_sources(run PRIVATE ${CMAKE_SOURCE_DIR}/ydb/core/driver_lib/run/config.cpp diff --git a/ydb/core/driver_lib/run/run.cpp b/ydb/core/driver_lib/run/run.cpp index 1d5715c57f..684c1d2e78 100644 --- a/ydb/core/driver_lib/run/run.cpp +++ b/ydb/core/driver_lib/run/run.cpp @@ -105,7 +105,6 @@ #include <ydb/services/ydb/ydb_scheme.h> #include <ydb/services/ydb/ydb_scripting.h> #include <ydb/services/ydb/ydb_table.h> -#include <ydb/services/yq/grpc_service.h> #include <ydb/core/yq/libs/init/init.h> @@ -842,7 +841,6 @@ void TKikimrRunner::InitializeGRpc(const TKikimrRunConfig& runConfig) { } if (hasYandexQuery) { - server.AddService(new NGRpcService::TGRpcYandexQueryService(ActorSystem.Get(), Counters, grpcRequestProxies[0])); server.AddService(new NGRpcService::TGRpcFederatedQueryService(ActorSystem.Get(), Counters, grpcRequestProxies[0])); server.AddService(new NGRpcService::TGRpcFqPrivateTaskService(ActorSystem.Get(), Counters, grpcRequestProxies[0])); } /* REMOVE */ else /* THIS else as well and separate ifs */ if (hasYandexQueryPrivate) { diff --git a/ydb/core/grpc_services/CMakeLists.darwin-x86_64.txt b/ydb/core/grpc_services/CMakeLists.darwin-x86_64.txt index 3a3ed2a3d9..2bde041db5 100644 --- a/ydb/core/grpc_services/CMakeLists.darwin-x86_64.txt +++ b/ydb/core/grpc_services/CMakeLists.darwin-x86_64.txt @@ -124,7 +124,6 @@ target_sources(ydb-core-grpc_services PRIVATE ${CMAKE_SOURCE_DIR}/ydb/core/grpc_services/rpc_stream_execute_scan_query.cpp ${CMAKE_SOURCE_DIR}/ydb/core/grpc_services/rpc_stream_execute_yql_script.cpp ${CMAKE_SOURCE_DIR}/ydb/core/grpc_services/rpc_whoami.cpp - ${CMAKE_SOURCE_DIR}/ydb/core/grpc_services/rpc_yq.cpp ${CMAKE_SOURCE_DIR}/ydb/core/grpc_services/table_settings.cpp ${CMAKE_SOURCE_DIR}/ydb/core/grpc_services/query/rpc_execute_query.cpp ${CMAKE_SOURCE_DIR}/ydb/core/grpc_services/query/rpc_execute_script.cpp diff --git a/ydb/core/grpc_services/CMakeLists.linux-aarch64.txt b/ydb/core/grpc_services/CMakeLists.linux-aarch64.txt index c2c39ae694..d7f21e40d5 100644 --- a/ydb/core/grpc_services/CMakeLists.linux-aarch64.txt +++ b/ydb/core/grpc_services/CMakeLists.linux-aarch64.txt @@ -125,7 +125,6 @@ target_sources(ydb-core-grpc_services PRIVATE ${CMAKE_SOURCE_DIR}/ydb/core/grpc_services/rpc_stream_execute_scan_query.cpp ${CMAKE_SOURCE_DIR}/ydb/core/grpc_services/rpc_stream_execute_yql_script.cpp ${CMAKE_SOURCE_DIR}/ydb/core/grpc_services/rpc_whoami.cpp - ${CMAKE_SOURCE_DIR}/ydb/core/grpc_services/rpc_yq.cpp ${CMAKE_SOURCE_DIR}/ydb/core/grpc_services/table_settings.cpp ${CMAKE_SOURCE_DIR}/ydb/core/grpc_services/query/rpc_execute_query.cpp ${CMAKE_SOURCE_DIR}/ydb/core/grpc_services/query/rpc_execute_script.cpp diff --git a/ydb/core/grpc_services/CMakeLists.linux-x86_64.txt b/ydb/core/grpc_services/CMakeLists.linux-x86_64.txt index c2c39ae694..d7f21e40d5 100644 --- a/ydb/core/grpc_services/CMakeLists.linux-x86_64.txt +++ b/ydb/core/grpc_services/CMakeLists.linux-x86_64.txt @@ -125,7 +125,6 @@ target_sources(ydb-core-grpc_services PRIVATE ${CMAKE_SOURCE_DIR}/ydb/core/grpc_services/rpc_stream_execute_scan_query.cpp ${CMAKE_SOURCE_DIR}/ydb/core/grpc_services/rpc_stream_execute_yql_script.cpp ${CMAKE_SOURCE_DIR}/ydb/core/grpc_services/rpc_whoami.cpp - ${CMAKE_SOURCE_DIR}/ydb/core/grpc_services/rpc_yq.cpp ${CMAKE_SOURCE_DIR}/ydb/core/grpc_services/table_settings.cpp ${CMAKE_SOURCE_DIR}/ydb/core/grpc_services/query/rpc_execute_query.cpp ${CMAKE_SOURCE_DIR}/ydb/core/grpc_services/query/rpc_execute_script.cpp diff --git a/ydb/core/grpc_services/CMakeLists.windows-x86_64.txt b/ydb/core/grpc_services/CMakeLists.windows-x86_64.txt index 3a3ed2a3d9..2bde041db5 100644 --- a/ydb/core/grpc_services/CMakeLists.windows-x86_64.txt +++ b/ydb/core/grpc_services/CMakeLists.windows-x86_64.txt @@ -124,7 +124,6 @@ target_sources(ydb-core-grpc_services PRIVATE ${CMAKE_SOURCE_DIR}/ydb/core/grpc_services/rpc_stream_execute_scan_query.cpp ${CMAKE_SOURCE_DIR}/ydb/core/grpc_services/rpc_stream_execute_yql_script.cpp ${CMAKE_SOURCE_DIR}/ydb/core/grpc_services/rpc_whoami.cpp - ${CMAKE_SOURCE_DIR}/ydb/core/grpc_services/rpc_yq.cpp ${CMAKE_SOURCE_DIR}/ydb/core/grpc_services/table_settings.cpp ${CMAKE_SOURCE_DIR}/ydb/core/grpc_services/query/rpc_execute_query.cpp ${CMAKE_SOURCE_DIR}/ydb/core/grpc_services/query/rpc_execute_script.cpp diff --git a/ydb/core/grpc_services/rpc_calls.h b/ydb/core/grpc_services/rpc_calls.h index 692d4026b8..bd988c7637 100644 --- a/ydb/core/grpc_services/rpc_calls.h +++ b/ydb/core/grpc_services/rpc_calls.h @@ -18,8 +18,6 @@ #include <ydb/public/api/protos/ydb_persqueue_v1.pb.h> #include <ydb/public/api/protos/ydb_topic.pb.h> -#include <ydb/public/api/protos/yq.pb.h> - #include <ydb/public/api/grpc/draft/dummy.pb.h> #include <ydb/public/lib/operation_id/operation_id.h> diff --git a/ydb/core/grpc_services/rpc_fq.cpp b/ydb/core/grpc_services/rpc_fq.cpp index 35337e9733..53520ca2be 100644 --- a/ydb/core/grpc_services/rpc_fq.cpp +++ b/ydb/core/grpc_services/rpc_fq.cpp @@ -22,13 +22,13 @@ namespace NGRpcService { using namespace Ydb; using NPerms = NKikimr::TEvTicketParser::TEvAuthorizeTicket; -template <typename RpcRequestType, typename EvRequestType, typename EvResponseType, typename CastRequest, typename CastResult> +template <typename RpcRequestType, typename EvRequestType, typename EvResponseType> class TFederatedQueryRequestRPC : public TRpcOperationRequestActor< - TFederatedQueryRequestRPC<RpcRequestType,EvRequestType,EvResponseType, CastRequest, CastResult>, RpcRequestType> { + TFederatedQueryRequestRPC<RpcRequestType,EvRequestType,EvResponseType>, RpcRequestType> { public: using TBase = TRpcOperationRequestActor< - TFederatedQueryRequestRPC<RpcRequestType,EvRequestType,EvResponseType,CastRequest,CastResult>, + TFederatedQueryRequestRPC<RpcRequestType,EvRequestType,EvResponseType>, RpcRequestType>; using TBase::Become; using TBase::Send; @@ -68,16 +68,19 @@ public: } Token = *authToken; - TString ydbProject = Request_->GetPeerMetaValues("x-ydb-fq-project").GetOrElse(""); + TString scope = Request_->GetPeerMetaValues("x-ydb-fq-project").GetOrElse(""); + if (scope.empty()) { + scope = Request_->GetPeerMetaValues("x-yq-scope").GetOrElse(""); // TODO: remove YQ-1055 + } - if (!ydbProject.StartsWith("yandexcloud://")) { - ReplyWithStatus("x-ydb-fq-project should start with yandexcloud:// but got " + ydbProject, StatusIds::BAD_REQUEST); + if (!scope.StartsWith("yandexcloud://")) { + ReplyWithStatus("x-ydb-fq-project should start with yandexcloud:// but got " + scope, StatusIds::BAD_REQUEST); return; } - const TVector<TString> path = StringSplitter(ydbProject).Split('/').SkipEmpty(); + const TVector<TString> path = StringSplitter(scope).Split('/').SkipEmpty(); if (path.size() != 2 && path.size() != 3) { - ReplyWithStatus("x-ydb-fq-project format is invalid. Must be yandexcloud://folder_id, but got " + ydbProject, StatusIds::BAD_REQUEST); + ReplyWithStatus("x-ydb-fq-project format is invalid. Must be yandexcloud://folder_id, but got " + scope, StatusIds::BAD_REQUEST); return; } @@ -110,19 +113,9 @@ public: } const auto* req = GetProtoRequest(); - TProtoStringType protoString; - if (!req->SerializeToString(&protoString)) { - ReplyWithStatus("Can't serialize proto", StatusIds::BAD_REQUEST); - return; - } - auto castedRequest = CastRequest(); - if (!castedRequest.ParseFromString(protoString)) { - ReplyWithStatus("Can't deserialize proto", StatusIds::BAD_REQUEST); - return; - } - auto ev = MakeHolder<EvRequestType>(FolderId, castedRequest, User, Token, permissions); + auto ev = MakeHolder<EvRequestType>(FolderId, *req, User, Token, permissions); Send(NYq::ControlPlaneProxyActorId(), ev.Release()); - Become(&TFederatedQueryRequestRPC<RpcRequestType, EvRequestType, EvResponseType, CastRequest, CastResult>::StateFunc); + Become(&TFederatedQueryRequestRPC<RpcRequestType, EvRequestType, EvResponseType>::StateFunc); } protected: @@ -142,18 +135,7 @@ protected: req.RaiseIssues(response.Issues); req.ReplyWithYdbStatus(StatusIds::BAD_REQUEST); } else { - TProtoStringType protoString; - if (!response.Result.SerializeToString(&protoString)) { - ReplyWithStatus("Can't serialize proto", StatusIds::BAD_REQUEST); - return; - } - auto castedResult = CastResult(); - if (!castedResult.ParseFromString(protoString)) { - ReplyWithStatus("Can't deserialize proto", StatusIds::BAD_REQUEST); - return; - } - - req.SendResult(castedResult, StatusIds::SUCCESS); + req.SendResult(response.Result, StatusIds::SUCCESS); } } @@ -163,17 +145,7 @@ protected: req.RaiseIssues(response.Issues); req.ReplyWithYdbStatus(StatusIds::BAD_REQUEST); } else { - TProtoStringType protoString; - if (!response.Result.SerializeToString(&protoString)) { - ReplyWithStatus("Can't serialize proto", StatusIds::BAD_REQUEST); - return; - } - auto castedResponse = CastResult(); - if (!castedResponse.ParseFromString(protoString)) { - ReplyWithStatus("Can't deserialize proto", StatusIds::BAD_REQUEST); - return; - } - req.SendResult(castedResponse, StatusIds::SUCCESS); + req.SendResult(response.Result, StatusIds::SUCCESS); } NYq::TEvAuditService::TExtraInfo extraInfo{ @@ -186,21 +158,9 @@ protected: .RequestId = RequestId, }; - const auto* protoReq = GetProtoRequest(); - TProtoStringType protoString; - if (!protoReq->SerializeToString(&protoString)) { - ReplyWithStatus("Can't serialize proto", StatusIds::BAD_REQUEST); - return; - } - auto castedProtoRequest = CastRequest(); - if (!castedProtoRequest.ParseFromString(protoString)) { - ReplyWithStatus("Can't deserialize proto", StatusIds::BAD_REQUEST); - return; - } - Send(NYq::YqAuditServiceActorId(), NYq::TEvAuditService::MakeAuditEvent( std::move(extraInfo), - castedProtoRequest, + *GetProtoRequest(), response.Issues, response.AuditDetails)); } @@ -214,9 +174,7 @@ protected: using TFederatedQueryCreateQueryRPC = TFederatedQueryRequestRPC< TGrpcFqRequestOperationCall<FederatedQuery::CreateQueryRequest, FederatedQuery::CreateQueryResponse>, NYq::TEvControlPlaneProxy::TEvCreateQueryRequest, - NYq::TEvControlPlaneProxy::TEvCreateQueryResponse, - YandexQuery::CreateQueryRequest, - FederatedQuery::CreateQueryResult>; + NYq::TEvControlPlaneProxy::TEvCreateQueryResponse>; void DoFederatedQueryCreateQueryRequest(std::unique_ptr<IRequestOpCtx> p, const IFacilityProvider& f) { f.RegisterActor(new TFederatedQueryCreateQueryRPC(p.release())); @@ -225,9 +183,7 @@ void DoFederatedQueryCreateQueryRequest(std::unique_ptr<IRequestOpCtx> p, const using TFederatedQueryListQueriesRPC = TFederatedQueryRequestRPC< TGrpcFqRequestOperationCall<FederatedQuery::ListQueriesRequest, FederatedQuery::ListQueriesResponse>, NYq::TEvControlPlaneProxy::TEvListQueriesRequest, - NYq::TEvControlPlaneProxy::TEvListQueriesResponse, - YandexQuery::ListQueriesRequest, - FederatedQuery::ListQueriesResult>; + NYq::TEvControlPlaneProxy::TEvListQueriesResponse>; void DoFederatedQueryListQueriesRequest(std::unique_ptr<IRequestOpCtx> p, const IFacilityProvider& f) { f.RegisterActor(new TFederatedQueryListQueriesRPC(p.release())); @@ -236,9 +192,7 @@ void DoFederatedQueryListQueriesRequest(std::unique_ptr<IRequestOpCtx> p, const using TFederatedQueryDescribeQueryRPC = TFederatedQueryRequestRPC< TGrpcFqRequestOperationCall<FederatedQuery::DescribeQueryRequest, FederatedQuery::DescribeQueryResponse>, NYq::TEvControlPlaneProxy::TEvDescribeQueryRequest, - NYq::TEvControlPlaneProxy::TEvDescribeQueryResponse, - YandexQuery::DescribeQueryRequest, - FederatedQuery::DescribeQueryResult>; + NYq::TEvControlPlaneProxy::TEvDescribeQueryResponse>; void DoFederatedQueryDescribeQueryRequest(std::unique_ptr<IRequestOpCtx> p, const IFacilityProvider& f) { f.RegisterActor(new TFederatedQueryDescribeQueryRPC(p.release())); @@ -247,9 +201,7 @@ void DoFederatedQueryDescribeQueryRequest(std::unique_ptr<IRequestOpCtx> p, cons using TFederatedQueryGetQueryStatusRPC = TFederatedQueryRequestRPC< TGrpcFqRequestOperationCall<FederatedQuery::GetQueryStatusRequest, FederatedQuery::GetQueryStatusResponse>, NYq::TEvControlPlaneProxy::TEvGetQueryStatusRequest, - NYq::TEvControlPlaneProxy::TEvGetQueryStatusResponse, - YandexQuery::GetQueryStatusRequest, - FederatedQuery::GetQueryStatusResult>; + NYq::TEvControlPlaneProxy::TEvGetQueryStatusResponse>; void DoFederatedQueryGetQueryStatusRequest(std::unique_ptr<IRequestOpCtx> p, const IFacilityProvider& f) { f.RegisterActor(new TFederatedQueryGetQueryStatusRPC(p.release())); @@ -258,9 +210,7 @@ void DoFederatedQueryGetQueryStatusRequest(std::unique_ptr<IRequestOpCtx> p, con using TFederatedQueryModifyQueryRPC = TFederatedQueryRequestRPC< TGrpcFqRequestOperationCall<FederatedQuery::ModifyQueryRequest, FederatedQuery::ModifyQueryResponse>, NYq::TEvControlPlaneProxy::TEvModifyQueryRequest, - NYq::TEvControlPlaneProxy::TEvModifyQueryResponse, - YandexQuery::ModifyQueryRequest, - FederatedQuery::ModifyQueryResult>; + NYq::TEvControlPlaneProxy::TEvModifyQueryResponse>; void DoFederatedQueryModifyQueryRequest(std::unique_ptr<IRequestOpCtx> p, const IFacilityProvider& f) { f.RegisterActor(new TFederatedQueryModifyQueryRPC(p.release())); @@ -269,9 +219,7 @@ void DoFederatedQueryModifyQueryRequest(std::unique_ptr<IRequestOpCtx> p, const using TFederatedQueryDeleteQueryRPC = TFederatedQueryRequestRPC< TGrpcFqRequestOperationCall<FederatedQuery::DeleteQueryRequest, FederatedQuery::DeleteQueryResponse>, NYq::TEvControlPlaneProxy::TEvDeleteQueryRequest, - NYq::TEvControlPlaneProxy::TEvDeleteQueryResponse, - YandexQuery::DeleteQueryRequest, - FederatedQuery::DeleteQueryResult>; + NYq::TEvControlPlaneProxy::TEvDeleteQueryResponse>; void DoFederatedQueryDeleteQueryRequest(std::unique_ptr<IRequestOpCtx> p, const IFacilityProvider& f) { f.RegisterActor(new TFederatedQueryDeleteQueryRPC(p.release())); @@ -280,9 +228,7 @@ void DoFederatedQueryDeleteQueryRequest(std::unique_ptr<IRequestOpCtx> p, const using TFederatedQueryControlQueryRPC = TFederatedQueryRequestRPC< TGrpcFqRequestOperationCall<FederatedQuery::ControlQueryRequest, FederatedQuery::ControlQueryResponse>, NYq::TEvControlPlaneProxy::TEvControlQueryRequest, - NYq::TEvControlPlaneProxy::TEvControlQueryResponse, - YandexQuery::ControlQueryRequest, - FederatedQuery::ControlQueryResult>; + NYq::TEvControlPlaneProxy::TEvControlQueryResponse>; void DoFederatedQueryControlQueryRequest(std::unique_ptr<IRequestOpCtx> p, const IFacilityProvider& f) { f.RegisterActor(new TFederatedQueryControlQueryRPC(p.release())); @@ -291,9 +237,7 @@ void DoFederatedQueryControlQueryRequest(std::unique_ptr<IRequestOpCtx> p, const using TFederatedQueryGetResultDataRPC = TFederatedQueryRequestRPC< TGrpcFqRequestOperationCall<FederatedQuery::GetResultDataRequest, FederatedQuery::GetResultDataResponse>, NYq::TEvControlPlaneProxy::TEvGetResultDataRequest, - NYq::TEvControlPlaneProxy::TEvGetResultDataResponse, - YandexQuery::GetResultDataRequest, - FederatedQuery::GetResultDataResult>; + NYq::TEvControlPlaneProxy::TEvGetResultDataResponse>; void DoFederatedQueryGetResultDataRequest(std::unique_ptr<IRequestOpCtx> p, const IFacilityProvider& f) { f.RegisterActor(new TFederatedQueryGetResultDataRPC(p.release())); @@ -302,9 +246,7 @@ void DoFederatedQueryGetResultDataRequest(std::unique_ptr<IRequestOpCtx> p, cons using TFederatedQueryListJobsRPC = TFederatedQueryRequestRPC< TGrpcFqRequestOperationCall<FederatedQuery::ListJobsRequest, FederatedQuery::ListJobsResponse>, NYq::TEvControlPlaneProxy::TEvListJobsRequest, - NYq::TEvControlPlaneProxy::TEvListJobsResponse, - YandexQuery::ListJobsRequest, - FederatedQuery::ListJobsResult>; + NYq::TEvControlPlaneProxy::TEvListJobsResponse>; void DoFederatedQueryListJobsRequest(std::unique_ptr<IRequestOpCtx> p, const IFacilityProvider& f) { f.RegisterActor(new TFederatedQueryListJobsRPC(p.release())); @@ -313,9 +255,7 @@ void DoFederatedQueryListJobsRequest(std::unique_ptr<IRequestOpCtx> p, const IFa using TFederatedQueryDescribeJobRPC = TFederatedQueryRequestRPC< TGrpcFqRequestOperationCall<FederatedQuery::DescribeJobRequest, FederatedQuery::DescribeJobResponse>, NYq::TEvControlPlaneProxy::TEvDescribeJobRequest, - NYq::TEvControlPlaneProxy::TEvDescribeJobResponse, - YandexQuery::DescribeJobRequest, - FederatedQuery::DescribeJobResult>; + NYq::TEvControlPlaneProxy::TEvDescribeJobResponse>; void DoFederatedQueryDescribeJobRequest(std::unique_ptr<IRequestOpCtx> p, const IFacilityProvider& f) { f.RegisterActor(new TFederatedQueryDescribeJobRPC(p.release())); @@ -324,9 +264,7 @@ void DoFederatedQueryDescribeJobRequest(std::unique_ptr<IRequestOpCtx> p, const using TFederatedQueryCreateConnectionRPC = TFederatedQueryRequestRPC< TGrpcFqRequestOperationCall<FederatedQuery::CreateConnectionRequest, FederatedQuery::CreateConnectionResponse>, NYq::TEvControlPlaneProxy::TEvCreateConnectionRequest, - NYq::TEvControlPlaneProxy::TEvCreateConnectionResponse, - YandexQuery::CreateConnectionRequest, - FederatedQuery::CreateConnectionResult>; + NYq::TEvControlPlaneProxy::TEvCreateConnectionResponse>; void DoFederatedQueryCreateConnectionRequest(std::unique_ptr<IRequestOpCtx> p, const IFacilityProvider& f) { f.RegisterActor(new TFederatedQueryCreateConnectionRPC(p.release())); @@ -335,9 +273,7 @@ void DoFederatedQueryCreateConnectionRequest(std::unique_ptr<IRequestOpCtx> p, c using TFederatedQueryListConnectionsRPC = TFederatedQueryRequestRPC< TGrpcFqRequestOperationCall<FederatedQuery::ListConnectionsRequest, FederatedQuery::ListConnectionsResponse>, NYq::TEvControlPlaneProxy::TEvListConnectionsRequest, - NYq::TEvControlPlaneProxy::TEvListConnectionsResponse, - YandexQuery::ListConnectionsRequest, - FederatedQuery::ListConnectionsResult>; + NYq::TEvControlPlaneProxy::TEvListConnectionsResponse>; void DoFederatedQueryListConnectionsRequest(std::unique_ptr<IRequestOpCtx> p, const IFacilityProvider& f) { f.RegisterActor(new TFederatedQueryListConnectionsRPC(p.release())); @@ -346,9 +282,7 @@ void DoFederatedQueryListConnectionsRequest(std::unique_ptr<IRequestOpCtx> p, co using TFederatedQueryDescribeConnectionRPC = TFederatedQueryRequestRPC< TGrpcFqRequestOperationCall<FederatedQuery::DescribeConnectionRequest, FederatedQuery::DescribeConnectionResponse>, NYq::TEvControlPlaneProxy::TEvDescribeConnectionRequest, - NYq::TEvControlPlaneProxy::TEvDescribeConnectionResponse, - YandexQuery::DescribeConnectionRequest, - FederatedQuery::DescribeConnectionResult>; + NYq::TEvControlPlaneProxy::TEvDescribeConnectionResponse>; void DoFederatedQueryDescribeConnectionRequest(std::unique_ptr<IRequestOpCtx> p, const IFacilityProvider& f) { f.RegisterActor(new TFederatedQueryDescribeConnectionRPC(p.release())); @@ -357,9 +291,7 @@ void DoFederatedQueryDescribeConnectionRequest(std::unique_ptr<IRequestOpCtx> p, using TFederatedQueryModifyConnectionRPC = TFederatedQueryRequestRPC< TGrpcFqRequestOperationCall<FederatedQuery::ModifyConnectionRequest, FederatedQuery::ModifyConnectionResponse>, NYq::TEvControlPlaneProxy::TEvModifyConnectionRequest, - NYq::TEvControlPlaneProxy::TEvModifyConnectionResponse, - YandexQuery::ModifyConnectionRequest, - FederatedQuery::ModifyConnectionResult>; + NYq::TEvControlPlaneProxy::TEvModifyConnectionResponse>; void DoFederatedQueryModifyConnectionRequest(std::unique_ptr<IRequestOpCtx> p, const IFacilityProvider& f) { f.RegisterActor(new TFederatedQueryModifyConnectionRPC(p.release())); @@ -368,9 +300,7 @@ void DoFederatedQueryModifyConnectionRequest(std::unique_ptr<IRequestOpCtx> p, c using TFederatedQueryDeleteConnectionRPC = TFederatedQueryRequestRPC< TGrpcFqRequestOperationCall<FederatedQuery::DeleteConnectionRequest, FederatedQuery::DeleteConnectionResponse>, NYq::TEvControlPlaneProxy::TEvDeleteConnectionRequest, - NYq::TEvControlPlaneProxy::TEvDeleteConnectionResponse, - YandexQuery::DeleteConnectionRequest, - FederatedQuery::DeleteConnectionResult>; + NYq::TEvControlPlaneProxy::TEvDeleteConnectionResponse>; void DoFederatedQueryDeleteConnectionRequest(std::unique_ptr<IRequestOpCtx> p, const IFacilityProvider& f) { f.RegisterActor(new TFederatedQueryDeleteConnectionRPC(p.release())); @@ -379,9 +309,7 @@ void DoFederatedQueryDeleteConnectionRequest(std::unique_ptr<IRequestOpCtx> p, c using TFederatedQueryTestConnectionRPC = TFederatedQueryRequestRPC< TGrpcFqRequestOperationCall<FederatedQuery::TestConnectionRequest, FederatedQuery::TestConnectionResponse>, NYq::TEvControlPlaneProxy::TEvTestConnectionRequest, - NYq::TEvControlPlaneProxy::TEvTestConnectionResponse, - YandexQuery::TestConnectionRequest, - FederatedQuery::TestConnectionResult>; + NYq::TEvControlPlaneProxy::TEvTestConnectionResponse>; void DoFederatedQueryTestConnectionRequest(std::unique_ptr<IRequestOpCtx> p, const IFacilityProvider& f) { f.RegisterActor(new TFederatedQueryTestConnectionRPC(p.release())); @@ -390,9 +318,7 @@ void DoFederatedQueryTestConnectionRequest(std::unique_ptr<IRequestOpCtx> p, con using TFederatedQueryCreateBindingRPC = TFederatedQueryRequestRPC< TGrpcFqRequestOperationCall<FederatedQuery::CreateBindingRequest, FederatedQuery::CreateBindingResponse>, NYq::TEvControlPlaneProxy::TEvCreateBindingRequest, - NYq::TEvControlPlaneProxy::TEvCreateBindingResponse, - YandexQuery::CreateBindingRequest, - FederatedQuery::CreateBindingResult>; + NYq::TEvControlPlaneProxy::TEvCreateBindingResponse>; void DoFederatedQueryCreateBindingRequest(std::unique_ptr<IRequestOpCtx> p, const IFacilityProvider& f) { f.RegisterActor(new TFederatedQueryCreateBindingRPC(p.release())); @@ -401,9 +327,7 @@ void DoFederatedQueryCreateBindingRequest(std::unique_ptr<IRequestOpCtx> p, cons using TFederatedQueryListBindingsRPC = TFederatedQueryRequestRPC< TGrpcFqRequestOperationCall<FederatedQuery::ListBindingsRequest, FederatedQuery::ListBindingsResponse>, NYq::TEvControlPlaneProxy::TEvListBindingsRequest, - NYq::TEvControlPlaneProxy::TEvListBindingsResponse, - YandexQuery::ListBindingsRequest, - FederatedQuery::ListBindingsResult>; + NYq::TEvControlPlaneProxy::TEvListBindingsResponse>; void DoFederatedQueryListBindingsRequest(std::unique_ptr<IRequestOpCtx> p, const IFacilityProvider& f) { f.RegisterActor(new TFederatedQueryListBindingsRPC(p.release())); @@ -412,9 +336,7 @@ void DoFederatedQueryListBindingsRequest(std::unique_ptr<IRequestOpCtx> p, const using TFederatedQueryDescribeBindingRPC = TFederatedQueryRequestRPC< TGrpcFqRequestOperationCall<FederatedQuery::DescribeBindingRequest, FederatedQuery::DescribeBindingResponse>, NYq::TEvControlPlaneProxy::TEvDescribeBindingRequest, - NYq::TEvControlPlaneProxy::TEvDescribeBindingResponse, - YandexQuery::DescribeBindingRequest, - FederatedQuery::DescribeBindingResult>; + NYq::TEvControlPlaneProxy::TEvDescribeBindingResponse>; void DoFederatedQueryDescribeBindingRequest(std::unique_ptr<IRequestOpCtx> p, const IFacilityProvider& f) { f.RegisterActor(new TFederatedQueryDescribeBindingRPC(p.release())); @@ -423,9 +345,7 @@ void DoFederatedQueryDescribeBindingRequest(std::unique_ptr<IRequestOpCtx> p, co using TFederatedQueryModifyBindingRPC = TFederatedQueryRequestRPC< TGrpcFqRequestOperationCall<FederatedQuery::ModifyBindingRequest, FederatedQuery::ModifyBindingResponse>, NYq::TEvControlPlaneProxy::TEvModifyBindingRequest, - NYq::TEvControlPlaneProxy::TEvModifyBindingResponse, - YandexQuery::ModifyBindingRequest, - FederatedQuery::ModifyBindingResult>; + NYq::TEvControlPlaneProxy::TEvModifyBindingResponse>; void DoFederatedQueryModifyBindingRequest(std::unique_ptr<IRequestOpCtx> p, const IFacilityProvider& f) { f.RegisterActor(new TFederatedQueryModifyBindingRPC(p.release())); @@ -434,9 +354,7 @@ void DoFederatedQueryModifyBindingRequest(std::unique_ptr<IRequestOpCtx> p, cons using TFederatedQueryDeleteBindingRPC = TFederatedQueryRequestRPC< TGrpcFqRequestOperationCall<FederatedQuery::DeleteBindingRequest, FederatedQuery::DeleteBindingResponse>, NYq::TEvControlPlaneProxy::TEvDeleteBindingRequest, - NYq::TEvControlPlaneProxy::TEvDeleteBindingResponse, - YandexQuery::DeleteBindingRequest, - FederatedQuery::DeleteBindingResult>; + NYq::TEvControlPlaneProxy::TEvDeleteBindingResponse>; void DoFederatedQueryDeleteBindingRequest(std::unique_ptr<IRequestOpCtx> p, const IFacilityProvider& f) { f.RegisterActor(new TFederatedQueryDeleteBindingRPC(p.release())); diff --git a/ydb/core/grpc_services/rpc_yq.cpp b/ydb/core/grpc_services/rpc_yq.cpp deleted file mode 100644 index 9823d1028b..0000000000 --- a/ydb/core/grpc_services/rpc_yq.cpp +++ /dev/null @@ -1,652 +0,0 @@ -// DEPRECATED!!! use rpc_fq.cpp - -#include "rpc_common.h" -#include "rpc_deferrable.h" - -#include <ydb/core/grpc_services/service_yq.h> -#include <ydb/core/yq/libs/audit/events/events.h> -#include <ydb/core/yq/libs/audit/yq_audit_service.h> -#include <ydb/core/yq/libs/control_plane_proxy/control_plane_proxy.h> -#include <ydb/core/yq/libs/control_plane_proxy/events/events.h> -#include <ydb/core/yq/libs/control_plane_proxy/utils.h> - -#include <ydb/library/aclib/aclib.h> - -#include <library/cpp/actors/core/hfunc.h> - -#include <util/generic/guid.h> -#include <util/string/split.h> - -namespace NKikimr { -namespace NGRpcService { - -using namespace Ydb; -using NPerms = NKikimr::TEvTicketParser::TEvAuthorizeTicket; - -template <typename RpcRequestType, typename EvRequestType, typename EvResponseType> -class TYandexQueryRequestRPC : public TRpcOperationRequestActor< - TYandexQueryRequestRPC<RpcRequestType,EvRequestType,EvResponseType>, RpcRequestType> { - -public: - using TBase = TRpcOperationRequestActor< - TYandexQueryRequestRPC<RpcRequestType,EvRequestType,EvResponseType>, - RpcRequestType>; - using TBase::Become; - using TBase::Send; - using TBase::PassAway; - using TBase::Request_; - using TBase::GetProtoRequest; - -protected: - TString Token; - TString FolderId; - TString User; - TString PeerName; - TString UserAgent; - TString RequestId; - -public: - TYandexQueryRequestRPC(IRequestOpCtx* request) - : TBase(request) {} - - void Bootstrap() { - auto requestCtx = Request_.get(); - - auto request = dynamic_cast<RpcRequestType*>(requestCtx); - Y_VERIFY(request); - - auto proxyCtx = dynamic_cast<IRequestProxyCtx*>(requestCtx); - Y_VERIFY(proxyCtx); - - PeerName = Request_->GetPeerName(); - UserAgent = Request_->GetPeerMetaValues("user-agent").GetOrElse("empty"); - RequestId = Request_->GetPeerMetaValues("x-request-id").GetOrElse(CreateGuidAsString()); - - TMaybe<TString> authToken = proxyCtx->GetYdbToken(); - if (!authToken) { - ReplyWithStatus("Token is empty", StatusIds::BAD_REQUEST); - return; - } - Token = *authToken; - - TString scope = Request_->GetPeerMetaValues("x-ydb-fq-project").GetOrElse(""); - if (scope.empty()) { - scope = Request_->GetPeerMetaValues("x-yq-scope").GetOrElse(""); // TODO: remove YQ-1055 - } - - if (!scope.StartsWith("yandexcloud://")) { - ReplyWithStatus("x-ydb-fq-project should start with yandexcloud:// but got " + scope, StatusIds::BAD_REQUEST); - return; - } - - const TVector<TString> path = StringSplitter(scope).Split('/').SkipEmpty(); - if (path.size() != 2 && path.size() != 3) { - ReplyWithStatus("x-ydb-fq-project format is invalid. Must be yandexcloud://folder_id, but got " + scope, StatusIds::BAD_REQUEST); - return; - } - - FolderId = path.back(); - if (!FolderId) { - ReplyWithStatus("Folder id is empty", StatusIds::BAD_REQUEST); - return; - } - - if (FolderId.length() > 1024) { - ReplyWithStatus("Folder id length greater than 1024 characters: " + FolderId, StatusIds::BAD_REQUEST); - return; - } - - const TString& internalToken = proxyCtx->GetSerializedToken(); - TVector<TString> permissions; - if (internalToken) { - NACLib::TUserToken userToken(internalToken); - User = userToken.GetUserSID(); - for (const auto& sid: request->Sids) { - if (userToken.IsExist(sid)) { - permissions.push_back(sid); - } - } - } - - if (!User) { - ReplyWithStatus("Authorization error. Permission denied", StatusIds::UNAUTHORIZED); - return; - } - - const auto* req = GetProtoRequest(); - auto ev = MakeHolder<EvRequestType>(FolderId, *req, User, Token, permissions); - Send(NYq::ControlPlaneProxyActorId(), ev.Release()); - Become(&TYandexQueryRequestRPC<RpcRequestType, EvRequestType, EvResponseType>::StateFunc); - } - -protected: - void ReplyWithStatus(const TString& issueMessage, StatusIds::StatusCode status) { - Request_->RaiseIssue(NYql::TIssue(issueMessage)); - Request_->ReplyWithYdbStatus(status); - PassAway(); - } - - STRICT_STFUNC(StateFunc, - hFunc(EvResponseType, Handle); - ) - - template <typename TResponse, typename TReq> - void SendResponse(const TResponse& response, TReq& req) { - if (response.Issues) { - req.RaiseIssues(response.Issues); - req.ReplyWithYdbStatus(StatusIds::BAD_REQUEST); - } else { - req.SendResult(response.Result, StatusIds::SUCCESS); - } - } - - template <typename TResponse, typename TReq> requires requires (TResponse r) { r.AuditDetails; } - void SendResponse(const TResponse& response, TReq& req) { - if (response.Issues) { - req.RaiseIssues(response.Issues); - req.ReplyWithYdbStatus(StatusIds::BAD_REQUEST); - } else { - req.SendResult(response.Result, StatusIds::SUCCESS); - } - - NYq::TEvAuditService::TExtraInfo extraInfo{ - .Token = Token, - .CloudId = response.AuditDetails.CloudId, - .FolderId = FolderId, - .User = User, - .PeerName = PeerName, - .UserAgent = UserAgent, - .RequestId = RequestId, - }; - - Send(NYq::YqAuditServiceActorId(), NYq::TEvAuditService::MakeAuditEvent( - std::move(extraInfo), - *GetProtoRequest(), - response.Issues, - response.AuditDetails)); - } - - void Handle(typename EvResponseType::TPtr& ev) { - SendResponse(*ev->Get(), *Request_); - PassAway(); - } -}; - -using TYandexQueryCreateQueryRPC = TYandexQueryRequestRPC< - TGrpcYqRequestOperationCall<YandexQuery::CreateQueryRequest, YandexQuery::CreateQueryResponse>, - NYq::TEvControlPlaneProxy::TEvCreateQueryRequest, - NYq::TEvControlPlaneProxy::TEvCreateQueryResponse>; - -void DoYandexQueryCreateQueryRequest(std::unique_ptr<IRequestOpCtx> p, const IFacilityProvider& f) { - f.RegisterActor(new TYandexQueryCreateQueryRPC(p.release())); -} - -using TYandexQueryListQueriesRPC = TYandexQueryRequestRPC< - TGrpcYqRequestOperationCall<YandexQuery::ListQueriesRequest, YandexQuery::ListQueriesResponse>, - NYq::TEvControlPlaneProxy::TEvListQueriesRequest, - NYq::TEvControlPlaneProxy::TEvListQueriesResponse>; - -void DoYandexQueryListQueriesRequest(std::unique_ptr<IRequestOpCtx> p, const IFacilityProvider& f) { - f.RegisterActor(new TYandexQueryListQueriesRPC(p.release())); -} - -using TYandexQueryDescribeQueryRPC = TYandexQueryRequestRPC< - TGrpcYqRequestOperationCall<YandexQuery::DescribeQueryRequest, YandexQuery::DescribeQueryResponse>, - NYq::TEvControlPlaneProxy::TEvDescribeQueryRequest, - NYq::TEvControlPlaneProxy::TEvDescribeQueryResponse>; - -void DoYandexQueryDescribeQueryRequest(std::unique_ptr<IRequestOpCtx> p, const IFacilityProvider& f) { - f.RegisterActor(new TYandexQueryDescribeQueryRPC(p.release())); -} - -using TYandexQueryGetQueryStatusRPC = TYandexQueryRequestRPC< - TGrpcYqRequestOperationCall<YandexQuery::GetQueryStatusRequest, YandexQuery::GetQueryStatusResponse>, - NYq::TEvControlPlaneProxy::TEvGetQueryStatusRequest, - NYq::TEvControlPlaneProxy::TEvGetQueryStatusResponse>; - -void DoYandexQueryGetQueryStatusRequest(std::unique_ptr<IRequestOpCtx> p, const IFacilityProvider& f) { - f.RegisterActor(new TYandexQueryGetQueryStatusRPC(p.release())); -} - -using TYandexQueryModifyQueryRPC = TYandexQueryRequestRPC< - TGrpcYqRequestOperationCall<YandexQuery::ModifyQueryRequest, YandexQuery::ModifyQueryResponse>, - NYq::TEvControlPlaneProxy::TEvModifyQueryRequest, - NYq::TEvControlPlaneProxy::TEvModifyQueryResponse>; - -void DoYandexQueryModifyQueryRequest(std::unique_ptr<IRequestOpCtx> p, const IFacilityProvider& f) { - f.RegisterActor(new TYandexQueryModifyQueryRPC(p.release())); -} - -using TYandexQueryDeleteQueryRPC = TYandexQueryRequestRPC< - TGrpcYqRequestOperationCall<YandexQuery::DeleteQueryRequest, YandexQuery::DeleteQueryResponse>, - NYq::TEvControlPlaneProxy::TEvDeleteQueryRequest, - NYq::TEvControlPlaneProxy::TEvDeleteQueryResponse>; - -void DoYandexQueryDeleteQueryRequest(std::unique_ptr<IRequestOpCtx> p, const IFacilityProvider& f) { - f.RegisterActor(new TYandexQueryDeleteQueryRPC(p.release())); -} - -using TYandexQueryControlQueryRPC = TYandexQueryRequestRPC< - TGrpcYqRequestOperationCall<YandexQuery::ControlQueryRequest, YandexQuery::ControlQueryResponse>, - NYq::TEvControlPlaneProxy::TEvControlQueryRequest, - NYq::TEvControlPlaneProxy::TEvControlQueryResponse>; - -void DoYandexQueryControlQueryRequest(std::unique_ptr<IRequestOpCtx> p, const IFacilityProvider& f) { - f.RegisterActor(new TYandexQueryControlQueryRPC(p.release())); -} - -using TYandexQueryGetResultDataRPC = TYandexQueryRequestRPC< - TGrpcYqRequestOperationCall<YandexQuery::GetResultDataRequest, YandexQuery::GetResultDataResponse>, - NYq::TEvControlPlaneProxy::TEvGetResultDataRequest, - NYq::TEvControlPlaneProxy::TEvGetResultDataResponse>; - -void DoYandexQueryGetResultDataRequest(std::unique_ptr<IRequestOpCtx> p, const IFacilityProvider& f) { - f.RegisterActor(new TYandexQueryGetResultDataRPC(p.release())); -} - -using TYandexQueryListJobsRPC = TYandexQueryRequestRPC< - TGrpcYqRequestOperationCall<YandexQuery::ListJobsRequest, YandexQuery::ListJobsResponse>, - NYq::TEvControlPlaneProxy::TEvListJobsRequest, - NYq::TEvControlPlaneProxy::TEvListJobsResponse>; - -void DoYandexQueryListJobsRequest(std::unique_ptr<IRequestOpCtx> p, const IFacilityProvider& f) { - f.RegisterActor(new TYandexQueryListJobsRPC(p.release())); -} - -using TYandexQueryDescribeJobRPC = TYandexQueryRequestRPC< - TGrpcYqRequestOperationCall<YandexQuery::DescribeJobRequest, YandexQuery::DescribeJobResponse>, - NYq::TEvControlPlaneProxy::TEvDescribeJobRequest, - NYq::TEvControlPlaneProxy::TEvDescribeJobResponse>; - -void DoYandexQueryDescribeJobRequest(std::unique_ptr<IRequestOpCtx> p, const IFacilityProvider& f) { - f.RegisterActor(new TYandexQueryDescribeJobRPC(p.release())); -} - -using TYandexQueryCreateConnectionRPC = TYandexQueryRequestRPC< - TGrpcYqRequestOperationCall<YandexQuery::CreateConnectionRequest, YandexQuery::CreateConnectionResponse>, - NYq::TEvControlPlaneProxy::TEvCreateConnectionRequest, - NYq::TEvControlPlaneProxy::TEvCreateConnectionResponse>; - -void DoYandexQueryCreateConnectionRequest(std::unique_ptr<IRequestOpCtx> p, const IFacilityProvider& f) { - f.RegisterActor(new TYandexQueryCreateConnectionRPC(p.release())); -} - -using TYandexQueryListConnectionsRPC = TYandexQueryRequestRPC< - TGrpcYqRequestOperationCall<YandexQuery::ListConnectionsRequest, YandexQuery::ListConnectionsResponse>, - NYq::TEvControlPlaneProxy::TEvListConnectionsRequest, - NYq::TEvControlPlaneProxy::TEvListConnectionsResponse>; - -void DoYandexQueryListConnectionsRequest(std::unique_ptr<IRequestOpCtx> p, const IFacilityProvider& f) { - f.RegisterActor(new TYandexQueryListConnectionsRPC(p.release())); -} - -using TYandexQueryDescribeConnectionRPC = TYandexQueryRequestRPC< - TGrpcYqRequestOperationCall<YandexQuery::DescribeConnectionRequest, YandexQuery::DescribeConnectionResponse>, - NYq::TEvControlPlaneProxy::TEvDescribeConnectionRequest, - NYq::TEvControlPlaneProxy::TEvDescribeConnectionResponse>; - -void DoYandexQueryDescribeConnectionRequest(std::unique_ptr<IRequestOpCtx> p, const IFacilityProvider& f) { - f.RegisterActor(new TYandexQueryDescribeConnectionRPC(p.release())); -} - -using TYandexQueryModifyConnectionRPC = TYandexQueryRequestRPC< - TGrpcYqRequestOperationCall<YandexQuery::ModifyConnectionRequest, YandexQuery::ModifyConnectionResponse>, - NYq::TEvControlPlaneProxy::TEvModifyConnectionRequest, - NYq::TEvControlPlaneProxy::TEvModifyConnectionResponse>; - -void DoYandexQueryModifyConnectionRequest(std::unique_ptr<IRequestOpCtx> p, const IFacilityProvider& f) { - f.RegisterActor(new TYandexQueryModifyConnectionRPC(p.release())); -} - -using TYandexQueryDeleteConnectionRPC = TYandexQueryRequestRPC< - TGrpcYqRequestOperationCall<YandexQuery::DeleteConnectionRequest, YandexQuery::DeleteConnectionResponse>, - NYq::TEvControlPlaneProxy::TEvDeleteConnectionRequest, - NYq::TEvControlPlaneProxy::TEvDeleteConnectionResponse>; - -void DoYandexQueryDeleteConnectionRequest(std::unique_ptr<IRequestOpCtx> p, const IFacilityProvider& f) { - f.RegisterActor(new TYandexQueryDeleteConnectionRPC(p.release())); -} - -using TYandexQueryTestConnectionRPC = TYandexQueryRequestRPC< - TGrpcYqRequestOperationCall<YandexQuery::TestConnectionRequest, YandexQuery::TestConnectionResponse>, - NYq::TEvControlPlaneProxy::TEvTestConnectionRequest, - NYq::TEvControlPlaneProxy::TEvTestConnectionResponse>; - -void DoYandexQueryTestConnectionRequest(std::unique_ptr<IRequestOpCtx> p, const IFacilityProvider& f) { - f.RegisterActor(new TYandexQueryTestConnectionRPC(p.release())); -} - -using TYandexQueryCreateBindingRPC = TYandexQueryRequestRPC< - TGrpcYqRequestOperationCall<YandexQuery::CreateBindingRequest, YandexQuery::CreateBindingResponse>, - NYq::TEvControlPlaneProxy::TEvCreateBindingRequest, - NYq::TEvControlPlaneProxy::TEvCreateBindingResponse>; - -void DoYandexQueryCreateBindingRequest(std::unique_ptr<IRequestOpCtx> p, const IFacilityProvider& f) { - f.RegisterActor(new TYandexQueryCreateBindingRPC(p.release())); -} - -using TYandexQueryListBindingsRPC = TYandexQueryRequestRPC< - TGrpcYqRequestOperationCall<YandexQuery::ListBindingsRequest, YandexQuery::ListBindingsResponse>, - NYq::TEvControlPlaneProxy::TEvListBindingsRequest, - NYq::TEvControlPlaneProxy::TEvListBindingsResponse>; - -void DoYandexQueryListBindingsRequest(std::unique_ptr<IRequestOpCtx> p, const IFacilityProvider& f) { - f.RegisterActor(new TYandexQueryListBindingsRPC(p.release())); -} - -using TYandexQueryDescribeBindingRPC = TYandexQueryRequestRPC< - TGrpcYqRequestOperationCall<YandexQuery::DescribeBindingRequest, YandexQuery::DescribeBindingResponse>, - NYq::TEvControlPlaneProxy::TEvDescribeBindingRequest, - NYq::TEvControlPlaneProxy::TEvDescribeBindingResponse>; - -void DoYandexQueryDescribeBindingRequest(std::unique_ptr<IRequestOpCtx> p, const IFacilityProvider& f) { - f.RegisterActor(new TYandexQueryDescribeBindingRPC(p.release())); -} - -using TYandexQueryModifyBindingRPC = TYandexQueryRequestRPC< - TGrpcYqRequestOperationCall<YandexQuery::ModifyBindingRequest, YandexQuery::ModifyBindingResponse>, - NYq::TEvControlPlaneProxy::TEvModifyBindingRequest, - NYq::TEvControlPlaneProxy::TEvModifyBindingResponse>; - -void DoYandexQueryModifyBindingRequest(std::unique_ptr<IRequestOpCtx> p, const IFacilityProvider& f) { - f.RegisterActor(new TYandexQueryModifyBindingRPC(p.release())); -} - -using TYandexQueryDeleteBindingRPC = TYandexQueryRequestRPC< - TGrpcYqRequestOperationCall<YandexQuery::DeleteBindingRequest, YandexQuery::DeleteBindingResponse>, - NYq::TEvControlPlaneProxy::TEvDeleteBindingRequest, - NYq::TEvControlPlaneProxy::TEvDeleteBindingResponse>; - -void DoYandexQueryDeleteBindingRequest(std::unique_ptr<IRequestOpCtx> p, const IFacilityProvider& f) { - f.RegisterActor(new TYandexQueryDeleteBindingRPC(p.release())); -} - -std::unique_ptr<TEvProxyRuntimeEvent> CreateCreateQueryRequestOperationCall(TIntrusivePtr<NGrpc::IRequestContextBase> ctx) { - static const std::function permissions{[](const YandexQuery::CreateQueryRequest& request) { - TVector<NPerms::TPermission> basePermissions{ - NPerms::Required("yq.queries.create"), - NPerms::Optional("yq.connections.use"), - NPerms::Optional("yq.bindings.use") - }; - if (request.execute_mode() != YandexQuery::SAVE) { - basePermissions.push_back(NPerms::Required("yq.queries.invoke")); - } - if (request.content().acl().visibility() == YandexQuery::Acl::SCOPE) { - basePermissions.push_back(NPerms::Required("yq.resources.managePublic")); - } - return basePermissions; - }}; - - return std::make_unique<TGrpcYqRequestOperationCall<YandexQuery::CreateQueryRequest, YandexQuery::CreateQueryResponse>>(ctx.Release(), &DoYandexQueryCreateQueryRequest, permissions); -} - -std::unique_ptr<TEvProxyRuntimeEvent> CreateListQueriesRequestOperationCall(TIntrusivePtr<NGrpc::IRequestContextBase> ctx) { - static const std::function permissions{[](const YandexQuery::ListQueriesRequest&) -> TVector<NPerms::TPermission> { - return { - NPerms::Required("yq.queries.get"), - NPerms::Optional("yq.resources.viewPublic"), - NPerms::Optional("yq.resources.viewPrivate") - }; - }}; - - return std::make_unique<TGrpcYqRequestOperationCall<YandexQuery::ListQueriesRequest, YandexQuery::ListQueriesResponse>>(ctx.Release(), &DoYandexQueryListQueriesRequest, permissions); -} - -std::unique_ptr<TEvProxyRuntimeEvent> CreateDescribeQueryRequestOperationCall(TIntrusivePtr<NGrpc::IRequestContextBase> ctx) { - static const std::function permissions{[](const YandexQuery::DescribeQueryRequest&) -> TVector<NPerms::TPermission> { - return { - NPerms::Required("yq.queries.get"), - NPerms::Optional("yq.queries.viewAst"), - NPerms::Optional("yq.resources.viewPublic"), - NPerms::Optional("yq.resources.viewPrivate"), - NPerms::Optional("yq.queries.viewQueryText") - }; - }}; - - return std::make_unique<TGrpcYqRequestOperationCall<YandexQuery::DescribeQueryRequest, YandexQuery::DescribeQueryResponse>>(ctx.Release(), &DoYandexQueryDescribeQueryRequest, permissions); -} - -std::unique_ptr<TEvProxyRuntimeEvent> CreateGetQueryStatusRequestOperationCall(TIntrusivePtr<NGrpc::IRequestContextBase> ctx) { - static const std::function permissions{[](const YandexQuery::GetQueryStatusRequest&) -> TVector<NPerms::TPermission> { - return { - NPerms::Required("yq.queries.getStatus"), - NPerms::Optional("yq.resources.viewPublic"), - NPerms::Optional("yq.resources.viewPrivate") - }; - }}; - - return std::make_unique<TGrpcYqRequestOperationCall<YandexQuery::GetQueryStatusRequest, YandexQuery::GetQueryStatusResponse>>(ctx.Release(), &DoYandexQueryGetQueryStatusRequest, permissions); -} - -std::unique_ptr<TEvProxyRuntimeEvent> CreateModifyQueryRequestOperationCall(TIntrusivePtr<NGrpc::IRequestContextBase> ctx) { - static const std::function permissions{[](const YandexQuery::ModifyQueryRequest& request) { - TVector<NPerms::TPermission> basePermissions{ - NPerms::Required("yq.queries.update"), - NPerms::Optional("yq.connections.use"), - NPerms::Optional("yq.bindings.use"), - NPerms::Optional("yq.resources.managePrivate") - }; - if (request.execute_mode() != YandexQuery::SAVE) { - basePermissions.push_back(NPerms::Required("yq.queries.invoke")); - } - if (request.content().acl().visibility() == YandexQuery::Acl::SCOPE) { - basePermissions.push_back(NPerms::Required("yq.resources.managePublic")); - } - return basePermissions; - }}; - - return std::make_unique<TGrpcYqRequestOperationCall<YandexQuery::ModifyQueryRequest, YandexQuery::ModifyQueryResponse>>(ctx.Release(), &DoYandexQueryModifyQueryRequest, permissions); -} - -std::unique_ptr<TEvProxyRuntimeEvent> CreateDeleteQueryRequestOperationCall(TIntrusivePtr<NGrpc::IRequestContextBase> ctx) { - static const std::function permissions{[](const YandexQuery::DeleteQueryRequest&) -> TVector<NPerms::TPermission> { - return { - NPerms::Required("yq.queries.delete"), - NPerms::Optional("yq.resources.managePublic"), - NPerms::Optional("yq.resources.managePrivate") - }; - }}; - - return std::make_unique<TGrpcYqRequestOperationCall<YandexQuery::DeleteQueryRequest, YandexQuery::DeleteQueryResponse>>(ctx.Release(), &DoYandexQueryDeleteQueryRequest, permissions); -} - -std::unique_ptr<TEvProxyRuntimeEvent> CreateControlQueryRequestOperationCall(TIntrusivePtr<NGrpc::IRequestContextBase> ctx) { - static const std::function permissions{[](const YandexQuery::ControlQueryRequest& request) -> TVector<NPerms::TPermission> { - TVector<NPerms::TPermission> basePermissions{ - NPerms::Required("yq.queries.control"), - NPerms::Optional("yq.resources.managePublic"), - NPerms::Optional("yq.resources.managePrivate") - }; - if (request.action() == YandexQuery::RESUME) { - basePermissions.push_back(NPerms::Required("yq.queries.start")); - } else if (request.action() != YandexQuery::QUERY_ACTION_UNSPECIFIED) { - basePermissions.push_back(NPerms::Required("yq.queries.abort")); - } - return basePermissions; - }}; - - return std::make_unique<TGrpcYqRequestOperationCall<YandexQuery::ControlQueryRequest, YandexQuery::ControlQueryResponse>>(ctx.Release(), &DoYandexQueryControlQueryRequest, permissions); -} - -std::unique_ptr<TEvProxyRuntimeEvent> CreateGetResultDataRequestOperationCall(TIntrusivePtr<NGrpc::IRequestContextBase> ctx) { - static const std::function permissions{ [](const YandexQuery::GetResultDataRequest&) -> TVector<NPerms::TPermission> { - return { - NPerms::Required("yq.queries.getData"), - NPerms::Optional("yq.resources.viewPublic"), - NPerms::Optional("yq.resources.viewPrivate") - }; - } }; - - return std::make_unique<TGrpcYqRequestOperationCall<YandexQuery::GetResultDataRequest, YandexQuery::GetResultDataResponse>>(ctx.Release(), &DoYandexQueryGetResultDataRequest, permissions); -} - -std::unique_ptr<TEvProxyRuntimeEvent> CreateListJobsRequestOperationCall(TIntrusivePtr<NGrpc::IRequestContextBase> ctx) { - static const std::function permissions{ [](const YandexQuery::ListJobsRequest&) -> TVector<NPerms::TPermission> { - return { - NPerms::Required("yq.jobs.get"), - NPerms::Optional("yq.resources.viewPublic"), - NPerms::Optional("yq.resources.viewPrivate") - }; - } }; - - return std::make_unique<TGrpcYqRequestOperationCall<YandexQuery::ListJobsRequest, YandexQuery::ListJobsResponse>>(ctx.Release(), &DoYandexQueryListJobsRequest, permissions); -} - -std::unique_ptr<TEvProxyRuntimeEvent> CreateDescribeJobRequestOperationCall(TIntrusivePtr<NGrpc::IRequestContextBase> ctx) { - static const std::function permissions{ [](const YandexQuery::DescribeJobRequest&) -> TVector<NPerms::TPermission> { - return { - NPerms::Required("yq.jobs.get"), - NPerms::Optional("yq.resources.viewPublic"), - NPerms::Optional("yq.resources.viewPrivate"), - NPerms::Optional("yq.queries.viewAst"), - NPerms::Optional("yq.queries.viewQueryText") - }; - } }; - - return std::make_unique<TGrpcYqRequestOperationCall<YandexQuery::DescribeJobRequest, YandexQuery::DescribeJobResponse>>(ctx.Release(), &DoYandexQueryDescribeJobRequest, permissions); -} - -std::unique_ptr<TEvProxyRuntimeEvent> CreateCreateConnectionRequestOperationCall(TIntrusivePtr<NGrpc::IRequestContextBase> ctx) { - static const std::function permissions{ [](const YandexQuery::CreateConnectionRequest& request) -> TVector<NPerms::TPermission> { - TVector<NPerms::TPermission> basePermissions{ - NPerms::Required("yq.connections.create"), - }; - if (request.content().acl().visibility() == YandexQuery::Acl::SCOPE) { - basePermissions.push_back(NPerms::Required("yq.resources.managePublic")); - } - return basePermissions; - } }; - - return std::make_unique<TGrpcYqRequestOperationCall<YandexQuery::CreateConnectionRequest, YandexQuery::CreateConnectionResponse>>(ctx.Release(), &DoYandexQueryCreateConnectionRequest, permissions); -} - -std::unique_ptr<TEvProxyRuntimeEvent> CreateListConnectionsRequestOperationCall(TIntrusivePtr<NGrpc::IRequestContextBase> ctx) { - static const std::function permissions{ [](const YandexQuery::ListConnectionsRequest&) -> TVector<NPerms::TPermission> { - return { - NPerms::Required("yq.connections.get"), - NPerms::Optional("yq.resources.viewPublic"), - NPerms::Optional("yq.resources.viewPrivate") - }; - } }; - - return std::make_unique<TGrpcYqRequestOperationCall<YandexQuery::ListConnectionsRequest, YandexQuery::ListConnectionsResponse>>(ctx.Release(), &DoYandexQueryListConnectionsRequest, permissions); -} - -std::unique_ptr<TEvProxyRuntimeEvent> CreateDescribeConnectionRequestOperationCall(TIntrusivePtr<NGrpc::IRequestContextBase> ctx) { - static const std::function permissions{ [](const YandexQuery::DescribeConnectionRequest&) -> TVector<NPerms::TPermission> { - return { - NPerms::Required("yq.connections.get"), - NPerms::Optional("yq.resources.viewPublic"), - NPerms::Optional("yq.resources.viewPrivate") - }; - } }; - - return std::make_unique<TGrpcYqRequestOperationCall<YandexQuery::DescribeConnectionRequest, YandexQuery::DescribeConnectionResponse>>(ctx.Release(), &DoYandexQueryDescribeConnectionRequest, permissions); -} - -std::unique_ptr<TEvProxyRuntimeEvent> CreateModifyConnectionRequestOperationCall(TIntrusivePtr<NGrpc::IRequestContextBase> ctx) { - static const std::function permissions{ [](const YandexQuery::ModifyConnectionRequest& request) -> TVector<NPerms::TPermission> { - TVector<NPerms::TPermission> basePermissions{ - NPerms::Required("yq.connections.update"), - NPerms::Optional("yq.resources.managePrivate") - }; - if (request.content().acl().visibility() == YandexQuery::Acl::SCOPE) { - basePermissions.push_back(NPerms::Required("yq.resources.managePublic")); - } - return basePermissions; - } }; - - return std::make_unique<TGrpcYqRequestOperationCall<YandexQuery::ModifyConnectionRequest, YandexQuery::ModifyConnectionResponse>>(ctx.Release(), &DoYandexQueryModifyConnectionRequest, permissions); -} - -std::unique_ptr<TEvProxyRuntimeEvent> CreateDeleteConnectionRequestOperationCall(TIntrusivePtr<NGrpc::IRequestContextBase> ctx) { - static const std::function permissions{ [](const YandexQuery::DeleteConnectionRequest&) -> TVector<NPerms::TPermission> { - return { - NPerms::Required("yq.connections.delete"), - NPerms::Optional("yq.resources.managePublic"), - NPerms::Optional("yq.resources.managePrivate") - }; - } }; - - return std::make_unique<TGrpcYqRequestOperationCall<YandexQuery::DeleteConnectionRequest, YandexQuery::DeleteConnectionResponse>>(ctx.Release(), &DoYandexQueryDeleteConnectionRequest, permissions); -} - -std::unique_ptr<TEvProxyRuntimeEvent> CreateTestConnectionRequestOperationCall(TIntrusivePtr<NGrpc::IRequestContextBase> ctx) { - static const std::function permissions{ [](const YandexQuery::TestConnectionRequest&) -> TVector<NPerms::TPermission> { - return { - NPerms::Required("yq.connections.create") - }; - } }; - - return std::make_unique<TGrpcYqRequestOperationCall<YandexQuery::TestConnectionRequest, YandexQuery::TestConnectionResponse>>(ctx.Release(), &DoYandexQueryTestConnectionRequest, permissions); -} - -std::unique_ptr<TEvProxyRuntimeEvent> CreateCreateBindingRequestOperationCall(TIntrusivePtr<NGrpc::IRequestContextBase> ctx) { - static const std::function permissions{ [](const YandexQuery::CreateBindingRequest&) -> TVector<NPerms::TPermission> { - // For use in binding links on connection with visibility SCOPE, - // the yq.resources.managePublic permission is required. But there - // is no information about connection visibility in this place, - // so yq.resources.managePublic is always requested as optional - return { - NPerms::Required("yq.bindings.create"), - NPerms::Optional("yq.resources.managePublic") - }; - } }; - - return std::make_unique<TGrpcYqRequestOperationCall<YandexQuery::CreateBindingRequest, YandexQuery::CreateBindingResponse>>(ctx.Release(), &DoYandexQueryCreateBindingRequest, permissions); -} - -std::unique_ptr<TEvProxyRuntimeEvent> CreateListBindingsRequestOperationCall(TIntrusivePtr<NGrpc::IRequestContextBase> ctx) { - static const std::function permissions{ [](const YandexQuery::ListBindingsRequest&) -> TVector<NPerms::TPermission> { - return { - NPerms::Required("yq.bindings.get"), - NPerms::Optional("yq.resources.viewPublic"), - NPerms::Optional("yq.resources.viewPrivate") - }; - } }; - - return std::make_unique<TGrpcYqRequestOperationCall<YandexQuery::ListBindingsRequest, YandexQuery::ListBindingsResponse>>(ctx.Release(), &DoYandexQueryListBindingsRequest, permissions); -} - -std::unique_ptr<TEvProxyRuntimeEvent> CreateDescribeBindingRequestOperationCall(TIntrusivePtr<NGrpc::IRequestContextBase> ctx) { - static const std::function permissions{ [](const YandexQuery::DescribeBindingRequest&) -> TVector<NPerms::TPermission> { - return { - NPerms::Required("yq.bindings.get"), - NPerms::Optional("yq.resources.viewPublic"), - NPerms::Optional("yq.resources.viewPrivate") - }; - } }; - - return std::make_unique<TGrpcYqRequestOperationCall<YandexQuery::DescribeBindingRequest, YandexQuery::DescribeBindingResponse>>(ctx.Release(), &DoYandexQueryDescribeBindingRequest, permissions); -} - -std::unique_ptr<TEvProxyRuntimeEvent> CreateModifyBindingRequestOperationCall(TIntrusivePtr<NGrpc::IRequestContextBase> ctx) { - static const std::function permissions{ [](const YandexQuery::ModifyBindingRequest&) -> TVector<NPerms::TPermission> { - // For use in binding links on connection with visibility SCOPE, - // the yq.resources.managePublic permission is required. But there - // is no information about connection visibility in this place, - // so yq.resources.managePublic is always requested as optional - return { - NPerms::Required("yq.bindings.update"), - NPerms::Optional("yq.resources.managePrivate"), - NPerms::Optional("yq.resources.managePublic") - }; - } }; - - return std::make_unique<TGrpcYqRequestOperationCall<YandexQuery::ModifyBindingRequest, YandexQuery::ModifyBindingResponse>>(ctx.Release(), &DoYandexQueryModifyBindingRequest, permissions); -} - -std::unique_ptr<TEvProxyRuntimeEvent> CreateDeleteBindingRequestOperationCall(TIntrusivePtr<NGrpc::IRequestContextBase> ctx) { - static const std::function permissions{ [](const YandexQuery::DeleteBindingRequest&) -> TVector<NPerms::TPermission> { - return { - NPerms::Required("yq.bindings.delete"), - NPerms::Optional("yq.resources.managePublic"), - NPerms::Optional("yq.resources.managePrivate") - }; - } }; - - return std::make_unique<TGrpcYqRequestOperationCall<YandexQuery::DeleteBindingRequest, YandexQuery::DeleteBindingResponse>>(ctx.Release(), &DoYandexQueryDeleteBindingRequest, permissions); -} - -} // namespace NGRpcService -} // namespace NKikimr diff --git a/ydb/core/grpc_services/service_yq.h b/ydb/core/grpc_services/service_yq.h deleted file mode 100644 index 0321df37ca..0000000000 --- a/ydb/core/grpc_services/service_yq.h +++ /dev/null @@ -1,119 +0,0 @@ -#pragma once - -#include <algorithm> -#include <memory> - -#include <ydb/core/base/ticket_parser.h> -#include <ydb/core/grpc_services/base/base.h> -#include <ydb/core/yq/libs/control_plane_proxy/utils.h> - -namespace NKikimr { -namespace NGRpcService { - -class IRequestOpCtx; -class IFacilityProvider; - -template <typename TReq, typename TResp> -class TGrpcYqRequestOperationCall : public TGrpcRequestOperationCall<TReq, TResp> { -public: - using TBase = TGrpcRequestOperationCall<TReq, TResp>; - using TBase::GetProtoRequest; - using TBase::GetPeerMetaValues; - using NPerms = NKikimr::TEvTicketParser::TEvAuthorizeTicket; - - const std::function<TVector<NPerms::TPermission>(const TReq&)>& Permissions; - TVector<TString> Sids; - - TGrpcYqRequestOperationCall(NGrpc::IRequestContextBase* ctx, - void (*cb)(std::unique_ptr<IRequestOpCtx>, const IFacilityProvider& f), - const std::function<TVector<NPerms::TPermission>(const TReq&)>& permissions) - : TGrpcRequestOperationCall<TReq, TResp>(ctx, cb, {}), Permissions(permissions) { - } - - bool TryCustomAttributeProcess(const TSchemeBoardEvents::TDescribeSchemeResult& , ICheckerIface* iface) override { - TString scope = GetPeerMetaValues("x-ydb-fq-project").GetOrElse(""); - if (scope.empty()) { - scope = GetPeerMetaValues("x-yq-scope").GetOrElse(""); // TODO: remove YQ-1055 - } - if (scope.StartsWith("yandexcloud://")) { - const TVector<TString> path = StringSplitter(scope).Split('/').SkipEmpty(); - if (path.size() == 2 || path.size() == 3) { - const TString& folderId = path.back(); - const auto& permissions = Permissions(*GetProtoRequest()); - TVector<TEvTicketParser::TEvAuthorizeTicket::TEntry> entries {{ - permissions, - { - {"folder_id", folderId} - } - }}; - std::transform(permissions.begin(), permissions.end(), std::back_inserter(Sids), - [](const auto& s) -> TString { return s.Permission + "@as"; }); - - auto serviceAccountId = NYq::ExtractServiceAccountId(*GetProtoRequest()); - if (serviceAccountId) { - entries.push_back({ - {{NPerms::Required("iam.serviceAccounts.use")}}, - { - {"service_account_id", serviceAccountId} - }}); - Sids.push_back("iam.serviceAccounts.use@as"); - } - - iface->SetEntries(entries); - return true; - } - } - - return false; - } -}; - -void DoYandexQueryCreateQueryRequest(std::unique_ptr<IRequestOpCtx> p, const IFacilityProvider& facility); -void DoYandexQueryListQueriesRequest(std::unique_ptr<IRequestOpCtx> p, const IFacilityProvider& facility); -void DoYandexQueryDescribeQueryRequest(std::unique_ptr<IRequestOpCtx> p, const IFacilityProvider& facility); -void DoYandexQueryGetQueryStatusRequest(std::unique_ptr<IRequestOpCtx> p, const IFacilityProvider& facility); -void DoYandexQueryModifyQueryRequest(std::unique_ptr<IRequestOpCtx> p, const IFacilityProvider& facility); -void DoYandexQueryDeleteQueryRequest(std::unique_ptr<IRequestOpCtx> p, const IFacilityProvider& facility); -void DoYandexQueryControlQueryRequest(std::unique_ptr<IRequestOpCtx> p, const IFacilityProvider& facility); -void DoYandexQueryGetResultDataRequest(std::unique_ptr<IRequestOpCtx> p, const IFacilityProvider& facility); -void DoYandexQueryListJobsRequest(std::unique_ptr<IRequestOpCtx> p, const IFacilityProvider& facility); -void DoYandexQueryDescribeJobRequest(std::unique_ptr<IRequestOpCtx> p, const IFacilityProvider& facility); -void DoYandexQueryCreateConnectionRequest(std::unique_ptr<IRequestOpCtx> p, const IFacilityProvider& facility); -void DoYandexQueryListConnectionsRequest(std::unique_ptr<IRequestOpCtx> p, const IFacilityProvider& facility); -void DoYandexQueryDescribeConnectionRequest(std::unique_ptr<IRequestOpCtx> p, const IFacilityProvider& facility); -void DoYandexQueryModifyConnectionRequest(std::unique_ptr<IRequestOpCtx> p, const IFacilityProvider& facility); -void DoYandexQueryDeleteConnectionRequest(std::unique_ptr<IRequestOpCtx> p, const IFacilityProvider& facility); -void DoYandexQueryTestConnectionRequest(std::unique_ptr<IRequestOpCtx> p, const IFacilityProvider& facility); -void DoYandexQueryCreateBindingRequest(std::unique_ptr<IRequestOpCtx> p, const IFacilityProvider& facility); -void DoYandexQueryListBindingsRequest(std::unique_ptr<IRequestOpCtx> p, const IFacilityProvider& facility); -void DoYandexQueryDescribeBindingRequest(std::unique_ptr<IRequestOpCtx> p, const IFacilityProvider& facility); -void DoYandexQueryModifyBindingRequest(std::unique_ptr<IRequestOpCtx> p, const IFacilityProvider& facility); -void DoYandexQueryDeleteBindingRequest(std::unique_ptr<IRequestOpCtx> p, const IFacilityProvider& facility); - -std::unique_ptr<TEvProxyRuntimeEvent> CreateCreateQueryRequestOperationCall(TIntrusivePtr<NGrpc::IRequestContextBase> ctx); -std::unique_ptr<TEvProxyRuntimeEvent> CreateListQueriesRequestOperationCall(TIntrusivePtr<NGrpc::IRequestContextBase> ctx); -std::unique_ptr<TEvProxyRuntimeEvent> CreateDescribeQueryRequestOperationCall(TIntrusivePtr<NGrpc::IRequestContextBase> ctx); -std::unique_ptr<TEvProxyRuntimeEvent> CreateGetQueryStatusRequestOperationCall(TIntrusivePtr<NGrpc::IRequestContextBase> ctx); -std::unique_ptr<TEvProxyRuntimeEvent> CreateModifyQueryRequestOperationCall(TIntrusivePtr<NGrpc::IRequestContextBase> ctx); -std::unique_ptr<TEvProxyRuntimeEvent> CreateDeleteQueryRequestOperationCall(TIntrusivePtr<NGrpc::IRequestContextBase> ctx); -std::unique_ptr<TEvProxyRuntimeEvent> CreateControlQueryRequestOperationCall(TIntrusivePtr<NGrpc::IRequestContextBase> ctx); -std::unique_ptr<TEvProxyRuntimeEvent> CreateGetResultDataRequestOperationCall(TIntrusivePtr<NGrpc::IRequestContextBase> ctx); - -std::unique_ptr<TEvProxyRuntimeEvent> CreateListJobsRequestOperationCall(TIntrusivePtr<NGrpc::IRequestContextBase> ctx); -std::unique_ptr<TEvProxyRuntimeEvent> CreateDescribeJobRequestOperationCall(TIntrusivePtr<NGrpc::IRequestContextBase> ctx); - -std::unique_ptr<TEvProxyRuntimeEvent> CreateCreateConnectionRequestOperationCall(TIntrusivePtr<NGrpc::IRequestContextBase> ctx); -std::unique_ptr<TEvProxyRuntimeEvent> CreateListConnectionsRequestOperationCall(TIntrusivePtr<NGrpc::IRequestContextBase> ctx); -std::unique_ptr<TEvProxyRuntimeEvent> CreateDescribeConnectionRequestOperationCall(TIntrusivePtr<NGrpc::IRequestContextBase> ctx); -std::unique_ptr<TEvProxyRuntimeEvent> CreateModifyConnectionRequestOperationCall(TIntrusivePtr<NGrpc::IRequestContextBase> ctx); -std::unique_ptr<TEvProxyRuntimeEvent> CreateDeleteConnectionRequestOperationCall(TIntrusivePtr<NGrpc::IRequestContextBase> ctx); -std::unique_ptr<TEvProxyRuntimeEvent> CreateTestConnectionRequestOperationCall(TIntrusivePtr<NGrpc::IRequestContextBase> ctx); - -std::unique_ptr<TEvProxyRuntimeEvent> CreateCreateBindingRequestOperationCall(TIntrusivePtr<NGrpc::IRequestContextBase> ctx); -std::unique_ptr<TEvProxyRuntimeEvent> CreateListBindingsRequestOperationCall(TIntrusivePtr<NGrpc::IRequestContextBase> ctx); -std::unique_ptr<TEvProxyRuntimeEvent> CreateDescribeBindingRequestOperationCall(TIntrusivePtr<NGrpc::IRequestContextBase> ctx); -std::unique_ptr<TEvProxyRuntimeEvent> CreateModifyBindingRequestOperationCall(TIntrusivePtr<NGrpc::IRequestContextBase> ctx); -std::unique_ptr<TEvProxyRuntimeEvent> CreateDeleteBindingRequestOperationCall(TIntrusivePtr<NGrpc::IRequestContextBase> ctx); - -} // namespace NGRpcService -} // namespace NKikimr diff --git a/ydb/core/testlib/CMakeLists.darwin-x86_64.txt b/ydb/core/testlib/CMakeLists.darwin-x86_64.txt index 82e750dc08..950fa554ed 100644 --- a/ydb/core/testlib/CMakeLists.darwin-x86_64.txt +++ b/ydb/core/testlib/CMakeLists.darwin-x86_64.txt @@ -96,7 +96,6 @@ target_link_libraries(ydb-core-testlib PUBLIC services-bg_tasks-ds_table ydb-services-bg_tasks ydb-services-ydb - ydb-services-yq ydb-core-http_proxy ) target_sources(ydb-core-testlib PRIVATE diff --git a/ydb/core/testlib/CMakeLists.linux-aarch64.txt b/ydb/core/testlib/CMakeLists.linux-aarch64.txt index 2a6f45b5b4..83ebee941f 100644 --- a/ydb/core/testlib/CMakeLists.linux-aarch64.txt +++ b/ydb/core/testlib/CMakeLists.linux-aarch64.txt @@ -97,7 +97,6 @@ target_link_libraries(ydb-core-testlib PUBLIC services-bg_tasks-ds_table ydb-services-bg_tasks ydb-services-ydb - ydb-services-yq ydb-core-http_proxy ) target_sources(ydb-core-testlib PRIVATE diff --git a/ydb/core/testlib/CMakeLists.linux-x86_64.txt b/ydb/core/testlib/CMakeLists.linux-x86_64.txt index 2a6f45b5b4..83ebee941f 100644 --- a/ydb/core/testlib/CMakeLists.linux-x86_64.txt +++ b/ydb/core/testlib/CMakeLists.linux-x86_64.txt @@ -97,7 +97,6 @@ target_link_libraries(ydb-core-testlib PUBLIC services-bg_tasks-ds_table ydb-services-bg_tasks ydb-services-ydb - ydb-services-yq ydb-core-http_proxy ) target_sources(ydb-core-testlib PRIVATE diff --git a/ydb/core/testlib/CMakeLists.windows-x86_64.txt b/ydb/core/testlib/CMakeLists.windows-x86_64.txt index 82e750dc08..950fa554ed 100644 --- a/ydb/core/testlib/CMakeLists.windows-x86_64.txt +++ b/ydb/core/testlib/CMakeLists.windows-x86_64.txt @@ -96,7 +96,6 @@ target_link_libraries(ydb-core-testlib PUBLIC services-bg_tasks-ds_table ydb-services-bg_tasks ydb-services-ydb - ydb-services-yq ydb-core-http_proxy ) target_sources(ydb-core-testlib PRIVATE diff --git a/ydb/core/testlib/test_client.cpp b/ydb/core/testlib/test_client.cpp index 145194530d..66bc9a76f3 100644 --- a/ydb/core/testlib/test_client.cpp +++ b/ydb/core/testlib/test_client.cpp @@ -7,7 +7,6 @@ #include <ydb/public/lib/base/msgbus.h> #include <ydb/core/grpc_services/grpc_request_proxy.h> #include <ydb/services/auth/grpc_service.h> -#include <ydb/services/yq/grpc_service.h> #include <ydb/services/fq/grpc_service.h> #include <ydb/services/fq/private_grpc.h> #include <ydb/services/cms/grpc_service.h> @@ -32,7 +31,6 @@ #include <ydb/services/persqueue_v1/topic.h> #include <ydb/services/persqueue_v1/grpc_pq_write.h> #include <ydb/services/monitoring/grpc_service.h> -#include <ydb/services/yq/grpc_service.h> #include <ydb/core/yq/libs/control_plane_proxy/control_plane_proxy.h> #include <ydb/core/yq/libs/control_plane_storage/control_plane_storage.h> #include <ydb/core/client/metadata/types_metadata.h> @@ -371,7 +369,6 @@ namespace Tests { GRpcServer->AddService(new NGRpcService::TGRpcMonitoringService(system, counters, grpcRequestProxies[0], true)); GRpcServer->AddService(new NGRpcService::TGRpcYdbQueryService(system, counters, grpcRequestProxies[0], true)); if (Settings->EnableYq) { - GRpcServer->AddService(new NGRpcService::TGRpcYandexQueryService(system, counters, grpcRequestProxies[0])); GRpcServer->AddService(new NGRpcService::TGRpcFederatedQueryService(system, counters, grpcRequestProxies[0])); GRpcServer->AddService(new NGRpcService::TGRpcFqPrivateTaskService(system, counters, grpcRequestProxies[0])); } diff --git a/ydb/core/yq/libs/actors/clusters_from_connections.cpp b/ydb/core/yq/libs/actors/clusters_from_connections.cpp index 4cb3a77e33..ab0a0c6ff1 100644 --- a/ydb/core/yq/libs/actors/clusters_from_connections.cpp +++ b/ydb/core/yq/libs/actors/clusters_from_connections.cpp @@ -17,20 +17,20 @@ namespace { template <typename TClusterConfig> void FillClusterAuth(TClusterConfig& clusterCfg, - const YandexQuery::IamAuth& auth, const TString& authToken, + const FederatedQuery::IamAuth& auth, const TString& authToken, const THashMap<TString, TString>& accountIdSignatures) { switch (auth.identity_case()) { - case YandexQuery::IamAuth::kNone: + case FederatedQuery::IamAuth::kNone: break; - case YandexQuery::IamAuth::kCurrentIam: + case FederatedQuery::IamAuth::kCurrentIam: clusterCfg.SetToken(authToken); break; - case YandexQuery::IamAuth::kServiceAccount: + case FederatedQuery::IamAuth::kServiceAccount: clusterCfg.SetServiceAccountId(auth.service_account().id()); clusterCfg.SetServiceAccountIdSignature(accountIdSignatures.at(auth.service_account().id())); break; // Do not replace with default. Adding a new auth item should cause a compilation error - case YandexQuery::IamAuth::IDENTITY_NOT_SET: + case FederatedQuery::IamAuth::IDENTITY_NOT_SET: break; } } @@ -38,7 +38,7 @@ void FillClusterAuth(TClusterConfig& clusterCfg, void FillPqClusterConfig(NYql::TPqClusterConfig& clusterConfig, const TString& name, bool useBearerForYdb, const TString& authToken, const THashMap<TString, TString>& accountIdSignatures, - const YandexQuery::DataStreams& ds) { + const FederatedQuery::DataStreams& ds) { clusterConfig.SetName(name); if (ds.endpoint()) { clusterConfig.SetEndpoint(ds.endpoint()); @@ -55,7 +55,7 @@ void FillS3ClusterConfig(NYql::TS3ClusterConfig& clusterConfig, const TString& name, const TString& authToken, const TString& objectStorageEndpoint, const THashMap<TString, TString>& accountIdSignatures, - const YandexQuery::ObjectStorageConnection& s3) { + const FederatedQuery::ObjectStorageConnection& s3) { clusterConfig.SetName(name); TString objectStorageUrl; @@ -76,7 +76,7 @@ void FillSolomonClusterConfig(NYql::TSolomonClusterConfig& clusterConfig, const TString& authToken, const TString& endpoint, const THashMap<TString, TString>& accountIdSignatures, - const YandexQuery::Monitoring& monitoring) { + const FederatedQuery::Monitoring& monitoring) { clusterConfig.SetName(name); clusterConfig.SetCluster(endpoint); @@ -90,7 +90,7 @@ void FillSolomonClusterConfig(NYql::TSolomonClusterConfig& clusterConfig, NYql::TPqClusterConfig CreatePqClusterConfig(const TString& name, bool useBearerForYdb, const TString& authToken, - const TString& accountSignature, const YandexQuery::DataStreams& ds) { + const TString& accountSignature, const FederatedQuery::DataStreams& ds) { NYql::TPqClusterConfig cluster; THashMap<TString, TString> accountIdSignatures; if (ds.auth().has_service_account()) { @@ -102,7 +102,7 @@ NYql::TPqClusterConfig CreatePqClusterConfig(const TString& name, NYql::TS3ClusterConfig CreateS3ClusterConfig(const TString& name, const TString& authToken, const TString& objectStorageEndpoint, - const TString& accountSignature, const YandexQuery::ObjectStorageConnection& s3) { + const TString& accountSignature, const FederatedQuery::ObjectStorageConnection& s3) { NYql::TS3ClusterConfig cluster; THashMap<TString, TString> accountIdSignatures; accountIdSignatures[s3.auth().service_account().id()] = accountSignature; @@ -114,7 +114,7 @@ NYql::TSolomonClusterConfig CreateSolomonClusterConfig(const TString& name, const TString& authToken, const TString& endpoint, const TString& accountSignature, - const YandexQuery::Monitoring& monitoring) { + const FederatedQuery::Monitoring& monitoring) { NYql::TSolomonClusterConfig cluster; THashMap<TString, TString> accountIdSignatures; accountIdSignatures[monitoring.auth().service_account().id()] = accountSignature; @@ -123,7 +123,7 @@ NYql::TSolomonClusterConfig CreateSolomonClusterConfig(const TString& name, } void AddClustersFromConnections( - const THashMap<TString, YandexQuery::Connection>& connections, + const THashMap<TString, FederatedQuery::Connection>& connections, bool useBearerForYdb, const TString& objectStorageEndpoint, const TString& monitoringEndpoint, @@ -135,7 +135,7 @@ void AddClustersFromConnections( for (const auto&[_, conn] : connections) { auto connectionName = conn.content().name(); switch (conn.content().setting().connection_case()) { - case YandexQuery::ConnectionSetting::kYdbDatabase: { + case FederatedQuery::ConnectionSetting::kYdbDatabase: { const auto& db = conn.content().setting().ydb_database(); auto* clusterCfg = gatewaysConfig.MutableYdb()->AddClusterMapping(); clusterCfg->SetName(connectionName); @@ -150,7 +150,7 @@ void AddClustersFromConnections( clusters.emplace(connectionName, YdbProviderName); break; } - case YandexQuery::ConnectionSetting::kClickhouseCluster: { + case FederatedQuery::ConnectionSetting::kClickhouseCluster: { const auto& ch = conn.content().setting().clickhouse_cluster(); auto* clusterCfg = gatewaysConfig.MutableClickHouse()->AddClusterMapping(); clusterCfg->SetName(connectionName); @@ -163,21 +163,21 @@ void AddClustersFromConnections( clusters.emplace(connectionName, ClickHouseProviderName); break; } - case YandexQuery::ConnectionSetting::kObjectStorage: { + case FederatedQuery::ConnectionSetting::kObjectStorage: { const auto& s3 = conn.content().setting().object_storage(); auto* clusterCfg = gatewaysConfig.MutableS3()->AddClusterMapping(); FillS3ClusterConfig(*clusterCfg, connectionName, authToken, objectStorageEndpoint, accountIdSignatures, s3); clusters.emplace(connectionName, S3ProviderName); break; } - case YandexQuery::ConnectionSetting::kDataStreams: { + case FederatedQuery::ConnectionSetting::kDataStreams: { const auto& ds = conn.content().setting().data_streams(); auto* clusterCfg = gatewaysConfig.MutablePq()->AddClusterMapping(); FillPqClusterConfig(*clusterCfg, connectionName, useBearerForYdb, authToken, accountIdSignatures, ds); clusters.emplace(connectionName, PqProviderName); break; } - case YandexQuery::ConnectionSetting::kMonitoring: { + case FederatedQuery::ConnectionSetting::kMonitoring: { const auto& monitoring = conn.content().setting().monitoring(); auto* clusterCfg = gatewaysConfig.MutableSolomon()->AddClusterMapping(); FillSolomonClusterConfig(*clusterCfg, connectionName, authToken, monitoringEndpoint, accountIdSignatures, monitoring); @@ -186,7 +186,7 @@ void AddClustersFromConnections( } // Do not replace with default. Adding a new connection should cause a compilation error - case YandexQuery::ConnectionSetting::CONNECTION_NOT_SET: + case FederatedQuery::ConnectionSetting::CONNECTION_NOT_SET: break; } } diff --git a/ydb/core/yq/libs/actors/clusters_from_connections.h b/ydb/core/yq/libs/actors/clusters_from_connections.h index 5661c4d950..17c2c54b6a 100644 --- a/ydb/core/yq/libs/actors/clusters_from_connections.h +++ b/ydb/core/yq/libs/actors/clusters_from_connections.h @@ -1,17 +1,17 @@ #pragma once #include <ydb/library/yql/providers/common/proto/gateways_config.pb.h> -#include <ydb/public/api/protos/yq.pb.h> +#include <ydb/public/api/protos/draft/fq.pb.h> namespace NYq { -NYql::TPqClusterConfig CreatePqClusterConfig(const TString& name, bool useBearerForYdb, const TString& authToken, const TString& accountSignature, const YandexQuery::DataStreams& ds); +NYql::TPqClusterConfig CreatePqClusterConfig(const TString& name, bool useBearerForYdb, const TString& authToken, const TString& accountSignature, const FederatedQuery::DataStreams& ds); -NYql::TS3ClusterConfig CreateS3ClusterConfig(const TString& name, const TString& authToken, const TString& objectStorageEndpoint, const TString& accountSignature, const YandexQuery::ObjectStorageConnection& s3); +NYql::TS3ClusterConfig CreateS3ClusterConfig(const TString& name, const TString& authToken, const TString& objectStorageEndpoint, const TString& accountSignature, const FederatedQuery::ObjectStorageConnection& s3); -NYql::TSolomonClusterConfig CreateSolomonClusterConfig(const TString& name, const TString& authToken, const TString& endpoint, const TString& accountSignature, const YandexQuery::Monitoring& monitoring); +NYql::TSolomonClusterConfig CreateSolomonClusterConfig(const TString& name, const TString& authToken, const TString& endpoint, const TString& accountSignature, const FederatedQuery::Monitoring& monitoring); -void AddClustersFromConnections(const THashMap<TString, YandexQuery::Connection>& connections, +void AddClustersFromConnections(const THashMap<TString, FederatedQuery::Connection>& connections, bool useBearerForYdb, const TString& objectStorageEndpoint, const TString& monitoringEndpoint, diff --git a/ydb/core/yq/libs/actors/pinger.cpp b/ydb/core/yq/libs/actors/pinger.cpp index bbce638faa..3f105cf44f 100644 --- a/ydb/core/yq/libs/actors/pinger.cpp +++ b/ydb/core/yq/libs/actors/pinger.cpp @@ -32,11 +32,11 @@ using namespace NFq; struct TEvPingResponse : public NActors::TEventLocal<TEvPingResponse, NActors::TEvents::TSystem::CallbackCompletion> { TPingTaskResult Result; - YandexQuery::QueryAction Action = YandexQuery::QUERY_ACTION_UNSPECIFIED; + FederatedQuery::QueryAction Action = FederatedQuery::QUERY_ACTION_UNSPECIFIED; explicit TEvPingResponse(TPingTaskResult&& result) : Result(std::move(result)) - , Action(Result.IsResultSet() ? Result.GetResult().action() : YandexQuery::QUERY_ACTION_UNSPECIFIED) + , Action(Result.IsResultSet() ? Result.GetResult().action() : FederatedQuery::QUERY_ACTION_UNSPECIFIED) { } @@ -252,7 +252,7 @@ private: } } - void SendQueryAction(YandexQuery::QueryAction action) { + void SendQueryAction(FederatedQuery::QueryAction action) { if (!Finishing) { Send(Parent, new TEvents::TEvQueryActionResult(action)); } @@ -331,8 +331,8 @@ private: LOG_T("Ping response success: " << ev->Get()->Result); StartLeaseTime = now; auto action = ev->Get()->Result.action(); - if (action != YandexQuery::QUERY_ACTION_UNSPECIFIED && !Finishing) { - LOG_D("Query action: " << YandexQuery::QueryAction_Name(action)); + if (action != FederatedQuery::QUERY_ACTION_UNSPECIFIED && !Finishing) { + LOG_D("Query action: " << FederatedQuery::QueryAction_Name(action)); SendQueryAction(action); } @@ -356,7 +356,7 @@ private: retryStateForLogging = continueLeaseRequest ? &RetryState : &ForwardRequests.front().RetryState; } LOG_E("Ping response error: " << errorMessage << ". Retried " << retryStateForLogging->GetRetriesCount() << " times during " << retryStateForLogging->GetRetryTime(now)); - auto action = ev->Get()->Status.IsSuccess() ? ev->Get()->Result.action() : YandexQuery::QUERY_ACTION_UNSPECIFIED; + auto action = ev->Get()->Status.IsSuccess() ? ev->Get()->Result.action() : FederatedQuery::QUERY_ACTION_UNSPECIFIED; Send(Parent, new TEvents::TEvForwardPingResponse(false, action), 0, ev->Cookie); FatalError = true; ForwardRequests.clear(); diff --git a/ydb/core/yq/libs/actors/run_actor.cpp b/ydb/core/yq/libs/actors/run_actor.cpp index ac7b89eec3..bb1774092b 100644 --- a/ydb/core/yq/libs/actors/run_actor.cpp +++ b/ydb/core/yq/libs/actors/run_actor.cpp @@ -131,7 +131,7 @@ public: const TString& sql, const TString& sessionId, const NSQLTranslation::TTranslationSettings& sqlSettings, - YandexQuery::ExecuteMode executeMode + FederatedQuery::ExecuteMode executeMode ) : RunActorId(runActorId) , FunctionRegistry(functionRegistry) @@ -162,7 +162,7 @@ public: return; } - if (ExecuteMode == YandexQuery::ExecuteMode::PARSE) { + if (ExecuteMode == FederatedQuery::ExecuteMode::PARSE) { SendStatusAndDie(TProgram::TStatus::Ok); return; } @@ -175,7 +175,7 @@ public: return; } - if (ExecuteMode == YandexQuery::ExecuteMode::COMPILE) { + if (ExecuteMode == FederatedQuery::ExecuteMode::COMPILE) { SendStatusAndDie(TProgram::TStatus::Ok); return; } @@ -186,13 +186,13 @@ public: // next phases can be async: optimize, validate, run TProgram::TFutureStatus futureStatus; switch (ExecuteMode) { - case YandexQuery::ExecuteMode::EXPLAIN: + case FederatedQuery::ExecuteMode::EXPLAIN: futureStatus = Program->OptimizeAsync(""); break; - case YandexQuery::ExecuteMode::VALIDATE: + case FederatedQuery::ExecuteMode::VALIDATE: futureStatus = Program->ValidateAsync(""); break; - case YandexQuery::ExecuteMode::RUN: + case FederatedQuery::ExecuteMode::RUN: futureStatus = Program->RunAsync(""); break; default: @@ -257,7 +257,7 @@ private: const TString Sql; const TString SessionId; const NSQLTranslation::TTranslationSettings SqlSettings; - const YandexQuery::ExecuteMode ExecuteMode; + const FederatedQuery::ExecuteMode ExecuteMode; bool Compiled = false; }; @@ -282,7 +282,7 @@ public: , Params(std::move(params)) , CreatedAt(Params.CreatedAt) , QueryCounters(queryCounters) - , EnableCheckpointCoordinator(Params.QueryType == YandexQuery::QueryContent::STREAMING && Params.Config.GetCheckpointCoordinator().GetEnabled()) + , EnableCheckpointCoordinator(Params.QueryType == FederatedQuery::QueryContent::STREAMING && Params.Config.GetCheckpointCoordinator().GetEnabled()) , MaxTasksPerStage(Params.Config.GetCommon().GetMaxTasksPerStage() ? Params.Config.GetCommon().GetMaxTasksPerStage() : 500) , MaxTasksPerOperation(Params.Config.GetCommon().GetMaxTasksPerOperation() ? Params.Config.GetCommon().GetMaxTasksPerOperation() : 40) , Compressor(Params.Config.GetCommon().GetQueryArtifactsCompressionMethod(), Params.Config.GetCommon().GetQueryArtifactsCompressionMinSize()) @@ -293,7 +293,7 @@ public: static constexpr char ActorName[] = "YQ_RUN_ACTOR"; void Bootstrap() { - LOG_D("Start run actor. Compute state: " << YandexQuery::QueryMeta::ComputeStatus_Name(Params.Status)); + LOG_D("Start run actor. Compute state: " << FederatedQuery::QueryMeta::ComputeStatus_Name(Params.Status)); FillConnections(); @@ -433,13 +433,13 @@ private: if (!EvalInfos.empty()) { for (auto& pair : EvalInfos) { auto& info = pair.second; - Send(info.ControlId, new NDq::TEvDq::TEvAbortExecution(NYql::NDqProto::StatusIds::ABORTED, YandexQuery::QueryMeta::ComputeStatus_Name(FinalQueryStatus))); + Send(info.ControlId, new NDq::TEvDq::TEvAbortExecution(NYql::NDqProto::StatusIds::ABORTED, FederatedQuery::QueryMeta::ComputeStatus_Name(FinalQueryStatus))); } } if (ControlId) { LOG_D("Cancel running query"); - Send(ControlId, new NDq::TEvDq::TEvAbortExecution(NYql::NDqProto::StatusIds::ABORTED, YandexQuery::QueryMeta::ComputeStatus_Name(FinalQueryStatus))); + Send(ControlId, new NDq::TEvDq::TEvAbortExecution(NYql::NDqProto::StatusIds::ABORTED, FederatedQuery::QueryMeta::ComputeStatus_Name(FinalQueryStatus))); } else { QueryResponseArrived = true; } @@ -452,7 +452,7 @@ private: } void AbortByExecutionTimeout() { - Abort("Execution time limit exceeded", YandexQuery::QueryMeta::ABORTED_BY_SYSTEM); + Abort("Execution time limit exceeded", FederatedQuery::QueryMeta::ABORTED_BY_SYSTEM); } bool TimeLimitExceeded() { @@ -536,27 +536,27 @@ private: } switch (Params.Status) { - case YandexQuery::QueryMeta::ABORTING_BY_USER: - case YandexQuery::QueryMeta::ABORTING_BY_SYSTEM: - case YandexQuery::QueryMeta::FAILING: - case YandexQuery::QueryMeta::COMPLETING: + case FederatedQuery::QueryMeta::ABORTING_BY_USER: + case FederatedQuery::QueryMeta::ABORTING_BY_SYSTEM: + case FederatedQuery::QueryMeta::FAILING: + case FederatedQuery::QueryMeta::COMPLETING: FinalizingStatusIsWritten = true; Finish(GetFinalStatusFromFinalizingStatus(Params.Status)); break; - case YandexQuery::QueryMeta::STARTING: + case FederatedQuery::QueryMeta::STARTING: QueryStateUpdateRequest.mutable_resources()->set_rate_limiter( Params.Config.GetRateLimiter().GetEnabled() ? Fq::Private::TaskResources::PREPARE : Fq::Private::TaskResources::NOT_NEEDED); QueryStateUpdateRequest.mutable_resources()->set_compilation(Fq::Private::TaskResources::PREPARE); // know nothing about read rules yet - Params.Status = YandexQuery::QueryMeta::RUNNING; // ??? - QueryStateUpdateRequest.set_status(YandexQuery::QueryMeta::RUNNING); + Params.Status = FederatedQuery::QueryMeta::RUNNING; // ??? + QueryStateUpdateRequest.set_status(FederatedQuery::QueryMeta::RUNNING); // DO NOT break here - case YandexQuery::QueryMeta::RESUMING: - case YandexQuery::QueryMeta::RUNNING: + case FederatedQuery::QueryMeta::RESUMING: + case FederatedQuery::QueryMeta::RUNNING: ProcessQuery(); break; default: - Abort("Fail to start query from unexpected status " + YandexQuery::QueryMeta::ComputeStatus_Name(Params.Status), YandexQuery::QueryMeta::FAILED); + Abort("Fail to start query from unexpected status " + FederatedQuery::QueryMeta::ComputeStatus_Name(Params.Status), FederatedQuery::QueryMeta::FAILED); break; } } @@ -573,7 +573,7 @@ private: } if (!Finishing) { - Abort("Internal Error", YandexQuery::QueryMeta::FAILED); + Abort("Internal Error", FederatedQuery::QueryMeta::FAILED); return; } @@ -588,8 +588,8 @@ private: } // If target status was successful, change it to failed because we are in internal error handler. - if (QueryStateUpdateRequest.status() == YandexQuery::QueryMeta::COMPLETED || QueryStateUpdateRequest.status() == YandexQuery::QueryMeta::PAUSED) { - QueryStateUpdateRequest.set_status(YandexQuery::QueryMeta::FAILED); + if (QueryStateUpdateRequest.status() == FederatedQuery::QueryMeta::COMPLETED || QueryStateUpdateRequest.status() == FederatedQuery::QueryMeta::PAUSED) { + QueryStateUpdateRequest.set_status(FederatedQuery::QueryMeta::FAILED); QueryStateUpdateRequest.set_status_code(NYql::NDqProto::StatusIds::INTERNAL_ERROR); } @@ -598,20 +598,20 @@ private: void Handle(TEvents::TEvQueryActionResult::TPtr& ev) { Action = ev->Get()->Action; - LOG_D("New query action received: " << YandexQuery::QueryAction_Name(Action)); + LOG_D("New query action received: " << FederatedQuery::QueryAction_Name(Action)); switch (Action) { - case YandexQuery::ABORT: - case YandexQuery::ABORT_GRACEFULLY: // not fully implemented + case FederatedQuery::ABORT: + case FederatedQuery::ABORT_GRACEFULLY: // not fully implemented // ignore issues in case of controlled abort - Finish(YandexQuery::QueryMeta::ABORTED_BY_USER); + Finish(FederatedQuery::QueryMeta::ABORTED_BY_USER); break; - case YandexQuery::PAUSE: // not implemented - case YandexQuery::PAUSE_GRACEFULLY: // not implemented - case YandexQuery::RESUME: // not implemented - Abort(TStringBuilder() << "Unsupported query action: " << YandexQuery::QueryAction_Name(Action), YandexQuery::QueryMeta::FAILED); + case FederatedQuery::PAUSE: // not implemented + case FederatedQuery::PAUSE_GRACEFULLY: // not implemented + case FederatedQuery::RESUME: // not implemented + Abort(TStringBuilder() << "Unsupported query action: " << FederatedQuery::QueryAction_Name(Action), FederatedQuery::QueryMeta::FAILED); break; default: - Abort(TStringBuilder() << "Unknown query action: " << YandexQuery::QueryAction_Name(Action), YandexQuery::QueryMeta::FAILED); + Abort(TStringBuilder() << "Unknown query action: " << FederatedQuery::QueryAction_Name(Action), FederatedQuery::QueryMeta::FAILED); break; } } @@ -784,7 +784,7 @@ private: bool AbortOnExceedingDqGraphsLimits() { TString errorMsg = CheckLimitsOfDqGraphs(); if (errorMsg) { - Abort(errorMsg, YandexQuery::QueryMeta::FAILED, Program->Issues()); + Abort(errorMsg, FederatedQuery::QueryMeta::FAILED, Program->Issues()); return true; } return false; @@ -937,7 +937,7 @@ private: void SetLoadFromCheckpointMode() { Fq::Private::PingTaskRequest request; - request.set_state_load_mode(YandexQuery::FROM_LAST_CHECKPOINT); + request.set_state_load_mode(FederatedQuery::FROM_LAST_CHECKPOINT); request.mutable_disposition()->mutable_from_last_checkpoint(); Send(Pinger, new TEvents::TEvForwardPingRequest(request), 0, SetLoadFromCheckpointModeCookie); @@ -1063,7 +1063,7 @@ private: } if (Finishing && !result.issues_size()) { // Race between abort and successful finishing. Override with success and provide results to user. - FinalQueryStatus = YandexQuery::QueryMeta::COMPLETED; + FinalQueryStatus = FederatedQuery::QueryMeta::COMPLETED; Issues.Clear(); } @@ -1200,7 +1200,7 @@ private: if (ev->Get()->Issues) { AddIssueWithSubIssues("Problems with read rules creation", ev->Get()->Issues); LOG_D(Issues.ToOneLineString()); - Finish(YandexQuery::QueryMeta::FAILED); + Finish(FederatedQuery::QueryMeta::FAILED); } else { QueryStateUpdateRequest.mutable_resources()->set_topic_consumers_state(Fq::Private::TaskResources::READY); ProcessQuery(); @@ -1271,7 +1271,7 @@ private: if (!ev->Get()->Status.IsSuccess()) { AddIssueWithSubIssues("Problems with rate limiter resource creation", ev->Get()->Status.GetIssues()); LOG_D(Issues.ToOneLineString()); - Finish(YandexQuery::QueryMeta::FAILED); + Finish(FederatedQuery::QueryMeta::FAILED); } else { Params.Resources.set_rate_limiter_path(ev->Get()->Result.rate_limiter()); QueryStateUpdateRequest.mutable_resources()->set_rate_limiter_path(ev->Get()->Result.rate_limiter()); @@ -1460,14 +1460,14 @@ private: apply("WatermarksIdlePartitions", "true"); switch (Params.QueryType) { - case YandexQuery::QueryContent::STREAMING: { + case FederatedQuery::QueryContent::STREAMING: { // - turn on check that query has one graph. apply("_OneGraphPerQuery", "1"); apply("_TableTimeout", "0"); apply("_LiteralTimeout", "0"); break; } - case YandexQuery::QueryContent::ANALYTICS: { + case FederatedQuery::QueryContent::ANALYTICS: { apply("AnalyticsHopping", "1"); const TString queryTimeoutMs = ToString(TDuration::Days(7).MilliSeconds()); apply("_TableTimeout", queryTimeoutMs); @@ -1493,84 +1493,84 @@ private: } } - YandexQuery::QueryMeta::ComputeStatus GetFinishStatus(bool isOk) const { + FederatedQuery::QueryMeta::ComputeStatus GetFinishStatus(bool isOk) const { if (isOk) { - return YandexQuery::QueryMeta::COMPLETED; + return FederatedQuery::QueryMeta::COMPLETED; } switch (Action) { - case YandexQuery::PAUSE: - case YandexQuery::PAUSE_GRACEFULLY: - case YandexQuery::ABORT: - case YandexQuery::ABORT_GRACEFULLY: - return YandexQuery::QueryMeta::ABORTED_BY_USER; - case YandexQuery::RESUME: - return YandexQuery::QueryMeta::ABORTED_BY_SYSTEM; - case YandexQuery::QUERY_ACTION_UNSPECIFIED: - case YandexQuery::QueryAction_INT_MIN_SENTINEL_DO_NOT_USE_: - case YandexQuery::QueryAction_INT_MAX_SENTINEL_DO_NOT_USE_: - return YandexQuery::QueryMeta::FAILED; + case FederatedQuery::PAUSE: + case FederatedQuery::PAUSE_GRACEFULLY: + case FederatedQuery::ABORT: + case FederatedQuery::ABORT_GRACEFULLY: + return FederatedQuery::QueryMeta::ABORTED_BY_USER; + case FederatedQuery::RESUME: + return FederatedQuery::QueryMeta::ABORTED_BY_SYSTEM; + case FederatedQuery::QUERY_ACTION_UNSPECIFIED: + case FederatedQuery::QueryAction_INT_MIN_SENTINEL_DO_NOT_USE_: + case FederatedQuery::QueryAction_INT_MAX_SENTINEL_DO_NOT_USE_: + return FederatedQuery::QueryMeta::FAILED; } } - YandexQuery::QueryMeta::ComputeStatus GetFinalizingStatus() { // Status before final. "*ING" one. + FederatedQuery::QueryMeta::ComputeStatus GetFinalizingStatus() { // Status before final. "*ING" one. switch (FinalQueryStatus) { - case YandexQuery::QueryMeta_ComputeStatus_QueryMeta_ComputeStatus_INT_MIN_SENTINEL_DO_NOT_USE_: - case YandexQuery::QueryMeta_ComputeStatus_QueryMeta_ComputeStatus_INT_MAX_SENTINEL_DO_NOT_USE_: - case YandexQuery::QueryMeta::COMPUTE_STATUS_UNSPECIFIED: - case YandexQuery::QueryMeta::STARTING: - case YandexQuery::QueryMeta::ABORTING_BY_USER: - case YandexQuery::QueryMeta::ABORTING_BY_SYSTEM: - case YandexQuery::QueryMeta::RESUMING: - case YandexQuery::QueryMeta::RUNNING: - case YandexQuery::QueryMeta::COMPLETING: - case YandexQuery::QueryMeta::FAILING: - case YandexQuery::QueryMeta::PAUSING: { + case FederatedQuery::QueryMeta_ComputeStatus_QueryMeta_ComputeStatus_INT_MIN_SENTINEL_DO_NOT_USE_: + case FederatedQuery::QueryMeta_ComputeStatus_QueryMeta_ComputeStatus_INT_MAX_SENTINEL_DO_NOT_USE_: + case FederatedQuery::QueryMeta::COMPUTE_STATUS_UNSPECIFIED: + case FederatedQuery::QueryMeta::STARTING: + case FederatedQuery::QueryMeta::ABORTING_BY_USER: + case FederatedQuery::QueryMeta::ABORTING_BY_SYSTEM: + case FederatedQuery::QueryMeta::RESUMING: + case FederatedQuery::QueryMeta::RUNNING: + case FederatedQuery::QueryMeta::COMPLETING: + case FederatedQuery::QueryMeta::FAILING: + case FederatedQuery::QueryMeta::PAUSING: { TStringBuilder msg; - msg << "\"" << YandexQuery::QueryMeta::ComputeStatus_Name(FinalQueryStatus) << "\" is not a final status for query"; + msg << "\"" << FederatedQuery::QueryMeta::ComputeStatus_Name(FinalQueryStatus) << "\" is not a final status for query"; Issues.AddIssue(msg); throw yexception() << msg; } - case YandexQuery::QueryMeta::ABORTED_BY_USER: - return YandexQuery::QueryMeta::ABORTING_BY_USER; - case YandexQuery::QueryMeta::ABORTED_BY_SYSTEM: - return YandexQuery::QueryMeta::ABORTING_BY_SYSTEM; - case YandexQuery::QueryMeta::COMPLETED: - return YandexQuery::QueryMeta::COMPLETING; - case YandexQuery::QueryMeta::FAILED: - return YandexQuery::QueryMeta::FAILING; - case YandexQuery::QueryMeta::PAUSED: - return YandexQuery::QueryMeta::PAUSING; + case FederatedQuery::QueryMeta::ABORTED_BY_USER: + return FederatedQuery::QueryMeta::ABORTING_BY_USER; + case FederatedQuery::QueryMeta::ABORTED_BY_SYSTEM: + return FederatedQuery::QueryMeta::ABORTING_BY_SYSTEM; + case FederatedQuery::QueryMeta::COMPLETED: + return FederatedQuery::QueryMeta::COMPLETING; + case FederatedQuery::QueryMeta::FAILED: + return FederatedQuery::QueryMeta::FAILING; + case FederatedQuery::QueryMeta::PAUSED: + return FederatedQuery::QueryMeta::PAUSING; } } - static YandexQuery::QueryMeta::ComputeStatus GetFinalStatusFromFinalizingStatus(YandexQuery::QueryMeta::ComputeStatus status) { + static FederatedQuery::QueryMeta::ComputeStatus GetFinalStatusFromFinalizingStatus(FederatedQuery::QueryMeta::ComputeStatus status) { switch (status) { - case YandexQuery::QueryMeta::ABORTING_BY_USER: - return YandexQuery::QueryMeta::ABORTED_BY_USER; - case YandexQuery::QueryMeta::ABORTING_BY_SYSTEM: - return YandexQuery::QueryMeta::ABORTED_BY_SYSTEM; - case YandexQuery::QueryMeta::COMPLETING: - return YandexQuery::QueryMeta::COMPLETED; - case YandexQuery::QueryMeta::FAILING: - return YandexQuery::QueryMeta::FAILED; + case FederatedQuery::QueryMeta::ABORTING_BY_USER: + return FederatedQuery::QueryMeta::ABORTED_BY_USER; + case FederatedQuery::QueryMeta::ABORTING_BY_SYSTEM: + return FederatedQuery::QueryMeta::ABORTED_BY_SYSTEM; + case FederatedQuery::QueryMeta::COMPLETING: + return FederatedQuery::QueryMeta::COMPLETED; + case FederatedQuery::QueryMeta::FAILING: + return FederatedQuery::QueryMeta::FAILED; default: - return YandexQuery::QueryMeta::COMPUTE_STATUS_UNSPECIFIED; + return FederatedQuery::QueryMeta::COMPUTE_STATUS_UNSPECIFIED; } } void WriteFinalizingStatus() { - const YandexQuery::QueryMeta::ComputeStatus finalizingStatus = GetFinalizingStatus(); + const FederatedQuery::QueryMeta::ComputeStatus finalizingStatus = GetFinalizingStatus(); Params.Status = finalizingStatus; - LOG_D("Write finalizing status: " << YandexQuery::QueryMeta::ComputeStatus_Name(finalizingStatus)); + LOG_D("Write finalizing status: " << FederatedQuery::QueryMeta::ComputeStatus_Name(finalizingStatus)); Fq::Private::PingTaskRequest request; request.set_status(finalizingStatus); Send(Pinger, new TEvents::TEvForwardPingRequest(request), 0, SaveFinalizingStatusCookie); } - void Finish(YandexQuery::QueryMeta::ComputeStatus status) { - LOG_D("Is about to finish query with status " << YandexQuery::QueryMeta::ComputeStatus_Name(status)); + void Finish(FederatedQuery::QueryMeta::ComputeStatus status) { + LOG_D("Is about to finish query with status " << FederatedQuery::QueryMeta::ComputeStatus_Name(status)); Finishing = true; FinalQueryStatus = status; @@ -1630,7 +1630,7 @@ private: */ if (!QueryStateUpdateRequest.issues_size() && IsAbortedStatus(QueryStateUpdateRequest.status())) { auto& issue = *QueryStateUpdateRequest.add_issues(); - issue.set_message(YandexQuery::QueryMeta::ComputeStatus_Name(QueryStateUpdateRequest.status())); + issue.set_message(FederatedQuery::QueryMeta::ComputeStatus_Name(QueryStateUpdateRequest.status())); issue.set_severity(NYql::TSeverityIds::S_ERROR); } @@ -1639,7 +1639,7 @@ private: PassAway(); } - void Abort(const TString& message, YandexQuery::QueryMeta::ComputeStatus status, const NYql::TIssues& issues = {}) { + void Abort(const TString& message, FederatedQuery::QueryMeta::ComputeStatus status, const NYql::TIssues& issues = {}) { AddIssueWithSubIssues(message, issues); Finish(status); } @@ -1734,7 +1734,7 @@ private: NSQLTranslation::TTranslationSettings sqlSettings; sqlSettings.ClusterMapping = clusters; sqlSettings.SyntaxVersion = 1; - sqlSettings.PgParser = (Params.QuerySyntax == YandexQuery::QueryContent::PG); + sqlSettings.PgParser = (Params.QuerySyntax == FederatedQuery::QueryContent::PG); sqlSettings.V0Behavior = NSQLTranslation::EV0Behavior::Disable; sqlSettings.Flags.insert({ "DqEngineEnable", "DqEngineForce", "DisableAnsiOptionalAs", "FlexibleTypes" }); try { @@ -1806,7 +1806,7 @@ private: if (abortMessage == "") { abortMessage = TStringBuilder() << "Run query failed: " << ToString(status); } - Abort(abortMessage, YandexQuery::QueryMeta::FAILED, issues); + Abort(abortMessage, FederatedQuery::QueryMeta::FAILED, issues); } } @@ -1855,11 +1855,11 @@ private: html << "<tr><td>Owner</td><td>" << Params.Owner << "</td></tr>"; html << "<tr><td>Result ID</td><td>" << Params.ResultId << "</td></tr>"; html << "<tr><td>Prev Rev</td><td>" << Params.PreviousQueryRevision << "</td></tr>"; - html << "<tr><td>Query Type</td><td>" << YandexQuery::QueryContent::QueryType_Name(Params.QueryType) << "</td></tr>"; - html << "<tr><td>Exec Mode</td><td>" << YandexQuery::ExecuteMode_Name(Params.ExecuteMode) << "</td></tr>"; - html << "<tr><td>St Load Mode</td><td>" << YandexQuery::StateLoadMode_Name(Params.StateLoadMode) << "</td></tr>"; + html << "<tr><td>Query Type</td><td>" << FederatedQuery::QueryContent::QueryType_Name(Params.QueryType) << "</td></tr>"; + html << "<tr><td>Exec Mode</td><td>" << FederatedQuery::ExecuteMode_Name(Params.ExecuteMode) << "</td></tr>"; + html << "<tr><td>St Load Mode</td><td>" << FederatedQuery::StateLoadMode_Name(Params.StateLoadMode) << "</td></tr>"; html << "<tr><td>Disposition</td><td>" << Params.StreamingDisposition << "</td></tr>"; - html << "<tr><td>Status</td><td>" << YandexQuery::QueryMeta::ComputeStatus_Name(Params.Status) << "</td></tr>"; + html << "<tr><td>Status</td><td>" << FederatedQuery::QueryMeta::ComputeStatus_Name(Params.Status) << "</td></tr>"; html << "</tbody></table>"; if (Params.Connections.size()) { @@ -1875,19 +1875,19 @@ private: html << "<td>" << connection.content().name() << "</td>"; html << "<td>"; switch (connection.content().setting().connection_case()) { - case YandexQuery::ConnectionSetting::kYdbDatabase: + case FederatedQuery::ConnectionSetting::kYdbDatabase: html << "YDB"; break; - case YandexQuery::ConnectionSetting::kClickhouseCluster: + case FederatedQuery::ConnectionSetting::kClickhouseCluster: html << "CLICKHOUSE"; break; - case YandexQuery::ConnectionSetting::kObjectStorage: + case FederatedQuery::ConnectionSetting::kObjectStorage: html << "OBJECT STORAGE"; break; - case YandexQuery::ConnectionSetting::kDataStreams: + case FederatedQuery::ConnectionSetting::kDataStreams: html << "DATA STREAMS"; break; - case YandexQuery::ConnectionSetting::kMonitoring: + case FederatedQuery::ConnectionSetting::kMonitoring: html << "MONITORING"; break; default: @@ -1916,10 +1916,10 @@ private: html << "<td>" << binding.content().name() << "</td>"; html << "<td>"; switch (binding.content().setting().binding_case()) { - case YandexQuery::BindingSetting::kDataStreams: + case FederatedQuery::BindingSetting::kDataStreams: html << "DATA STREAMS"; break; - case YandexQuery::BindingSetting::kObjectStorage: + case FederatedQuery::BindingSetting::kObjectStorage: html << "OBJECT STORAGE"; break; default: @@ -1966,12 +1966,12 @@ private: << " Connections: " << Params.Connections.size() << " Bindings: " << Params.Bindings.size() << " AccountIdSignatures: " << Params.AccountIdSignatures.size() - << " QueryType: " << YandexQuery::QueryContent::QueryType_Name(Params.QueryType) - << " ExecuteMode: " << YandexQuery::ExecuteMode_Name(Params.ExecuteMode) + << " QueryType: " << FederatedQuery::QueryContent::QueryType_Name(Params.QueryType) + << " ExecuteMode: " << FederatedQuery::ExecuteMode_Name(Params.ExecuteMode) << " ResultId: " << Params.ResultId - << " StateLoadMode: " << YandexQuery::StateLoadMode_Name(Params.StateLoadMode) + << " StateLoadMode: " << FederatedQuery::StateLoadMode_Name(Params.StateLoadMode) << " StreamingDisposition: " << Params.StreamingDisposition - << " Status: " << YandexQuery::QueryMeta::ComputeStatus_Name(Params.Status) + << " Status: " << FederatedQuery::QueryMeta::ComputeStatus_Name(Params.Status) << " DqGraphs: " << Params.DqGraphs.size() << " DqGraphIndex: " << Params.DqGraphIndex << " Resource.TopicConsumers: " << Params.Resources.topic_consumers().size() @@ -1982,7 +1982,7 @@ private: TActorId FetcherId; TActorId ProgramRunnerId; TRunActorParams Params; - THashMap<TString, YandexQuery::Connection> YqConnections; + THashMap<TString, FederatedQuery::Connection> YqConnections; TProgramPtr Program; TIssues Issues; @@ -1991,7 +1991,7 @@ private: TInstant Deadline; TActorId Pinger; TInstant CreatedAt; - YandexQuery::QueryAction Action = YandexQuery::QueryAction::QUERY_ACTION_UNSPECIFIED; + FederatedQuery::QueryAction Action = FederatedQuery::QueryAction::QUERY_ACTION_UNSPECIFIED; TMap<NActors::TActorId, TEvaluationGraphInfo> EvalInfos; std::vector<NYq::NProto::TGraphParams> DqGraphParams; std::vector<i32> DqGrapResultIndices; @@ -2023,7 +2023,7 @@ private: bool ConsumersAreDeleted = false; bool FinalizingStatusIsWritten = false; bool QueryResponseArrived = false; - YandexQuery::QueryMeta::ComputeStatus FinalQueryStatus = YandexQuery::QueryMeta::COMPUTE_STATUS_UNSPECIFIED; // Status that will be assigned to query after it finishes. + FederatedQuery::QueryMeta::ComputeStatus FinalQueryStatus = FederatedQuery::QueryMeta::COMPUTE_STATUS_UNSPECIFIED; // Status that will be assigned to query after it finishes. // Cookies for pings enum : ui64 { diff --git a/ydb/core/yq/libs/actors/run_actor_params.cpp b/ydb/core/yq/libs/actors/run_actor_params.cpp index 7c634164f0..593f3648f1 100644 --- a/ydb/core/yq/libs/actors/run_actor_params.cpp +++ b/ydb/core/yq/libs/actors/run_actor_params.cpp @@ -23,19 +23,19 @@ TRunActorParams::TRunActorParams( const TString& userId, const TString& owner, const int64_t previousQueryRevision, - TVector<YandexQuery::Connection> connections, - TVector<YandexQuery::Binding> bindings, + TVector<FederatedQuery::Connection> connections, + TVector<FederatedQuery::Binding> bindings, NYql::ISecuredServiceAccountCredentialsFactory::TPtr credentialsFactory, THashMap<TString, TString> accountIdSignatures, - YandexQuery::QueryContent::QueryType queryType, - YandexQuery::QueryContent::QuerySyntax querySyntax, - YandexQuery::ExecuteMode executeMode, + FederatedQuery::QueryContent::QueryType queryType, + FederatedQuery::QueryContent::QuerySyntax querySyntax, + FederatedQuery::ExecuteMode executeMode, const TString& resultId, - const YandexQuery::StateLoadMode stateLoadMode, - const YandexQuery::StreamingDisposition& streamingDisposition, - YandexQuery::QueryMeta::ComputeStatus status, + const FederatedQuery::StateLoadMode stateLoadMode, + const FederatedQuery::StreamingDisposition& streamingDisposition, + FederatedQuery::QueryMeta::ComputeStatus status, const TString& cloudId, - TVector<YandexQuery::ResultSetMeta> resultSetMetas, + TVector<FederatedQuery::ResultSetMeta> resultSetMetas, TVector<TString> dqGraphs, int32_t dqGraphIndex, bool automatic, diff --git a/ydb/core/yq/libs/actors/run_actor_params.h b/ydb/core/yq/libs/actors/run_actor_params.h index d2115f9f03..0471179589 100644 --- a/ydb/core/yq/libs/actors/run_actor_params.h +++ b/ydb/core/yq/libs/actors/run_actor_params.h @@ -40,19 +40,19 @@ struct TRunActorParams { // TODO2 : Change name const TString& userId, const TString& owner, const int64_t previousQueryRevision, - TVector<YandexQuery::Connection> connections, - TVector<YandexQuery::Binding> bindings, + TVector<FederatedQuery::Connection> connections, + TVector<FederatedQuery::Binding> bindings, NYql::ISecuredServiceAccountCredentialsFactory::TPtr credentialsFactory, THashMap<TString, TString> accountIdSignatures, - YandexQuery::QueryContent::QueryType queryType, - YandexQuery::QueryContent::QuerySyntax querySyntax, - YandexQuery::ExecuteMode executeMode, + FederatedQuery::QueryContent::QueryType queryType, + FederatedQuery::QueryContent::QuerySyntax querySyntax, + FederatedQuery::ExecuteMode executeMode, const TString& resultId, - const YandexQuery::StateLoadMode stateLoadMode, - const YandexQuery::StreamingDisposition& streamingDisposition, - YandexQuery::QueryMeta::ComputeStatus status, + const FederatedQuery::StateLoadMode stateLoadMode, + const FederatedQuery::StreamingDisposition& streamingDisposition, + FederatedQuery::QueryMeta::ComputeStatus status, const TString& cloudId, - TVector<YandexQuery::ResultSetMeta> resultSetMetas, + TVector<FederatedQuery::ResultSetMeta> resultSetMetas, TVector<TString> dqGraphs, int32_t dqGraphIndex, bool automatic, @@ -91,19 +91,19 @@ struct TRunActorParams { // TODO2 : Change name const TString UserId; const TString Owner; const int64_t PreviousQueryRevision; - const TVector<YandexQuery::Connection> Connections; - const TVector<YandexQuery::Binding> Bindings; + const TVector<FederatedQuery::Connection> Connections; + const TVector<FederatedQuery::Binding> Bindings; const NYql::ISecuredServiceAccountCredentialsFactory::TPtr CredentialsFactory; const THashMap<TString, TString> AccountIdSignatures; - const YandexQuery::QueryContent::QueryType QueryType; - const YandexQuery::QueryContent::QuerySyntax QuerySyntax; - const YandexQuery::ExecuteMode ExecuteMode; + const FederatedQuery::QueryContent::QueryType QueryType; + const FederatedQuery::QueryContent::QuerySyntax QuerySyntax; + const FederatedQuery::ExecuteMode ExecuteMode; const TString ResultId; - const YandexQuery::StateLoadMode StateLoadMode; - const YandexQuery::StreamingDisposition StreamingDisposition; - YandexQuery::QueryMeta::ComputeStatus Status; + const FederatedQuery::StateLoadMode StateLoadMode; + const FederatedQuery::StreamingDisposition StreamingDisposition; + FederatedQuery::QueryMeta::ComputeStatus Status; const TString CloudId; - const TVector<YandexQuery::ResultSetMeta> ResultSetMetas; + const TVector<FederatedQuery::ResultSetMeta> ResultSetMetas; const TVector<TString> DqGraphs; const int32_t DqGraphIndex; diff --git a/ydb/core/yq/libs/actors/table_bindings_from_bindings.cpp b/ydb/core/yq/libs/actors/table_bindings_from_bindings.cpp index 95a71b6c2f..3f8edf340f 100644 --- a/ydb/core/yq/libs/actors/table_bindings_from_bindings.cpp +++ b/ydb/core/yq/libs/actors/table_bindings_from_bindings.cpp @@ -13,7 +13,7 @@ using namespace NYql; namespace { -void FillBinding(NSQLTranslation::TTranslationSettings& sqlSettings, const YandexQuery::Binding& binding, const THashMap<TString, YandexQuery::Connection>& connections) { +void FillBinding(NSQLTranslation::TTranslationSettings& sqlSettings, const FederatedQuery::Binding& binding, const THashMap<TString, FederatedQuery::Connection>& connections) { TString clusterType; TString path; TString format; @@ -23,7 +23,7 @@ void FillBinding(NSQLTranslation::TTranslationSettings& sqlSettings, const Yande NSc::TValue projection; NSc::TValue partitionedBy; switch (binding.content().setting().binding_case()) { - case YandexQuery::BindingSetting::kDataStreams: { + case FederatedQuery::BindingSetting::kDataStreams: { clusterType = PqProviderName; auto yds = binding.content().setting().data_streams(); path = yds.stream_name(); @@ -33,7 +33,7 @@ void FillBinding(NSQLTranslation::TTranslationSettings& sqlSettings, const Yande formatSettings = {yds.format_setting().begin(), yds.format_setting().end()}; break; } - case YandexQuery::BindingSetting::kObjectStorage: { + case FederatedQuery::BindingSetting::kObjectStorage: { clusterType = S3ProviderName; const auto s3 = binding.content().setting().object_storage(); if (s3.subset().empty()) { @@ -53,7 +53,7 @@ void FillBinding(NSQLTranslation::TTranslationSettings& sqlSettings, const Yande break; } - case YandexQuery::BindingSetting::BINDING_NOT_SET: { + case FederatedQuery::BindingSetting::BINDING_NOT_SET: { throw yexception() << "BINDING_NOT_SET case for binding " << binding.meta().id() << ", name " << binding.content().name(); } // Do not add default. Adding a new binding should cause a compilation error @@ -90,7 +90,7 @@ void FillBinding(NSQLTranslation::TTranslationSettings& sqlSettings, const Yande } //namespace -void AddTableBindingsFromBindings(const TVector<YandexQuery::Binding>& bindings, const THashMap<TString, YandexQuery::Connection>& connections, NSQLTranslation::TTranslationSettings& sqlSettings) { +void AddTableBindingsFromBindings(const TVector<FederatedQuery::Binding>& bindings, const THashMap<TString, FederatedQuery::Connection>& connections, NSQLTranslation::TTranslationSettings& sqlSettings) { for (const auto& binding : bindings) { FillBinding(sqlSettings, binding, connections); } diff --git a/ydb/core/yq/libs/actors/table_bindings_from_bindings.h b/ydb/core/yq/libs/actors/table_bindings_from_bindings.h index 76343b06dc..d9997462e1 100644 --- a/ydb/core/yq/libs/actors/table_bindings_from_bindings.h +++ b/ydb/core/yq/libs/actors/table_bindings_from_bindings.h @@ -1,10 +1,10 @@ #pragma once #include <ydb/library/yql/sql/settings/translation_settings.h> -#include <ydb/public/api/protos/yq.pb.h> +#include <ydb/public/api/protos/draft/fq.pb.h> namespace NYq { -void AddTableBindingsFromBindings(const TVector<YandexQuery::Binding>& bindings, const THashMap<TString, YandexQuery::Connection>& connections, NSQLTranslation::TTranslationSettings& sqlSettings); +void AddTableBindingsFromBindings(const TVector<FederatedQuery::Binding>& bindings, const THashMap<TString, FederatedQuery::Connection>& connections, NSQLTranslation::TTranslationSettings& sqlSettings); } //NYq diff --git a/ydb/core/yq/libs/audit/events/events.h b/ydb/core/yq/libs/audit/events/events.h index 15026dc082..6c1067d720 100644 --- a/ydb/core/yq/libs/audit/events/events.h +++ b/ydb/core/yq/libs/audit/events/events.h @@ -2,7 +2,7 @@ #include <ydb/library/yql/public/issue/yql_issue.h> -#include <ydb/public/api/protos/yq.pb.h> +#include <ydb/public/api/protos/draft/fq.pb.h> #include <ydb/core/yq/libs/control_plane_storage/events/events.h> #include <ydb/core/yq/libs/checkpointing_common/defs.h> @@ -72,102 +72,102 @@ public: struct TAuditReport; // CreateBinding - using CreateBindingAuditReport = TAuditReport<YandexQuery::CreateBindingRequest, YandexQuery::Binding>; + using CreateBindingAuditReport = TAuditReport<FederatedQuery::CreateBindingRequest, FederatedQuery::Binding>; template<> - struct TAuditReport<YandexQuery::CreateBindingRequest, YandexQuery::Binding> + struct TAuditReport<FederatedQuery::CreateBindingRequest, FederatedQuery::Binding> : NActors::TEventLocal<CreateBindingAuditReport, EvCreateBindingReport> - , TAuditReportBase<YandexQuery::CreateBindingRequest, YandexQuery::Binding> { + , TAuditReportBase<FederatedQuery::CreateBindingRequest, FederatedQuery::Binding> { using TAuditReportBase::TAuditReportBase; }; // ModifyBinding - using ModifyBindingAuditReport = TAuditReport<YandexQuery::ModifyBindingRequest, YandexQuery::Binding>; + using ModifyBindingAuditReport = TAuditReport<FederatedQuery::ModifyBindingRequest, FederatedQuery::Binding>; template<> - struct TAuditReport<YandexQuery::ModifyBindingRequest, YandexQuery::Binding> + struct TAuditReport<FederatedQuery::ModifyBindingRequest, FederatedQuery::Binding> : NActors::TEventLocal<ModifyBindingAuditReport, EvModifyBindingReport> - , TAuditReportBase<YandexQuery::ModifyBindingRequest, YandexQuery::Binding> { + , TAuditReportBase<FederatedQuery::ModifyBindingRequest, FederatedQuery::Binding> { using TAuditReportBase::TAuditReportBase; }; // DeleteBinding - using DeleteBindingAuditReport = TAuditReport<YandexQuery::DeleteBindingRequest, YandexQuery::Binding>; + using DeleteBindingAuditReport = TAuditReport<FederatedQuery::DeleteBindingRequest, FederatedQuery::Binding>; template<> - struct TAuditReport<YandexQuery::DeleteBindingRequest, YandexQuery::Binding> + struct TAuditReport<FederatedQuery::DeleteBindingRequest, FederatedQuery::Binding> : NActors::TEventLocal<DeleteBindingAuditReport, EvDeleteBindingReport> - , TAuditReportBase<YandexQuery::DeleteBindingRequest, YandexQuery::Binding> { + , TAuditReportBase<FederatedQuery::DeleteBindingRequest, FederatedQuery::Binding> { using TAuditReportBase::TAuditReportBase; }; // CreateConnection - using CreateConnectionAuditReport = TAuditReport<YandexQuery::CreateConnectionRequest, YandexQuery::Connection>; + using CreateConnectionAuditReport = TAuditReport<FederatedQuery::CreateConnectionRequest, FederatedQuery::Connection>; template<> - struct TAuditReport<YandexQuery::CreateConnectionRequest, YandexQuery::Connection> + struct TAuditReport<FederatedQuery::CreateConnectionRequest, FederatedQuery::Connection> : NActors::TEventLocal<CreateConnectionAuditReport, EvCreateConnectionReport> - , TAuditReportBase<YandexQuery::CreateConnectionRequest, YandexQuery::Connection> { + , TAuditReportBase<FederatedQuery::CreateConnectionRequest, FederatedQuery::Connection> { using TAuditReportBase::TAuditReportBase; }; // ModifyConnection - using ModifyConnectionAuditReport = TAuditReport<YandexQuery::ModifyConnectionRequest, YandexQuery::Connection>; + using ModifyConnectionAuditReport = TAuditReport<FederatedQuery::ModifyConnectionRequest, FederatedQuery::Connection>; template<> - struct TAuditReport<YandexQuery::ModifyConnectionRequest, YandexQuery::Connection> + struct TAuditReport<FederatedQuery::ModifyConnectionRequest, FederatedQuery::Connection> : NActors::TEventLocal<ModifyConnectionAuditReport, EvModifyConnectionReport> - , TAuditReportBase<YandexQuery::ModifyConnectionRequest, YandexQuery::Connection> { + , TAuditReportBase<FederatedQuery::ModifyConnectionRequest, FederatedQuery::Connection> { using TAuditReportBase::TAuditReportBase; }; // DeleteConnection - using DeleteConnectionAuditReport = TAuditReport<YandexQuery::DeleteConnectionRequest, YandexQuery::Connection>; + using DeleteConnectionAuditReport = TAuditReport<FederatedQuery::DeleteConnectionRequest, FederatedQuery::Connection>; template<> - struct TAuditReport<YandexQuery::DeleteConnectionRequest, YandexQuery::Connection> + struct TAuditReport<FederatedQuery::DeleteConnectionRequest, FederatedQuery::Connection> : NActors::TEventLocal<DeleteConnectionAuditReport, EvDeleteConnectionReport> - , TAuditReportBase<YandexQuery::DeleteConnectionRequest, YandexQuery::Connection> { + , TAuditReportBase<FederatedQuery::DeleteConnectionRequest, FederatedQuery::Connection> { using TAuditReportBase::TAuditReportBase; }; // CreateQuery - using CreateQueryAuditReport = TAuditReport<YandexQuery::CreateQueryRequest, YandexQuery::Query>; + using CreateQueryAuditReport = TAuditReport<FederatedQuery::CreateQueryRequest, FederatedQuery::Query>; template<> - struct TAuditReport<YandexQuery::CreateQueryRequest, YandexQuery::Query> + struct TAuditReport<FederatedQuery::CreateQueryRequest, FederatedQuery::Query> : NActors::TEventLocal<CreateQueryAuditReport, EvCreateQueryReport> - , TAuditReportBase<YandexQuery::CreateQueryRequest, YandexQuery::Query> { + , TAuditReportBase<FederatedQuery::CreateQueryRequest, FederatedQuery::Query> { using TAuditReportBase::TAuditReportBase; }; // ControlQuery - using ControlQueryAuditReport = TAuditReport<YandexQuery::ControlQueryRequest, YandexQuery::Query>; + using ControlQueryAuditReport = TAuditReport<FederatedQuery::ControlQueryRequest, FederatedQuery::Query>; template<> - struct TAuditReport<YandexQuery::ControlQueryRequest, YandexQuery::Query> + struct TAuditReport<FederatedQuery::ControlQueryRequest, FederatedQuery::Query> : NActors::TEventLocal<ControlQueryAuditReport, EvControlQueryReport> - , TAuditReportBase<YandexQuery::ControlQueryRequest, YandexQuery::Query> { + , TAuditReportBase<FederatedQuery::ControlQueryRequest, FederatedQuery::Query> { using TAuditReportBase::TAuditReportBase; }; // ModifyQuery - using ModifyQueryAuditReport = TAuditReport<YandexQuery::ModifyQueryRequest, YandexQuery::Query>; + using ModifyQueryAuditReport = TAuditReport<FederatedQuery::ModifyQueryRequest, FederatedQuery::Query>; template<> - struct TAuditReport<YandexQuery::ModifyQueryRequest, YandexQuery::Query> + struct TAuditReport<FederatedQuery::ModifyQueryRequest, FederatedQuery::Query> : NActors::TEventLocal<ModifyQueryAuditReport, EvModifyQueryReport> - , TAuditReportBase<YandexQuery::ModifyQueryRequest, YandexQuery::Query> { + , TAuditReportBase<FederatedQuery::ModifyQueryRequest, FederatedQuery::Query> { using TAuditReportBase::TAuditReportBase; }; // DeleteQuery - using DeleteQueryAuditReport = TAuditReport<YandexQuery::DeleteQueryRequest, YandexQuery::Query>; + using DeleteQueryAuditReport = TAuditReport<FederatedQuery::DeleteQueryRequest, FederatedQuery::Query>; template<> - struct TAuditReport<YandexQuery::DeleteQueryRequest, YandexQuery::Query> + struct TAuditReport<FederatedQuery::DeleteQueryRequest, FederatedQuery::Query> : NActors::TEventLocal<DeleteQueryAuditReport, EvDeleteQueryReport> - , TAuditReportBase<YandexQuery::DeleteQueryRequest, YandexQuery::Query> { + , TAuditReportBase<FederatedQuery::DeleteQueryRequest, FederatedQuery::Query> { using TAuditReportBase::TAuditReportBase; }; diff --git a/ydb/core/yq/libs/checkpointing/checkpoint_coordinator.cpp b/ydb/core/yq/libs/checkpointing/checkpoint_coordinator.cpp index 7780443d26..1b967679fd 100644 --- a/ydb/core/yq/libs/checkpointing/checkpoint_coordinator.cpp +++ b/ydb/core/yq/libs/checkpointing/checkpoint_coordinator.cpp @@ -33,8 +33,8 @@ TCheckpointCoordinator::TCheckpointCoordinator(TCoordinatorId coordinatorId, const TCheckpointCoordinatorConfig& settings, const ::NMonitoring::TDynamicCounterPtr& counters, const NProto::TGraphParams& graphParams, - const YandexQuery::StateLoadMode& stateLoadMode, - const YandexQuery::StreamingDisposition& streamingDisposition, + const FederatedQuery::StateLoadMode& stateLoadMode, + const FederatedQuery::StreamingDisposition& streamingDisposition, // vvv TaskController temporary params vvv const TString& traceId, const NActors::TActorId& executerId, @@ -67,7 +67,7 @@ TCheckpointCoordinator::TCheckpointCoordinator(TCoordinatorId coordinatorId, void TCheckpointCoordinator::Handle(NYql::NDqs::TEvReadyState::TPtr& ev) { NYql::TTaskControllerImpl<TCheckpointCoordinator>::OnReadyState(ev); - CC_LOG_D("TEvReadyState, streaming disposition " << StreamingDisposition << ", state load mode " << YandexQuery::StateLoadMode_Name(StateLoadMode)); + CC_LOG_D("TEvReadyState, streaming disposition " << StreamingDisposition << ", state load mode " << FederatedQuery::StateLoadMode_Name(StateLoadMode)); const auto& tasks = ev->Get()->Record.GetTask(); const auto& actorIds = ev->Get()->Record.GetActorId(); @@ -137,10 +137,10 @@ void TCheckpointCoordinator::Handle(const TEvCheckpointStorage::TEvRegisterCoord transport->EventsQueue.Send(new NYql::NDq::TEvDqCompute::TEvNewCheckpointCoordinator(CoordinatorId.Generation, CoordinatorId.GraphId)); } - const bool needCheckpointMetadata = StateLoadMode == YandexQuery::StateLoadMode::FROM_LAST_CHECKPOINT || StreamingDisposition.has_from_last_checkpoint(); + const bool needCheckpointMetadata = StateLoadMode == FederatedQuery::StateLoadMode::FROM_LAST_CHECKPOINT || StreamingDisposition.has_from_last_checkpoint(); if (needCheckpointMetadata) { - const bool loadGraphDescription = StateLoadMode == YandexQuery::StateLoadMode::EMPTY && StreamingDisposition.has_from_last_checkpoint(); // Continue mode - CC_LOG_I("Send TEvGetCheckpointsMetadataRequest; state load mode: " << YandexQuery::StateLoadMode_Name(StateLoadMode) << "; load graph: " << loadGraphDescription); + const bool loadGraphDescription = StateLoadMode == FederatedQuery::StateLoadMode::EMPTY && StreamingDisposition.has_from_last_checkpoint(); // Continue mode + CC_LOG_I("Send TEvGetCheckpointsMetadataRequest; state load mode: " << FederatedQuery::StateLoadMode_Name(StateLoadMode) << "; load graph: " << loadGraphDescription); Send(StorageProxy, new TEvCheckpointStorage::TEvGetCheckpointsMetadataRequest( CoordinatorId.GraphId, @@ -148,14 +148,14 @@ void TCheckpointCoordinator::Handle(const TEvCheckpointStorage::TEvRegisterCoord 1, loadGraphDescription), IEventHandle::FlagTrackDelivery); - } else if (StateLoadMode == YandexQuery::StateLoadMode::EMPTY) { + } else if (StateLoadMode == FederatedQuery::StateLoadMode::EMPTY) { ++*Metrics.StartedFromEmptyCheckpoint; CheckpointIdGenerator = std::make_unique<TCheckpointIdGenerator>(CoordinatorId); InitingZeroCheckpoint = true; InitCheckpoint(); ScheduleNextCheckpoint(); } else { - OnInternalError(TStringBuilder() << "Unexpected state load mode (" << YandexQuery::StateLoadMode_Name(StateLoadMode) << ") and streaming disposition " << StreamingDisposition); + OnInternalError(TStringBuilder() << "Unexpected state load mode (" << FederatedQuery::StateLoadMode_Name(StateLoadMode) << ") and streaming disposition " << StreamingDisposition); } } @@ -191,7 +191,7 @@ void TCheckpointCoordinator::Handle(const TEvCheckpointStorage::TEvGetCheckpoint if (!checkpoints.empty()) { const auto& checkpoint = checkpoints.at(0); CheckpointIdGenerator = std::make_unique<TCheckpointIdGenerator>(CoordinatorId, checkpoint.CheckpointId); - const bool needRestoreOffsets = StateLoadMode == YandexQuery::StateLoadMode::EMPTY && StreamingDisposition.has_from_last_checkpoint(); + const bool needRestoreOffsets = StateLoadMode == FederatedQuery::StateLoadMode::EMPTY && StreamingDisposition.has_from_last_checkpoint(); if (needRestoreOffsets) { TryToRestoreOffsetsFromForeignCheckpoint(checkpoint); } else { @@ -602,8 +602,8 @@ THolder<NActors::IActor> MakeCheckpointCoordinator( const TCheckpointCoordinatorConfig& settings, const ::NMonitoring::TDynamicCounterPtr& counters, const NProto::TGraphParams& graphParams, - const YandexQuery::StateLoadMode& stateLoadMode /* = YandexQuery::StateLoadMode::FROM_LAST_CHECKPOINT */, - const YandexQuery::StreamingDisposition& streamingDisposition /* = {} */, + const FederatedQuery::StateLoadMode& stateLoadMode /* = FederatedQuery::StateLoadMode::FROM_LAST_CHECKPOINT */, + const FederatedQuery::StreamingDisposition& streamingDisposition /* = {} */, // vvv TaskController temporary params vvv const TString& traceId, const NActors::TActorId& executerId, diff --git a/ydb/core/yq/libs/checkpointing/checkpoint_coordinator.h b/ydb/core/yq/libs/checkpointing/checkpoint_coordinator.h index 7a626bcc7c..12da4d5232 100644 --- a/ydb/core/yq/libs/checkpointing/checkpoint_coordinator.h +++ b/ydb/core/yq/libs/checkpointing/checkpoint_coordinator.h @@ -8,7 +8,7 @@ #include <ydb/core/yq/libs/checkpoint_storage/events/events.h> #include <ydb/core/yq/libs/config/protos/checkpoint_coordinator.pb.h> -#include <ydb/public/api/protos/yq.pb.h> +#include <ydb/public/api/protos/draft/fq.pb.h> #include <ydb/library/yql/dq/actors/compute/dq_compute_actor.h> #include <ydb/library/yql/dq/actors/compute/retry_queue.h> @@ -30,8 +30,8 @@ public: const TCheckpointCoordinatorConfig& settings, const ::NMonitoring::TDynamicCounterPtr& counters, const NProto::TGraphParams& graphParams, - const YandexQuery::StateLoadMode& stateLoadMode, - const YandexQuery::StreamingDisposition& streamingDisposition, + const FederatedQuery::StateLoadMode& stateLoadMode, + const FederatedQuery::StreamingDisposition& streamingDisposition, // vvv TaskController temporary params vvv const TString& traceId, const NActors::TActorId& executerId, @@ -192,8 +192,8 @@ private: TCheckpointCoordinatorMetrics Metrics; - YandexQuery::StateLoadMode StateLoadMode; - YandexQuery::StreamingDisposition StreamingDisposition; + FederatedQuery::StateLoadMode StateLoadMode; + FederatedQuery::StreamingDisposition StreamingDisposition; }; THolder<NActors::IActor> MakeCheckpointCoordinator( @@ -203,8 +203,8 @@ THolder<NActors::IActor> MakeCheckpointCoordinator( const TCheckpointCoordinatorConfig& settings, const ::NMonitoring::TDynamicCounterPtr& counters, const NProto::TGraphParams& graphParams, - const YandexQuery::StateLoadMode& stateLoadMode /* = YandexQuery::StateLoadMode::FROM_LAST_CHECKPOINT */, - const YandexQuery::StreamingDisposition& streamingDisposition /* = {} */, + const FederatedQuery::StateLoadMode& stateLoadMode /* = FederatedQuery::StateLoadMode::FROM_LAST_CHECKPOINT */, + const FederatedQuery::StreamingDisposition& streamingDisposition /* = {} */, // vvv TaskController temporary params vvv const TString& traceId, const NActors::TActorId& executerId, diff --git a/ydb/core/yq/libs/checkpointing/ut/checkpoint_coordinator_ut.cpp b/ydb/core/yq/libs/checkpointing/ut/checkpoint_coordinator_ut.cpp index 5647471df9..873249b181 100644 --- a/ydb/core/yq/libs/checkpointing/ut/checkpoint_coordinator_ut.cpp +++ b/ydb/core/yq/libs/checkpointing/ut/checkpoint_coordinator_ut.cpp @@ -100,7 +100,7 @@ struct TTestBootstrap : public TTestActorRuntime { Settings, Counters, NProto::TGraphParams(), - YandexQuery::StateLoadMode::FROM_LAST_CHECKPOINT, + FederatedQuery::StateLoadMode::FROM_LAST_CHECKPOINT, {}, // "my-graph-id", diff --git a/ydb/core/yq/libs/cloud_audit/yq_cloud_audit_service.cpp b/ydb/core/yq/libs/cloud_audit/yq_cloud_audit_service.cpp index 2132fcf3c6..72812e2917 100644 --- a/ydb/core/yq/libs/cloud_audit/yq_cloud_audit_service.cpp +++ b/ydb/core/yq/libs/cloud_audit/yq_cloud_audit_service.cpp @@ -50,28 +50,28 @@ TString ParsePeer(TString peerName) { return res; } -std::string MapConnectionType(const YandexQuery::ConnectionSetting::ConnectionCase& connectionCase) { +std::string MapConnectionType(const FederatedQuery::ConnectionSetting::ConnectionCase& connectionCase) { switch (connectionCase) { - case YandexQuery::ConnectionSetting::ConnectionCase::kYdbDatabase: + case FederatedQuery::ConnectionSetting::ConnectionCase::kYdbDatabase: return "YdbDatabase"; - case YandexQuery::ConnectionSetting::ConnectionCase::kClickhouseCluster: + case FederatedQuery::ConnectionSetting::ConnectionCase::kClickhouseCluster: return "ClickhouseCluster"; - case YandexQuery::ConnectionSetting::ConnectionCase::kDataStreams: + case FederatedQuery::ConnectionSetting::ConnectionCase::kDataStreams: return "DataStreams"; - case YandexQuery::ConnectionSetting::ConnectionCase::kObjectStorage: + case FederatedQuery::ConnectionSetting::ConnectionCase::kObjectStorage: return "ObjectStorage"; - case YandexQuery::ConnectionSetting::ConnectionCase::kMonitoring: + case FederatedQuery::ConnectionSetting::ConnectionCase::kMonitoring: return "Monitoring"; default: Y_ENSURE(false, "Invalid connection case " << i32(connectionCase)); } } -std::string MapBindingType(const YandexQuery::BindingSetting::BindingCase& bindingCase) { +std::string MapBindingType(const FederatedQuery::BindingSetting::BindingCase& bindingCase) { switch (bindingCase) { - case YandexQuery::BindingSetting::BindingSetting::kDataStreams: + case FederatedQuery::BindingSetting::BindingSetting::kDataStreams: return "YdbDataStreams"; - case YandexQuery::BindingSetting::BindingSetting::kObjectStorage: + case FederatedQuery::BindingSetting::BindingSetting::kObjectStorage: return "ObjectStorage"; default: Y_ENSURE(false, "Invalid connection case " << i32(bindingCase)); @@ -435,29 +435,29 @@ private: void Handle(TEvAuditService::CreateBindingAuditReport::TPtr& ev) { auto& auditReport = *ev.Get()->Get(); - auto prepareEventDetails = [](const TAuditDetails<YandexQuery::Binding>& details) { + auto prepareEventDetails = [](const TAuditDetails<FederatedQuery::Binding>& details) { yandex::cloud::events::yq::CreateBinding::EventDetails eventDetails; if (details.After) { const auto& after = *details.After; eventDetails.set_binding_id(after.meta().id()); eventDetails.set_name(after.content().name()); - eventDetails.set_visibility(YandexQuery::Acl::Visibility_Name(after.content().acl().visibility())); + eventDetails.set_visibility(FederatedQuery::Acl::Visibility_Name(after.content().acl().visibility())); eventDetails.set_connection_id(after.content().connection_id()); eventDetails.set_type(MapBindingType(after.content().setting().binding_case())); } return eventDetails; }; - auto prepareRequestParameters = [](const YandexQuery::CreateBindingRequest& request) { + auto prepareRequestParameters = [](const FederatedQuery::CreateBindingRequest& request) { yandex::cloud::events::yq::CreateBinding::RequestParameters requestParameters; requestParameters.set_name(request.content().name()); - requestParameters.set_visibility(YandexQuery::Acl::Visibility_Name(request.content().acl().visibility())); + requestParameters.set_visibility(FederatedQuery::Acl::Visibility_Name(request.content().acl().visibility())); requestParameters.set_connection_id(request.content().connection_id()); requestParameters.set_type(MapBindingType(request.content().setting().binding_case())); return requestParameters; }; - Register(new TAuditEventSenderActor<yandex::cloud::events::yq::CreateBinding, YandexQuery::CreateBindingRequest, YandexQuery::Binding>( + Register(new TAuditEventSenderActor<yandex::cloud::events::yq::CreateBinding, FederatedQuery::CreateBindingRequest, FederatedQuery::Binding>( Session, AuditServiceSensors, prepareEventDetails, @@ -475,30 +475,30 @@ private: void Handle(TEvAuditService::ModifyBindingAuditReport::TPtr& ev) { auto& auditReport = *ev.Get()->Get(); - auto prepareEventDetails = [](const TAuditDetails<YandexQuery::Binding>& details) { + auto prepareEventDetails = [](const TAuditDetails<FederatedQuery::Binding>& details) { yandex::cloud::events::yq::UpdateBinding::EventDetails eventDetails; if (details.After) { const auto& after = *details.After; eventDetails.set_binding_id(after.meta().id()); eventDetails.set_name(after.content().name()); - eventDetails.set_visibility(YandexQuery::Acl::Visibility_Name(after.content().acl().visibility())); + eventDetails.set_visibility(FederatedQuery::Acl::Visibility_Name(after.content().acl().visibility())); eventDetails.set_connection_id(after.content().connection_id()); eventDetails.set_type(MapBindingType(after.content().setting().binding_case())); } return eventDetails; }; - auto prepareRequestParameters = [](const YandexQuery::ModifyBindingRequest& request) { + auto prepareRequestParameters = [](const FederatedQuery::ModifyBindingRequest& request) { yandex::cloud::events::yq::UpdateBinding::RequestParameters requestParameters; requestParameters.set_binding_id(request.binding_id()); requestParameters.set_name(request.content().name()); - requestParameters.set_visibility(YandexQuery::Acl::Visibility_Name(request.content().acl().visibility())); + requestParameters.set_visibility(FederatedQuery::Acl::Visibility_Name(request.content().acl().visibility())); requestParameters.set_connection_id(request.content().connection_id()); requestParameters.set_type(MapBindingType(request.content().setting().binding_case())); return requestParameters; }; - Register(new TAuditEventSenderActor<yandex::cloud::events::yq::UpdateBinding, YandexQuery::ModifyBindingRequest, YandexQuery::Binding>( + Register(new TAuditEventSenderActor<yandex::cloud::events::yq::UpdateBinding, FederatedQuery::ModifyBindingRequest, FederatedQuery::Binding>( Session, AuditServiceSensors, prepareEventDetails, @@ -516,26 +516,26 @@ private: void Handle(TEvAuditService::DeleteBindingAuditReport::TPtr& ev) { auto& auditReport = *ev.Get()->Get(); - auto prepareEventDetails = [](const TAuditDetails<YandexQuery::Binding>& details) { + auto prepareEventDetails = [](const TAuditDetails<FederatedQuery::Binding>& details) { yandex::cloud::events::yq::DeleteBinding::EventDetails eventDetails; if (details.Before) { const auto& before = *details.Before; eventDetails.set_binding_id(before.meta().id()); eventDetails.set_name(before.content().name()); - eventDetails.set_visibility(YandexQuery::Acl::Visibility_Name(before.content().acl().visibility())); + eventDetails.set_visibility(FederatedQuery::Acl::Visibility_Name(before.content().acl().visibility())); eventDetails.set_connection_id(before.content().connection_id()); eventDetails.set_type(MapBindingType(before.content().setting().binding_case())); } return eventDetails; }; - auto prepareRequestParameters = [](const YandexQuery::DeleteBindingRequest& request) { + auto prepareRequestParameters = [](const FederatedQuery::DeleteBindingRequest& request) { yandex::cloud::events::yq::DeleteBinding::RequestParameters requestParameters; requestParameters.set_binding_id(request.binding_id()); return requestParameters; }; - Register(new TAuditEventSenderActor<yandex::cloud::events::yq::DeleteBinding, YandexQuery::DeleteBindingRequest, YandexQuery::Binding>( + Register(new TAuditEventSenderActor<yandex::cloud::events::yq::DeleteBinding, FederatedQuery::DeleteBindingRequest, FederatedQuery::Binding>( Session, AuditServiceSensors, prepareEventDetails, @@ -553,27 +553,27 @@ private: void Handle(TEvAuditService::CreateConnectionAuditReport::TPtr& ev) { auto& auditReport = *ev.Get()->Get(); - auto prepareEventDetails = [](const TAuditDetails<YandexQuery::Connection>& details) { + auto prepareEventDetails = [](const TAuditDetails<FederatedQuery::Connection>& details) { yandex::cloud::events::yq::CreateConnection::EventDetails eventDetails; if (details.After) { const auto& after = *details.After; eventDetails.set_connection_id(after.meta().id()); eventDetails.set_name(after.content().name()); - eventDetails.set_visibility(YandexQuery::Acl::Visibility_Name(after.content().acl().visibility())); + eventDetails.set_visibility(FederatedQuery::Acl::Visibility_Name(after.content().acl().visibility())); eventDetails.set_type(MapConnectionType(after.content().setting().connection_case())); } return eventDetails; }; - auto prepareRequestParameters = [](const YandexQuery::CreateConnectionRequest& request) { + auto prepareRequestParameters = [](const FederatedQuery::CreateConnectionRequest& request) { yandex::cloud::events::yq::CreateConnection::RequestParameters requestParameters; requestParameters.set_name(request.content().name()); - requestParameters.set_visibility(YandexQuery::Acl::Visibility_Name(request.content().acl().visibility())); + requestParameters.set_visibility(FederatedQuery::Acl::Visibility_Name(request.content().acl().visibility())); requestParameters.set_type(MapConnectionType(request.content().setting().connection_case())); return requestParameters; }; - Register(new TAuditEventSenderActor<yandex::cloud::events::yq::CreateConnection, YandexQuery::CreateConnectionRequest, YandexQuery::Connection>( + Register(new TAuditEventSenderActor<yandex::cloud::events::yq::CreateConnection, FederatedQuery::CreateConnectionRequest, FederatedQuery::Connection>( Session, AuditServiceSensors, prepareEventDetails, @@ -591,28 +591,28 @@ private: void Handle(TEvAuditService::ModifyConnectionAuditReport::TPtr& ev) { auto& auditReport = *ev.Get()->Get(); - auto prepareEventDetails = [](const TAuditDetails<YandexQuery::Connection>& details) { + auto prepareEventDetails = [](const TAuditDetails<FederatedQuery::Connection>& details) { yandex::cloud::events::yq::UpdateConnection::EventDetails eventDetails; if (details.After) { const auto& after = *details.After; eventDetails.set_connection_id(after.meta().id()); eventDetails.set_name(after.content().name()); - eventDetails.set_visibility(YandexQuery::Acl::Visibility_Name(after.content().acl().visibility())); + eventDetails.set_visibility(FederatedQuery::Acl::Visibility_Name(after.content().acl().visibility())); eventDetails.set_type(MapConnectionType(after.content().setting().connection_case())); } return eventDetails; }; - auto prepareRequestParameters = [](const YandexQuery::ModifyConnectionRequest& request) { + auto prepareRequestParameters = [](const FederatedQuery::ModifyConnectionRequest& request) { yandex::cloud::events::yq::UpdateConnection::RequestParameters requestParameters; requestParameters.set_connection_id(request.connection_id()); requestParameters.set_name(request.content().name()); - requestParameters.set_visibility(YandexQuery::Acl::Visibility_Name(request.content().acl().visibility())); + requestParameters.set_visibility(FederatedQuery::Acl::Visibility_Name(request.content().acl().visibility())); requestParameters.set_type(MapConnectionType(request.content().setting().connection_case())); return requestParameters; }; - Register(new TAuditEventSenderActor<yandex::cloud::events::yq::UpdateConnection, YandexQuery::ModifyConnectionRequest, YandexQuery::Connection>( + Register(new TAuditEventSenderActor<yandex::cloud::events::yq::UpdateConnection, FederatedQuery::ModifyConnectionRequest, FederatedQuery::Connection>( Session, AuditServiceSensors, prepareEventDetails, @@ -630,25 +630,25 @@ private: void Handle(TEvAuditService::DeleteConnectionAuditReport::TPtr& ev) { auto& auditReport = *ev.Get()->Get(); - auto prepareEventDetails = [](const TAuditDetails<YandexQuery::Connection>& details) { + auto prepareEventDetails = [](const TAuditDetails<FederatedQuery::Connection>& details) { yandex::cloud::events::yq::DeleteConnection::EventDetails eventDetails; if (details.Before) { const auto& before = *details.Before; eventDetails.set_connection_id(before.meta().id()); eventDetails.set_name(before.content().name()); - eventDetails.set_visibility(YandexQuery::Acl::Visibility_Name(before.content().acl().visibility())); + eventDetails.set_visibility(FederatedQuery::Acl::Visibility_Name(before.content().acl().visibility())); eventDetails.set_type(MapConnectionType(before.content().setting().connection_case())); } return eventDetails; }; - auto prepareRequestParameters = [](const YandexQuery::DeleteConnectionRequest& request) { + auto prepareRequestParameters = [](const FederatedQuery::DeleteConnectionRequest& request) { yandex::cloud::events::yq::DeleteConnection::RequestParameters requestParameters; requestParameters.set_connection_id(request.connection_id()); return requestParameters; }; - Register(new TAuditEventSenderActor<yandex::cloud::events::yq::DeleteConnection, YandexQuery::DeleteConnectionRequest, YandexQuery::Connection>( + Register(new TAuditEventSenderActor<yandex::cloud::events::yq::DeleteConnection, FederatedQuery::DeleteConnectionRequest, FederatedQuery::Connection>( Session, AuditServiceSensors, prepareEventDetails, @@ -666,32 +666,32 @@ private: void Handle(TEvAuditService::CreateQueryAuditReport::TPtr& ev) { auto& auditReport = *ev.Get()->Get(); - auto prepareEventDetails = [](const TAuditDetails<YandexQuery::Query>& details) { + auto prepareEventDetails = [](const TAuditDetails<FederatedQuery::Query>& details) { yandex::cloud::events::yq::CreateQuery::EventDetails eventDetails; if (details.After) { const auto& after = *details.After; eventDetails.set_query_id(after.meta().common().id()); eventDetails.set_name(after.content().name()); - eventDetails.set_visibility(YandexQuery::Acl::Visibility_Name(after.content().acl().visibility())); - eventDetails.set_type(YandexQuery::QueryContent::QueryType_Name(after.content().type())); - eventDetails.set_execute_mode(YandexQuery::ExecuteMode_Name(after.meta().execute_mode())); - eventDetails.set_compute_status(YandexQuery::QueryMeta::ComputeStatus_Name(after.meta().status())); + eventDetails.set_visibility(FederatedQuery::Acl::Visibility_Name(after.content().acl().visibility())); + eventDetails.set_type(FederatedQuery::QueryContent::QueryType_Name(after.content().type())); + eventDetails.set_execute_mode(FederatedQuery::ExecuteMode_Name(after.meta().execute_mode())); + eventDetails.set_compute_status(FederatedQuery::QueryMeta::ComputeStatus_Name(after.meta().status())); eventDetails.set_text_length(after.content().text().length()); } return eventDetails; }; - auto prepareRequestParameters = [](const YandexQuery::CreateQueryRequest& request) { + auto prepareRequestParameters = [](const FederatedQuery::CreateQueryRequest& request) { yandex::cloud::events::yq::CreateQuery::RequestParameters requestParameters; requestParameters.set_name(request.content().name()); - requestParameters.set_visibility(YandexQuery::Acl::Visibility_Name(request.content().acl().visibility())); - requestParameters.set_type(YandexQuery::QueryContent::QueryType_Name(request.content().type())); - requestParameters.set_execute_mode(YandexQuery::ExecuteMode_Name(request.execute_mode())); + requestParameters.set_visibility(FederatedQuery::Acl::Visibility_Name(request.content().acl().visibility())); + requestParameters.set_type(FederatedQuery::QueryContent::QueryType_Name(request.content().type())); + requestParameters.set_execute_mode(FederatedQuery::ExecuteMode_Name(request.execute_mode())); requestParameters.set_text_length(request.content().text().length()); return requestParameters; }; - Register(new TAuditEventSenderActor<yandex::cloud::events::yq::CreateQuery, YandexQuery::CreateQueryRequest, YandexQuery::Query>( + Register(new TAuditEventSenderActor<yandex::cloud::events::yq::CreateQuery, FederatedQuery::CreateQueryRequest, FederatedQuery::Query>( Session, AuditServiceSensors, prepareEventDetails, @@ -709,29 +709,29 @@ private: void Handle(TEvAuditService::ControlQueryAuditReport::TPtr& ev) { auto& auditReport = *ev.Get()->Get(); - auto prepareEventDetails = [](const TAuditDetails<YandexQuery::Query>& details) { + auto prepareEventDetails = [](const TAuditDetails<FederatedQuery::Query>& details) { yandex::cloud::events::yq::ControlQuery::EventDetails eventDetails; if (details.Before) { const auto& before = *details.Before; eventDetails.set_query_id(before.meta().common().id()); eventDetails.set_name(before.content().name()); - eventDetails.set_visibility(YandexQuery::Acl::Visibility_Name(before.content().acl().visibility())); - eventDetails.set_type(YandexQuery::QueryContent::QueryType_Name(before.content().type())); - eventDetails.set_execute_mode(YandexQuery::ExecuteMode_Name(before.meta().execute_mode())); - eventDetails.set_compute_status(YandexQuery::QueryMeta::ComputeStatus_Name(before.meta().status())); + eventDetails.set_visibility(FederatedQuery::Acl::Visibility_Name(before.content().acl().visibility())); + eventDetails.set_type(FederatedQuery::QueryContent::QueryType_Name(before.content().type())); + eventDetails.set_execute_mode(FederatedQuery::ExecuteMode_Name(before.meta().execute_mode())); + eventDetails.set_compute_status(FederatedQuery::QueryMeta::ComputeStatus_Name(before.meta().status())); eventDetails.set_text_length(before.content().text().length()); } return eventDetails; }; - auto prepareRequestParameters = [](const YandexQuery::ControlQueryRequest& request) { + auto prepareRequestParameters = [](const FederatedQuery::ControlQueryRequest& request) { yandex::cloud::events::yq::ControlQuery::RequestParameters requestParameters; requestParameters.set_query_id(request.query_id()); - requestParameters.set_action(YandexQuery::QueryAction_Name(request.action())); + requestParameters.set_action(FederatedQuery::QueryAction_Name(request.action())); return requestParameters; }; - Register(new TAuditEventSenderActor<yandex::cloud::events::yq::ControlQuery, YandexQuery::ControlQueryRequest, YandexQuery::Query>( + Register(new TAuditEventSenderActor<yandex::cloud::events::yq::ControlQuery, FederatedQuery::ControlQueryRequest, FederatedQuery::Query>( Session, AuditServiceSensors, prepareEventDetails, @@ -749,34 +749,34 @@ private: void Handle(TEvAuditService::ModifyQueryAuditReport::TPtr& ev) { auto& auditReport = *ev.Get()->Get(); - auto prepareEventDetails = [](const TAuditDetails<YandexQuery::Query>& details) { + auto prepareEventDetails = [](const TAuditDetails<FederatedQuery::Query>& details) { yandex::cloud::events::yq::UpdateQuery::EventDetails eventDetails; if (details.After) { const auto& after = *details.After; eventDetails.set_query_id(after.meta().common().id()); eventDetails.set_name(after.content().name()); - eventDetails.set_visibility(YandexQuery::Acl::Visibility_Name(after.content().acl().visibility())); - eventDetails.set_type(YandexQuery::QueryContent::QueryType_Name(after.content().type())); - eventDetails.set_execute_mode(YandexQuery::ExecuteMode_Name(after.meta().execute_mode())); - eventDetails.set_compute_status(YandexQuery::QueryMeta::ComputeStatus_Name(after.meta().status())); + eventDetails.set_visibility(FederatedQuery::Acl::Visibility_Name(after.content().acl().visibility())); + eventDetails.set_type(FederatedQuery::QueryContent::QueryType_Name(after.content().type())); + eventDetails.set_execute_mode(FederatedQuery::ExecuteMode_Name(after.meta().execute_mode())); + eventDetails.set_compute_status(FederatedQuery::QueryMeta::ComputeStatus_Name(after.meta().status())); eventDetails.set_text_length(after.content().text().length()); } return eventDetails; }; - auto prepareRequestParameters = [](const YandexQuery::ModifyQueryRequest& request) { + auto prepareRequestParameters = [](const FederatedQuery::ModifyQueryRequest& request) { yandex::cloud::events::yq::UpdateQuery::RequestParameters requestParameters; requestParameters.set_query_id(request.query_id()); requestParameters.set_name(request.content().name()); - requestParameters.set_visibility(YandexQuery::Acl::Visibility_Name(request.content().acl().visibility())); - requestParameters.set_type(YandexQuery::QueryContent::QueryType_Name(request.content().type())); - requestParameters.set_execute_mode(YandexQuery::ExecuteMode_Name(request.execute_mode())); - requestParameters.set_state_load_mode(YandexQuery::StateLoadMode_Name(request.state_load_mode())); + requestParameters.set_visibility(FederatedQuery::Acl::Visibility_Name(request.content().acl().visibility())); + requestParameters.set_type(FederatedQuery::QueryContent::QueryType_Name(request.content().type())); + requestParameters.set_execute_mode(FederatedQuery::ExecuteMode_Name(request.execute_mode())); + requestParameters.set_state_load_mode(FederatedQuery::StateLoadMode_Name(request.state_load_mode())); requestParameters.set_text_length(request.content().text().length()); return requestParameters; }; - Register(new TAuditEventSenderActor<yandex::cloud::events::yq::UpdateQuery, YandexQuery::ModifyQueryRequest, YandexQuery::Query>( + Register(new TAuditEventSenderActor<yandex::cloud::events::yq::UpdateQuery, FederatedQuery::ModifyQueryRequest, FederatedQuery::Query>( Session, AuditServiceSensors, prepareEventDetails, @@ -794,28 +794,28 @@ private: void Handle(TEvAuditService::DeleteQueryAuditReport::TPtr& ev) { auto& auditReport = *ev.Get()->Get(); - auto prepareEventDetails = [](const TAuditDetails<YandexQuery::Query>& details) { + auto prepareEventDetails = [](const TAuditDetails<FederatedQuery::Query>& details) { yandex::cloud::events::yq::DeleteQuery::EventDetails eventDetails; if (details.Before) { const auto& before = *details.Before; eventDetails.set_query_id(before.meta().common().id()); eventDetails.set_name(before.content().name()); - eventDetails.set_visibility(YandexQuery::Acl::Visibility_Name(before.content().acl().visibility())); - eventDetails.set_type(YandexQuery::QueryContent::QueryType_Name(before.content().type())); - eventDetails.set_execute_mode(YandexQuery::ExecuteMode_Name(before.meta().execute_mode())); - eventDetails.set_compute_status(YandexQuery::QueryMeta::ComputeStatus_Name(before.meta().status())); + eventDetails.set_visibility(FederatedQuery::Acl::Visibility_Name(before.content().acl().visibility())); + eventDetails.set_type(FederatedQuery::QueryContent::QueryType_Name(before.content().type())); + eventDetails.set_execute_mode(FederatedQuery::ExecuteMode_Name(before.meta().execute_mode())); + eventDetails.set_compute_status(FederatedQuery::QueryMeta::ComputeStatus_Name(before.meta().status())); eventDetails.set_text_length(before.content().text().length()); } return eventDetails; }; - auto prepareRequestParameters = [](const YandexQuery::DeleteQueryRequest& request) { + auto prepareRequestParameters = [](const FederatedQuery::DeleteQueryRequest& request) { yandex::cloud::events::yq::DeleteQuery::RequestParameters requestParameters; requestParameters.set_query_id(request.query_id()); return requestParameters; }; - Register(new TAuditEventSenderActor<yandex::cloud::events::yq::DeleteQuery, YandexQuery::DeleteQueryRequest, YandexQuery::Query>( + Register(new TAuditEventSenderActor<yandex::cloud::events::yq::DeleteQuery, FederatedQuery::DeleteQueryRequest, FederatedQuery::Query>( Session, AuditServiceSensors, prepareEventDetails, diff --git a/ydb/core/yq/libs/control_plane_config/events/events.h b/ydb/core/yq/libs/control_plane_config/events/events.h index fdc0a0b413..7920e85588 100644 --- a/ydb/core/yq/libs/control_plane_config/events/events.h +++ b/ydb/core/yq/libs/control_plane_config/events/events.h @@ -3,7 +3,7 @@ #include <ydb/core/yq/libs/events/event_subspace.h> #include <ydb/core/yq/libs/quota_manager/events/events.h> -#include <ydb/public/api/protos/yq.pb.h> +#include <ydb/public/api/protos/draft/fq.pb.h> #include <library/cpp/actors/core/event_pb.h> #include <library/cpp/actors/core/events.h> diff --git a/ydb/core/yq/libs/control_plane_proxy/control_plane_proxy.cpp b/ydb/core/yq/libs/control_plane_proxy/control_plane_proxy.cpp index 5a410b93b7..96d5a51b28 100644 --- a/ydb/core/yq/libs/control_plane_proxy/control_plane_proxy.cpp +++ b/ydb/core/yq/libs/control_plane_proxy/control_plane_proxy.cpp @@ -511,14 +511,14 @@ public: } }; -class TCreateQueryRequestActor : public TRequestActor<YandexQuery::CreateQueryRequest, +class TCreateQueryRequestActor : public TRequestActor<FederatedQuery::CreateQueryRequest, TEvControlPlaneStorage::TEvCreateQueryRequest, TEvControlPlaneStorage::TEvCreateQueryResponse, TEvControlPlaneProxy::TEvCreateQueryResponse> { bool QuoterResourceCreated = false; public: - using TBaseRequestActor = TRequestActor<YandexQuery::CreateQueryRequest, + using TBaseRequestActor = TRequestActor<FederatedQuery::CreateQueryRequest, TEvControlPlaneStorage::TEvCreateQueryRequest, TEvControlPlaneStorage::TEvCreateQueryResponse, TEvControlPlaneProxy::TEvCreateQueryResponse>; @@ -837,7 +837,7 @@ private: void Handle(TEvControlPlaneProxy::TEvCreateQueryRequest::TPtr& ev) { TInstant startTime = TInstant::Now(); - YandexQuery::CreateQueryRequest request = ev->Get()->Request; + FederatedQuery::CreateQueryRequest request = ev->Get()->Request; CPP_LOG_T("CreateQueryRequest: " << request.DebugString()); const TString cloudId = ev->Get()->CloudId; const TString folderId = ev->Get()->FolderId; @@ -890,7 +890,7 @@ private: void Handle(TEvControlPlaneProxy::TEvListQueriesRequest::TPtr& ev) { TInstant startTime = TInstant::Now(); - YandexQuery::ListQueriesRequest request = ev->Get()->Request; + FederatedQuery::ListQueriesRequest request = ev->Get()->Request; CPP_LOG_T("ListQueriesRequest: " << request.DebugString()); const TString cloudId = ev->Get()->CloudId; const TString folderId = ev->Get()->FolderId; @@ -931,7 +931,7 @@ private: | TPermissions::TPermission::VIEW_PRIVATE }; - Register(new TRequestActor<YandexQuery::ListQueriesRequest, + Register(new TRequestActor<FederatedQuery::ListQueriesRequest, TEvControlPlaneStorage::TEvListQueriesRequest, TEvControlPlaneStorage::TEvListQueriesResponse, TEvControlPlaneProxy::TEvListQueriesResponse> @@ -945,7 +945,7 @@ private: void Handle(TEvControlPlaneProxy::TEvDescribeQueryRequest::TPtr& ev) { TInstant startTime = TInstant::Now(); - YandexQuery::DescribeQueryRequest request = ev->Get()->Request; + FederatedQuery::DescribeQueryRequest request = ev->Get()->Request; CPP_LOG_T("DescribeQueryRequest: " << request.DebugString()); const TString cloudId = ev->Get()->CloudId; const TString folderId = ev->Get()->FolderId; @@ -989,7 +989,7 @@ private: | TPermissions::VIEW_QUERY_TEXT }; - Register(new TRequestActor<YandexQuery::DescribeQueryRequest, + Register(new TRequestActor<FederatedQuery::DescribeQueryRequest, TEvControlPlaneStorage::TEvDescribeQueryRequest, TEvControlPlaneStorage::TEvDescribeQueryResponse, TEvControlPlaneProxy::TEvDescribeQueryResponse> @@ -1003,7 +1003,7 @@ private: void Handle(TEvControlPlaneProxy::TEvGetQueryStatusRequest::TPtr& ev) { TInstant startTime = TInstant::Now(); - YandexQuery::GetQueryStatusRequest request = ev->Get()->Request; + FederatedQuery::GetQueryStatusRequest request = ev->Get()->Request; CPP_LOG_T("GetStatusRequest: " << request.DebugString()); const TString cloudId = ev->Get()->CloudId; const TString folderId = ev->Get()->FolderId; @@ -1045,7 +1045,7 @@ private: | TPermissions::TPermission::VIEW_PRIVATE }; - Register(new TRequestActor<YandexQuery::GetQueryStatusRequest, + Register(new TRequestActor<FederatedQuery::GetQueryStatusRequest, TEvControlPlaneStorage::TEvGetQueryStatusRequest, TEvControlPlaneStorage::TEvGetQueryStatusResponse, TEvControlPlaneProxy::TEvGetQueryStatusResponse> @@ -1059,7 +1059,7 @@ private: void Handle(TEvControlPlaneProxy::TEvModifyQueryRequest::TPtr& ev) { TInstant startTime = TInstant::Now(); - YandexQuery::ModifyQueryRequest request = ev->Get()->Request; + FederatedQuery::ModifyQueryRequest request = ev->Get()->Request; CPP_LOG_T("ModifyQueryRequest: " << request.DebugString()); const TString cloudId = ev->Get()->CloudId; const TString folderId = ev->Get()->FolderId; @@ -1104,7 +1104,7 @@ private: | TPermissions::TPermission::MANAGE_PRIVATE }; - Register(new TRequestActor<YandexQuery::ModifyQueryRequest, + Register(new TRequestActor<FederatedQuery::ModifyQueryRequest, TEvControlPlaneStorage::TEvModifyQueryRequest, TEvControlPlaneStorage::TEvModifyQueryResponse, TEvControlPlaneProxy::TEvModifyQueryResponse> @@ -1118,7 +1118,7 @@ private: void Handle(TEvControlPlaneProxy::TEvDeleteQueryRequest::TPtr& ev) { TInstant startTime = TInstant::Now(); - YandexQuery::DeleteQueryRequest request = ev->Get()->Request; + FederatedQuery::DeleteQueryRequest request = ev->Get()->Request; CPP_LOG_T("DeleteQueryRequest: " << request.DebugString()); const TString cloudId = ev->Get()->CloudId; const TString folderId = ev->Get()->FolderId; @@ -1160,7 +1160,7 @@ private: | TPermissions::TPermission::MANAGE_PRIVATE }; - Register(new TRequestActor<YandexQuery::DeleteQueryRequest, + Register(new TRequestActor<FederatedQuery::DeleteQueryRequest, TEvControlPlaneStorage::TEvDeleteQueryRequest, TEvControlPlaneStorage::TEvDeleteQueryResponse, TEvControlPlaneProxy::TEvDeleteQueryResponse> @@ -1174,7 +1174,7 @@ private: void Handle(TEvControlPlaneProxy::TEvControlQueryRequest::TPtr& ev) { TInstant startTime = TInstant::Now(); - YandexQuery::ControlQueryRequest request = ev->Get()->Request; + FederatedQuery::ControlQueryRequest request = ev->Get()->Request; CPP_LOG_T("ControlQueryRequest: " << request.DebugString()); const TString cloudId = ev->Get()->CloudId; const TString folderId = ev->Get()->FolderId; @@ -1216,7 +1216,7 @@ private: | TPermissions::TPermission::MANAGE_PRIVATE }; - Register(new TRequestActor<YandexQuery::ControlQueryRequest, + Register(new TRequestActor<FederatedQuery::ControlQueryRequest, TEvControlPlaneStorage::TEvControlQueryRequest, TEvControlPlaneStorage::TEvControlQueryResponse, TEvControlPlaneProxy::TEvControlQueryResponse> @@ -1230,7 +1230,7 @@ private: void Handle(TEvControlPlaneProxy::TEvGetResultDataRequest::TPtr& ev) { TInstant startTime = TInstant::Now(); - YandexQuery::GetResultDataRequest request = ev->Get()->Request; + FederatedQuery::GetResultDataRequest request = ev->Get()->Request; CPP_LOG_T("GetResultDataRequest: " << request.DebugString()); const TString cloudId = ev->Get()->CloudId; const TString folderId = ev->Get()->FolderId; @@ -1275,7 +1275,7 @@ private: | TPermissions::TPermission::VIEW_PRIVATE }; - Register(new TRequestActor<YandexQuery::GetResultDataRequest, + Register(new TRequestActor<FederatedQuery::GetResultDataRequest, TEvControlPlaneStorage::TEvGetResultDataRequest, TEvControlPlaneStorage::TEvGetResultDataResponse, TEvControlPlaneProxy::TEvGetResultDataResponse> @@ -1289,7 +1289,7 @@ private: void Handle(TEvControlPlaneProxy::TEvListJobsRequest::TPtr& ev) { TInstant startTime = TInstant::Now(); - YandexQuery::ListJobsRequest request = ev->Get()->Request; + FederatedQuery::ListJobsRequest request = ev->Get()->Request; CPP_LOG_T("ListJobsRequest: " << request.DebugString()); const TString cloudId = ev->Get()->CloudId; const TString folderId = ev->Get()->FolderId; @@ -1331,7 +1331,7 @@ private: | TPermissions::TPermission::VIEW_PRIVATE }; - Register(new TRequestActor<YandexQuery::ListJobsRequest, + Register(new TRequestActor<FederatedQuery::ListJobsRequest, TEvControlPlaneStorage::TEvListJobsRequest, TEvControlPlaneStorage::TEvListJobsResponse, TEvControlPlaneProxy::TEvListJobsResponse> @@ -1345,7 +1345,7 @@ private: void Handle(TEvControlPlaneProxy::TEvDescribeJobRequest::TPtr& ev) { TInstant startTime = TInstant::Now(); - YandexQuery::DescribeJobRequest request = ev->Get()->Request; + FederatedQuery::DescribeJobRequest request = ev->Get()->Request; CPP_LOG_T("DescribeJobRequest: " << request.DebugString()); const TString cloudId = ev->Get()->CloudId; const TString folderId = ev->Get()->FolderId; @@ -1389,7 +1389,7 @@ private: | TPermissions::VIEW_QUERY_TEXT }; - Register(new TRequestActor<YandexQuery::DescribeJobRequest, + Register(new TRequestActor<FederatedQuery::DescribeJobRequest, TEvControlPlaneStorage::TEvDescribeJobRequest, TEvControlPlaneStorage::TEvDescribeJobResponse, TEvControlPlaneProxy::TEvDescribeJobResponse> @@ -1403,7 +1403,7 @@ private: void Handle(TEvControlPlaneProxy::TEvCreateConnectionRequest::TPtr& ev) { TInstant startTime = TInstant::Now(); - YandexQuery::CreateConnectionRequest request = ev->Get()->Request; + FederatedQuery::CreateConnectionRequest request = ev->Get()->Request; CPP_LOG_T("CreateConnectionRequest: " << request.DebugString()); const TString cloudId = ev->Get()->CloudId; const TString folderId = ev->Get()->FolderId; @@ -1448,7 +1448,7 @@ private: TPermissions::TPermission::MANAGE_PUBLIC }; - Register(new TRequestActor<YandexQuery::CreateConnectionRequest, + Register(new TRequestActor<FederatedQuery::CreateConnectionRequest, TEvControlPlaneStorage::TEvCreateConnectionRequest, TEvControlPlaneStorage::TEvCreateConnectionResponse, TEvControlPlaneProxy::TEvCreateConnectionResponse> @@ -1461,7 +1461,7 @@ private: void Handle(TEvControlPlaneProxy::TEvListConnectionsRequest::TPtr& ev) { TInstant startTime = TInstant::Now(); - YandexQuery::ListConnectionsRequest request = ev->Get()->Request; + FederatedQuery::ListConnectionsRequest request = ev->Get()->Request; CPP_LOG_T("ListConnectionsRequest: " << request.DebugString()); const TString cloudId = ev->Get()->CloudId; const TString folderId = ev->Get()->FolderId; @@ -1502,7 +1502,7 @@ private: | TPermissions::TPermission::VIEW_PRIVATE }; - Register(new TRequestActor<YandexQuery::ListConnectionsRequest, + Register(new TRequestActor<FederatedQuery::ListConnectionsRequest, TEvControlPlaneStorage::TEvListConnectionsRequest, TEvControlPlaneStorage::TEvListConnectionsResponse, TEvControlPlaneProxy::TEvListConnectionsResponse> @@ -1516,7 +1516,7 @@ private: void Handle(TEvControlPlaneProxy::TEvDescribeConnectionRequest::TPtr& ev) { TInstant startTime = TInstant::Now(); - YandexQuery::DescribeConnectionRequest request = ev->Get()->Request; + FederatedQuery::DescribeConnectionRequest request = ev->Get()->Request; CPP_LOG_T("DescribeConnectionRequest: " << request.DebugString()); const TString cloudId = ev->Get()->CloudId; const TString folderId = ev->Get()->FolderId; @@ -1558,7 +1558,7 @@ private: | TPermissions::TPermission::VIEW_PRIVATE }; - Register(new TRequestActor<YandexQuery::DescribeConnectionRequest, + Register(new TRequestActor<FederatedQuery::DescribeConnectionRequest, TEvControlPlaneStorage::TEvDescribeConnectionRequest, TEvControlPlaneStorage::TEvDescribeConnectionResponse, TEvControlPlaneProxy::TEvDescribeConnectionResponse> @@ -1572,7 +1572,7 @@ private: void Handle(TEvControlPlaneProxy::TEvModifyConnectionRequest::TPtr& ev) { TInstant startTime = TInstant::Now(); - YandexQuery::ModifyConnectionRequest request = ev->Get()->Request; + FederatedQuery::ModifyConnectionRequest request = ev->Get()->Request; CPP_LOG_T("ModifyConnectionRequest: " << request.DebugString()); const TString cloudId = ev->Get()->CloudId; const TString folderId = ev->Get()->FolderId; @@ -1619,7 +1619,7 @@ private: | TPermissions::TPermission::MANAGE_PRIVATE }; - Register(new TRequestActor<YandexQuery::ModifyConnectionRequest, + Register(new TRequestActor<FederatedQuery::ModifyConnectionRequest, TEvControlPlaneStorage::TEvModifyConnectionRequest, TEvControlPlaneStorage::TEvModifyConnectionResponse, TEvControlPlaneProxy::TEvModifyConnectionResponse> @@ -1633,7 +1633,7 @@ private: void Handle(TEvControlPlaneProxy::TEvDeleteConnectionRequest::TPtr& ev) { TInstant startTime = TInstant::Now(); - YandexQuery::DeleteConnectionRequest request = ev->Get()->Request; + FederatedQuery::DeleteConnectionRequest request = ev->Get()->Request; CPP_LOG_T("DeleteConnectionRequest: " << request.DebugString()); const TString cloudId = ev->Get()->CloudId; const TString folderId = ev->Get()->FolderId; @@ -1675,7 +1675,7 @@ private: | TPermissions::TPermission::MANAGE_PRIVATE }; - Register(new TRequestActor<YandexQuery::DeleteConnectionRequest, + Register(new TRequestActor<FederatedQuery::DeleteConnectionRequest, TEvControlPlaneStorage::TEvDeleteConnectionRequest, TEvControlPlaneStorage::TEvDeleteConnectionResponse, TEvControlPlaneProxy::TEvDeleteConnectionResponse> @@ -1689,7 +1689,7 @@ private: void Handle(TEvControlPlaneProxy::TEvTestConnectionRequest::TPtr& ev) { TInstant startTime = TInstant::Now(); - YandexQuery::TestConnectionRequest request = ev->Get()->Request; + FederatedQuery::TestConnectionRequest request = ev->Get()->Request; CPP_LOG_T("TestConnectionRequest: " << request.DebugString()); const TString cloudId = ev->Get()->CloudId; const TString folderId = ev->Get()->FolderId; @@ -1730,7 +1730,7 @@ private: return; } - Register(new TRequestActor<YandexQuery::TestConnectionRequest, + Register(new TRequestActor<FederatedQuery::TestConnectionRequest, TEvTestConnection::TEvTestConnectionRequest, TEvTestConnection::TEvTestConnectionResponse, TEvControlPlaneProxy::TEvTestConnectionResponse> @@ -1743,7 +1743,7 @@ private: void Handle(TEvControlPlaneProxy::TEvCreateBindingRequest::TPtr& ev) { TInstant startTime = TInstant::Now(); - YandexQuery::CreateBindingRequest request = ev->Get()->Request; + FederatedQuery::CreateBindingRequest request = ev->Get()->Request; CPP_LOG_T("CreateBindingRequest: " << request.DebugString()); const TString cloudId = ev->Get()->CloudId; const TString folderId = ev->Get()->FolderId; @@ -1783,7 +1783,7 @@ private: TPermissions::TPermission::MANAGE_PUBLIC }; - Register(new TRequestActor<YandexQuery::CreateBindingRequest, + Register(new TRequestActor<FederatedQuery::CreateBindingRequest, TEvControlPlaneStorage::TEvCreateBindingRequest, TEvControlPlaneStorage::TEvCreateBindingResponse, TEvControlPlaneProxy::TEvCreateBindingResponse> @@ -1796,7 +1796,7 @@ private: void Handle(TEvControlPlaneProxy::TEvListBindingsRequest::TPtr& ev) { TInstant startTime = TInstant::Now(); - YandexQuery::ListBindingsRequest request = ev->Get()->Request; + FederatedQuery::ListBindingsRequest request = ev->Get()->Request; CPP_LOG_T("ListBindingsRequest: " << request.DebugString()); const TString cloudId = ev->Get()->CloudId; const TString folderId = ev->Get()->FolderId; @@ -1837,7 +1837,7 @@ private: | TPermissions::TPermission::VIEW_PRIVATE }; - Register(new TRequestActor<YandexQuery::ListBindingsRequest, + Register(new TRequestActor<FederatedQuery::ListBindingsRequest, TEvControlPlaneStorage::TEvListBindingsRequest, TEvControlPlaneStorage::TEvListBindingsResponse, TEvControlPlaneProxy::TEvListBindingsResponse> @@ -1851,7 +1851,7 @@ private: void Handle(TEvControlPlaneProxy::TEvDescribeBindingRequest::TPtr& ev) { TInstant startTime = TInstant::Now(); - YandexQuery::DescribeBindingRequest request = ev->Get()->Request; + FederatedQuery::DescribeBindingRequest request = ev->Get()->Request; CPP_LOG_T("DescribeBindingRequest: " << request.DebugString()); const TString cloudId = ev->Get()->CloudId; const TString folderId = ev->Get()->FolderId; @@ -1893,7 +1893,7 @@ private: | TPermissions::TPermission::VIEW_PRIVATE }; - Register(new TRequestActor<YandexQuery::DescribeBindingRequest, + Register(new TRequestActor<FederatedQuery::DescribeBindingRequest, TEvControlPlaneStorage::TEvDescribeBindingRequest, TEvControlPlaneStorage::TEvDescribeBindingResponse, TEvControlPlaneProxy::TEvDescribeBindingResponse> @@ -1907,7 +1907,7 @@ private: void Handle(TEvControlPlaneProxy::TEvModifyBindingRequest::TPtr& ev) { TInstant startTime = TInstant::Now(); - YandexQuery::ModifyBindingRequest request = ev->Get()->Request; + FederatedQuery::ModifyBindingRequest request = ev->Get()->Request; CPP_LOG_T("ModifyBindingRequest: " << request.DebugString()); const TString cloudId = ev->Get()->CloudId; const TString folderId = ev->Get()->FolderId; @@ -1949,7 +1949,7 @@ private: | TPermissions::TPermission::MANAGE_PRIVATE }; - Register(new TRequestActor<YandexQuery::ModifyBindingRequest, + Register(new TRequestActor<FederatedQuery::ModifyBindingRequest, TEvControlPlaneStorage::TEvModifyBindingRequest, TEvControlPlaneStorage::TEvModifyBindingResponse, TEvControlPlaneProxy::TEvModifyBindingResponse> @@ -1963,7 +1963,7 @@ private: void Handle(TEvControlPlaneProxy::TEvDeleteBindingRequest::TPtr& ev) { TInstant startTime = TInstant::Now(); - YandexQuery::DeleteBindingRequest request = ev->Get()->Request; + FederatedQuery::DeleteBindingRequest request = ev->Get()->Request; CPP_LOG_T("DeleteBindingRequest: " << request.DebugString()); const TString cloudId = ev->Get()->CloudId; const TString folderId = ev->Get()->FolderId; @@ -2005,7 +2005,7 @@ private: | TPermissions::TPermission::MANAGE_PRIVATE }; - Register(new TRequestActor<YandexQuery::DeleteBindingRequest, + Register(new TRequestActor<FederatedQuery::DeleteBindingRequest, TEvControlPlaneStorage::TEvDeleteBindingRequest, TEvControlPlaneStorage::TEvDeleteBindingResponse, TEvControlPlaneProxy::TEvDeleteBindingResponse> diff --git a/ydb/core/yq/libs/control_plane_proxy/events/events.h b/ydb/core/yq/libs/control_plane_proxy/events/events.h index f6c4f12f82..17901356cb 100644 --- a/ydb/core/yq/libs/control_plane_proxy/events/events.h +++ b/ydb/core/yq/libs/control_plane_proxy/events/events.h @@ -3,7 +3,7 @@ #include <ydb/core/yq/libs/control_plane_storage/events/events.h> #include <ydb/core/yq/libs/quota_manager/events/events.h> -#include <ydb/public/api/protos/yq.pb.h> +#include <ydb/public/api/protos/draft/fq.pb.h> #include <library/cpp/actors/core/event_pb.h> #include <library/cpp/actors/core/events.h> @@ -138,48 +138,48 @@ struct TEvControlPlaneProxy { TAuditDetails<AuditMessage> AuditDetails; }; - using TEvCreateQueryRequest = TControlPlaneRequest<YandexQuery::CreateQueryRequest, EvCreateQueryRequest>; - using TEvCreateQueryResponse = TControlPlaneAuditableResponse<YandexQuery::CreateQueryResult, YandexQuery::Query, EvCreateQueryResponse>; - using TEvListQueriesRequest = TControlPlaneRequest<YandexQuery::ListQueriesRequest, EvListQueriesRequest>; - using TEvListQueriesResponse = TControlPlaneNonAuditableResponse<YandexQuery::ListQueriesResult, EvListQueriesResponse>; - using TEvDescribeQueryRequest = TControlPlaneRequest<YandexQuery::DescribeQueryRequest, EvDescribeQueryRequest>; - using TEvDescribeQueryResponse = TControlPlaneNonAuditableResponse<YandexQuery::DescribeQueryResult, EvDescribeQueryResponse>; - using TEvGetQueryStatusRequest = TControlPlaneRequest<YandexQuery::GetQueryStatusRequest, EvGetQueryStatusRequest>; - using TEvGetQueryStatusResponse = TControlPlaneNonAuditableResponse<YandexQuery::GetQueryStatusResult, EvGetQueryStatusResponse>; - using TEvModifyQueryRequest = TControlPlaneRequest<YandexQuery::ModifyQueryRequest, EvModifyQueryRequest>; - using TEvModifyQueryResponse = TControlPlaneAuditableResponse<YandexQuery::ModifyQueryResult, YandexQuery::Query, EvModifyQueryResponse>; - using TEvDeleteQueryRequest = TControlPlaneRequest<YandexQuery::DeleteQueryRequest, EvDeleteQueryRequest>; - using TEvDeleteQueryResponse = TControlPlaneAuditableResponse<YandexQuery::DeleteQueryResult, YandexQuery::Query, EvDeleteQueryResponse>; - using TEvControlQueryRequest = TControlPlaneRequest<YandexQuery::ControlQueryRequest, EvControlQueryRequest>; - using TEvControlQueryResponse = TControlPlaneAuditableResponse<YandexQuery::ControlQueryResult, YandexQuery::Query, EvControlQueryResponse>; - using TEvGetResultDataRequest = TControlPlaneRequest<YandexQuery::GetResultDataRequest, EvGetResultDataRequest>; - using TEvGetResultDataResponse = TControlPlaneNonAuditableResponse<YandexQuery::GetResultDataResult, EvGetResultDataResponse>; - using TEvListJobsRequest = TControlPlaneRequest<YandexQuery::ListJobsRequest, EvListJobsRequest>; - using TEvListJobsResponse = TControlPlaneNonAuditableResponse<YandexQuery::ListJobsResult, EvListJobsResponse>; - using TEvDescribeJobRequest = TControlPlaneRequest<YandexQuery::DescribeJobRequest, EvDescribeJobRequest>; - using TEvDescribeJobResponse = TControlPlaneNonAuditableResponse<YandexQuery::DescribeJobResult, EvDescribeJobResponse>; - using TEvCreateConnectionRequest = TControlPlaneRequest<YandexQuery::CreateConnectionRequest, EvCreateConnectionRequest>; - using TEvCreateConnectionResponse = TControlPlaneAuditableResponse<YandexQuery::CreateConnectionResult, YandexQuery::Connection, EvCreateConnectionResponse>; - using TEvListConnectionsRequest = TControlPlaneRequest<YandexQuery::ListConnectionsRequest, EvListConnectionsRequest>; - using TEvListConnectionsResponse = TControlPlaneNonAuditableResponse<YandexQuery::ListConnectionsResult, EvListConnectionsResponse>; - using TEvDescribeConnectionRequest = TControlPlaneRequest<YandexQuery::DescribeConnectionRequest, EvDescribeConnectionRequest>; - using TEvDescribeConnectionResponse = TControlPlaneNonAuditableResponse<YandexQuery::DescribeConnectionResult, EvDescribeConnectionResponse>; - using TEvModifyConnectionRequest = TControlPlaneRequest<YandexQuery::ModifyConnectionRequest, EvModifyConnectionRequest>; - using TEvModifyConnectionResponse = TControlPlaneAuditableResponse<YandexQuery::ModifyConnectionResult, YandexQuery::Connection, EvModifyConnectionResponse>; - using TEvDeleteConnectionRequest = TControlPlaneRequest<YandexQuery::DeleteConnectionRequest, EvDeleteConnectionRequest>; - using TEvDeleteConnectionResponse = TControlPlaneAuditableResponse<YandexQuery::DeleteConnectionResult, YandexQuery::Connection, EvDeleteConnectionResponse>; - using TEvTestConnectionRequest = TControlPlaneRequest<YandexQuery::TestConnectionRequest, EvTestConnectionRequest>; - using TEvTestConnectionResponse = TControlPlaneNonAuditableResponse<YandexQuery::TestConnectionResult, EvTestConnectionResponse>; - using TEvCreateBindingRequest = TControlPlaneRequest<YandexQuery::CreateBindingRequest, EvCreateBindingRequest>; - using TEvCreateBindingResponse = TControlPlaneAuditableResponse<YandexQuery::CreateBindingResult, YandexQuery::Binding, EvCreateBindingResponse>; - using TEvListBindingsRequest = TControlPlaneRequest<YandexQuery::ListBindingsRequest, EvListBindingsRequest>; - using TEvListBindingsResponse = TControlPlaneNonAuditableResponse<YandexQuery::ListBindingsResult, EvListBindingsResponse>; - using TEvDescribeBindingRequest = TControlPlaneRequest<YandexQuery::DescribeBindingRequest, EvDescribeBindingRequest>; - using TEvDescribeBindingResponse = TControlPlaneNonAuditableResponse<YandexQuery::DescribeBindingResult, EvDescribeBindingResponse>; - using TEvModifyBindingRequest = TControlPlaneRequest<YandexQuery::ModifyBindingRequest, EvModifyBindingRequest>; - using TEvModifyBindingResponse = TControlPlaneAuditableResponse<YandexQuery::ModifyBindingResult, YandexQuery::Binding, EvModifyBindingResponse>; - using TEvDeleteBindingRequest = TControlPlaneRequest<YandexQuery::DeleteBindingRequest, EvDeleteBindingRequest>; - using TEvDeleteBindingResponse = TControlPlaneAuditableResponse<YandexQuery::DeleteBindingResult, YandexQuery::Binding, EvDeleteBindingResponse>; + using TEvCreateQueryRequest = TControlPlaneRequest<FederatedQuery::CreateQueryRequest, EvCreateQueryRequest>; + using TEvCreateQueryResponse = TControlPlaneAuditableResponse<FederatedQuery::CreateQueryResult, FederatedQuery::Query, EvCreateQueryResponse>; + using TEvListQueriesRequest = TControlPlaneRequest<FederatedQuery::ListQueriesRequest, EvListQueriesRequest>; + using TEvListQueriesResponse = TControlPlaneNonAuditableResponse<FederatedQuery::ListQueriesResult, EvListQueriesResponse>; + using TEvDescribeQueryRequest = TControlPlaneRequest<FederatedQuery::DescribeQueryRequest, EvDescribeQueryRequest>; + using TEvDescribeQueryResponse = TControlPlaneNonAuditableResponse<FederatedQuery::DescribeQueryResult, EvDescribeQueryResponse>; + using TEvGetQueryStatusRequest = TControlPlaneRequest<FederatedQuery::GetQueryStatusRequest, EvGetQueryStatusRequest>; + using TEvGetQueryStatusResponse = TControlPlaneNonAuditableResponse<FederatedQuery::GetQueryStatusResult, EvGetQueryStatusResponse>; + using TEvModifyQueryRequest = TControlPlaneRequest<FederatedQuery::ModifyQueryRequest, EvModifyQueryRequest>; + using TEvModifyQueryResponse = TControlPlaneAuditableResponse<FederatedQuery::ModifyQueryResult, FederatedQuery::Query, EvModifyQueryResponse>; + using TEvDeleteQueryRequest = TControlPlaneRequest<FederatedQuery::DeleteQueryRequest, EvDeleteQueryRequest>; + using TEvDeleteQueryResponse = TControlPlaneAuditableResponse<FederatedQuery::DeleteQueryResult, FederatedQuery::Query, EvDeleteQueryResponse>; + using TEvControlQueryRequest = TControlPlaneRequest<FederatedQuery::ControlQueryRequest, EvControlQueryRequest>; + using TEvControlQueryResponse = TControlPlaneAuditableResponse<FederatedQuery::ControlQueryResult, FederatedQuery::Query, EvControlQueryResponse>; + using TEvGetResultDataRequest = TControlPlaneRequest<FederatedQuery::GetResultDataRequest, EvGetResultDataRequest>; + using TEvGetResultDataResponse = TControlPlaneNonAuditableResponse<FederatedQuery::GetResultDataResult, EvGetResultDataResponse>; + using TEvListJobsRequest = TControlPlaneRequest<FederatedQuery::ListJobsRequest, EvListJobsRequest>; + using TEvListJobsResponse = TControlPlaneNonAuditableResponse<FederatedQuery::ListJobsResult, EvListJobsResponse>; + using TEvDescribeJobRequest = TControlPlaneRequest<FederatedQuery::DescribeJobRequest, EvDescribeJobRequest>; + using TEvDescribeJobResponse = TControlPlaneNonAuditableResponse<FederatedQuery::DescribeJobResult, EvDescribeJobResponse>; + using TEvCreateConnectionRequest = TControlPlaneRequest<FederatedQuery::CreateConnectionRequest, EvCreateConnectionRequest>; + using TEvCreateConnectionResponse = TControlPlaneAuditableResponse<FederatedQuery::CreateConnectionResult, FederatedQuery::Connection, EvCreateConnectionResponse>; + using TEvListConnectionsRequest = TControlPlaneRequest<FederatedQuery::ListConnectionsRequest, EvListConnectionsRequest>; + using TEvListConnectionsResponse = TControlPlaneNonAuditableResponse<FederatedQuery::ListConnectionsResult, EvListConnectionsResponse>; + using TEvDescribeConnectionRequest = TControlPlaneRequest<FederatedQuery::DescribeConnectionRequest, EvDescribeConnectionRequest>; + using TEvDescribeConnectionResponse = TControlPlaneNonAuditableResponse<FederatedQuery::DescribeConnectionResult, EvDescribeConnectionResponse>; + using TEvModifyConnectionRequest = TControlPlaneRequest<FederatedQuery::ModifyConnectionRequest, EvModifyConnectionRequest>; + using TEvModifyConnectionResponse = TControlPlaneAuditableResponse<FederatedQuery::ModifyConnectionResult, FederatedQuery::Connection, EvModifyConnectionResponse>; + using TEvDeleteConnectionRequest = TControlPlaneRequest<FederatedQuery::DeleteConnectionRequest, EvDeleteConnectionRequest>; + using TEvDeleteConnectionResponse = TControlPlaneAuditableResponse<FederatedQuery::DeleteConnectionResult, FederatedQuery::Connection, EvDeleteConnectionResponse>; + using TEvTestConnectionRequest = TControlPlaneRequest<FederatedQuery::TestConnectionRequest, EvTestConnectionRequest>; + using TEvTestConnectionResponse = TControlPlaneNonAuditableResponse<FederatedQuery::TestConnectionResult, EvTestConnectionResponse>; + using TEvCreateBindingRequest = TControlPlaneRequest<FederatedQuery::CreateBindingRequest, EvCreateBindingRequest>; + using TEvCreateBindingResponse = TControlPlaneAuditableResponse<FederatedQuery::CreateBindingResult, FederatedQuery::Binding, EvCreateBindingResponse>; + using TEvListBindingsRequest = TControlPlaneRequest<FederatedQuery::ListBindingsRequest, EvListBindingsRequest>; + using TEvListBindingsResponse = TControlPlaneNonAuditableResponse<FederatedQuery::ListBindingsResult, EvListBindingsResponse>; + using TEvDescribeBindingRequest = TControlPlaneRequest<FederatedQuery::DescribeBindingRequest, EvDescribeBindingRequest>; + using TEvDescribeBindingResponse = TControlPlaneNonAuditableResponse<FederatedQuery::DescribeBindingResult, EvDescribeBindingResponse>; + using TEvModifyBindingRequest = TControlPlaneRequest<FederatedQuery::ModifyBindingRequest, EvModifyBindingRequest>; + using TEvModifyBindingResponse = TControlPlaneAuditableResponse<FederatedQuery::ModifyBindingResult, FederatedQuery::Binding, EvModifyBindingResponse>; + using TEvDeleteBindingRequest = TControlPlaneRequest<FederatedQuery::DeleteBindingRequest, EvDeleteBindingRequest>; + using TEvDeleteBindingResponse = TControlPlaneAuditableResponse<FederatedQuery::DeleteBindingResult, FederatedQuery::Binding, EvDeleteBindingResponse>; }; } diff --git a/ydb/core/yq/libs/control_plane_proxy/ut/control_plane_proxy_ut.cpp b/ydb/core/yq/libs/control_plane_proxy/ut/control_plane_proxy_ut.cpp index 38b07decd0..4a869e8756 100644 --- a/ydb/core/yq/libs/control_plane_proxy/ut/control_plane_proxy_ut.cpp +++ b/ydb/core/yq/libs/control_plane_proxy/ut/control_plane_proxy_ut.cpp @@ -112,7 +112,7 @@ struct TTestBootstrap { void SendCreateQueryRequest(const TVector<TString>& permissions = {}, const TString& user = "test_user@staff", bool processCreateRateLimiterResource = true) { TActorId sender = Runtime->AllocateEdgeActor(); - YandexQuery::CreateQueryRequest proto; + FederatedQuery::CreateQueryRequest proto; proto.mutable_content()->set_name("my_query_name"); auto request = std::make_unique<TEvControlPlaneProxy::TEvCreateQueryRequest>("", proto, user, "", permissions); @@ -144,7 +144,7 @@ struct TTestBootstrap { void SendListQueriesRequest(const TVector<TString>& permissions = {}, const TString& user = "test_user@staff") { TActorId sender = Runtime->AllocateEdgeActor(); - YandexQuery::ListQueriesRequest proto; + FederatedQuery::ListQueriesRequest proto; auto request = std::make_unique<TEvControlPlaneProxy::TEvListQueriesRequest>("my_folder", proto, user, "", permissions); Runtime->Send(new IEventHandleFat(ControlPlaneProxyActorId(), sender, request.release())); @@ -154,7 +154,7 @@ struct TTestBootstrap { void SendDescribeQueryRequest(const TVector<TString>& permissions = {}, const TString& user = "test_user@staff") { TActorId sender = Runtime->AllocateEdgeActor(); - YandexQuery::DescribeQueryRequest proto; + FederatedQuery::DescribeQueryRequest proto; auto request = std::make_unique<TEvControlPlaneProxy::TEvDescribeQueryRequest>("my_folder", proto, user, "", permissions); Runtime->Send(new IEventHandleFat(ControlPlaneProxyActorId(), sender, request.release())); @@ -164,7 +164,7 @@ struct TTestBootstrap { void SendGetQueryStatusRequest(const TVector<TString>& permissions = {}, const TString& user = "test_user@staff") { TActorId sender = Runtime->AllocateEdgeActor(); - YandexQuery::GetQueryStatusRequest proto; + FederatedQuery::GetQueryStatusRequest proto; auto request = std::make_unique<TEvControlPlaneProxy::TEvGetQueryStatusRequest>("my_folder", proto, user, "", permissions); Runtime->Send(new IEventHandleFat(ControlPlaneProxyActorId(), sender, request.release())); @@ -174,7 +174,7 @@ struct TTestBootstrap { void SendModifyQueryRequest(const TVector<TString>& permissions = {}, const TString& user = "test_user@staff") { TActorId sender = Runtime->AllocateEdgeActor(); - YandexQuery::ModifyQueryRequest proto; + FederatedQuery::ModifyQueryRequest proto; auto request = std::make_unique<TEvControlPlaneProxy::TEvModifyQueryRequest>("my_folder", proto, user, "", permissions); Runtime->Send(new IEventHandleFat(ControlPlaneProxyActorId(), sender, request.release())); @@ -184,7 +184,7 @@ struct TTestBootstrap { void SendDeleteQueryRequest(const TVector<TString>& permissions = {}, const TString& user = "test_user@staff") { TActorId sender = Runtime->AllocateEdgeActor(); - YandexQuery::DeleteQueryRequest proto; + FederatedQuery::DeleteQueryRequest proto; auto request = std::make_unique<TEvControlPlaneProxy::TEvDeleteQueryRequest>("my_folder", proto, user, "", permissions); Runtime->Send(new IEventHandleFat(ControlPlaneProxyActorId(), sender, request.release())); @@ -194,7 +194,7 @@ struct TTestBootstrap { void SendControlQueryRequest(const TVector<TString>& permissions = {}, const TString& user = "test_user@staff") { TActorId sender = Runtime->AllocateEdgeActor(); - YandexQuery::ControlQueryRequest proto; + FederatedQuery::ControlQueryRequest proto; auto request = std::make_unique<TEvControlPlaneProxy::TEvControlQueryRequest>("my_folder", proto, user, "", permissions); Runtime->Send(new IEventHandleFat(ControlPlaneProxyActorId(), sender, request.release())); @@ -204,7 +204,7 @@ struct TTestBootstrap { void SendGetResultDataRequest(const TVector<TString>& permissions = {}, const TString& user = "test_user@staff") { TActorId sender = Runtime->AllocateEdgeActor(); - YandexQuery::GetResultDataRequest proto; + FederatedQuery::GetResultDataRequest proto; auto request = std::make_unique<TEvControlPlaneProxy::TEvGetResultDataRequest>("my_folder", proto, user, "", permissions); Runtime->Send(new IEventHandleFat(ControlPlaneProxyActorId(), sender, request.release())); @@ -214,7 +214,7 @@ struct TTestBootstrap { void SendListJobsRequest(const TVector<TString>& permissions = {}, const TString& user = "test_user@staff") { TActorId sender = Runtime->AllocateEdgeActor(); - YandexQuery::ListJobsRequest proto; + FederatedQuery::ListJobsRequest proto; proto.set_query_id("my_query_id"); auto request = std::make_unique<TEvControlPlaneProxy::TEvListJobsRequest>("", proto, user, "", permissions); @@ -225,7 +225,7 @@ struct TTestBootstrap { void SendDescribeJobRequest(const TVector<TString>& permissions = {}, const TString& user = "test_user@staff") { TActorId sender = Runtime->AllocateEdgeActor(); - YandexQuery::DescribeJobRequest proto; + FederatedQuery::DescribeJobRequest proto; auto request = std::make_unique<TEvControlPlaneProxy::TEvDescribeJobRequest>("my_folder", proto, user, "", permissions); Runtime->Send(new IEventHandleFat(ControlPlaneProxyActorId(), sender, request.release())); @@ -235,7 +235,7 @@ struct TTestBootstrap { void SendCreateConnectionRequest(const TVector<TString>& permissions = {}, const TString& serviceAccountId = {}, const TString& user = "test_user@staff") { TActorId sender = Runtime->AllocateEdgeActor(); - YandexQuery::CreateConnectionRequest proto; + FederatedQuery::CreateConnectionRequest proto; if (serviceAccountId) { proto.mutable_content() ->mutable_setting() @@ -253,7 +253,7 @@ struct TTestBootstrap { void SendListConnectionsRequest(const TVector<TString>& permissions = {}, const TString& user = "test_user@staff") { TActorId sender = Runtime->AllocateEdgeActor(); - YandexQuery::ListConnectionsRequest proto; + FederatedQuery::ListConnectionsRequest proto; auto request = std::make_unique<TEvControlPlaneProxy::TEvListConnectionsRequest>("my_folder", proto, user, "", permissions); Runtime->Send(new IEventHandleFat(ControlPlaneProxyActorId(), sender, request.release())); @@ -263,7 +263,7 @@ struct TTestBootstrap { void SendDescribeConnectionRequest(const TVector<TString>& permissions = {}, const TString& user = "test_user@staff") { TActorId sender = Runtime->AllocateEdgeActor(); - YandexQuery::DescribeConnectionRequest proto; + FederatedQuery::DescribeConnectionRequest proto; auto request = std::make_unique<TEvControlPlaneProxy::TEvDescribeConnectionRequest>("my_folder", proto, user, "", permissions); Runtime->Send(new IEventHandleFat(ControlPlaneProxyActorId(), sender, request.release())); @@ -273,7 +273,7 @@ struct TTestBootstrap { void SendModifyConnectionRequest(const TVector<TString>& permissions = {}, const TString& serviceAccountId = {}, const TString& user = "test_user@staff") { TActorId sender = Runtime->AllocateEdgeActor(); - YandexQuery::ModifyConnectionRequest proto; + FederatedQuery::ModifyConnectionRequest proto; if (serviceAccountId) { proto.mutable_content() ->mutable_setting() @@ -291,7 +291,7 @@ struct TTestBootstrap { void SendDeleteConnectionRequest(const TVector<TString>& permissions = {}, const TString& user = "test_user@staff") { TActorId sender = Runtime->AllocateEdgeActor(); - YandexQuery::DeleteConnectionRequest proto; + FederatedQuery::DeleteConnectionRequest proto; auto request = std::make_unique<TEvControlPlaneProxy::TEvDeleteConnectionRequest>("my_folder", proto, user, "", permissions); Runtime->Send(new IEventHandleFat(ControlPlaneProxyActorId(), sender, request.release())); @@ -301,7 +301,7 @@ struct TTestBootstrap { void SendTestConnectionRequest(const TVector<TString>& permissions = {}, const TString& serviceAccountId = {}, const TString& user = "test_user@staff") { TActorId sender = Runtime->AllocateEdgeActor(); - YandexQuery::TestConnectionRequest proto; + FederatedQuery::TestConnectionRequest proto; if (serviceAccountId) { proto.mutable_setting() ->mutable_ydb_database() @@ -318,7 +318,7 @@ struct TTestBootstrap { void SendCreateBindingRequest(const TVector<TString>& permissions = {}, const TString& user = "test_user@staff") { TActorId sender = Runtime->AllocateEdgeActor(); - YandexQuery::CreateBindingRequest proto; + FederatedQuery::CreateBindingRequest proto; auto request = std::make_unique<TEvControlPlaneProxy::TEvCreateBindingRequest>("my_folder", proto, user, "", permissions); Runtime->Send(new IEventHandleFat(ControlPlaneProxyActorId(), sender, request.release())); @@ -328,7 +328,7 @@ struct TTestBootstrap { void SendListBindingsRequest(const TVector<TString>& permissions = {}, const TString& user = "test_user@staff") { TActorId sender = Runtime->AllocateEdgeActor(); - YandexQuery::ListBindingsRequest proto; + FederatedQuery::ListBindingsRequest proto; auto request = std::make_unique<TEvControlPlaneProxy::TEvListBindingsRequest>("my_folder", proto, user, "", permissions); Runtime->Send(new IEventHandleFat(ControlPlaneProxyActorId(), sender, request.release())); @@ -338,7 +338,7 @@ struct TTestBootstrap { void SendDescribeBindingRequest(const TVector<TString>& permissions = {}, const TString& user = "test_user@staff") { TActorId sender = Runtime->AllocateEdgeActor(); - YandexQuery::DescribeBindingRequest proto; + FederatedQuery::DescribeBindingRequest proto; auto request = std::make_unique<TEvControlPlaneProxy::TEvDescribeBindingRequest>("my_folder", proto, user, "", permissions); Runtime->Send(new IEventHandleFat(ControlPlaneProxyActorId(), sender, request.release())); @@ -348,7 +348,7 @@ struct TTestBootstrap { void SendModifyBindingRequest(const TVector<TString>& permissions = {}, const TString& user = "test_user@staff") { TActorId sender = Runtime->AllocateEdgeActor(); - YandexQuery::ModifyBindingRequest proto; + FederatedQuery::ModifyBindingRequest proto; auto request = std::make_unique<TEvControlPlaneProxy::TEvModifyBindingRequest>("my_folder", proto, user, "", permissions); Runtime->Send(new IEventHandleFat(ControlPlaneProxyActorId(), sender, request.release())); @@ -358,7 +358,7 @@ struct TTestBootstrap { void SendDeleteBindingRequest(const TVector<TString>& permissions = {}, const TString& user = "test_user@staff") { TActorId sender = Runtime->AllocateEdgeActor(); - YandexQuery::DeleteBindingRequest proto; + FederatedQuery::DeleteBindingRequest proto; auto request = std::make_unique<TEvControlPlaneProxy::TEvDeleteBindingRequest>("my_folder", proto, user, "", permissions); Runtime->Send(new IEventHandleFat(ControlPlaneProxyActorId(), sender, request.release())); diff --git a/ydb/core/yq/libs/control_plane_proxy/utils.h b/ydb/core/yq/libs/control_plane_proxy/utils.h index 2d583cac89..a57bc592d8 100644 --- a/ydb/core/yq/libs/control_plane_proxy/utils.h +++ b/ydb/core/yq/libs/control_plane_proxy/utils.h @@ -1,59 +1,9 @@ #pragma once -#include <ydb/public/api/protos/yq.pb.h> #include <ydb/public/api/protos/draft/fq.pb.h> namespace NYq { -inline TString GetServiceAccountId(const YandexQuery::IamAuth& auth) { - return auth.has_service_account() - ? auth.service_account().id() - : TString{}; -} - -template<typename T> -TString ExtractServiceAccountIdImpl(const T& setting) { - switch (setting.connection_case()) { - case YandexQuery::ConnectionSetting::kYdbDatabase: { - return GetServiceAccountId(setting.ydb_database().auth()); - } - case YandexQuery::ConnectionSetting::kDataStreams: { - return GetServiceAccountId(setting.data_streams().auth()); - } - case YandexQuery::ConnectionSetting::kObjectStorage: { - return GetServiceAccountId(setting.object_storage().auth()); - } - case YandexQuery::ConnectionSetting::kMonitoring: { - return GetServiceAccountId(setting.monitoring().auth()); - } - case YandexQuery::ConnectionSetting::kClickhouseCluster: { - return GetServiceAccountId(setting.clickhouse_cluster().auth()); - } - // Do not replace with default. Adding a new connection should cause a compilation error - case YandexQuery::ConnectionSetting::CONNECTION_NOT_SET: - break; - } - return {}; -} - -inline TString ExtractServiceAccountId(const YandexQuery::TestConnectionRequest& c) { - return ExtractServiceAccountIdImpl(c.setting()); -} - -inline TString ExtractServiceAccountId(const YandexQuery::CreateConnectionRequest& c) { - return ExtractServiceAccountIdImpl(c.content().setting()); -} - -inline TString ExtractServiceAccountId(const YandexQuery::ModifyConnectionRequest& c) { - return ExtractServiceAccountIdImpl(c.content().setting()); -} - -template<typename T> -TString ExtractServiceAccountId(const T&) { - return {}; -} - -///////////////////////////////////////////////////////////////////////////////// inline TString GetServiceAccountId(const FederatedQuery::IamAuth& auth) { return auth.has_service_account() ? auth.service_account().id() @@ -97,4 +47,9 @@ inline TString ExtractServiceAccountId(const FederatedQuery::ModifyConnectionReq return ExtractServiceAccountIdImpl2(c.content().setting()); } +template<typename T> +TString ExtractServiceAccountId(const T&) { + return {}; +} + } // namespace NYq diff --git a/ydb/core/yq/libs/control_plane_storage/config.cpp b/ydb/core/yq/libs/control_plane_storage/config.cpp index 4469c3228a..691ef5ec08 100644 --- a/ydb/core/yq/libs/control_plane_storage/config.cpp +++ b/ydb/core/yq/libs/control_plane_storage/config.cpp @@ -5,16 +5,16 @@ namespace NYq { namespace { -YandexQuery::ConnectionSetting::ConnectionCase GetConnectionType(const TString& typeStr) { - YandexQuery::ConnectionSetting::ConnectionType type = YandexQuery::ConnectionSetting::CONNECTION_TYPE_UNSPECIFIED; - YandexQuery::ConnectionSetting::ConnectionType_Parse(typeStr, &type); - return static_cast<YandexQuery::ConnectionSetting::ConnectionCase>(type); +FederatedQuery::ConnectionSetting::ConnectionCase GetConnectionType(const TString& typeStr) { + FederatedQuery::ConnectionSetting::ConnectionType type = FederatedQuery::ConnectionSetting::CONNECTION_TYPE_UNSPECIFIED; + FederatedQuery::ConnectionSetting::ConnectionType_Parse(typeStr, &type); + return static_cast<FederatedQuery::ConnectionSetting::ConnectionCase>(type); } -YandexQuery::BindingSetting::BindingCase GetBindingType(const TString& typeStr) { - YandexQuery::BindingSetting::BindingType type = YandexQuery::BindingSetting::BINDING_TYPE_UNSPECIFIED; - YandexQuery::BindingSetting::BindingType_Parse(typeStr, &type); - return static_cast<YandexQuery::BindingSetting::BindingCase>(type); +FederatedQuery::BindingSetting::BindingCase GetBindingType(const TString& typeStr) { + FederatedQuery::BindingSetting::BindingType type = FederatedQuery::BindingSetting::BINDING_TYPE_UNSPECIFIED; + FederatedQuery::BindingSetting::BindingType_Parse(typeStr, &type); + return static_cast<FederatedQuery::BindingSetting::BindingCase>(type); } } diff --git a/ydb/core/yq/libs/control_plane_storage/config.h b/ydb/core/yq/libs/control_plane_storage/config.h index 1fd1b3231f..5348a8d56a 100644 --- a/ydb/core/yq/libs/control_plane_storage/config.h +++ b/ydb/core/yq/libs/control_plane_storage/config.h @@ -4,7 +4,7 @@ #include <ydb/core/yq/libs/config/protos/common.pb.h> #include <ydb/core/yq/libs/config/protos/control_plane_storage.pb.h> -#include <ydb/public/api/protos/yq.pb.h> +#include <ydb/public/api/protos/draft/fq.pb.h> #include <util/datetime/base.h> #include <util/generic/hash.h> @@ -21,8 +21,8 @@ struct TControlPlaneStorageConfig { TDuration AnalyticsRetryCounterUpdateTime; TDuration StreamingRetryCounterUpdateTime; TDuration TaskLeaseTtl; - TSet<YandexQuery::ConnectionSetting::ConnectionCase> AvailableConnections; - TSet<YandexQuery::BindingSetting::BindingCase> AvailableBindings; + TSet<FederatedQuery::ConnectionSetting::ConnectionCase> AvailableConnections; + TSet<FederatedQuery::BindingSetting::BindingCase> AvailableBindings; THashMap<ui64, TRetryPolicyItem> RetryPolicies; TRetryPolicyItem TaskLeaseRetryPolicy; TDuration QuotaTtl; diff --git a/ydb/core/yq/libs/control_plane_storage/control_plane_storage_counters.cpp b/ydb/core/yq/libs/control_plane_storage/control_plane_storage_counters.cpp index 832dc006ba..f04b346cb5 100644 --- a/ydb/core/yq/libs/control_plane_storage/control_plane_storage_counters.cpp +++ b/ydb/core/yq/libs/control_plane_storage/control_plane_storage_counters.cpp @@ -52,35 +52,35 @@ TFinalStatusCounters::TFinalStatusCounters(const ::NMonitoring::TDynamicCounterP Paused = subgroup->GetCounter("PAUSED", true); } -void TFinalStatusCounters::IncByStatus(YandexQuery::QueryMeta::ComputeStatus finalStatus) { +void TFinalStatusCounters::IncByStatus(FederatedQuery::QueryMeta::ComputeStatus finalStatus) { switch (finalStatus) { - case YandexQuery::QueryMeta::COMPLETED: + case FederatedQuery::QueryMeta::COMPLETED: Completed->Inc(); break; - case YandexQuery::QueryMeta::FAILED: + case FederatedQuery::QueryMeta::FAILED: Failed->Inc(); break; - case YandexQuery::QueryMeta::ABORTED_BY_SYSTEM: + case FederatedQuery::QueryMeta::ABORTED_BY_SYSTEM: AbortedBySystem->Inc(); break; - case YandexQuery::QueryMeta::ABORTED_BY_USER: + case FederatedQuery::QueryMeta::ABORTED_BY_USER: AbortedByUser->Inc(); break; - case YandexQuery::QueryMeta::PAUSED: + case FederatedQuery::QueryMeta::PAUSED: Paused->Inc(); break; - case YandexQuery::QueryMeta::COMPUTE_STATUS_UNSPECIFIED: - case YandexQuery::QueryMeta::STARTING: - case YandexQuery::QueryMeta::ABORTING_BY_USER: - case YandexQuery::QueryMeta::ABORTING_BY_SYSTEM: - case YandexQuery::QueryMeta::RESUMING: - case YandexQuery::QueryMeta::RUNNING: - case YandexQuery::QueryMeta::COMPLETING: - case YandexQuery::QueryMeta::FAILING: - case YandexQuery::QueryMeta::PAUSING: + case FederatedQuery::QueryMeta::COMPUTE_STATUS_UNSPECIFIED: + case FederatedQuery::QueryMeta::STARTING: + case FederatedQuery::QueryMeta::ABORTING_BY_USER: + case FederatedQuery::QueryMeta::ABORTING_BY_SYSTEM: + case FederatedQuery::QueryMeta::RESUMING: + case FederatedQuery::QueryMeta::RUNNING: + case FederatedQuery::QueryMeta::COMPLETING: + case FederatedQuery::QueryMeta::FAILING: + case FederatedQuery::QueryMeta::PAUSING: break; default: - Y_ENSURE(true, "Unexpected status: " << YandexQuery::QueryMeta_ComputeStatus_Name(finalStatus)); + Y_ENSURE(true, "Unexpected status: " << FederatedQuery::QueryMeta_ComputeStatus_Name(finalStatus)); } } diff --git a/ydb/core/yq/libs/control_plane_storage/control_plane_storage_counters.h b/ydb/core/yq/libs/control_plane_storage/control_plane_storage_counters.h index e102972085..6f0b9f11ed 100644 --- a/ydb/core/yq/libs/control_plane_storage/control_plane_storage_counters.h +++ b/ydb/core/yq/libs/control_plane_storage/control_plane_storage_counters.h @@ -1,7 +1,7 @@ #pragma once #include <library/cpp/monlib/dynamic_counters/counters.h> -#include <ydb/public/api/protos/yq.pb.h> +#include <ydb/public/api/protos/draft/fq.pb.h> namespace NYq { @@ -57,7 +57,7 @@ class TFinalStatusCounters: public virtual TThrRefBase { public: TFinalStatusCounters(const ::NMonitoring::TDynamicCounterPtr& counters); - void IncByStatus(YandexQuery::QueryMeta::ComputeStatus finalStatus); + void IncByStatus(FederatedQuery::QueryMeta::ComputeStatus finalStatus); virtual ~TFinalStatusCounters() override; }; diff --git a/ydb/core/yq/libs/control_plane_storage/events/events.h b/ydb/core/yq/libs/control_plane_storage/events/events.h index 50f820e9b2..7a9ea0d491 100644 --- a/ydb/core/yq/libs/control_plane_storage/events/events.h +++ b/ydb/core/yq/libs/control_plane_storage/events/events.h @@ -9,7 +9,7 @@ #include <library/cpp/actors/interconnect/events_local.h> #include <ydb/core/yq/libs/protos/fq_private.pb.h> -#include <ydb/public/api/protos/yq.pb.h> +#include <ydb/public/api/protos/draft/fq.pb.h> #include <ydb/public/sdk/cpp/client/ydb_params/params.h> #include <ydb/library/yql/public/issue/yql_issue.h> @@ -297,46 +297,46 @@ struct TEvControlPlaneStorage { TAuditDetails<AuditMessage> AuditDetails; }; - using TEvCreateQueryRequest = TControlPlaneRequest<YandexQuery::CreateQueryRequest, EvCreateQueryRequest>; - using TEvCreateQueryResponse = TControlPlaneAuditableResponse<YandexQuery::CreateQueryResult, YandexQuery::Query, EvCreateQueryResponse>; - using TEvListQueriesRequest = TControlPlaneRequest<YandexQuery::ListQueriesRequest, EvListQueriesRequest>; - using TEvListQueriesResponse = TControlPlaneNonAuditableResponse<YandexQuery::ListQueriesResult, EvListQueriesResponse>; - using TEvDescribeQueryRequest = TControlPlaneRequest<YandexQuery::DescribeQueryRequest, EvDescribeQueryRequest>; - using TEvDescribeQueryResponse = TControlPlaneNonAuditableResponse<YandexQuery::DescribeQueryResult, EvDescribeQueryResponse>; - using TEvGetQueryStatusRequest = TControlPlaneRequest<YandexQuery::GetQueryStatusRequest, EvGetQueryStatusRequest>; - using TEvGetQueryStatusResponse = TControlPlaneNonAuditableResponse<YandexQuery::GetQueryStatusResult, EvGetQueryStatusResponse>; - using TEvModifyQueryRequest = TControlPlaneRequest<YandexQuery::ModifyQueryRequest, EvModifyQueryRequest>; - using TEvModifyQueryResponse = TControlPlaneAuditableResponse<YandexQuery::ModifyQueryResult, YandexQuery::Query, EvModifyQueryResponse>; - using TEvDeleteQueryRequest = TControlPlaneRequest<YandexQuery::DeleteQueryRequest, EvDeleteQueryRequest>; - using TEvDeleteQueryResponse = TControlPlaneAuditableResponse<YandexQuery::DeleteQueryResult, YandexQuery::Query, EvDeleteQueryResponse>; - using TEvControlQueryRequest = TControlPlaneRequest<YandexQuery::ControlQueryRequest, EvControlQueryRequest>; - using TEvControlQueryResponse = TControlPlaneAuditableResponse<YandexQuery::ControlQueryResult, YandexQuery::Query, EvControlQueryResponse>; - using TEvGetResultDataRequest = TControlPlaneRequest<YandexQuery::GetResultDataRequest, EvGetResultDataRequest>; - using TEvGetResultDataResponse = TControlPlaneNonAuditableResponse<YandexQuery::GetResultDataResult, EvGetResultDataResponse>; - using TEvListJobsRequest = TControlPlaneRequest<YandexQuery::ListJobsRequest, EvListJobsRequest>; - using TEvListJobsResponse = TControlPlaneNonAuditableResponse<YandexQuery::ListJobsResult, EvListJobsResponse>; - using TEvDescribeJobRequest = TControlPlaneRequest<YandexQuery::DescribeJobRequest, EvDescribeJobRequest>; - using TEvDescribeJobResponse = TControlPlaneNonAuditableResponse<YandexQuery::DescribeJobResult, EvDescribeJobResponse>; - using TEvCreateConnectionRequest = TControlPlaneRequest<YandexQuery::CreateConnectionRequest, EvCreateConnectionRequest>; - using TEvCreateConnectionResponse = TControlPlaneAuditableResponse<YandexQuery::CreateConnectionResult, YandexQuery::Connection, EvCreateConnectionResponse>; - using TEvListConnectionsRequest = TControlPlaneRequest<YandexQuery::ListConnectionsRequest, EvListConnectionsRequest>; - using TEvListConnectionsResponse = TControlPlaneNonAuditableResponse<YandexQuery::ListConnectionsResult, EvListConnectionsResponse>; - using TEvDescribeConnectionRequest = TControlPlaneRequest<YandexQuery::DescribeConnectionRequest, EvDescribeConnectionRequest>; - using TEvDescribeConnectionResponse = TControlPlaneNonAuditableResponse<YandexQuery::DescribeConnectionResult, EvDescribeConnectionResponse>; - using TEvModifyConnectionRequest = TControlPlaneRequest<YandexQuery::ModifyConnectionRequest, EvModifyConnectionRequest>; - using TEvModifyConnectionResponse = TControlPlaneAuditableResponse<YandexQuery::ModifyConnectionResult, YandexQuery::Connection, EvModifyConnectionResponse>; - using TEvDeleteConnectionRequest = TControlPlaneRequest<YandexQuery::DeleteConnectionRequest, EvDeleteConnectionRequest>; - using TEvDeleteConnectionResponse = TControlPlaneAuditableResponse<YandexQuery::DeleteConnectionResult, YandexQuery::Connection, EvDeleteConnectionResponse>; - using TEvCreateBindingRequest = TControlPlaneRequest<YandexQuery::CreateBindingRequest, EvCreateBindingRequest>; - using TEvCreateBindingResponse = TControlPlaneAuditableResponse<YandexQuery::CreateBindingResult, YandexQuery::Binding, EvCreateBindingResponse>; - using TEvListBindingsRequest = TControlPlaneRequest<YandexQuery::ListBindingsRequest, EvListBindingsRequest>; - using TEvListBindingsResponse = TControlPlaneNonAuditableResponse<YandexQuery::ListBindingsResult, EvListBindingsResponse>; - using TEvDescribeBindingRequest = TControlPlaneRequest<YandexQuery::DescribeBindingRequest, EvDescribeBindingRequest>; - using TEvDescribeBindingResponse = TControlPlaneNonAuditableResponse<YandexQuery::DescribeBindingResult, EvDescribeBindingResponse>; - using TEvModifyBindingRequest = TControlPlaneRequest<YandexQuery::ModifyBindingRequest, EvModifyBindingRequest>; - using TEvModifyBindingResponse = TControlPlaneAuditableResponse<YandexQuery::ModifyBindingResult, YandexQuery::Binding, EvModifyBindingResponse>; - using TEvDeleteBindingRequest = TControlPlaneRequest<YandexQuery::DeleteBindingRequest, EvDeleteBindingRequest>; - using TEvDeleteBindingResponse = TControlPlaneAuditableResponse<YandexQuery::DeleteBindingResult, YandexQuery::Binding, EvDeleteBindingResponse>; + using TEvCreateQueryRequest = TControlPlaneRequest<FederatedQuery::CreateQueryRequest, EvCreateQueryRequest>; + using TEvCreateQueryResponse = TControlPlaneAuditableResponse<FederatedQuery::CreateQueryResult, FederatedQuery::Query, EvCreateQueryResponse>; + using TEvListQueriesRequest = TControlPlaneRequest<FederatedQuery::ListQueriesRequest, EvListQueriesRequest>; + using TEvListQueriesResponse = TControlPlaneNonAuditableResponse<FederatedQuery::ListQueriesResult, EvListQueriesResponse>; + using TEvDescribeQueryRequest = TControlPlaneRequest<FederatedQuery::DescribeQueryRequest, EvDescribeQueryRequest>; + using TEvDescribeQueryResponse = TControlPlaneNonAuditableResponse<FederatedQuery::DescribeQueryResult, EvDescribeQueryResponse>; + using TEvGetQueryStatusRequest = TControlPlaneRequest<FederatedQuery::GetQueryStatusRequest, EvGetQueryStatusRequest>; + using TEvGetQueryStatusResponse = TControlPlaneNonAuditableResponse<FederatedQuery::GetQueryStatusResult, EvGetQueryStatusResponse>; + using TEvModifyQueryRequest = TControlPlaneRequest<FederatedQuery::ModifyQueryRequest, EvModifyQueryRequest>; + using TEvModifyQueryResponse = TControlPlaneAuditableResponse<FederatedQuery::ModifyQueryResult, FederatedQuery::Query, EvModifyQueryResponse>; + using TEvDeleteQueryRequest = TControlPlaneRequest<FederatedQuery::DeleteQueryRequest, EvDeleteQueryRequest>; + using TEvDeleteQueryResponse = TControlPlaneAuditableResponse<FederatedQuery::DeleteQueryResult, FederatedQuery::Query, EvDeleteQueryResponse>; + using TEvControlQueryRequest = TControlPlaneRequest<FederatedQuery::ControlQueryRequest, EvControlQueryRequest>; + using TEvControlQueryResponse = TControlPlaneAuditableResponse<FederatedQuery::ControlQueryResult, FederatedQuery::Query, EvControlQueryResponse>; + using TEvGetResultDataRequest = TControlPlaneRequest<FederatedQuery::GetResultDataRequest, EvGetResultDataRequest>; + using TEvGetResultDataResponse = TControlPlaneNonAuditableResponse<FederatedQuery::GetResultDataResult, EvGetResultDataResponse>; + using TEvListJobsRequest = TControlPlaneRequest<FederatedQuery::ListJobsRequest, EvListJobsRequest>; + using TEvListJobsResponse = TControlPlaneNonAuditableResponse<FederatedQuery::ListJobsResult, EvListJobsResponse>; + using TEvDescribeJobRequest = TControlPlaneRequest<FederatedQuery::DescribeJobRequest, EvDescribeJobRequest>; + using TEvDescribeJobResponse = TControlPlaneNonAuditableResponse<FederatedQuery::DescribeJobResult, EvDescribeJobResponse>; + using TEvCreateConnectionRequest = TControlPlaneRequest<FederatedQuery::CreateConnectionRequest, EvCreateConnectionRequest>; + using TEvCreateConnectionResponse = TControlPlaneAuditableResponse<FederatedQuery::CreateConnectionResult, FederatedQuery::Connection, EvCreateConnectionResponse>; + using TEvListConnectionsRequest = TControlPlaneRequest<FederatedQuery::ListConnectionsRequest, EvListConnectionsRequest>; + using TEvListConnectionsResponse = TControlPlaneNonAuditableResponse<FederatedQuery::ListConnectionsResult, EvListConnectionsResponse>; + using TEvDescribeConnectionRequest = TControlPlaneRequest<FederatedQuery::DescribeConnectionRequest, EvDescribeConnectionRequest>; + using TEvDescribeConnectionResponse = TControlPlaneNonAuditableResponse<FederatedQuery::DescribeConnectionResult, EvDescribeConnectionResponse>; + using TEvModifyConnectionRequest = TControlPlaneRequest<FederatedQuery::ModifyConnectionRequest, EvModifyConnectionRequest>; + using TEvModifyConnectionResponse = TControlPlaneAuditableResponse<FederatedQuery::ModifyConnectionResult, FederatedQuery::Connection, EvModifyConnectionResponse>; + using TEvDeleteConnectionRequest = TControlPlaneRequest<FederatedQuery::DeleteConnectionRequest, EvDeleteConnectionRequest>; + using TEvDeleteConnectionResponse = TControlPlaneAuditableResponse<FederatedQuery::DeleteConnectionResult, FederatedQuery::Connection, EvDeleteConnectionResponse>; + using TEvCreateBindingRequest = TControlPlaneRequest<FederatedQuery::CreateBindingRequest, EvCreateBindingRequest>; + using TEvCreateBindingResponse = TControlPlaneAuditableResponse<FederatedQuery::CreateBindingResult, FederatedQuery::Binding, EvCreateBindingResponse>; + using TEvListBindingsRequest = TControlPlaneRequest<FederatedQuery::ListBindingsRequest, EvListBindingsRequest>; + using TEvListBindingsResponse = TControlPlaneNonAuditableResponse<FederatedQuery::ListBindingsResult, EvListBindingsResponse>; + using TEvDescribeBindingRequest = TControlPlaneRequest<FederatedQuery::DescribeBindingRequest, EvDescribeBindingRequest>; + using TEvDescribeBindingResponse = TControlPlaneNonAuditableResponse<FederatedQuery::DescribeBindingResult, EvDescribeBindingResponse>; + using TEvModifyBindingRequest = TControlPlaneRequest<FederatedQuery::ModifyBindingRequest, EvModifyBindingRequest>; + using TEvModifyBindingResponse = TControlPlaneAuditableResponse<FederatedQuery::ModifyBindingResult, FederatedQuery::Binding, EvModifyBindingResponse>; + using TEvDeleteBindingRequest = TControlPlaneRequest<FederatedQuery::DeleteBindingRequest, EvDeleteBindingRequest>; + using TEvDeleteBindingResponse = TControlPlaneAuditableResponse<FederatedQuery::DeleteBindingResult, FederatedQuery::Binding, EvDeleteBindingResponse>; // internal messages struct TEvWriteResultDataRequest : NActors::TEventLocal<TEvWriteResultDataRequest, EvWriteResultDataRequest> { diff --git a/ydb/core/yq/libs/control_plane_storage/in_memory_control_plane_storage.cpp b/ydb/core/yq/libs/control_plane_storage/in_memory_control_plane_storage.cpp index 4a28a547fd..635dc26743 100644 --- a/ydb/core/yq/libs/control_plane_storage/in_memory_control_plane_storage.cpp +++ b/ydb/core/yq/libs/control_plane_storage/in_memory_control_plane_storage.cpp @@ -42,8 +42,8 @@ class TInMemoryControlPlaneStorageActor : public NActors::TActor<TInMemoryContro }; TConfig Config; - TMap<TKey, YandexQuery::Query> Queries; - TMap<TKey, YandexQuery::Connection> Connections; + TMap<TKey, FederatedQuery::Query> Queries; + TMap<TKey, FederatedQuery::Connection> Connections; TMap<TString, TInstant> IdempotencyKeys; // idempotency_key -> created_at static constexpr int64_t InitialRevision = 1; @@ -89,7 +89,7 @@ private: { CPS_LOG_I("CreateQueryRequest"); - const YandexQuery::CreateQueryRequest& request = ev->Get()->Request; + const FederatedQuery::CreateQueryRequest& request = ev->Get()->Request; CPS_LOG_D("CreateQueryRequest: " << request.DebugString()); CleanupIndempotencyKeys(); auto now = TInstant::Now(); @@ -111,11 +111,11 @@ private: const TString user = ev->Get()->User; const TString scope = ev->Get()->Scope; const TString queryId = CreateGuidAsString(); - YandexQuery::Query query; - YandexQuery::QueryContent& content = *query.mutable_content(); + FederatedQuery::Query query; + FederatedQuery::QueryContent& content = *query.mutable_content(); content = request.content(); - YandexQuery::QueryMeta& meta = *query.mutable_meta(); - YandexQuery::CommonMeta& common = *meta.mutable_common(); + FederatedQuery::QueryMeta& meta = *query.mutable_meta(); + FederatedQuery::CommonMeta& common = *meta.mutable_common(); common.set_id(queryId); common.set_created_by(user); auto timestamp = NProtoInterop::CastToProto(now); @@ -129,16 +129,16 @@ private: } CPS_LOG_D("CreateQueryRequest, success: " << request.DebugString() << " query_id: " << queryId); - YandexQuery::CreateQueryResult result; + FederatedQuery::CreateQueryResult result; result.set_query_id(queryId); - Send(ev->Sender, new TEvControlPlaneStorage::TEvCreateQueryResponse(result, TAuditDetails<YandexQuery::Query>{}), 0, ev->Cookie); + Send(ev->Sender, new TEvControlPlaneStorage::TEvCreateQueryResponse(result, TAuditDetails<FederatedQuery::Query>{}), 0, ev->Cookie); } void Handle(TEvControlPlaneStorage::TEvListQueriesRequest::TPtr& ev) { SendEmptyResponse< TEvControlPlaneStorage::TEvListQueriesRequest::TPtr, - YandexQuery::ListQueriesResult, + FederatedQuery::ListQueriesResult, TEvControlPlaneStorage::TEvListQueriesResponse>(ev, "ListQueriesRequest"); } @@ -146,7 +146,7 @@ private: { SendEmptyResponse< TEvControlPlaneStorage::TEvDescribeQueryRequest::TPtr, - YandexQuery::DescribeQueryResult, + FederatedQuery::DescribeQueryResult, TEvControlPlaneStorage::TEvDescribeQueryResponse>(ev, "DescribeQueryRequest"); } @@ -154,34 +154,34 @@ private: { SendEmptyAuditResponse< TEvControlPlaneStorage::TEvModifyQueryRequest::TPtr, - YandexQuery::ModifyQueryResult, + FederatedQuery::ModifyQueryResult, TEvControlPlaneStorage::TEvModifyQueryResponse, - TAuditDetails<YandexQuery::Query>>(ev, "ModifyQueryRequest"); + TAuditDetails<FederatedQuery::Query>>(ev, "ModifyQueryRequest"); } void Handle(TEvControlPlaneStorage::TEvDeleteQueryRequest::TPtr& ev) { SendEmptyAuditResponse< TEvControlPlaneStorage::TEvDeleteQueryRequest::TPtr, - YandexQuery::DeleteQueryResult, + FederatedQuery::DeleteQueryResult, TEvControlPlaneStorage::TEvDeleteQueryResponse, - TAuditDetails<YandexQuery::Query>>(ev, "DeleteQueryRequest"); + TAuditDetails<FederatedQuery::Query>>(ev, "DeleteQueryRequest"); } void Handle(TEvControlPlaneStorage::TEvControlQueryRequest::TPtr& ev) { SendEmptyAuditResponse< TEvControlPlaneStorage::TEvControlQueryRequest::TPtr, - YandexQuery::ControlQueryResult, + FederatedQuery::ControlQueryResult, TEvControlPlaneStorage::TEvControlQueryResponse, - TAuditDetails<YandexQuery::Query>>(ev, "ControlQueryRequest"); + TAuditDetails<FederatedQuery::Query>>(ev, "ControlQueryRequest"); } void Handle(TEvControlPlaneStorage::TEvGetResultDataRequest::TPtr& ev) { SendEmptyResponse< TEvControlPlaneStorage::TEvGetResultDataRequest::TPtr, - YandexQuery::GetResultDataResult, + FederatedQuery::GetResultDataResult, TEvControlPlaneStorage::TEvGetResultDataResponse>(ev, "GetResultDataRequest"); } @@ -189,7 +189,7 @@ private: { SendEmptyResponse< TEvControlPlaneStorage::TEvListJobsRequest::TPtr, - YandexQuery::ListJobsResult, + FederatedQuery::ListJobsResult, TEvControlPlaneStorage::TEvListJobsResponse>(ev, "ListJobsRequest"); } @@ -197,16 +197,16 @@ private: { SendEmptyAuditResponse< TEvControlPlaneStorage::TEvCreateConnectionRequest::TPtr, - YandexQuery::CreateConnectionResult, + FederatedQuery::CreateConnectionResult, TEvControlPlaneStorage::TEvCreateConnectionResponse, - TAuditDetails<YandexQuery::Connection>>(ev, "CreateConnectionRequest"); + TAuditDetails<FederatedQuery::Connection>>(ev, "CreateConnectionRequest"); } void Handle(TEvControlPlaneStorage::TEvListConnectionsRequest::TPtr& ev) { SendEmptyResponse< TEvControlPlaneStorage::TEvListConnectionsRequest::TPtr, - YandexQuery::ListConnectionsResult, + FederatedQuery::ListConnectionsResult, TEvControlPlaneStorage::TEvListConnectionsResponse>(ev, "ListConnectionsRequest"); } @@ -214,7 +214,7 @@ private: { SendEmptyResponse< TEvControlPlaneStorage::TEvDescribeConnectionRequest::TPtr, - YandexQuery::DescribeConnectionResult, + FederatedQuery::DescribeConnectionResult, TEvControlPlaneStorage::TEvDescribeConnectionResponse>(ev, "DescribeConnectionRequest"); } @@ -222,34 +222,34 @@ private: { SendEmptyAuditResponse< TEvControlPlaneStorage::TEvModifyConnectionRequest::TPtr, - YandexQuery::ModifyConnectionResult, + FederatedQuery::ModifyConnectionResult, TEvControlPlaneStorage::TEvModifyConnectionResponse, - TAuditDetails<YandexQuery::Connection>>(ev, "ModifyConnectionRequest"); + TAuditDetails<FederatedQuery::Connection>>(ev, "ModifyConnectionRequest"); } void Handle(TEvControlPlaneStorage::TEvDeleteConnectionRequest::TPtr& ev) { SendEmptyAuditResponse< TEvControlPlaneStorage::TEvDeleteConnectionRequest::TPtr, - YandexQuery::DeleteConnectionResult, + FederatedQuery::DeleteConnectionResult, TEvControlPlaneStorage::TEvDeleteConnectionResponse, - TAuditDetails<YandexQuery::Connection>>(ev, "DeleteConnectionRequest"); + TAuditDetails<FederatedQuery::Connection>>(ev, "DeleteConnectionRequest"); } void Handle(TEvControlPlaneStorage::TEvCreateBindingRequest::TPtr& ev) { SendEmptyAuditResponse< TEvControlPlaneStorage::TEvCreateBindingRequest::TPtr, - YandexQuery::CreateBindingResult, + FederatedQuery::CreateBindingResult, TEvControlPlaneStorage::TEvCreateBindingResponse, - TAuditDetails<YandexQuery::Binding>>(ev, "CreateBindingRequest"); + TAuditDetails<FederatedQuery::Binding>>(ev, "CreateBindingRequest"); } void Handle(TEvControlPlaneStorage::TEvListBindingsRequest::TPtr& ev) { SendEmptyResponse< TEvControlPlaneStorage::TEvListBindingsRequest::TPtr, - YandexQuery::ListBindingsResult, + FederatedQuery::ListBindingsResult, TEvControlPlaneStorage::TEvListBindingsResponse>(ev, "ListBindingsRequest"); } @@ -257,7 +257,7 @@ private: { SendEmptyResponse< TEvControlPlaneStorage::TEvDescribeBindingRequest::TPtr, - YandexQuery::DescribeBindingResult, + FederatedQuery::DescribeBindingResult, TEvControlPlaneStorage::TEvDescribeBindingResponse>(ev, "DescribeBindingRequest"); } @@ -265,25 +265,25 @@ private: { SendEmptyAuditResponse< TEvControlPlaneStorage::TEvModifyBindingRequest::TPtr, - YandexQuery::ModifyBindingResult, + FederatedQuery::ModifyBindingResult, TEvControlPlaneStorage::TEvModifyBindingResponse, - TAuditDetails<YandexQuery::Binding>>(ev, "ModifyBindingRequest"); + TAuditDetails<FederatedQuery::Binding>>(ev, "ModifyBindingRequest"); } void Handle(TEvControlPlaneStorage::TEvDeleteBindingRequest::TPtr& ev) { SendEmptyAuditResponse< TEvControlPlaneStorage::TEvDeleteBindingRequest::TPtr, - YandexQuery::DeleteBindingResult, + FederatedQuery::DeleteBindingResult, TEvControlPlaneStorage::TEvDeleteBindingResponse, - TAuditDetails<YandexQuery::Binding>>(ev, "DeleteBindingRequest"); + TAuditDetails<FederatedQuery::Binding>>(ev, "DeleteBindingRequest"); } void Handle(TEvControlPlaneStorage::TEvDescribeJobRequest::TPtr& ev) { SendEmptyResponse< TEvControlPlaneStorage::TEvDescribeJobRequest::TPtr, - YandexQuery::DescribeJobResult, + FederatedQuery::DescribeJobResult, TEvControlPlaneStorage::TEvDescribeJobResponse>(ev, "DescribeJobRequest"); } @@ -346,21 +346,21 @@ private: NYql::TIssues ValidateCreateQueryRequest(TEvControlPlaneStorage::TEvCreateQueryRequest::TPtr& ev) { NYql::TIssues issues; - const YandexQuery::CreateQueryRequest& request = ev->Get()->Request; + const FederatedQuery::CreateQueryRequest& request = ev->Get()->Request; const TString user = ev->Get()->User; const TString scope = ev->Get()->Scope; - const YandexQuery::QueryContent& query = request.content(); + const FederatedQuery::QueryContent& query = request.content(); TString error; if (!request.validate(error)) { issues.AddIssue(MakeErrorIssue(TIssuesIds::BAD_REQUEST, error)); } - if (query.type() == YandexQuery::QueryContent::QUERY_TYPE_UNSPECIFIED) { + if (query.type() == FederatedQuery::QueryContent::QUERY_TYPE_UNSPECIFIED) { issues.AddIssue(MakeErrorIssue(TIssuesIds::BAD_REQUEST, "type field is not specified")); } - if (query.acl().visibility() == YandexQuery::Acl::VISIBILITY_UNSPECIFIED) { + if (query.acl().visibility() == FederatedQuery::Acl::VISIBILITY_UNSPECIFIED) { issues.AddIssue(MakeErrorIssue(TIssuesIds::BAD_REQUEST, "acl.visibility field is not specified")); } diff --git a/ydb/core/yq/libs/control_plane_storage/internal/rate_limiter_resources.cpp b/ydb/core/yq/libs/control_plane_storage/internal/rate_limiter_resources.cpp index aa8d10309a..9a043ff8c3 100644 --- a/ydb/core/yq/libs/control_plane_storage/internal/rate_limiter_resources.cpp +++ b/ydb/core/yq/libs/control_plane_storage/internal/rate_limiter_resources.cpp @@ -105,7 +105,7 @@ public: return; } - YandexQuery::Internal::QueryInternal internal; + FederatedQuery::Internal::QueryInternal internal; if (!internal.ParseFromString(*parser.ColumnParser(INTERNAL_COLUMN_NAME).GetOptionalString())) { ReplyWithError(TStringBuilder() << "Error parsing proto message for query internal. Please contact internal support"); return; @@ -113,7 +113,7 @@ public: CloudId = internal.cloud_id(); if constexpr (TDerived::IsCreateRequest) { - YandexQuery::Query query; + FederatedQuery::Query query; if (!query.ParseFromString(*parser.ColumnParser(QUERY_COLUMN_NAME).GetOptionalString())) { ReplyWithError(TStringBuilder() << "Error parsing proto message for query. Please contact internal support"); return; diff --git a/ydb/core/yq/libs/control_plane_storage/internal/response_tasks.h b/ydb/core/yq/libs/control_plane_storage/internal/response_tasks.h index 2f7aa74f3a..bbaa690bbd 100644 --- a/ydb/core/yq/libs/control_plane_storage/internal/response_tasks.h +++ b/ydb/core/yq/libs/control_plane_storage/internal/response_tasks.h @@ -9,8 +9,8 @@ struct TTask { TString Scope; TString QueryId; ui32 RetryCount; - YandexQuery::Query Query; - YandexQuery::Internal::QueryInternal Internal; + FederatedQuery::Query Query; + FederatedQuery::Internal::QueryInternal Internal; ui64 Generation = 0; TInstant Deadline; }; diff --git a/ydb/core/yq/libs/control_plane_storage/internal/task_get.cpp b/ydb/core/yq/libs/control_plane_storage/internal/task_get.cpp index 490575f227..7788ee443f 100644 --- a/ydb/core/yq/libs/control_plane_storage/internal/task_get.cpp +++ b/ydb/core/yq/libs/control_plane_storage/internal/task_get.cpp @@ -21,37 +21,37 @@ struct TTaskInternal { TString TablePathPrefix; TString Owner; TString HostName; - TMaybe<YandexQuery::Job> Job; + TMaybe<FederatedQuery::Job> Job; TInstant Deadline; TString TenantName; TString NewTenantName; }; - TString GetServiceAccountId(const YandexQuery::IamAuth& auth) { + TString GetServiceAccountId(const FederatedQuery::IamAuth& auth) { return auth.has_service_account() ? auth.service_account().id() : TString{}; } - TString ExtractServiceAccountId(const YandexQuery::Connection& c) { + TString ExtractServiceAccountId(const FederatedQuery::Connection& c) { switch (c.content().setting().connection_case()) { - case YandexQuery::ConnectionSetting::kYdbDatabase: { + case FederatedQuery::ConnectionSetting::kYdbDatabase: { return GetServiceAccountId(c.content().setting().ydb_database().auth()); } - case YandexQuery::ConnectionSetting::kDataStreams: { + case FederatedQuery::ConnectionSetting::kDataStreams: { return GetServiceAccountId(c.content().setting().data_streams().auth()); } - case YandexQuery::ConnectionSetting::kObjectStorage: { + case FederatedQuery::ConnectionSetting::kObjectStorage: { return GetServiceAccountId(c.content().setting().object_storage().auth()); } - case YandexQuery::ConnectionSetting::kMonitoring: { + case FederatedQuery::ConnectionSetting::kMonitoring: { return GetServiceAccountId(c.content().setting().monitoring().auth()); } - case YandexQuery::ConnectionSetting::kClickhouseCluster: { + case FederatedQuery::ConnectionSetting::kClickhouseCluster: { return GetServiceAccountId(c.content().setting().clickhouse_cluster().auth()); } // Do not replace with default. Adding a new connection should cause a compilation error - case YandexQuery::ConnectionSetting::CONNECTION_NOT_SET: + case FederatedQuery::ConnectionSetting::CONNECTION_NOT_SET: break; } return {}; @@ -205,7 +205,7 @@ std::tuple<TString, NYdb::TParams, std::function<std::pair<TString, NYdb::TParam abortIssueMsg.set_message("Query was aborted by system due to high failure rate"); abortIssueMsg.set_severity(NYql::TSeverityIds::S_ERROR); *task.Query.add_issue() = abortIssueMsg; - task.Query.mutable_meta()->set_status(YandexQuery::QueryMeta::ABORTING_BY_SYSTEM); + task.Query.mutable_meta()->set_status(FederatedQuery::QueryMeta::ABORTING_BY_SYSTEM); } if (tenantInfo->TenantState.Value(taskInternal.TenantName, TenantState::Active) != TenantState::Active) { @@ -238,7 +238,7 @@ TDuration ExtractLimit(const TTask& task) { auto userExecutionLimit = TDuration::Zero(); switch (limits.timeout_case()) { - case YandexQuery::Limits::TimeoutCase::kExecutionDeadline: { + case FederatedQuery::Limits::TimeoutCase::kExecutionDeadline: { auto now = TInstant::Now(); auto deadline = NProtoInterop::CastFromProto(limits.execution_deadline()); if (!deadline) { @@ -251,7 +251,7 @@ TDuration ExtractLimit(const TTask& task) { } break; } - case YandexQuery::Limits::TimeoutCase::kExecutionTimeout: { + case FederatedQuery::Limits::TimeoutCase::kExecutionTimeout: { userExecutionLimit = NProtoInterop::CastFromProto(limits.execution_timeout()); break; } @@ -438,10 +438,10 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvGetTaskRequ for (const auto& task : tasks) { const auto& queryType = task.Query.content().type(); - if (queryType != YandexQuery::QueryContent::ANALYTICS && queryType != YandexQuery::QueryContent::STREAMING) { //TODO: fix + if (queryType != FederatedQuery::QueryContent::ANALYTICS && queryType != FederatedQuery::QueryContent::STREAMING) { //TODO: fix ythrow yexception() << "query type " - << YandexQuery::QueryContent::QueryType_Name(queryType) + << FederatedQuery::QueryContent::QueryType_Name(queryType) << " unsupported"; } @@ -452,7 +452,7 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvGetTaskRequ newTask->set_state_load_mode(task.Internal.state_load_mode()); auto* queryId = newTask->mutable_query_id(); queryId->set_value(task.Query.meta().common().id()); - newTask->set_streaming(queryType == YandexQuery::QueryContent::STREAMING); + newTask->set_streaming(queryType == FederatedQuery::QueryContent::STREAMING); newTask->set_text(task.Query.content().text()); *newTask->mutable_connection() = task.Internal.connection(); *newTask->mutable_binding() = task.Internal.binding(); diff --git a/ydb/core/yq/libs/control_plane_storage/internal/task_ping.cpp b/ydb/core/yq/libs/control_plane_storage/internal/task_ping.cpp index 07394f1277..dbd70b458f 100644 --- a/ydb/core/yq/libs/control_plane_storage/internal/task_ping.cpp +++ b/ydb/core/yq/libs/control_plane_storage/internal/task_ping.cpp @@ -46,9 +46,9 @@ TPingTaskParams ConstructHardPingTask( auto prepareParams = [=, counters=counters, actorSystem = NActors::TActivationContext::ActorSystem()](const TVector<TResultSet>& resultSets) { TString jobId; - YandexQuery::Query query; - YandexQuery::Internal::QueryInternal internal; - YandexQuery::Job job; + FederatedQuery::Query query; + FederatedQuery::Internal::QueryInternal internal; + FederatedQuery::Job job; TString owner; if (resultSets.size() != 3) { @@ -96,8 +96,8 @@ TPingTaskParams ConstructHardPingTask( ); } - TMaybe<YandexQuery::QueryMeta::ComputeStatus> queryStatus; - if (request.status() != YandexQuery::QueryMeta::COMPUTE_STATUS_UNSPECIFIED) { + TMaybe<FederatedQuery::QueryMeta::ComputeStatus> queryStatus; + if (request.status() != FederatedQuery::QueryMeta::COMPUTE_STATUS_UNSPECIFIED) { queryStatus = request.status(); } TMaybe<NYql::TIssues> issues; @@ -138,7 +138,7 @@ TPingTaskParams ConstructHardPingTask( transientIssues->AddIssue(NYql::TIssue(builder)); } else { // failure query should be processed instantly - queryStatus = YandexQuery::QueryMeta::FAILING; + queryStatus = FederatedQuery::QueryMeta::FAILING; backoff = TDuration::Zero(); if (!issues) { issues.ConstructInPlace(); @@ -250,13 +250,13 @@ TPingTaskParams ConstructHardPingTask( *job.mutable_expire_at() = NProtoInterop::CastToProto(expireAt); } - if (query.meta().status() == YandexQuery::QueryMeta::COMPLETED) { + if (query.meta().status() == FederatedQuery::QueryMeta::COMPLETED) { *query.mutable_meta()->mutable_result_expire_at() = request.deadline(); } if (request.state_load_mode()) { internal.set_state_load_mode(request.state_load_mode()); - if (request.state_load_mode() == YandexQuery::FROM_LAST_CHECKPOINT) { // Saved checkpoint + if (request.state_load_mode() == FederatedQuery::FROM_LAST_CHECKPOINT) { // Saved checkpoint query.mutable_meta()->set_has_saved_checkpoints(true); } } @@ -363,7 +363,7 @@ TPingTaskParams ConstructHardPingTask( } TString updateResultSetsExpire; - if (query.meta().status() == YandexQuery::QueryMeta::COMPLETED) { + if (query.meta().status() == FederatedQuery::QueryMeta::COMPLETED) { writeQueryBuilder.AddTimestamp("result_sets_expire_at", NProtoInterop::CastFromProto(request.deadline())); updateResultSetsExpire = "`" RESULT_SETS_EXPIRE_AT_COLUMN_NAME "` = $result_sets_expire_at"; } else { @@ -422,7 +422,7 @@ TPingTaskParams ConstructSoftPingTask( auto prepareParams = [=](const TVector<TResultSet>& resultSets) { TString owner; - YandexQuery::Internal::QueryInternal internal; + FederatedQuery::Internal::QueryInternal internal; if (resultSets.size() != 2) { ythrow TCodeLineException(TIssuesIds::INTERNAL_ERROR) << "RESULT SET SIZE of " << resultSets.size() << " != 2"; @@ -510,7 +510,7 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvPingTaskReq } if (IsTerminalStatus(request.status())) { - LOG_YQ_AUDIT_SERVICE_INFO("FinalStatus: cloud id: [" << cloudId << "], scope: [" << scope << "], query id: [" << request.query_id() << "], job id: [" << request.job_id() << "], status: " << YandexQuery::QueryMeta::ComputeStatus_Name(request.status())); + LOG_YQ_AUDIT_SERVICE_INFO("FinalStatus: cloud id: [" << cloudId << "], scope: [" << scope << "], query id: [" << request.query_id() << "], job id: [" << request.job_id() << "], status: " << FederatedQuery::QueryMeta::ComputeStatus_Name(request.status())); } auto pingTaskParams = DoesPingTaskUpdateQueriesTable(request) ? diff --git a/ydb/core/yq/libs/control_plane_storage/message_builders.h b/ydb/core/yq/libs/control_plane_storage/message_builders.h index dd125f247a..b4f2c2155e 100644 --- a/ydb/core/yq/libs/control_plane_storage/message_builders.h +++ b/ydb/core/yq/libs/control_plane_storage/message_builders.h @@ -1,7 +1,5 @@ #pragma once -#include "message_builders_yq.h" - #include <util/datetime/base.h> #include <ydb/library/yql/dq/actors/protos/dq_status_codes.pb.h> @@ -1196,7 +1194,7 @@ std::unique_ptr<NYq::TEvControlPlaneStorage::TEvPingTaskRequest> Build() request.mutable_query_id()->set_value(QueryId); request.mutable_result_id()->set_value(ResultId); if (Status) { - request.set_status((YandexQuery::QueryMeta::ComputeStatus)*Status); + request.set_status((FederatedQuery::QueryMeta::ComputeStatus)*Status); } request.set_status_code(StatusCode); if (Issues) { @@ -1210,7 +1208,7 @@ std::unique_ptr<NYq::TEvControlPlaneStorage::TEvPingTaskRequest> Build() } if (ResultSetMetas) { for (const auto& meta : *ResultSetMetas) { - YandexQuery::ResultSetMeta casted; + FederatedQuery::ResultSetMeta casted; casted.CopyFrom(meta); *request.add_result_set_meta() = casted; } @@ -1323,4 +1321,60 @@ public: } }; +template <class TEvent, class TMessage> +class TRateLimiterResourceBuilderImpl { + TString Owner; + TString QueryId; + TString Scope; + TString Tenant; + +public: + TRateLimiterResourceBuilderImpl() + { + SetOwner(DefaultOwner()); + } + + static TString DefaultOwner() + { + return "owner"; + } + + TRateLimiterResourceBuilderImpl& SetOwner(const TString& owner) + { + Owner = owner; + return *this; + } + + TRateLimiterResourceBuilderImpl& SetQueryId(const TString& queryId) + { + QueryId = queryId; + return *this; + } + + TRateLimiterResourceBuilderImpl& SetScope(const TString& scope) + { + Scope = scope; + return *this; + } + + TRateLimiterResourceBuilderImpl& SetTenant(const TString& tenant) + { + Tenant = tenant; + return *this; + } + + std::unique_ptr<TEvent> Build() + { + TMessage req; + req.set_owner_id(Owner); + req.mutable_query_id()->set_value(QueryId); + req.set_scope(Scope); + req.set_tenant(Tenant); + return std::make_unique<TEvent>(std::move(req)); + } +}; + +using TCreateRateLimiterResourceBuilder = TRateLimiterResourceBuilderImpl<NYq::TEvControlPlaneStorage::TEvCreateRateLimiterResourceRequest, Fq::Private::CreateRateLimiterResourceRequest>; +using TDeleteRateLimiterResourceBuilder = TRateLimiterResourceBuilderImpl<NYq::TEvControlPlaneStorage::TEvDeleteRateLimiterResourceRequest, Fq::Private::DeleteRateLimiterResourceRequest>; + } diff --git a/ydb/core/yq/libs/control_plane_storage/message_builders_yq.h b/ydb/core/yq/libs/control_plane_storage/message_builders_yq.h deleted file mode 100644 index ae5f68c56d..0000000000 --- a/ydb/core/yq/libs/control_plane_storage/message_builders_yq.h +++ /dev/null @@ -1,1370 +0,0 @@ -// TODO: remove YQ-1055 - -#pragma once - -#include <util/datetime/base.h> - -#include <ydb/library/yql/dq/actors/protos/dq_status_codes.pb.h> -#include <ydb/library/yql/public/issue/yql_issue_message.h> -#include <ydb/public/api/protos/yq.pb.h> - -#include <ydb/core/yq/libs/control_plane_storage/events/events.h> - -#include <library/cpp/protobuf/interop/cast.h> - -namespace NYq { - -// Queries - -class TCreateQueryBuilder { - YandexQuery::CreateQueryRequest Request; - -public: - TCreateQueryBuilder() - { - SetMode(YandexQuery::RUN); - SetType(YandexQuery::QueryContent::ANALYTICS); - SetName("test_query_name_1"); - SetVisibility(YandexQuery::Acl::SCOPE); - SetText("SELECT 1;"); - } - - TCreateQueryBuilder& SetMode(YandexQuery::ExecuteMode mode) - { - Request.set_execute_mode(mode); - return *this; - } - - TCreateQueryBuilder& SetType(YandexQuery::QueryContent::QueryType type) - { - Request.mutable_content()->set_type(type); - return *this; - } - - TCreateQueryBuilder& SetAutomatic(bool automatic) - { - Request.mutable_content()->set_automatic(automatic); - return *this; - } - - TCreateQueryBuilder& SetVisibility(YandexQuery::Acl::Visibility visibility) - { - Request.mutable_content()->mutable_acl()->set_visibility(visibility); - return *this; - } - - TCreateQueryBuilder& SetText(const TString& content) - { - Request.mutable_content()->set_text(content); - return *this; - } - - TCreateQueryBuilder& SetName(const TString& name) - { - Request.mutable_content()->set_name(name); - return *this; - } - - TCreateQueryBuilder& SetIdempotencyKey(const TString& idempotencyKey) - { - Request.set_idempotency_key(idempotencyKey); - return *this; - } - - TCreateQueryBuilder& SetDisposition(const YandexQuery::StreamingDisposition& disposition) - { - *Request.mutable_disposition() = disposition; - return *this; - } - - TCreateQueryBuilder& ClearAcl() - { - Request.mutable_content()->clear_acl(); - return *this; - } - - const YandexQuery::CreateQueryRequest& Build() - { - return Request; - } -}; - -class TListQueriesBuilder { - YandexQuery::ListQueriesRequest Request; - -public: - TListQueriesBuilder() - { - SetLimit(10); - } - - TListQueriesBuilder& SetPageToken(const TString& pageToken) - { - Request.set_page_token(pageToken); - return *this; - } - - TListQueriesBuilder& SetLimit(int64_t limit) - { - Request.set_limit(limit); - return *this; - } - - const YandexQuery::ListQueriesRequest& Build() - { - return Request; - } -}; - -class TDescribeQueryBuilder { - YandexQuery::DescribeQueryRequest Request; - -public: - TDescribeQueryBuilder& SetQueryId(const TString& queryId) - { - Request.set_query_id(queryId); - return *this; - } - - const YandexQuery::DescribeQueryRequest& Build() - { - return Request; - } -}; - -class TGetQueryStatusBuilder { - YandexQuery::GetQueryStatusRequest Request; - -public: - TGetQueryStatusBuilder& SetQueryId(const TString& queryId) - { - Request.set_query_id(queryId); - return *this; - } - - const YandexQuery::GetQueryStatusRequest& Build() - { - return Request; - } -}; - -class TDeleteQueryBuilder { - YandexQuery::DeleteQueryRequest Request; - -public: - TDeleteQueryBuilder& SetQueryId(const TString& queryId) - { - Request.set_query_id(queryId); - return *this; - } - - TDeleteQueryBuilder& SetIdempotencyKey(const TString& idempotencyKey) - { - Request.set_idempotency_key(idempotencyKey); - return *this; - } - - TDeleteQueryBuilder& SetPreviousRevision(const int64_t periousRevision) - { - Request.set_previous_revision(periousRevision); - return *this; - } - - const YandexQuery::DeleteQueryRequest& Build() - { - return Request; - } -}; - -class TModifyQueryBuilder { - YandexQuery::ModifyQueryRequest Request; - -public: - TModifyQueryBuilder() - { - SetName("test_query_name_2"); - SetMode(YandexQuery::RUN); - SetType(YandexQuery::QueryContent::ANALYTICS); - SetVisibility(YandexQuery::Acl::SCOPE); - SetText("SELECT 1;"); - } - - TModifyQueryBuilder& SetQueryId(const TString& queryId) - { - Request.set_query_id(queryId); - return *this; - } - - TModifyQueryBuilder& SetType(YandexQuery::QueryContent::QueryType type) - { - Request.mutable_content()->set_type(type); - return *this; - } - - TModifyQueryBuilder& SetVisibility(YandexQuery::Acl::Visibility visibility) - { - Request.mutable_content()->mutable_acl()->set_visibility(visibility); - return *this; - } - - TModifyQueryBuilder& SetMode(YandexQuery::ExecuteMode mode) - { - Request.set_execute_mode(mode); - return *this; - } - - TModifyQueryBuilder& SetAutomatic(bool automatic) - { - Request.mutable_content()->set_automatic(automatic); - return *this; - } - - TModifyQueryBuilder& SetText(const TString& content) - { - Request.mutable_content()->set_text(content); - return *this; - } - - TModifyQueryBuilder& SetDisposition(const YandexQuery::StreamingDisposition& disposition) - { - *Request.mutable_disposition() = disposition; - return *this; - } - - TModifyQueryBuilder& SetState(const YandexQuery::StateLoadMode& state) - { - Request.set_state_load_mode(state); - return *this; - } - - TModifyQueryBuilder& SetName(const TString& name) - { - Request.mutable_content()->set_name(name); - return *this; - } - - TModifyQueryBuilder& SetIdempotencyKey(const TString& idempotencyKey) - { - Request.set_idempotency_key(idempotencyKey); - return *this; - } - - TModifyQueryBuilder& SetPreviousRevision(const int64_t periousRevision) - { - Request.set_previous_revision(periousRevision); - return *this; - } - - TModifyQueryBuilder& SetDescription(const TString& description) - { - Request.mutable_content()->set_description(description); - return *this; - } - - const YandexQuery::ModifyQueryRequest& Build() - { - return Request; - } -}; - -class TControlQueryBuilder { - YandexQuery::ControlQueryRequest Request; - -public: - TControlQueryBuilder() - { - SetAction(YandexQuery::ABORT); - } - - TControlQueryBuilder& SetAction(const YandexQuery::QueryAction& action) - { - Request.set_action(action); - return *this; - } - - TControlQueryBuilder& SetQueryId(const TString& queryId) - { - Request.set_query_id(queryId); - return *this; - } - - TControlQueryBuilder& SetIdempotencyKey(const TString& idempotencyKey) - { - Request.set_idempotency_key(idempotencyKey); - return *this; - } - - TControlQueryBuilder& SetPreviousRevision(const int64_t periousRevision) - { - Request.set_previous_revision(periousRevision); - return *this; - } - - const YandexQuery::ControlQueryRequest& Build() - { - return Request; - } -}; - -// Results - -class TGetResultDataBuilder { - YandexQuery::GetResultDataRequest Request; - -public: - TGetResultDataBuilder() - { - SetLimit(10); - } - - TGetResultDataBuilder& SetQueryId(const TString& queryId) - { - Request.set_query_id(queryId); - return *this; - } - - TGetResultDataBuilder& SetResultSetIndex(int64_t resultSetIndex) - { - Request.set_result_set_index(resultSetIndex); - return *this; - } - - TGetResultDataBuilder& SetOffset(int64_t offset) - { - Request.set_offset(offset); - return *this; - } - - TGetResultDataBuilder& SetLimit(int64_t limit) - { - Request.set_limit(limit); - return *this; - } - - const YandexQuery::GetResultDataRequest& Build() - { - return Request; - } -}; - -// Jobs - -class TListJobsBuilder { - YandexQuery::ListJobsRequest Request; - -public: - TListJobsBuilder() - { - SetLimit(10); - } - - TListJobsBuilder& SetQueryId(const TString& queryId) - { - Request.mutable_filter()->set_query_id(queryId); - return *this; - } - - TListJobsBuilder& SetPageToken(const TString& pageToken) - { - Request.set_page_token(pageToken); - return *this; - } - - TListJobsBuilder& SetLimit(int64_t limit) - { - Request.set_limit(limit); - return *this; - } - - const YandexQuery::ListJobsRequest& Build() - { - return Request; - } -}; - -class TDescribeJobBuilder { - YandexQuery::DescribeJobRequest Request; - -public: - TDescribeJobBuilder& SetJobId(const TString& jobId) - { - Request.set_job_id(jobId); - return *this; - } - - const YandexQuery::DescribeJobRequest& Build() - { - return Request; - } -}; - -// Connections - -class TCreateConnectionBuilder { - YandexQuery::CreateConnectionRequest Request; - -public: - TCreateConnectionBuilder() - { - SetName("test_connection_name_1"); - SetVisibility(YandexQuery::Acl::SCOPE); - CreateDataStreams("my_database_id", ""); - } - - TCreateConnectionBuilder& CreateYdb(const TString& database, const TString& endpoint, const TString& serviceAccount) - { - auto& ydb = *Request.mutable_content()->mutable_setting()->mutable_ydb_database(); - if (serviceAccount) { - ydb.mutable_auth()->mutable_service_account()->set_id(serviceAccount); - } else { - ydb.mutable_auth()->mutable_current_iam(); - } - - ydb.set_database(database); - ydb.set_endpoint(endpoint); - return *this; - } - - TCreateConnectionBuilder& CreateYdb(const TString& databaseId, const TString& serviceAccount) - { - auto& ydb = *Request.mutable_content()->mutable_setting()->mutable_ydb_database(); - if (serviceAccount) { - ydb.mutable_auth()->mutable_service_account()->set_id(serviceAccount); - } else { - ydb.mutable_auth()->mutable_current_iam(); - } - - ydb.set_database_id(databaseId); - return *this; - } - - TCreateConnectionBuilder& CreateDataStreams(const TString& databaseId, const TString& serviceAccount) - { - auto& yds = *Request.mutable_content()->mutable_setting()->mutable_data_streams(); - if (serviceAccount) { - yds.mutable_auth()->mutable_service_account()->set_id(serviceAccount); - } else { - yds.mutable_auth()->mutable_current_iam(); - } - - yds.set_database_id(databaseId); - return *this; - } - - TCreateConnectionBuilder& CreateClickHouse(const TString& databaseId, const TString& login, const TString& password, const TString& serviceAccount) - { - auto& ch = *Request.mutable_content()->mutable_setting()->mutable_clickhouse_cluster(); - if (serviceAccount) { - ch.mutable_auth()->mutable_service_account()->set_id(serviceAccount); - } else { - ch.mutable_auth()->mutable_current_iam(); - } - - ch.set_database_id(databaseId); - ch.set_login(login); - ch.set_password(password); - return *this; - } - - TCreateConnectionBuilder& CreateObjectStorage(const TString& bucket, const TString& serviceAccount) - { - auto& os = *Request.mutable_content()->mutable_setting()->mutable_object_storage(); - if (serviceAccount) { - os.mutable_auth()->mutable_service_account()->set_id(serviceAccount); - } else { - os.mutable_auth()->mutable_current_iam(); - } - - os.set_bucket(bucket); - return *this; - } - - TCreateConnectionBuilder& SetVisibility(YandexQuery::Acl::Visibility visibility) - { - Request.mutable_content()->mutable_acl()->set_visibility(visibility); - return *this; - } - - TCreateConnectionBuilder& SetName(const TString& name) - { - Request.mutable_content()->set_name(name); - return *this; - } - - TCreateConnectionBuilder& SetDescription(const TString& description) - { - Request.mutable_content()->set_name(description); - return *this; - } - - TCreateConnectionBuilder& SetIdempotencyKey(const TString& idempotencyKey) - { - Request.set_idempotency_key(idempotencyKey); - return *this; - } - - const YandexQuery::CreateConnectionRequest& Build() - { - return Request; - } -}; - -class TListConnectionsBuilder { - YandexQuery::ListConnectionsRequest Request; - -public: - TListConnectionsBuilder() - { - SetLimit(10); - } - - TListConnectionsBuilder& SetPageToken(const TString& pageToken) - { - Request.set_page_token(pageToken); - return *this; - } - - TListConnectionsBuilder& SetLimit(int64_t limit) - { - Request.set_limit(limit); - return *this; - } - - const YandexQuery::ListConnectionsRequest& Build() - { - return Request; - } -}; - -class TDescribeConnectionBuilder { - YandexQuery::DescribeConnectionRequest Request; - -public: - TDescribeConnectionBuilder& SetConnectionId(const TString& connectionId) - { - Request.set_connection_id(connectionId); - return *this; - } - - const YandexQuery::DescribeConnectionRequest& Build() - { - return Request; - } -}; - -class TModifyConnectionBuilder { - YandexQuery::ModifyConnectionRequest Request; - -public: - TModifyConnectionBuilder() - { - SetName("test_connection_name_2"); - SetVisibility(YandexQuery::Acl::SCOPE); - CreateDataStreams("my_database_id", ""); - } - - TModifyConnectionBuilder& CreateYdb(const TString& databaseId, const TString& serviceAccount) - { - auto& ydb = *Request.mutable_content()->mutable_setting()->mutable_ydb_database(); - if (serviceAccount) { - ydb.mutable_auth()->mutable_service_account()->set_id(serviceAccount); - } else { - ydb.mutable_auth()->mutable_current_iam(); - } - - ydb.set_database_id(databaseId); - return *this; - } - - TModifyConnectionBuilder& CreateDataStreams(const TString& databaseId, const TString& serviceAccount) - { - auto& yds = *Request.mutable_content()->mutable_setting()->mutable_data_streams(); - if (serviceAccount) { - yds.mutable_auth()->mutable_service_account()->set_id(serviceAccount); - } else { - yds.mutable_auth()->mutable_current_iam(); - } - - yds.set_database_id(databaseId); - return *this; - } - - TModifyConnectionBuilder& CreateClickHouse(const TString& databaseId, const TString& login, const TString& password, const TString& serviceAccount) - { - auto& ch = *Request.mutable_content()->mutable_setting()->mutable_clickhouse_cluster(); - if (serviceAccount) { - ch.mutable_auth()->mutable_service_account()->set_id(serviceAccount); - } else { - ch.mutable_auth()->mutable_current_iam(); - } - - ch.set_database_id(databaseId); - ch.set_login(login); - ch.set_password(password); - return *this; - } - - TModifyConnectionBuilder& CreateObjectStorage(const TString& bucket, const TString& serviceAccount) - { - auto& os = *Request.mutable_content()->mutable_setting()->mutable_object_storage(); - if (serviceAccount) { - os.mutable_auth()->mutable_service_account()->set_id(serviceAccount); - } else { - os.mutable_auth()->mutable_current_iam(); - } - - os.set_bucket(bucket); - return *this; - } - - TModifyConnectionBuilder& SetVisibility(YandexQuery::Acl::Visibility visibility) - { - Request.mutable_content()->mutable_acl()->set_visibility(visibility); - return *this; - } - - TModifyConnectionBuilder& SetName(const TString& name) - { - Request.mutable_content()->set_name(name); - return *this; - } - - TModifyConnectionBuilder& SetDescription(const TString& description) - { - Request.mutable_content()->set_description(description); - return *this; - } - - TModifyConnectionBuilder& SetIdempotencyKey(const TString& idempotencyKey) - { - Request.set_idempotency_key(idempotencyKey); - return *this; - } - - TModifyConnectionBuilder& SetConnectionId(const TString& connectionId) - { - Request.set_connection_id(connectionId); - return *this; - } - - TModifyConnectionBuilder& SetPreviousRevision(const int64_t periousRevision) - { - Request.set_previous_revision(periousRevision); - return *this; - } - - const YandexQuery::ModifyConnectionRequest& Build() - { - return Request; - } -}; - -class TDeleteConnectionBuilder { - YandexQuery::DeleteConnectionRequest Request; - -public: - TDeleteConnectionBuilder& SetConnectionId(const TString& connectionId) - { - Request.set_connection_id(connectionId); - return *this; - } - - TDeleteConnectionBuilder& SetIdempotencyKey(const TString& idempotencyKey) - { - Request.set_idempotency_key(idempotencyKey); - return *this; - } - - TDeleteConnectionBuilder& SetPreviousRevision(const int64_t periousRevision) - { - Request.set_previous_revision(periousRevision); - return *this; - } - - const YandexQuery::DeleteConnectionRequest& Build() - { - return Request; - } -}; - -// Bindings - -class TCreateBindingBuilder { - YandexQuery::CreateBindingRequest Request; - -public: - TCreateBindingBuilder() - { - SetName("test_binding_name_1"); - SetVisibility(YandexQuery::Acl::SCOPE); - YandexQuery::DataStreamsBinding binding; - binding.set_stream_name("my_stream"); - binding.set_format("json"); - binding.set_compression("zip"); - auto* column = binding.mutable_schema()->add_column(); - column->set_name("sample_column_name"); - column->mutable_type()->set_type_id(Ydb::Type::UINT64); - CreateDataStreams(binding); - } - - TCreateBindingBuilder& SetConnectionId(const TString& connectionId) - { - Request.mutable_content()->set_connection_id(connectionId); - return *this; - } - - TCreateBindingBuilder& CreateDataStreams(const YandexQuery::DataStreamsBinding& binding) - { - *Request.mutable_content()->mutable_setting()->mutable_data_streams() = binding; - return *this; - } - - TCreateBindingBuilder& CreateObjectStorage(const YandexQuery::ObjectStorageBinding& binding) - { - *Request.mutable_content()->mutable_setting()->mutable_object_storage() = binding; - return *this; - } - - TCreateBindingBuilder& SetVisibility(YandexQuery::Acl::Visibility visibility) - { - Request.mutable_content()->mutable_acl()->set_visibility(visibility); - return *this; - } - - TCreateBindingBuilder& SetName(const TString& name) - { - Request.mutable_content()->set_name(name); - return *this; - } - - TCreateBindingBuilder& SetDescription(const TString& description) - { - Request.mutable_content()->set_name(description); - return *this; - } - - TCreateBindingBuilder& SetIdempotencyKey(const TString& idempotencyKey) - { - Request.set_idempotency_key(idempotencyKey); - return *this; - } - - const YandexQuery::CreateBindingRequest& Build() - { - return Request; - } -}; - -class TListBindingsBuilder { - YandexQuery::ListBindingsRequest Request; - -public: - TListBindingsBuilder() - { - SetLimit(10); - } - - TListBindingsBuilder& SetPageToken(const TString& pageToken) - { - Request.set_page_token(pageToken); - return *this; - } - - TListBindingsBuilder& SetLimit(int64_t limit) - { - Request.set_limit(limit); - return *this; - } - - TListBindingsBuilder& SetConnectionId(const TString& connectionId) - { - Request.mutable_filter()->set_connection_id(connectionId); - return *this; - } - - const YandexQuery::ListBindingsRequest& Build() - { - return Request; - } -}; - -class TDescribeBindingBuilder { - YandexQuery::DescribeBindingRequest Request; - -public: - TDescribeBindingBuilder& SetBindingId(const TString& bindingId) - { - Request.set_binding_id(bindingId); - return *this; - } - - const YandexQuery::DescribeBindingRequest& Build() - { - return Request; - } -}; - -class TModifyBindingBuilder { - YandexQuery::ModifyBindingRequest Request; - -public: - TModifyBindingBuilder() - { - SetName("test_binding_name_2"); - SetVisibility(YandexQuery::Acl::SCOPE); - YandexQuery::DataStreamsBinding binding; - binding.set_stream_name("my_stream"); - binding.set_format("json"); - binding.set_compression("zip"); - auto* column = binding.mutable_schema()->add_column(); - column->set_name("sample_column_name"); - column->mutable_type()->set_type_id(Ydb::Type::UINT64); - CreateDataStreams(binding); - } - - TModifyBindingBuilder& SetConnectionId(const TString& connectionId) - { - Request.mutable_content()->set_connection_id(connectionId); - return *this; - } - - TModifyBindingBuilder& CreateDataStreams(const YandexQuery::DataStreamsBinding& binding) - { - *Request.mutable_content()->mutable_setting()->mutable_data_streams() = binding; - return *this; - } - - TModifyBindingBuilder& CreateObjectStorage(const YandexQuery::ObjectStorageBinding& binding) - { - *Request.mutable_content()->mutable_setting()->mutable_object_storage() = binding; - return *this; - } - - TModifyBindingBuilder& SetVisibility(YandexQuery::Acl::Visibility visibility) - { - Request.mutable_content()->mutable_acl()->set_visibility(visibility); - return *this; - } - - TModifyBindingBuilder& SetName(const TString& name) - { - Request.mutable_content()->set_name(name); - return *this; - } - - TModifyBindingBuilder& SetDescription(const TString& description) - { - Request.mutable_content()->set_name(description); - return *this; - } - - TModifyBindingBuilder& SetIdempotencyKey(const TString& idempotencyKey) - { - Request.set_idempotency_key(idempotencyKey); - return *this; - } - - TModifyBindingBuilder& SetBindingId(const TString& bindingId) - { - Request.set_binding_id(bindingId); - return *this; - } - - TModifyBindingBuilder& SetPreviousRevision(const int64_t periousRevision) - { - Request.set_previous_revision(periousRevision); - return *this; - } - - const YandexQuery::ModifyBindingRequest& Build() - { - return Request; - } -}; - -class TDeleteBindingBuilder { - YandexQuery::DeleteBindingRequest Request; - -public: - TDeleteBindingBuilder& SetBindingId(const TString& bindingId) - { - Request.set_binding_id(bindingId); - return *this; - } - - TDeleteBindingBuilder& SetIdempotencyKey(const TString& idempotencyKey) - { - Request.set_idempotency_key(idempotencyKey); - return *this; - } - - TDeleteBindingBuilder& SetPreviousRevision(const int64_t periousRevision) - { - Request.set_previous_revision(periousRevision); - return *this; - } - - const YandexQuery::DeleteBindingRequest& Build() - { - return Request; - } -}; - -// internal - -class TWriteResultDataBuilder { - TString ResultId; - int32_t ResultSetId = 0; - int64_t StartRowId = 0; - TInstant Deadline; - Ydb::ResultSet ResultSet; - -public: - TWriteResultDataBuilder() - { - SetDeadline(TInstant::Now() + TDuration::Minutes(5)); - Ydb::ResultSet resultSet; - auto& value = *resultSet.add_rows(); - value.set_int64_value(1); - SetResultSet(resultSet); - } - - TWriteResultDataBuilder& SetResultId(const TString& resultId) - { - ResultId = resultId; - return *this; - } - - TWriteResultDataBuilder& SetResultSetIndex(int32_t resultSetId) - { - ResultSetId = resultSetId; - return *this; - } - - TWriteResultDataBuilder& SetStartRowId(int64_t startRowId) - { - StartRowId = startRowId; - return *this; - } - - TWriteResultDataBuilder& SetDeadline(const TInstant& deadline) - { - Deadline = deadline; - return *this; - } - - TWriteResultDataBuilder& SetResultSet(const Ydb::ResultSet& resultSet) - { - ResultSet = resultSet; - return *this; - } - - std::unique_ptr<TEvControlPlaneStorage::TEvWriteResultDataRequest> Build() - { - auto request = std::make_unique<TEvControlPlaneStorage::TEvWriteResultDataRequest>(); - request->Request.mutable_result_id()->set_value(ResultId); - *request->Request.mutable_result_set() = ResultSet; - request->Request.set_result_set_id(ResultSetId); - request->Request.set_offset(StartRowId); - *request->Request.mutable_deadline() = NProtoInterop::CastToProto(Deadline); - return request; - } -}; - -class TGetTaskBuilder { - TString Owner; - TString HostName; - TString TenantName; - NYq::TTenantInfo::TPtr TenantInfo; - -public: - TGetTaskBuilder() - { - SetOwner(DefaultOwner()); - SetHostName("localhost"); - SetTenantName("/root/tenant"); - SetTenantInfo(std::make_shared<NYq::TTenantInfo>()); - } - - static TString DefaultOwner() { - return "owner"; - } - - TGetTaskBuilder& SetOwner(const TString& owner) - { - Owner = owner; - return *this; - } - - TGetTaskBuilder& SetHostName(const TString& hostName) - { - HostName = hostName; - return *this; - } - - TGetTaskBuilder& SetTenantName(const TString& tenantName) - { - TenantName = tenantName; - return *this; - } - - TGetTaskBuilder& SetTenantInfo(NYq::TTenantInfo::TPtr tenantInfo) - { - TenantInfo = tenantInfo; - return *this; - } - - std::unique_ptr<TEvControlPlaneStorage::TEvGetTaskRequest> Build() - { - auto request = std::make_unique<TEvControlPlaneStorage::TEvGetTaskRequest>(); - request->Request.set_tenant(TenantName); - request->Request.set_owner_id(Owner); - request->Request.set_host(HostName); - request->TenantInfo = TenantInfo; - return request; - } -}; - -class TPingTaskBuilder { - TString TenantName; - TString CloudId; - TString Scope; - TString QueryId; - TString ResultId; - TString Owner; - TInstant Deadline; - TMaybe<YandexQuery::QueryMeta::ComputeStatus> Status; - TMaybe<NYql::TIssues> Issues; - TMaybe<NYql::TIssues> TransientIssues; - TMaybe<TString> Statistics; - TMaybe<TVector<YandexQuery::ResultSetMeta>> ResultSetMetas; - TMaybe<TString> Ast; - TMaybe<TString> Plan; - TMaybe<TInstant> StartedAt; - TMaybe<TInstant> FinishedAt; - bool ResignQuery = false; - NYql::NDqProto::StatusIds::StatusCode StatusCode = NYql::NDqProto::StatusIds::UNSPECIFIED; - TVector<NYq::TEvControlPlaneStorage::TTopicConsumer> CreatedTopicConsumers; - TVector<TString> DqGraphs; - i32 DqGraphIndex = 0; - -public: - TPingTaskBuilder() - { - SetDeadline(TInstant::Now() + TDuration::Minutes(5)); - SetTenantName("/root/tenant"); - } - - TPingTaskBuilder& SetTenantName(const TString& tenantName) - { - TenantName = tenantName; - return *this; - } - - TPingTaskBuilder& SetCloudId(const TString& cloudId) - { - CloudId = cloudId; - return *this; - } - - TPingTaskBuilder& SetScope(const TString& scope) - { - Scope = scope; - return *this; - } - - TPingTaskBuilder& SetQueryId(const TString& queryId) - { - QueryId = queryId; - return *this; - } - - TPingTaskBuilder& SetResultId(const TString& resultId) - { - ResultId = resultId; - return *this; - } - - TPingTaskBuilder& SetOwner(const TString& owner) - { - Owner = owner; - return *this; - } - - TPingTaskBuilder& SetDeadline(const TInstant& deadline) - { - Deadline = deadline; - return *this; - } - - TPingTaskBuilder& SetStatus(const YandexQuery::QueryMeta::ComputeStatus& status) - { - Status = status; - return *this; - } - - TPingTaskBuilder& SetIssues(const NYql::TIssues& issues) - { - Issues = issues; - return *this; - } - - TPingTaskBuilder& SetTransientIssues(const NYql::TIssues& issues) - { - TransientIssues = issues; - return *this; - } - - TPingTaskBuilder& SetStatistics(const TString& statistics) - { - Statistics = statistics; - return *this; - } - - TPingTaskBuilder& SetResultSetMetas(const TVector<YandexQuery::ResultSetMeta>& resultSetMetas) - { - ResultSetMetas = resultSetMetas; - return *this; - } - - TPingTaskBuilder& SetAst(const TString& ast) - { - Ast = ast; - return *this; - } - - TPingTaskBuilder& SetPlan(const TString& plan) - { - Plan = plan; - return *this; - } - - TPingTaskBuilder& SetStatedAt(const TInstant& started) - { - StartedAt = started; - return *this; - } - - TPingTaskBuilder& SetFinishedAt(const TInstant& finished) - { - FinishedAt = finished; - return *this; - } - - TPingTaskBuilder& SetResignQuery(bool resignQuery = true) - { - ResignQuery = resignQuery; - return *this; - } - - TPingTaskBuilder& SetStatusCode(NYql::NDqProto::StatusIds::StatusCode statusCode = NYql::NDqProto::StatusIds::UNSPECIFIED) - { - StatusCode = statusCode; - return *this; - } - - TPingTaskBuilder& AddCreatedConsumer(const TString& databaseId, const TString& database, const TString& topicPath, const TString& consumerName, const TString& clusterEndpoint, bool useSsl) - { - CreatedTopicConsumers.emplace_back(NYq::TEvControlPlaneStorage::TTopicConsumer{databaseId, database, topicPath, consumerName, clusterEndpoint, useSsl, "", false}); - return *this; - } - - TPingTaskBuilder& AddDqGraph(const TString& dqGraph) - { - DqGraphs.push_back(dqGraph); - return *this; - } - - TPingTaskBuilder& SetDqGraphIndex(i32 dqGraphIndex) - { - DqGraphIndex = dqGraphIndex; - return *this; - } - - std::unique_ptr<TEvControlPlaneStorage::TEvPingTaskRequest> Build() - { - Fq::Private::PingTaskRequest request; - request.set_owner_id(Owner); - request.mutable_query_id()->set_value(QueryId); - request.mutable_result_id()->set_value(ResultId); - if (Status) { - request.set_status(*Status); - } - request.set_status_code(StatusCode); - if (Issues) { - NYql::IssuesToMessage(*Issues, request.mutable_issues()); - } - if (TransientIssues) { - NYql::IssuesToMessage(*TransientIssues, request.mutable_transient_issues()); - } - if (Statistics) { - request.set_statistics(*Statistics); - } - if (ResultSetMetas) { - for (const auto& meta : *ResultSetMetas) { - *request.add_result_set_meta() = meta; - } - } - for (const auto& dqGraph : DqGraphs) { - request.add_dq_graph(dqGraph); - } - request.set_dq_graph_index(DqGraphIndex); - if (Ast) { - request.set_ast(*Ast); - } - if (Plan) { - request.set_plan(*Plan); - } - request.set_resign_query(ResignQuery); - for (const auto& consumer : CreatedTopicConsumers) { - auto& cons = *request.add_created_topic_consumers(); - cons.set_database_id(consumer.DatabaseId); - cons.set_database(consumer.Database); - cons.set_topic_path(consumer.TopicPath); - cons.set_consumer_name(consumer.ConsumerName); - cons.set_cluster_endpoint(consumer.ClusterEndpoint); - cons.set_use_ssl(consumer.UseSsl); - cons.set_token_name(consumer.TokenName); - cons.set_add_bearer_to_token(consumer.AddBearerToToken); - } - request.set_tenant(TenantName); - request.set_scope(Scope); - *request.mutable_deadline() = NProtoInterop::CastToProto(Deadline); - if (StartedAt) { - *request.mutable_started_at() = NProtoInterop::CastToProto(*StartedAt); - } - if (FinishedAt) { - *request.mutable_finished_at() = NProtoInterop::CastToProto(*FinishedAt); - } - - return std::make_unique<TEvControlPlaneStorage::TEvPingTaskRequest>(std::move(request)); - } -}; - -class TNodesHealthCheckBuilder { - TString TenantName; - ui32 NodeId = 0; - TString HostName; - TString InstanceId; - ui64 ActiveWorkers = 0; - ui64 MemoryLimit = 0; - ui64 MemoryAllocated = 0; - -public: - TNodesHealthCheckBuilder() - {} - - TNodesHealthCheckBuilder& SetTenantName(const TString& tenantName) - { - TenantName = tenantName; - return *this; - } - - TNodesHealthCheckBuilder& SetNodeId(const ui32& nodeId) - { - NodeId = nodeId; - return *this; - } - - TNodesHealthCheckBuilder& SetHostName(const TString& hostName) - { - HostName = hostName; - return *this; - } - - TNodesHealthCheckBuilder& SetInstanceId(const TString& instanceId) - { - InstanceId = instanceId; - return *this; - } - - TNodesHealthCheckBuilder& SetActiveWorkers(const ui64& activeWorkers) - { - ActiveWorkers = activeWorkers; - return *this; - } - - TNodesHealthCheckBuilder& SetMemoryLimit(const ui64& memoryLimit) - { - MemoryLimit = memoryLimit; - return *this; - } - - TNodesHealthCheckBuilder& SetMemoryAllocated(const ui64& memoryAllocated) - { - MemoryAllocated = memoryAllocated; - return *this; - } - - std::unique_ptr<TEvControlPlaneStorage::TEvNodesHealthCheckRequest> Build() - { - Fq::Private::NodesHealthCheckRequest request; - request.set_tenant(TenantName); - auto& node = *request.mutable_node(); - node.set_node_id(NodeId); - node.set_instance_id(InstanceId); - node.set_hostname(HostName); - node.set_active_workers(ActiveWorkers); - node.set_memory_limit(MemoryLimit); - node.set_memory_allocated(MemoryAllocated); - return std::make_unique<TEvControlPlaneStorage::TEvNodesHealthCheckRequest>(std::move(request)); - } -}; - -template <class TEvent, class TMessage> -class TRateLimiterResourceBuilderImpl { - TString Owner; - TString QueryId; - TString Scope; - TString Tenant; - -public: - TRateLimiterResourceBuilderImpl() - { - SetOwner(DefaultOwner()); - } - - static TString DefaultOwner() - { - return "owner"; - } - - TRateLimiterResourceBuilderImpl& SetOwner(const TString& owner) - { - Owner = owner; - return *this; - } - - TRateLimiterResourceBuilderImpl& SetQueryId(const TString& queryId) - { - QueryId = queryId; - return *this; - } - - TRateLimiterResourceBuilderImpl& SetScope(const TString& scope) - { - Scope = scope; - return *this; - } - - TRateLimiterResourceBuilderImpl& SetTenant(const TString& tenant) - { - Tenant = tenant; - return *this; - } - - std::unique_ptr<TEvent> Build() - { - TMessage req; - req.set_owner_id(Owner); - req.mutable_query_id()->set_value(QueryId); - req.set_scope(Scope); - req.set_tenant(Tenant); - return std::make_unique<TEvent>(std::move(req)); - } -}; - -using TCreateRateLimiterResourceBuilder = TRateLimiterResourceBuilderImpl<TEvControlPlaneStorage::TEvCreateRateLimiterResourceRequest, Fq::Private::CreateRateLimiterResourceRequest>; -using TDeleteRateLimiterResourceBuilder = TRateLimiterResourceBuilderImpl<TEvControlPlaneStorage::TEvDeleteRateLimiterResourceRequest, Fq::Private::DeleteRateLimiterResourceRequest>; - -} diff --git a/ydb/core/yq/libs/control_plane_storage/proto/yq_internal.proto b/ydb/core/yq/libs/control_plane_storage/proto/yq_internal.proto index f056df4de9..1d029cd9c5 100644 --- a/ydb/core/yq/libs/control_plane_storage/proto/yq_internal.proto +++ b/ydb/core/yq/libs/control_plane_storage/proto/yq_internal.proto @@ -1,15 +1,15 @@ syntax = "proto3"; option cc_enable_arenas = true; -package YandexQuery.Internal; +package FederatedQuery.Internal; option java_package = "com.yandex.query.internal"; option java_outer_classname = "YandexQueryInternalProtos"; import "ydb/library/yql/providers/dq/api/protos/service.proto"; import "ydb/library/yql/dq/proto/dq_tasks.proto"; import "ydb/public/api/protos/ydb_issue_message.proto"; -import "ydb/public/api/protos/yq.proto"; import "ydb/core/yq/libs/protos/fq_private.proto"; +import "ydb/public/api/protos/draft/fq.proto"; import "google/protobuf/duration.proto"; @@ -22,9 +22,9 @@ message QueryInternal { repeated NYql.NDqProto.TDqTask task = 2; // deprecated and should not be used, will be removed in future repeated Yql.DqsProto.TAttr settings = 3; repeated Consumer consumer = 4; - repeated YandexQuery.Connection connection = 5; - repeated YandexQuery.Binding binding = 6; - YandexQuery.QueryAction action = 7; + repeated FederatedQuery.Connection connection = 5; + repeated FederatedQuery.Binding binding = 6; + FederatedQuery.QueryAction action = 7; string ast = 8; // deprecated and should not be used, will be removed in future ExecuteMode execute_mode = 9; StateLoadMode state_load_mode = 10; diff --git a/ydb/core/yq/libs/control_plane_storage/request_actor.h b/ydb/core/yq/libs/control_plane_storage/request_actor.h index 8fc12f1b8e..1afe1518c5 100644 --- a/ydb/core/yq/libs/control_plane_storage/request_actor.h +++ b/ydb/core/yq/libs/control_plane_storage/request_actor.h @@ -6,7 +6,7 @@ #include <ydb/core/yq/libs/control_plane_storage/schema.h> #include <ydb/core/yq/libs/db_schema/db_schema.h> #include <ydb/core/yq/libs/shared_resources/db_exec.h> -#include <ydb/public/api/protos/yq.pb.h> +#include <ydb/public/api/protos/draft/fq.pb.h> #include <ydb/public/sdk/cpp/client/ydb_value/value.h> #include <util/datetime/base.h> diff --git a/ydb/core/yq/libs/control_plane_storage/request_validators.cpp b/ydb/core/yq/libs/control_plane_storage/request_validators.cpp index 1ae3107189..cb818b6a20 100644 --- a/ydb/core/yq/libs/control_plane_storage/request_validators.cpp +++ b/ydb/core/yq/libs/control_plane_storage/request_validators.cpp @@ -81,20 +81,20 @@ NYql::TIssues ValidateDateProjectionType(const NYdb::TType& columnType, const TS } -NYql::TIssues ValidateConnectionSetting(const YandexQuery::ConnectionSetting& setting, const TSet<YandexQuery::ConnectionSetting::ConnectionCase>& availableConnections, bool disableCurrentIam, bool clickHousePasswordRequire) { +NYql::TIssues ValidateConnectionSetting(const FederatedQuery::ConnectionSetting& setting, const TSet<FederatedQuery::ConnectionSetting::ConnectionCase>& availableConnections, bool disableCurrentIam, bool clickHousePasswordRequire) { NYql::TIssues issues; if (!availableConnections.contains(setting.connection_case())) { issues.AddIssue(MakeErrorIssue(TIssuesIds::BAD_REQUEST, "connection of the specified type is disabled")); } switch (setting.connection_case()) { - case YandexQuery::ConnectionSetting::kYdbDatabase: { - const YandexQuery::YdbDatabase database = setting.ydb_database(); - if (!database.has_auth() || database.auth().identity_case() == YandexQuery::IamAuth::IDENTITY_NOT_SET) { + case FederatedQuery::ConnectionSetting::kYdbDatabase: { + const FederatedQuery::YdbDatabase database = setting.ydb_database(); + if (!database.has_auth() || database.auth().identity_case() == FederatedQuery::IamAuth::IDENTITY_NOT_SET) { issues.AddIssue(MakeErrorIssue(TIssuesIds::BAD_REQUEST, "content.setting.ydb_database.auth field is not specified")); } - if (database.auth().identity_case() == YandexQuery::IamAuth::kCurrentIam && disableCurrentIam) { + if (database.auth().identity_case() == FederatedQuery::IamAuth::kCurrentIam && disableCurrentIam) { issues.AddIssue(MakeErrorIssue(TIssuesIds::BAD_REQUEST, "current iam authorization is disabled")); } @@ -103,13 +103,13 @@ NYql::TIssues ValidateConnectionSetting(const YandexQuery::ConnectionSetting& se } break; } - case YandexQuery::ConnectionSetting::kClickhouseCluster: { - const YandexQuery::ClickHouseCluster ch = setting.clickhouse_cluster(); - if (!ch.has_auth() || ch.auth().identity_case() == YandexQuery::IamAuth::IDENTITY_NOT_SET) { + case FederatedQuery::ConnectionSetting::kClickhouseCluster: { + const FederatedQuery::ClickHouseCluster ch = setting.clickhouse_cluster(); + if (!ch.has_auth() || ch.auth().identity_case() == FederatedQuery::IamAuth::IDENTITY_NOT_SET) { issues.AddIssue(MakeErrorIssue(TIssuesIds::BAD_REQUEST, "content.setting.clickhouse_cluster.auth field is not specified")); } - if (ch.auth().identity_case() == YandexQuery::IamAuth::kCurrentIam && disableCurrentIam) { + if (ch.auth().identity_case() == FederatedQuery::IamAuth::kCurrentIam && disableCurrentIam) { issues.AddIssue(MakeErrorIssue(TIssuesIds::BAD_REQUEST, "current iam authorization is disabled")); } @@ -126,13 +126,13 @@ NYql::TIssues ValidateConnectionSetting(const YandexQuery::ConnectionSetting& se } break; } - case YandexQuery::ConnectionSetting::kObjectStorage: { - const YandexQuery::ObjectStorageConnection objectStorage = setting.object_storage(); - if (!objectStorage.has_auth() || objectStorage.auth().identity_case() == YandexQuery::IamAuth::IDENTITY_NOT_SET) { + case FederatedQuery::ConnectionSetting::kObjectStorage: { + const FederatedQuery::ObjectStorageConnection objectStorage = setting.object_storage(); + if (!objectStorage.has_auth() || objectStorage.auth().identity_case() == FederatedQuery::IamAuth::IDENTITY_NOT_SET) { issues.AddIssue(MakeErrorIssue(TIssuesIds::BAD_REQUEST, "content.setting.object_storage.auth field is not specified")); } - if (objectStorage.auth().identity_case() == YandexQuery::IamAuth::kCurrentIam && disableCurrentIam) { + if (objectStorage.auth().identity_case() == FederatedQuery::IamAuth::kCurrentIam && disableCurrentIam) { issues.AddIssue(MakeErrorIssue(TIssuesIds::BAD_REQUEST, "current iam authorization is disabled")); } @@ -141,13 +141,13 @@ NYql::TIssues ValidateConnectionSetting(const YandexQuery::ConnectionSetting& se } break; } - case YandexQuery::ConnectionSetting::kDataStreams: { - const YandexQuery::DataStreams dataStreams = setting.data_streams(); - if (!dataStreams.has_auth() || dataStreams.auth().identity_case() == YandexQuery::IamAuth::IDENTITY_NOT_SET) { + case FederatedQuery::ConnectionSetting::kDataStreams: { + const FederatedQuery::DataStreams dataStreams = setting.data_streams(); + if (!dataStreams.has_auth() || dataStreams.auth().identity_case() == FederatedQuery::IamAuth::IDENTITY_NOT_SET) { issues.AddIssue(MakeErrorIssue(TIssuesIds::BAD_REQUEST, "content.setting.data_streams.auth field is not specified")); } - if (dataStreams.auth().identity_case() == YandexQuery::IamAuth::kCurrentIam && disableCurrentIam) { + if (dataStreams.auth().identity_case() == FederatedQuery::IamAuth::kCurrentIam && disableCurrentIam) { issues.AddIssue(MakeErrorIssue(TIssuesIds::BAD_REQUEST, "current iam authorization is disabled")); } @@ -156,13 +156,13 @@ NYql::TIssues ValidateConnectionSetting(const YandexQuery::ConnectionSetting& se } break; } - case YandexQuery::ConnectionSetting::kMonitoring: { - const YandexQuery::Monitoring monitoring = setting.monitoring(); - if (!monitoring.has_auth() || monitoring.auth().identity_case() == YandexQuery::IamAuth::IDENTITY_NOT_SET) { + case FederatedQuery::ConnectionSetting::kMonitoring: { + const FederatedQuery::Monitoring monitoring = setting.monitoring(); + if (!monitoring.has_auth() || monitoring.auth().identity_case() == FederatedQuery::IamAuth::IDENTITY_NOT_SET) { issues.AddIssue(MakeErrorIssue(TIssuesIds::BAD_REQUEST, "content.setting.monitoring.auth field is not specified")); } - if (monitoring.auth().identity_case() == YandexQuery::IamAuth::kCurrentIam && disableCurrentIam) { + if (monitoring.auth().identity_case() == FederatedQuery::IamAuth::kCurrentIam && disableCurrentIam) { issues.AddIssue(MakeErrorIssue(TIssuesIds::BAD_REQUEST, "current iam authorization is disabled")); } @@ -175,7 +175,7 @@ NYql::TIssues ValidateConnectionSetting(const YandexQuery::ConnectionSetting& se } break; } - case YandexQuery::ConnectionSetting::CONNECTION_NOT_SET: { + case FederatedQuery::ConnectionSetting::CONNECTION_NOT_SET: { issues.AddIssue(MakeErrorIssue(TIssuesIds::BAD_REQUEST, "connection is not set")); break; } @@ -269,7 +269,7 @@ NYql::TIssues ValidateFormatSetting(const TString& format, const google::protobu return issues; } -NYql::TIssues ValidateProjectionColumns(const YandexQuery::Schema& schema, const TVector<TString>& partitionedBy) { +NYql::TIssues ValidateProjectionColumns(const FederatedQuery::Schema& schema, const TVector<TString>& partitionedBy) { NYql::TIssues issues; TMap<TString, Ydb::Type> types; for (const auto& column: schema.column()) { @@ -287,7 +287,7 @@ NYql::TIssues ValidateProjectionColumns(const YandexQuery::Schema& schema, const return issues; } -NYql::TIssues ValidateProjection(const YandexQuery::Schema& schema, const TString& projection, const TVector<TString>& partitionedBy) { +NYql::TIssues ValidateProjection(const FederatedQuery::Schema& schema, const TString& projection, const TVector<TString>& partitionedBy) { auto generator =NYql::NPathGenerator::CreatePathGenerator(projection, partitionedBy); // an exception is thrown if an error occurs TMap<TString, NYql::NPathGenerator::IPathGenerator::EType> projectionColumns; for (const auto& column: generator->GetConfig().Rules) { diff --git a/ydb/core/yq/libs/control_plane_storage/request_validators.h b/ydb/core/yq/libs/control_plane_storage/request_validators.h index 14804e0499..576ba2b12d 100644 --- a/ydb/core/yq/libs/control_plane_storage/request_validators.h +++ b/ydb/core/yq/libs/control_plane_storage/request_validators.h @@ -5,7 +5,7 @@ #include <ydb/core/yq/libs/config/yq_issue.h> #include <ydb/library/yql/providers/s3/path_generator/yql_s3_path_generator.h> #include <ydb/library/yql/public/issue/yql_issue.h> -#include <ydb/public/api/protos/yq.pb.h> +#include <ydb/public/api/protos/draft/fq.pb.h> #include <util/generic/fwd.h> #include <util/generic/set.h> @@ -57,19 +57,19 @@ NYql::TIssues ValidateQuery(const T& ev, size_t maxSize) auto& request = ev->Get()->Request; const auto& content = request.content(); - if (request.execute_mode() == YandexQuery::ExecuteMode::EXECUTE_MODE_UNSPECIFIED) { + if (request.execute_mode() == FederatedQuery::ExecuteMode::EXECUTE_MODE_UNSPECIFIED) { issues.AddIssue(MakeErrorIssue(TIssuesIds::BAD_REQUEST, "execute_mode field is not specified")); } - if (content.type() == YandexQuery::QueryContent::QUERY_TYPE_UNSPECIFIED) { + if (content.type() == FederatedQuery::QueryContent::QUERY_TYPE_UNSPECIFIED) { issues.AddIssue(MakeErrorIssue(TIssuesIds::BAD_REQUEST, "type field is not specified")); } - if (content.acl().visibility() == YandexQuery::Acl::VISIBILITY_UNSPECIFIED) { + if (content.acl().visibility() == FederatedQuery::Acl::VISIBILITY_UNSPECIFIED) { issues.AddIssue(MakeErrorIssue(TIssuesIds::BAD_REQUEST, "acl.visibility field is not specified")); } - if (content.type() == YandexQuery::QueryContent::STREAMING && !request.has_disposition()) { + if (content.type() == FederatedQuery::QueryContent::STREAMING && !request.has_disposition()) { request.mutable_disposition()->mutable_fresh(); } @@ -80,18 +80,18 @@ NYql::TIssues ValidateFormatSetting(const TString& format, const google::protobu NYql::TIssues ValidateDateFormatSetting(const google::protobuf::Map<TString, TString>& formatSetting, bool matchAllSettings = false); -NYql::TIssues ValidateProjectionColumns(const YandexQuery::Schema& schema, const TVector<TString>& partitionedBy); -NYql::TIssues ValidateProjection(const YandexQuery::Schema& schema, const TString& projection, const TVector<TString>& partitionedBy); +NYql::TIssues ValidateProjectionColumns(const FederatedQuery::Schema& schema, const TVector<TString>& partitionedBy); +NYql::TIssues ValidateProjection(const FederatedQuery::Schema& schema, const TString& projection, const TVector<TString>& partitionedBy); template<typename T> -NYql::TIssues ValidateBinding(const T& ev, size_t maxSize, const TSet<YandexQuery::BindingSetting::BindingCase>& availableBindings) +NYql::TIssues ValidateBinding(const T& ev, size_t maxSize, const TSet<FederatedQuery::BindingSetting::BindingCase>& availableBindings) { const auto& request = ev->Get()->Request; NYql::TIssues issues = ValidateEvent(ev, maxSize); if (request.has_content()) { - const YandexQuery::BindingContent& content = request.content(); - if (content.acl().visibility() == YandexQuery::Acl::VISIBILITY_UNSPECIFIED) { + const FederatedQuery::BindingContent& content = request.content(); + if (content.acl().visibility() == FederatedQuery::Acl::VISIBILITY_UNSPECIFIED) { issues.AddIssue(MakeErrorIssue(TIssuesIds::BAD_REQUEST, "binding.acl.visibility field is not specified")); } @@ -103,27 +103,27 @@ NYql::TIssues ValidateBinding(const T& ev, size_t maxSize, const TSet<YandexQuer issues.AddIssue(MakeErrorIssue(TIssuesIds::BAD_REQUEST, "binding.setting field is not specified")); } - const YandexQuery::BindingSetting& setting = content.setting(); + const FederatedQuery::BindingSetting& setting = content.setting(); if (!availableBindings.contains(setting.binding_case())) { issues.AddIssue(MakeErrorIssue(TIssuesIds::BAD_REQUEST, "binding of the specified type is disabled")); } switch (setting.binding_case()) { - case YandexQuery::BindingSetting::kDataStreams: { - const YandexQuery::DataStreamsBinding dataStreams = setting.data_streams(); + case FederatedQuery::BindingSetting::kDataStreams: { + const FederatedQuery::DataStreamsBinding dataStreams = setting.data_streams(); if (!dataStreams.has_schema()) { issues.AddIssue(MakeErrorIssue(TIssuesIds::BAD_REQUEST, "data streams with empty schema is forbidden")); } issues.AddIssues(ValidateDateFormatSetting(dataStreams.format_setting(), true)); break; } - case YandexQuery::BindingSetting::BINDING_NOT_SET: { + case FederatedQuery::BindingSetting::BINDING_NOT_SET: { issues.AddIssue(MakeErrorIssue(TIssuesIds::BAD_REQUEST, "binding is not set")); break; } // Do not replace with default. Adding a new binding should cause a compilation error - case YandexQuery::BindingSetting::kObjectStorage: - const YandexQuery::ObjectStorageBinding objectStorage = setting.object_storage(); + case FederatedQuery::BindingSetting::kObjectStorage: + const FederatedQuery::ObjectStorageBinding objectStorage = setting.object_storage(); for (const auto& subset: objectStorage.subset()) { issues.AddIssues(ValidateFormatSetting(subset.format(), subset.format_setting())); if (subset.projection_size() || subset.partitioned_by_size()) { @@ -153,10 +153,10 @@ NYql::TIssues ValidateBinding(const T& ev, size_t maxSize, const TSet<YandexQuer return issues; } -NYql::TIssues ValidateConnectionSetting(const YandexQuery::ConnectionSetting& setting, const TSet<YandexQuery::ConnectionSetting::ConnectionCase>& availableConnections, bool disableCurrentIam, bool clickHousePasswordRequire = true); +NYql::TIssues ValidateConnectionSetting(const FederatedQuery::ConnectionSetting& setting, const TSet<FederatedQuery::ConnectionSetting::ConnectionCase>& availableConnections, bool disableCurrentIam, bool clickHousePasswordRequire = true); template<typename T> -NYql::TIssues ValidateConnection(const T& ev, size_t maxSize, const TSet<YandexQuery::ConnectionSetting::ConnectionCase>& availableConnections, bool disableCurrentIam, bool clickHousePasswordRequire = true) +NYql::TIssues ValidateConnection(const T& ev, size_t maxSize, const TSet<FederatedQuery::ConnectionSetting::ConnectionCase>& availableConnections, bool disableCurrentIam, bool clickHousePasswordRequire = true) { const auto& request = ev->Get()->Request; NYql::TIssues issues = ValidateEvent(ev, maxSize); @@ -165,8 +165,8 @@ NYql::TIssues ValidateConnection(const T& ev, size_t maxSize, const TSet<YandexQ issues.AddIssue(MakeErrorIssue(TIssuesIds::BAD_REQUEST, "content field is not specified")); } - const YandexQuery::ConnectionContent& content = request.content(); - if (content.acl().visibility() == YandexQuery::Acl::VISIBILITY_UNSPECIFIED) { + const FederatedQuery::ConnectionContent& content = request.content(); + if (content.acl().visibility() == FederatedQuery::Acl::VISIBILITY_UNSPECIFIED) { issues.AddIssue(MakeErrorIssue(TIssuesIds::BAD_REQUEST, "content.acl.visibility field is not specified")); } @@ -178,7 +178,7 @@ NYql::TIssues ValidateConnection(const T& ev, size_t maxSize, const TSet<YandexQ issues.AddIssue(MakeErrorIssue(TIssuesIds::BAD_REQUEST, "content.setting field is not specified")); } - const YandexQuery::ConnectionSetting& setting = content.setting(); + const FederatedQuery::ConnectionSetting& setting = content.setting(); issues.AddIssues(ValidateConnectionSetting(setting, availableConnections, disableCurrentIam, clickHousePasswordRequire)); return issues; } diff --git a/ydb/core/yq/libs/control_plane_storage/util.cpp b/ydb/core/yq/libs/control_plane_storage/util.cpp index e2095339e7..f3ce471767 100644 --- a/ydb/core/yq/libs/control_plane_storage/util.cpp +++ b/ydb/core/yq/libs/control_plane_storage/util.cpp @@ -36,15 +36,15 @@ bool TRetryLimiter::UpdateOnRetry(const TInstant& lastSeenAt, const TRetryPolicy return shouldRetry; } -bool IsTerminalStatus(YandexQuery::QueryMeta::ComputeStatus status) +bool IsTerminalStatus(FederatedQuery::QueryMeta::ComputeStatus status) { - return IsIn({ YandexQuery::QueryMeta::ABORTED_BY_USER, YandexQuery::QueryMeta::ABORTED_BY_SYSTEM, - YandexQuery::QueryMeta::COMPLETED, YandexQuery::QueryMeta::FAILED }, status); + return IsIn({ FederatedQuery::QueryMeta::ABORTED_BY_USER, FederatedQuery::QueryMeta::ABORTED_BY_SYSTEM, + FederatedQuery::QueryMeta::COMPLETED, FederatedQuery::QueryMeta::FAILED }, status); } -bool IsAbortedStatus(YandexQuery::QueryMeta::ComputeStatus status) +bool IsAbortedStatus(FederatedQuery::QueryMeta::ComputeStatus status) { - return IsIn({ YandexQuery::QueryMeta::ABORTED_BY_USER, YandexQuery::QueryMeta::ABORTED_BY_SYSTEM }, status); + return IsIn({ FederatedQuery::QueryMeta::ABORTED_BY_USER, FederatedQuery::QueryMeta::ABORTED_BY_SYSTEM }, status); } TDuration GetDuration(const TString& value, const TDuration& defaultValue) @@ -150,7 +150,7 @@ NConfig::TControlPlaneStorageConfig FillDefaultParameters(NConfig::TControlPlane } bool DoesPingTaskUpdateQueriesTable(const Fq::Private::PingTaskRequest& request) { - return request.status() != YandexQuery::QueryMeta::COMPUTE_STATUS_UNSPECIFIED + return request.status() != FederatedQuery::QueryMeta::COMPUTE_STATUS_UNSPECIFIED || !request.issues().empty() || !request.transient_issues().empty() || request.statistics() diff --git a/ydb/core/yq/libs/control_plane_storage/util.h b/ydb/core/yq/libs/control_plane_storage/util.h index af8dbd2797..320322b7d9 100644 --- a/ydb/core/yq/libs/control_plane_storage/util.h +++ b/ydb/core/yq/libs/control_plane_storage/util.h @@ -32,9 +32,9 @@ public: double RetryRate = 0.0; }; -bool IsTerminalStatus(YandexQuery::QueryMeta::ComputeStatus status); +bool IsTerminalStatus(FederatedQuery::QueryMeta::ComputeStatus status); -bool IsAbortedStatus(YandexQuery::QueryMeta::ComputeStatus status); +bool IsAbortedStatus(FederatedQuery::QueryMeta::ComputeStatus status); TDuration GetDuration(const TString& value, const TDuration& defaultValue); diff --git a/ydb/core/yq/libs/control_plane_storage/validators.cpp b/ydb/core/yq/libs/control_plane_storage/validators.cpp index 1b731031f2..d2cb315707 100644 --- a/ydb/core/yq/libs/control_plane_storage/validators.cpp +++ b/ydb/core/yq/libs/control_plane_storage/validators.cpp @@ -1,7 +1,7 @@ #include "validators.h" #include "ydb_control_plane_storage_impl.h" -#include <ydb/public/api/protos/yq.pb.h> +#include <ydb/public/api/protos/draft/fq.pb.h> #include <ydb/core/yq/libs/control_plane_storage/events/events.h> #include <ydb/core/yq/libs/db_schema/db_schema.h> @@ -9,7 +9,7 @@ namespace NYq { TValidationQuery CreateUniqueNameValidator(const TString& tableName, - YandexQuery::Acl::Visibility visibility, + FederatedQuery::Acl::Visibility visibility, const TString& scope, const TString& name, const TString& user, @@ -25,7 +25,7 @@ TValidationQuery CreateUniqueNameValidator(const TString& tableName, "FROM `" + tableName + "` WHERE `" SCOPE_COLUMN_NAME "` = $scope AND `" NAME_COLUMN_NAME "` = $name AND `" VISIBILITY_COLUMN_NAME "` = $visibility" ); - if (visibility != YandexQuery::Acl::SCOPE) { + if (visibility != FederatedQuery::Acl::SCOPE) { queryBuilder.AddString("user", user); queryBuilder.AddText(" AND `" USER_COLUMN_NAME "` = $user"); } @@ -54,7 +54,7 @@ TValidationQuery CreateUniqueNameValidator(const TString& tableName, TValidationQuery CreateModifyUniqueNameValidator(const TString& tableName, const TString& idColumnName, - YandexQuery::Acl::Visibility visibility, + FederatedQuery::Acl::Visibility visibility, const TString& scope, const TString& name, const TString& user, @@ -73,7 +73,7 @@ TValidationQuery CreateModifyUniqueNameValidator(const TString& tableName, "FROM `" + tableName + "` WHERE `" SCOPE_COLUMN_NAME "` = $scope AND `" NAME_COLUMN_NAME "` = $name AND `" VISIBILITY_COLUMN_NAME "` = $visibility" ); - if (visibility != YandexQuery::Acl::SCOPE) { + if (visibility != FederatedQuery::Acl::SCOPE) { queryBuilder.AddString("user", user); queryBuilder.AddText(" AND `" USER_COLUMN_NAME "` = $user"); } @@ -90,7 +90,7 @@ TValidationQuery CreateModifyUniqueNameValidator(const TString& tableName, ythrow TCodeLineException(TIssuesIds::INTERNAL_ERROR) << "Not valid number of lines, one is expected. Please contact internal support"; } - YandexQuery::Acl::Visibility oldVisibility = static_cast<YandexQuery::Acl::Visibility>(parser.ColumnParser(VISIBILITY_COLUMN_NAME).GetOptionalInt64().GetOrElse(YandexQuery::Acl::VISIBILITY_UNSPECIFIED)); + FederatedQuery::Acl::Visibility oldVisibility = static_cast<FederatedQuery::Acl::Visibility>(parser.ColumnParser(VISIBILITY_COLUMN_NAME).GetOptionalInt64().GetOrElse(FederatedQuery::Acl::VISIBILITY_UNSPECIFIED)); TString oldName = parser.ColumnParser(NAME_COLUMN_NAME).GetOptionalString().GetOrElse(""); if (oldVisibility == visibility && oldName == name) { @@ -216,7 +216,7 @@ static TValidationQuery CreateAccessValidatorImpl(const TString& tableName, } TString queryUser = parser.ColumnParser(USER_COLUMN_NAME).GetOptionalString().GetOrElse(""); - YandexQuery::Acl::Visibility visibility = static_cast<YandexQuery::Acl::Visibility>(parser.ColumnParser(VISIBILITY_COLUMN_NAME).GetOptionalInt64().GetOrElse(YandexQuery::Acl::VISIBILITY_UNSPECIFIED)); + FederatedQuery::Acl::Visibility visibility = static_cast<FederatedQuery::Acl::Visibility>(parser.ColumnParser(VISIBILITY_COLUMN_NAME).GetOptionalInt64().GetOrElse(FederatedQuery::Acl::VISIBILITY_UNSPECIFIED)); bool hasAccess = HasAccessImpl(permissions, visibility, queryUser, user, privatePermission, publicPermission); if (!hasAccess) { ythrow TCodeLineException(TIssuesIds::ACCESS_DENIED) << error; @@ -295,7 +295,7 @@ TValidationQuery CreateConnectionExistsValidator(const TString& scope, const TString& error, TPermissions permissions, const TString& user, - YandexQuery::Acl::Visibility bindingVisibility, + FederatedQuery::Acl::Visibility bindingVisibility, const TString& tablePathPrefix) { TSqlQueryBuilder queryBuilder(tablePathPrefix); queryBuilder.AddString("scope", scope); @@ -316,10 +316,10 @@ TValidationQuery CreateConnectionExistsValidator(const TString& scope, ythrow TCodeLineException(TIssuesIds::ACCESS_DENIED) << error; } - YandexQuery::Acl::Visibility connectionVisibility = static_cast<YandexQuery::Acl::Visibility>(parser.ColumnParser(VISIBILITY_COLUMN_NAME).GetOptionalInt64().GetOrElse(YandexQuery::Acl::VISIBILITY_UNSPECIFIED)); + FederatedQuery::Acl::Visibility connectionVisibility = static_cast<FederatedQuery::Acl::Visibility>(parser.ColumnParser(VISIBILITY_COLUMN_NAME).GetOptionalInt64().GetOrElse(FederatedQuery::Acl::VISIBILITY_UNSPECIFIED)); TString connectionUser = parser.ColumnParser(USER_COLUMN_NAME).GetOptionalString().GetOrElse(""); - if (bindingVisibility == YandexQuery::Acl::SCOPE && connectionVisibility == YandexQuery::Acl::PRIVATE) { + if (bindingVisibility == FederatedQuery::Acl::SCOPE && connectionVisibility == FederatedQuery::Acl::PRIVATE) { ythrow TCodeLineException(TIssuesIds::BAD_REQUEST) << "Binding with SCOPE visibility cannot refer to connection with PRIVATE visibility"; } @@ -341,7 +341,7 @@ TValidationQuery CreateConnectionOverrideBindingValidator(const TString& scope, TSqlQueryBuilder queryBuilder(tablePathPrefix); queryBuilder.AddString("scope", scope); queryBuilder.AddString("connection_name", connectionName); - queryBuilder.AddInt64("scope_visibility", YandexQuery::Acl::SCOPE); + queryBuilder.AddInt64("scope_visibility", FederatedQuery::Acl::SCOPE); queryBuilder.AddText( "$connection_id = SELECT `" CONNECTION_ID_COLUMN_NAME "`\n" "FROM `" CONNECTIONS_TABLE_NAME "` WHERE `" SCOPE_COLUMN_NAME "` = $scope AND `" NAME_COLUMN_NAME "` = $connection_name AND `" VISIBILITY_COLUMN_NAME "` = $scope_visibility;\n" @@ -362,7 +362,7 @@ TValidationQuery CreateConnectionOverrideBindingValidator(const TString& scope, TString bindingUser = parser.ColumnParser(USER_COLUMN_NAME).GetOptionalString().GetOrElse(""); TString bindingName = parser.ColumnParser(NAME_COLUMN_NAME).GetOptionalString().GetOrElse(""); - YandexQuery::Acl::Visibility bindingVisibility = static_cast<YandexQuery::Acl::Visibility>(parser.ColumnParser(VISIBILITY_COLUMN_NAME).GetOptionalInt64().GetOrElse(YandexQuery::Acl::VISIBILITY_UNSPECIFIED)); + FederatedQuery::Acl::Visibility bindingVisibility = static_cast<FederatedQuery::Acl::Visibility>(parser.ColumnParser(VISIBILITY_COLUMN_NAME).GetOptionalInt64().GetOrElse(FederatedQuery::Acl::VISIBILITY_UNSPECIFIED)); if (HasViewAccess(permissions, bindingVisibility, bindingUser, user)) { ythrow TCodeLineException(TIssuesIds::BAD_REQUEST) << "Connection named " << connectionName << " overrides connection from binding " << bindingName << ". Please rename this connection"; @@ -382,7 +382,7 @@ TValidationQuery CreateBindingConnectionValidator(const TString& scope, queryBuilder.AddString("scope", scope); queryBuilder.AddString("connection_id", connectionId); queryBuilder.AddString("user", user); - queryBuilder.AddInt64("private_visibility", YandexQuery::Acl::PRIVATE); + queryBuilder.AddInt64("private_visibility", FederatedQuery::Acl::PRIVATE); queryBuilder.AddText( "$name = SELECT `" NAME_COLUMN_NAME "`\n" "FROM `" CONNECTIONS_TABLE_NAME "` WHERE `" SCOPE_COLUMN_NAME "` = $scope AND `" CONNECTION_ID_COLUMN_NAME "` = $connection_id;\n" @@ -442,7 +442,7 @@ TValidationQuery CreateTtlValidator(const TString& tableName, return {query.Sql, query.Params, validator}; } -TValidationQuery CreateQueryComputeStatusValidator(const std::vector<YandexQuery::QueryMeta::ComputeStatus>& computeStatuses, +TValidationQuery CreateQueryComputeStatusValidator(const std::vector<FederatedQuery::QueryMeta::ComputeStatus>& computeStatuses, const TString& scope, const TString& id, const TString& error, @@ -467,12 +467,12 @@ TValidationQuery CreateQueryComputeStatusValidator(const std::vector<YandexQuery ythrow TCodeLineException(TIssuesIds::BAD_REQUEST) << "Query does not exist or permission denied. Please check the id of the query or your access rights"; } - YandexQuery::Query query; + FederatedQuery::Query query; if (!query.ParseFromString(*parser.ColumnParser(QUERY_COLUMN_NAME).GetOptionalString())) { ythrow TCodeLineException(TIssuesIds::INTERNAL_ERROR) << "Error parsing proto message for query. Please contact internal support"; } - const YandexQuery::QueryMeta::ComputeStatus status = query.meta().status(); + const FederatedQuery::QueryMeta::ComputeStatus status = query.meta().status(); if (!IsIn(computeStatuses, status)) { ythrow TCodeLineException(TIssuesIds::BAD_REQUEST) << error; } diff --git a/ydb/core/yq/libs/control_plane_storage/validators.h b/ydb/core/yq/libs/control_plane_storage/validators.h index a61b882138..a8d540a563 100644 --- a/ydb/core/yq/libs/control_plane_storage/validators.h +++ b/ydb/core/yq/libs/control_plane_storage/validators.h @@ -7,7 +7,7 @@ #include <util/generic/fwd.h> #include <util/string/printf.h> -#include <ydb/public/api/protos/yq.pb.h> +#include <ydb/public/api/protos/draft/fq.pb.h> #include <ydb/public/sdk/cpp/client/ydb_params/params.h> #include <ydb/public/sdk/cpp/client/ydb_params/params.h> #include <ydb/public/sdk/cpp/client/ydb_result/result.h> @@ -26,7 +26,7 @@ struct TValidationQuery { }; TValidationQuery CreateUniqueNameValidator(const TString& tableName, - YandexQuery::Acl::Visibility visibility, + FederatedQuery::Acl::Visibility visibility, const TString& scope, const TString& name, const TString& user, @@ -35,7 +35,7 @@ TValidationQuery CreateUniqueNameValidator(const TString& tableName, TValidationQuery CreateModifyUniqueNameValidator(const TString& tableName, const TString& idColumnName, - YandexQuery::Acl::Visibility visibility, + FederatedQuery::Acl::Visibility visibility, const TString& scope, const TString& name, const TString& user, @@ -85,7 +85,7 @@ TValidationQuery CreateConnectionExistsValidator(const TString& scope, const TString& error, TPermissions permissions, const TString& user, - YandexQuery::Acl::Visibility bindingVisibility, + FederatedQuery::Acl::Visibility bindingVisibility, const TString& tablePathPrefix); TValidationQuery CreateConnectionOverrideBindingValidator(const TString& scope, @@ -106,7 +106,7 @@ TValidationQuery CreateTtlValidator(const TString& tableName, const TString& error, const TString& tablePathPrefix); -TValidationQuery CreateQueryComputeStatusValidator(const std::vector<YandexQuery::QueryMeta::ComputeStatus>& computeStatuses, +TValidationQuery CreateQueryComputeStatusValidator(const std::vector<FederatedQuery::QueryMeta::ComputeStatus>& computeStatuses, const TString& scope, const TString& id, const TString& error, diff --git a/ydb/core/yq/libs/control_plane_storage/ydb_control_plane_storage_bindings.cpp b/ydb/core/yq/libs/control_plane_storage/ydb_control_plane_storage_bindings.cpp index ffe1064b8b..ff5a16c548 100644 --- a/ydb/core/yq/libs/control_plane_storage/ydb_control_plane_storage_bindings.cpp +++ b/ydb/core/yq/libs/control_plane_storage/ydb_control_plane_storage_bindings.cpp @@ -25,7 +25,7 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvCreateBindi if (IsSuperUser(user)) { permissions.SetAll(); } - const YandexQuery::CreateBindingRequest& request = event.Request; + const FederatedQuery::CreateBindingRequest& request = event.Request; const TString bindingId = GetEntityIdAsString(Config->IdsPrefix, EEntityType::BINDING); int byteSize = request.ByteSize(); const TString connectionId = request.content().connection_id(); @@ -37,7 +37,7 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvCreateBindi << request.DebugString()); NYql::TIssues issues = ValidateBinding(ev); - if (request.content().acl().visibility() == YandexQuery::Acl::SCOPE && !permissions.Check(TPermissions::MANAGE_PUBLIC)) { + if (request.content().acl().visibility() == FederatedQuery::Acl::SCOPE && !permissions.Check(TPermissions::MANAGE_PUBLIC)) { issues.AddIssue(MakeErrorIssue(TIssuesIds::ACCESS_DENIED, "Permission denied to create a binding with these parameters. Please receive a permission yq.resources.managePublic")); } if (issues) { @@ -52,15 +52,15 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvCreateBindi return; } - YandexQuery::Binding binding; - YandexQuery::BindingContent& content = *binding.mutable_content(); + FederatedQuery::Binding binding; + FederatedQuery::BindingContent& content = *binding.mutable_content(); content = request.content(); *binding.mutable_meta() = CreateCommonMeta(bindingId, user, startTime, InitialRevision); - YandexQuery::Internal::BindingInternal bindingInternal; + FederatedQuery::Internal::BindingInternal bindingInternal; bindingInternal.set_cloud_id(cloudId); - std::shared_ptr<std::pair<YandexQuery::CreateBindingResult, TAuditDetails<YandexQuery::Binding>>> response = std::make_shared<std::pair<YandexQuery::CreateBindingResult, TAuditDetails<YandexQuery::Binding>>>(); + std::shared_ptr<std::pair<FederatedQuery::CreateBindingResult, TAuditDetails<FederatedQuery::Binding>>> response = std::make_shared<std::pair<FederatedQuery::CreateBindingResult, TAuditDetails<FederatedQuery::Binding>>>(); response->first.set_binding_id(bindingId); response->second.After.ConstructInPlace().CopyFrom(binding); response->second.CloudId = cloudId; @@ -128,7 +128,7 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvCreateBindi auto debugInfo = Config->Proto.GetEnableDebugMode() ? std::make_shared<TDebugInfo>() : TDebugInfoPtr{}; TAsyncStatus result = Write(query.Sql, query.Params, requestCounters, debugInfo, validators); auto prepare = [response] { return *response; }; - auto success = SendResponse<TEvControlPlaneStorage::TEvCreateBindingResponse, YandexQuery::CreateBindingResult>( + auto success = SendResponse<TEvControlPlaneStorage::TEvCreateBindingResponse, FederatedQuery::CreateBindingResult>( MakeLogPrefix(scope, user, bindingId) + "CreateBindingRequest", NActors::TActivationContext::ActorSystem(), result, @@ -154,7 +154,7 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvListBinding TRequestCounters requestCounters = Counters.GetCounters(cloudId, scope, RTS_LIST_BINDINGS, RTC_LIST_BINDINGS); requestCounters.IncInFly(); requestCounters.Common->RequestBytes->Add(event.GetByteSize()); - const YandexQuery::ListBindingsRequest& request = event.Request; + const FederatedQuery::ListBindingsRequest& request = event.Request; const TString user = event.User; const TString pageToken = request.page_token(); const int byteSize = event.Request.ByteSize(); @@ -212,7 +212,7 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvListBinding filters.push_back("`" USER_COLUMN_NAME "` = $user"); } - if (request.filter().visibility() != YandexQuery::Acl::VISIBILITY_UNSPECIFIED) { + if (request.filter().visibility() != FederatedQuery::Acl::VISIBILITY_UNSPECIFIED) { queryBuilder.AddInt64("visibility", request.filter().visibility()); filters.push_back("`" VISIBILITY_COLUMN_NAME "` = $visibility"); } @@ -239,28 +239,28 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvListBinding ythrow TCodeLineException(TIssuesIds::INTERNAL_ERROR) << "Result set size is not equal to 1 but equal " << resultSets->size() << ". Please contact internal support"; } - YandexQuery::ListBindingsResult result; + FederatedQuery::ListBindingsResult result; TResultSetParser parser(resultSets->front()); while (parser.TryNextRow()) { - YandexQuery::Binding binding; + FederatedQuery::Binding binding; if (!binding.ParseFromString(*parser.ColumnParser(BINDING_COLUMN_NAME).GetOptionalString())) { ythrow TCodeLineException(TIssuesIds::INTERNAL_ERROR) << "Error parsing proto message for binding. Please contact internal support"; } - YandexQuery::BriefBinding& briefBinding = *result.add_binding(); + FederatedQuery::BriefBinding& briefBinding = *result.add_binding(); briefBinding.set_name(binding.content().name()); briefBinding.set_connection_id(binding.content().connection_id()); *briefBinding.mutable_meta() = binding.meta(); switch (binding.content().setting().binding_case()) { - case YandexQuery::BindingSetting::kDataStreams: { - briefBinding.set_type(YandexQuery::BindingSetting::DATA_STREAMS); + case FederatedQuery::BindingSetting::kDataStreams: { + briefBinding.set_type(FederatedQuery::BindingSetting::DATA_STREAMS); break; } - case YandexQuery::BindingSetting::kObjectStorage: { - briefBinding.set_type(YandexQuery::BindingSetting::OBJECT_STORAGE); + case FederatedQuery::BindingSetting::kObjectStorage: { + briefBinding.set_type(FederatedQuery::BindingSetting::OBJECT_STORAGE); break; } // Do not replace with default. Adding a new binding should cause a compilation error - case YandexQuery::BindingSetting::BINDING_NOT_SET: + case FederatedQuery::BindingSetting::BINDING_NOT_SET: break; } briefBinding.set_visibility(binding.content().acl().visibility()); @@ -273,7 +273,7 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvListBinding return result; }; - auto success = SendResponse<TEvControlPlaneStorage::TEvListBindingsResponse, YandexQuery::ListBindingsResult>( + auto success = SendResponse<TEvControlPlaneStorage::TEvListBindingsResponse, FederatedQuery::ListBindingsResult>( MakeLogPrefix(scope, user) + "ListBindingsRequest", NActors::TActivationContext::ActorSystem(), result, @@ -299,7 +299,7 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvDescribeBin TRequestCounters requestCounters = Counters.GetCounters(cloudId, scope, RTS_DESCRIBE_BINDING, RTC_DESCRIBE_BINDING); requestCounters.IncInFly(); requestCounters.Common->RequestBytes->Add(event.GetByteSize()); - const YandexQuery::DescribeBindingRequest& request = event.Request; + const FederatedQuery::DescribeBindingRequest& request = event.Request; const TString bindingId = request.binding_id(); const TString user = event.User; const TString token = event.Token; @@ -348,7 +348,7 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvDescribeBin ythrow TCodeLineException(TIssuesIds::ACCESS_DENIED) << "Binding does not exist or permission denied. Please check the id binding or your access rights"; } - YandexQuery::DescribeBindingResult result; + FederatedQuery::DescribeBindingResult result; if (!result.mutable_binding()->ParseFromString(*parser.ColumnParser(BINDING_COLUMN_NAME).GetOptionalString())) { ythrow TCodeLineException(TIssuesIds::INTERNAL_ERROR) << "Error parsing proto message for binding. Please contact internal support"; } @@ -360,7 +360,7 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvDescribeBin return result; }; - auto success = SendResponse<TEvControlPlaneStorage::TEvDescribeBindingResponse, YandexQuery::DescribeBindingResult>( + auto success = SendResponse<TEvControlPlaneStorage::TEvDescribeBindingResponse, FederatedQuery::DescribeBindingResult>( MakeLogPrefix(scope, user, bindingId) + "DescribeBindingRequest", NActors::TActivationContext::ActorSystem(), result, @@ -386,7 +386,7 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvModifyBindi TRequestCounters requestCounters = Counters.GetCounters(cloudId, scope, RTS_MODIFY_BINDING, RTC_MODIFY_BINDING); requestCounters.IncInFly(); requestCounters.Common->RequestBytes->Add(event.GetByteSize()); - const YandexQuery::ModifyBindingRequest& request = event.Request; + const FederatedQuery::ModifyBindingRequest& request = event.Request; const TString bindingId = request.binding_id(); const TString user = event.User; const TString token = event.Token; @@ -429,13 +429,13 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvModifyBindi "WHERE `" SCOPE_COLUMN_NAME "` = $scope AND `" CONNECTION_ID_COLUMN_NAME "` = $connection_id;" ); - std::shared_ptr<std::pair<YandexQuery::ModifyBindingResult, TAuditDetails<YandexQuery::Binding>>> response = std::make_shared<std::pair<YandexQuery::ModifyBindingResult, TAuditDetails<YandexQuery::Binding>>>(); + std::shared_ptr<std::pair<FederatedQuery::ModifyBindingResult, TAuditDetails<FederatedQuery::Binding>>> response = std::make_shared<std::pair<FederatedQuery::ModifyBindingResult, TAuditDetails<FederatedQuery::Binding>>>(); auto prepareParams = [=, config=Config](const TVector<TResultSet>& resultSets) { if (resultSets.size() != 2) { ythrow TCodeLineException(TIssuesIds::INTERNAL_ERROR) << "Result set size is not equal to 2 but equal " << resultSets.size() << ". Please contact internal support"; } - YandexQuery::Binding binding; + FederatedQuery::Binding binding; { TResultSetParser parser(resultSets.front()); if (!parser.TryNextRow()) { @@ -447,18 +447,18 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvModifyBindi } } - YandexQuery::Acl::Visibility connectionVisibility = YandexQuery::Acl::VISIBILITY_UNSPECIFIED; + FederatedQuery::Acl::Visibility connectionVisibility = FederatedQuery::Acl::VISIBILITY_UNSPECIFIED; { TResultSetParser parser(resultSets.back()); if (!parser.TryNextRow()) { ythrow TCodeLineException(TIssuesIds::ACCESS_DENIED) << "Connection does not exist or permission denied. Please check the connectin id or your access rights"; } - connectionVisibility = static_cast<YandexQuery::Acl::Visibility>(parser.ColumnParser(VISIBILITY_COLUMN_NAME).GetOptionalInt64().GetOrElse(YandexQuery::Acl::VISIBILITY_UNSPECIFIED)); + connectionVisibility = static_cast<FederatedQuery::Acl::Visibility>(parser.ColumnParser(VISIBILITY_COLUMN_NAME).GetOptionalInt64().GetOrElse(FederatedQuery::Acl::VISIBILITY_UNSPECIFIED)); } - const YandexQuery::Acl::Visibility requestBindingVisibility = request.content().acl().visibility(); - if (requestBindingVisibility == YandexQuery::Acl::SCOPE && connectionVisibility == YandexQuery::Acl::PRIVATE) { + const FederatedQuery::Acl::Visibility requestBindingVisibility = request.content().acl().visibility(); + if (requestBindingVisibility == FederatedQuery::Acl::SCOPE && connectionVisibility == FederatedQuery::Acl::PRIVATE) { ythrow TCodeLineException(TIssuesIds::BAD_REQUEST) << "Binding with SCOPE visibility cannot refer to connection with PRIVATE visibility"; } @@ -480,7 +480,7 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvModifyBindi ythrow TCodeLineException(TIssuesIds::BAD_REQUEST) << "Binding type cannot be changed. Please specify the same binding type"; } - if (binding.content().acl().visibility() == YandexQuery::Acl::SCOPE && requestBindingVisibility == YandexQuery::Acl::PRIVATE) { + if (binding.content().acl().visibility() == FederatedQuery::Acl::SCOPE && requestBindingVisibility == FederatedQuery::Acl::PRIVATE) { ythrow TCodeLineException(TIssuesIds::BAD_REQUEST) << "Changing visibility from SCOPE to PRIVATE is forbidden. Please create a new binding with visibility PRIVATE"; } @@ -490,7 +490,7 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvModifyBindi content = request.content(); - YandexQuery::Internal::BindingInternal bindingInternal; + FederatedQuery::Internal::BindingInternal bindingInternal; response->second.After.ConstructInPlace().CopyFrom(binding); response->second.CloudId = bindingInternal.cloud_id(); @@ -557,7 +557,7 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvModifyBindi auto debugInfo = Config->Proto.GetEnableDebugMode() ? std::make_shared<TDebugInfo>() : TDebugInfoPtr{}; auto result = ReadModifyWrite(readQuery.Sql, readQuery.Params, prepareParams, requestCounters, debugInfo, validators); auto prepare = [response] { return *response; }; - auto success = SendResponse<TEvControlPlaneStorage::TEvModifyBindingResponse, YandexQuery::ModifyBindingResult>( + auto success = SendResponse<TEvControlPlaneStorage::TEvModifyBindingResponse, FederatedQuery::ModifyBindingResult>( MakeLogPrefix(scope, user, bindingId) + "ModifyBindingRequest", NActors::TActivationContext::ActorSystem(), result, @@ -583,7 +583,7 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvDeleteBindi TRequestCounters requestCounters = Counters.GetCounters(cloudId, scope, RTS_DELETE_BINDING, RTC_DELETE_BINDING); requestCounters.IncInFly(); requestCounters.Common->RequestBytes->Add(event.GetByteSize()); - const YandexQuery::DeleteBindingRequest& request = event.Request; + const FederatedQuery::DeleteBindingRequest& request = event.Request; const TString user = event.User; const TString token = event.Token; const TString bindingId = request.binding_id(); @@ -615,7 +615,7 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvDeleteBindi return; } - std::shared_ptr<std::pair<YandexQuery::DeleteBindingResult, TAuditDetails<YandexQuery::Binding>>> response = std::make_shared<std::pair<YandexQuery::DeleteBindingResult, TAuditDetails<YandexQuery::Binding>>>(); + std::shared_ptr<std::pair<FederatedQuery::DeleteBindingResult, TAuditDetails<FederatedQuery::Binding>>> response = std::make_shared<std::pair<FederatedQuery::DeleteBindingResult, TAuditDetails<FederatedQuery::Binding>>>(); TSqlQueryBuilder queryBuilder(YdbConnection->TablePathPrefix, "DeleteBinding"); queryBuilder.AddString("scope", scope); @@ -668,7 +668,7 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvDeleteBindi auto debugInfo = Config->Proto.GetEnableDebugMode() ? std::make_shared<TDebugInfo>() : TDebugInfoPtr{}; auto result = Write(query.Sql, query.Params, requestCounters, debugInfo, validators); auto prepare = [response] { return *response; }; - auto success = SendResponse<TEvControlPlaneStorage::TEvDeleteBindingResponse, YandexQuery::DeleteBindingResult>( + auto success = SendResponse<TEvControlPlaneStorage::TEvDeleteBindingResponse, FederatedQuery::DeleteBindingResult>( MakeLogPrefix(scope, user, bindingId) + "DeleteBindingRequest", NActors::TActivationContext::ActorSystem(), result, diff --git a/ydb/core/yq/libs/control_plane_storage/ydb_control_plane_storage_connections.cpp b/ydb/core/yq/libs/control_plane_storage/ydb_control_plane_storage_connections.cpp index bb70983da2..a026ba9414 100644 --- a/ydb/core/yq/libs/control_plane_storage/ydb_control_plane_storage_connections.cpp +++ b/ydb/core/yq/libs/control_plane_storage/ydb_control_plane_storage_connections.cpp @@ -3,7 +3,7 @@ #include <util/string/join.h> -#include <ydb/public/api/protos/yq.pb.h> +#include <ydb/public/api/protos/draft/fq.pb.h> #include <ydb/core/yq/libs/config/protos/issue_id.pb.h> #include <ydb/core/yq/libs/db_schema/db_schema.h> @@ -19,7 +19,7 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvCreateConne TRequestCounters requestCounters = Counters.GetCounters(cloudId, scope, RTS_CREATE_CONNECTION, RTC_CREATE_CONNECTION); requestCounters.IncInFly(); requestCounters.Common->RequestBytes->Add(event.GetByteSize()); - const YandexQuery::CreateConnectionRequest& request = event.Request; + const FederatedQuery::CreateConnectionRequest& request = event.Request; const TString user = event.User; const TString token = event.Token; const int byteSize = request.ByteSize(); @@ -38,7 +38,7 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvCreateConne << request.DebugString()); NYql::TIssues issues = ValidateConnection(ev); - if (request.content().acl().visibility() == YandexQuery::Acl::SCOPE && !permissions.Check(TPermissions::MANAGE_PUBLIC)) { + if (request.content().acl().visibility() == FederatedQuery::Acl::SCOPE && !permissions.Check(TPermissions::MANAGE_PUBLIC)) { issues.AddIssue(MakeErrorIssue(TIssuesIds::ACCESS_DENIED, "Permission denied to create a connection with these parameters. Please receive a permission yq.resources.managePublic")); } if (issues) { @@ -53,15 +53,15 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvCreateConne return; } - YandexQuery::Connection connection; - YandexQuery::ConnectionContent& content = *connection.mutable_content(); + FederatedQuery::Connection connection; + FederatedQuery::ConnectionContent& content = *connection.mutable_content(); content = request.content(); *connection.mutable_meta() = CreateCommonMeta(connectionId, user, startTime, InitialRevision); - YandexQuery::Internal::ConnectionInternal connectionInternal; + FederatedQuery::Internal::ConnectionInternal connectionInternal; connectionInternal.set_cloud_id(cloudId); - std::shared_ptr<std::pair<YandexQuery::CreateConnectionResult, TAuditDetails<YandexQuery::Connection>>> response = std::make_shared<std::pair<YandexQuery::CreateConnectionResult, TAuditDetails<YandexQuery::Connection>>>(); + std::shared_ptr<std::pair<FederatedQuery::CreateConnectionResult, TAuditDetails<FederatedQuery::Connection>>> response = std::make_shared<std::pair<FederatedQuery::CreateConnectionResult, TAuditDetails<FederatedQuery::Connection>>>(); response->first.set_connection_id(connectionId); response->second.After.ConstructInPlace().CopyFrom(connection); response->second.CloudId = cloudId; @@ -107,7 +107,7 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvCreateConne validators.push_back(validatorName); validators.push_back(validatorCountConnections); - if (content.acl().visibility() == YandexQuery::Acl::PRIVATE) { + if (content.acl().visibility() == FederatedQuery::Acl::PRIVATE) { auto overridBindingValidator = CreateConnectionOverrideBindingValidator( scope, content.name(), @@ -122,7 +122,7 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvCreateConne auto debugInfo = Config->Proto.GetEnableDebugMode() ? std::make_shared<TDebugInfo>() : TDebugInfoPtr{}; TAsyncStatus result = Write(query.Sql, query.Params, requestCounters, debugInfo, validators); auto prepare = [response] { return *response; }; - auto success = SendResponse<TEvControlPlaneStorage::TEvCreateConnectionResponse, YandexQuery::CreateConnectionResult>( + auto success = SendResponse<TEvControlPlaneStorage::TEvCreateConnectionResponse, FederatedQuery::CreateConnectionResult>( MakeLogPrefix(scope, user, connectionId) + "CreateConnectionRequest", NActors::TActivationContext::ActorSystem(), result, @@ -148,7 +148,7 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvListConnect TRequestCounters requestCounters = Counters.GetCounters(cloudId, scope, RTS_LIST_CONNECTIONS, RTC_LIST_CONNECTIONS); requestCounters.IncInFly(); requestCounters.Common->RequestBytes->Add(event.GetByteSize()); - const YandexQuery::ListConnectionsRequest& request = event.Request; + const FederatedQuery::ListConnectionsRequest& request = event.Request; const TString user = event.User; const TString pageToken = request.page_token(); @@ -202,12 +202,12 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvListConnect filters.push_back("`" USER_COLUMN_NAME "` = $user"); } - if (request.filter().connection_type() != YandexQuery::ConnectionSetting::CONNECTION_TYPE_UNSPECIFIED) { + if (request.filter().connection_type() != FederatedQuery::ConnectionSetting::CONNECTION_TYPE_UNSPECIFIED) { queryBuilder.AddInt64("connection_type", request.filter().connection_type()); filters.push_back("`" CONNECTION_TYPE_COLUMN_NAME "` = $connection_type"); } - if (request.filter().visibility() != YandexQuery::Acl::VISIBILITY_UNSPECIFIED) { + if (request.filter().visibility() != FederatedQuery::Acl::VISIBILITY_UNSPECIFIED) { queryBuilder.AddInt64("visibility", request.filter().visibility()); filters.push_back("`" VISIBILITY_COLUMN_NAME "` = $visibility"); } @@ -234,7 +234,7 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvListConnect ythrow TCodeLineException(TIssuesIds::INTERNAL_ERROR) << "Result set size is not equal to 1 but equal " << resultSets->size() << ". Please contact internal support"; } - YandexQuery::ListConnectionsResult result; + FederatedQuery::ListConnectionsResult result; TResultSetParser parser(resultSets->front()); while (parser.TryNextRow()) { auto& connection = *result.add_connection(); @@ -255,7 +255,7 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvListConnect return result; }; - auto success = SendResponse<TEvControlPlaneStorage::TEvListConnectionsResponse, YandexQuery::ListConnectionsResult>( + auto success = SendResponse<TEvControlPlaneStorage::TEvListConnectionsResponse, FederatedQuery::ListConnectionsResult>( MakeLogPrefix(scope, user) + "ListConnectionsRequest", NActors::TActivationContext::ActorSystem(), result, @@ -281,7 +281,7 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvDescribeCon TRequestCounters requestCounters = Counters.GetCounters(cloudId, scope, RTS_DESCRIBE_CONNECTION, RTC_DESCRIBE_CONNECTION); requestCounters.IncInFly(); requestCounters.Common->RequestBytes->Add(event.GetByteSize()); - const YandexQuery::DescribeConnectionRequest& request = event.Request; + const FederatedQuery::DescribeConnectionRequest& request = event.Request; const TString user = event.User; const TString connectionId = request.connection_id(); const TString token = event.Token; @@ -328,7 +328,7 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvDescribeCon ythrow TCodeLineException(TIssuesIds::INTERNAL_ERROR) << "Result set size is not equal to 1 but equal " << resultSets->size() << ". Please contact internal support"; } - YandexQuery::DescribeConnectionResult result; + FederatedQuery::DescribeConnectionResult result; TResultSetParser parser(resultSets->front()); if (!parser.TryNextRow()) { ythrow TCodeLineException(TIssuesIds::ACCESS_DENIED) << "Connection does not exist or permission denied. Please check the id connection or your access rights"; @@ -351,7 +351,7 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvDescribeCon return result; }; - auto success = SendResponse<TEvControlPlaneStorage::TEvDescribeConnectionResponse, YandexQuery::DescribeConnectionResult>( + auto success = SendResponse<TEvControlPlaneStorage::TEvDescribeConnectionResponse, FederatedQuery::DescribeConnectionResult>( MakeLogPrefix(scope, user, connectionId) + "DescribeConnectionRequest", NActors::TActivationContext::ActorSystem(), result, @@ -385,7 +385,7 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvModifyConne if (IsSuperUser(user)) { permissions.SetAll(); } - const YandexQuery::ModifyConnectionRequest& request = event.Request; + const FederatedQuery::ModifyConnectionRequest& request = event.Request; const TString connectionId = request.connection_id(); const int64_t previousRevision = request.previous_revision(); const TString idempotencyKey = request.idempotency_key(); @@ -416,7 +416,7 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvModifyConne "WHERE `" SCOPE_COLUMN_NAME "` = $scope AND `" CONNECTION_ID_COLUMN_NAME "` = $connection_id;" ); - std::shared_ptr<std::pair<YandexQuery::ModifyConnectionResult, TAuditDetails<YandexQuery::Connection>>> response = std::make_shared<std::pair<YandexQuery::ModifyConnectionResult, TAuditDetails<YandexQuery::Connection>>>(); + std::shared_ptr<std::pair<FederatedQuery::ModifyConnectionResult, TAuditDetails<FederatedQuery::Connection>>> response = std::make_shared<std::pair<FederatedQuery::ModifyConnectionResult, TAuditDetails<FederatedQuery::Connection>>>(); auto prepareParams = [=, config=Config](const TVector<TResultSet>& resultSets) { if (resultSets.size() != 1) { ythrow TCodeLineException(TIssuesIds::INTERNAL_ERROR) << "Result set size is not equal to 1 but equal " << resultSets.size() << ". Please contact internal support"; @@ -427,7 +427,7 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvModifyConne ythrow TCodeLineException(TIssuesIds::ACCESS_DENIED) << "Connection does not exist or permission denied. Please check the id connection or your access rights"; } - YandexQuery::Connection connection; + FederatedQuery::Connection connection; if (!connection.ParseFromString(*parser.ColumnParser(CONNECTION_COLUMN_NAME).GetOptionalString())) { ythrow TCodeLineException(TIssuesIds::INTERNAL_ERROR) << "Error parsing proto message for connection. Please contact internal support"; } @@ -445,7 +445,7 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvModifyConne ythrow TCodeLineException(TIssuesIds::BAD_REQUEST) << "Connection type cannot be changed. Please specify the same connection type"; } - if (content.acl().visibility() == YandexQuery::Acl::SCOPE && request.content().acl().visibility() == YandexQuery::Acl::PRIVATE) { + if (content.acl().visibility() == FederatedQuery::Acl::SCOPE && request.content().acl().visibility() == FederatedQuery::Acl::PRIVATE) { ythrow TCodeLineException(TIssuesIds::BAD_REQUEST) << "Changing visibility from SCOPE to PRIVATE is forbidden. Please create a new connection with visibility PRIVATE"; } @@ -461,7 +461,7 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvModifyConne content = request.content(); } - YandexQuery::Internal::ConnectionInternal connectionInternal; + FederatedQuery::Internal::ConnectionInternal connectionInternal; response->second.After.ConstructInPlace().CopyFrom(connection); response->second.CloudId = connectionInternal.cloud_id(); @@ -528,7 +528,7 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvModifyConne auto debugInfo = Config->Proto.GetEnableDebugMode() ? std::make_shared<TDebugInfo>() : TDebugInfoPtr{}; auto result = ReadModifyWrite(readQuery.Sql, readQuery.Params, prepareParams, requestCounters, debugInfo, validators); auto prepare = [response] { return *response; }; - auto success = SendResponse<TEvControlPlaneStorage::TEvModifyConnectionResponse, YandexQuery::ModifyConnectionResult>( + auto success = SendResponse<TEvControlPlaneStorage::TEvModifyConnectionResponse, FederatedQuery::ModifyConnectionResult>( MakeLogPrefix(scope, user, connectionId) + "ModifyConnectionRequest", NActors::TActivationContext::ActorSystem(), result, @@ -554,7 +554,7 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvDeleteConne TRequestCounters requestCounters = Counters.GetCounters(cloudId, scope, RTS_DELETE_CONNECTION, RTC_DELETE_CONNECTION); requestCounters.IncInFly(); requestCounters.Common->RequestBytes->Add(event.GetByteSize()); - const YandexQuery::DeleteConnectionRequest& request = event.Request; + const FederatedQuery::DeleteConnectionRequest& request = event.Request; const TString user = event.User; const TString token = event.Token; @@ -586,7 +586,7 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvDeleteConne return; } - std::shared_ptr<std::pair<YandexQuery::DeleteConnectionResult, TAuditDetails<YandexQuery::Connection>>> response = std::make_shared<std::pair<YandexQuery::DeleteConnectionResult, TAuditDetails<YandexQuery::Connection>>>(); + std::shared_ptr<std::pair<FederatedQuery::DeleteConnectionResult, TAuditDetails<FederatedQuery::Connection>>> response = std::make_shared<std::pair<FederatedQuery::DeleteConnectionResult, TAuditDetails<FederatedQuery::Connection>>>(); TSqlQueryBuilder queryBuilder(YdbConnection->TablePathPrefix, "DeleteConnection"); queryBuilder.AddString("scope", scope); @@ -647,7 +647,7 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvDeleteConne auto debugInfo = Config->Proto.GetEnableDebugMode() ? std::make_shared<TDebugInfo>() : TDebugInfoPtr{}; auto result = Write(query.Sql, query.Params, requestCounters, debugInfo, validators); auto prepare = [response] { return *response; }; - auto success = SendResponse<TEvControlPlaneStorage::TEvDeleteConnectionResponse, YandexQuery::DeleteConnectionResult>( + auto success = SendResponse<TEvControlPlaneStorage::TEvDeleteConnectionResponse, FederatedQuery::DeleteConnectionResult>( MakeLogPrefix(scope, user, connectionId) + "DeleteConnectionRequest", NActors::TActivationContext::ActorSystem(), result, diff --git a/ydb/core/yq/libs/control_plane_storage/ydb_control_plane_storage_impl.h b/ydb/core/yq/libs/control_plane_storage/ydb_control_plane_storage_impl.h index ea7b6576c3..93e0bee0f9 100644 --- a/ydb/core/yq/libs/control_plane_storage/ydb_control_plane_storage_impl.h +++ b/ydb/core/yq/libs/control_plane_storage/ydb_control_plane_storage_impl.h @@ -18,7 +18,7 @@ #include <library/cpp/monlib/service/pages/templates.h> #include <library/cpp/protobuf/interop/cast.h> -#include <ydb/public/api/protos/yq.pb.h> +#include <ydb/public/api/protos/draft/fq.pb.h> #include <ydb/public/sdk/cpp/client/ydb_scheme/scheme.h> #include <ydb/library/db_pool/db_pool.h> @@ -57,14 +57,14 @@ inline static void PrepareAccessConditionImpl(TSqlQueryBuilder& builder, TPermis // any row } else if (permissions.Check(publicPermission)) { builder.AddString("user", user); - builder.AddInt64("visibility_scope", YandexQuery::Acl::SCOPE); + builder.AddInt64("visibility_scope", FederatedQuery::Acl::SCOPE); builder.AddText(" AND (`" VISIBILITY_COLUMN_NAME "` = $visibility_scope OR `" USER_COLUMN_NAME "` = $user)"); } else if (permissions.Check(privatePermission)) { - builder.AddInt64("visibility_private", YandexQuery::Acl::PRIVATE); + builder.AddInt64("visibility_private", FederatedQuery::Acl::PRIVATE); builder.AddText(" AND (`" VISIBILITY_COLUMN_NAME "` = $visibility_private)"); } else { builder.AddString("user", user); - builder.AddInt64("visibility_private", YandexQuery::Acl::PRIVATE); + builder.AddInt64("visibility_private", FederatedQuery::Acl::PRIVATE); builder.AddText(" AND (`" VISIBILITY_COLUMN_NAME "` = $visibility_private AND `" USER_COLUMN_NAME "` = $user)"); } } @@ -77,19 +77,19 @@ inline static void PrepareManageAccessCondition(TSqlQueryBuilder& builder, TPerm PrepareAccessConditionImpl(builder, permissions, user, TPermissions::MANAGE_PRIVATE, TPermissions::MANAGE_PUBLIC); } -inline static bool HasAccessImpl(TPermissions permissions, YandexQuery::Acl::Visibility entityVisibility, const TString& entityUser, const TString& user, TPermissions::TPermission privatePermission, TPermissions::TPermission publicPermission) { +inline static bool HasAccessImpl(TPermissions permissions, FederatedQuery::Acl::Visibility entityVisibility, const TString& entityUser, const TString& user, TPermissions::TPermission privatePermission, TPermissions::TPermission publicPermission) { return (permissions.Check(publicPermission) && permissions.Check(privatePermission)) - || (permissions.Check(publicPermission) && (entityVisibility == YandexQuery::Acl::SCOPE || entityUser == user)) - || (permissions.Check(privatePermission) && entityVisibility == YandexQuery::Acl::PRIVATE) - || (entityVisibility == YandexQuery::Acl::PRIVATE && entityUser == user); + || (permissions.Check(publicPermission) && (entityVisibility == FederatedQuery::Acl::SCOPE || entityUser == user)) + || (permissions.Check(privatePermission) && entityVisibility == FederatedQuery::Acl::PRIVATE) + || (entityVisibility == FederatedQuery::Acl::PRIVATE && entityUser == user); } -inline static bool HasViewAccess(TPermissions permissions, YandexQuery::Acl::Visibility entityVisibility, const TString& entityUser, const TString& user) { +inline static bool HasViewAccess(TPermissions permissions, FederatedQuery::Acl::Visibility entityVisibility, const TString& entityUser, const TString& user) { return HasAccessImpl(permissions, entityVisibility, entityUser, user, TPermissions::VIEW_PRIVATE, TPermissions::VIEW_PUBLIC); } -inline static bool HasManageAccess(TPermissions permissions, YandexQuery::Acl::Visibility entityVisibility, const TString& entityUser, const TString& user) { +inline static bool HasManageAccess(TPermissions permissions, FederatedQuery::Acl::Visibility entityVisibility, const TString& entityUser, const TString& user) { return HasAccessImpl(permissions, entityVisibility, entityUser, user, TPermissions::MANAGE_PRIVATE, TPermissions::MANAGE_PUBLIC); } @@ -186,7 +186,7 @@ THashMap<TString, T> GetEntitiesWithVisibilityPriority(const TResultSet& resultS const TString name = entity.content().name(); if (auto it = entities.find(name); it != entities.end()) { const auto visibility = entity.content().acl().visibility(); - if (visibility == YandexQuery::Acl::PRIVATE) { + if (visibility == FederatedQuery::Acl::PRIVATE) { entities[name] = std::move(entity); } } else { @@ -336,8 +336,8 @@ protected: return s.size() > maxLength ? (s.substr(0, maxLength - 3) + "...") : s; } - static YandexQuery::CommonMeta CreateCommonMeta(const TString& id, const TString& user, const TInstant& startTime, int64_t revision) { - YandexQuery::CommonMeta common; + static FederatedQuery::CommonMeta CreateCommonMeta(const TString& id, const TString& user, const TInstant& startTime, int64_t revision) { + FederatedQuery::CommonMeta common; common.set_id(id); common.set_created_by(user); common.set_modified_by(user); diff --git a/ydb/core/yq/libs/control_plane_storage/ydb_control_plane_storage_queries.cpp b/ydb/core/yq/libs/control_plane_storage/ydb_control_plane_storage_queries.cpp index d90bfebfa1..12cd7a93ef 100644 --- a/ydb/core/yq/libs/control_plane_storage/ydb_control_plane_storage_queries.cpp +++ b/ydb/core/yq/libs/control_plane_storage/ydb_control_plane_storage_queries.cpp @@ -13,7 +13,7 @@ #include <ydb/core/yq/libs/control_plane_storage/schema.h> #include <ydb/core/yq/libs/db_schema/db_schema.h> -#include <ydb/public/api/protos/yq.pb.h> +#include <ydb/public/api/protos/draft/fq.pb.h> #include <ydb/public/sdk/cpp/client/ydb_value/value.h> #include <ydb/core/yq/libs/shared_resources/db_exec.h> @@ -24,21 +24,21 @@ namespace { constexpr ui64 GRPC_MESSAGE_SIZE_LIMIT = 64000000; -YandexQuery::IamAuth::IdentityCase GetIamAuth(const YandexQuery::Connection& connection) { +FederatedQuery::IamAuth::IdentityCase GetIamAuth(const FederatedQuery::Connection& connection) { const auto& setting = connection.content().setting(); switch (setting.connection_case()) { - case YandexQuery::ConnectionSetting::kYdbDatabase: + case FederatedQuery::ConnectionSetting::kYdbDatabase: return setting.data_streams().auth().identity_case(); - case YandexQuery::ConnectionSetting::kClickhouseCluster: + case FederatedQuery::ConnectionSetting::kClickhouseCluster: return setting.clickhouse_cluster().auth().identity_case(); - case YandexQuery::ConnectionSetting::kObjectStorage: + case FederatedQuery::ConnectionSetting::kObjectStorage: return setting.object_storage().auth().identity_case(); - case YandexQuery::ConnectionSetting::kDataStreams: + case FederatedQuery::ConnectionSetting::kDataStreams: return setting.data_streams().auth().identity_case(); - case YandexQuery::ConnectionSetting::kMonitoring: + case FederatedQuery::ConnectionSetting::kMonitoring: return setting.monitoring().auth().identity_case(); - case YandexQuery::ConnectionSetting::CONNECTION_NOT_SET: - return YandexQuery::IamAuth::IDENTITY_NOT_SET; + case FederatedQuery::ConnectionSetting::CONNECTION_NOT_SET: + return FederatedQuery::IamAuth::IDENTITY_NOT_SET; } } @@ -51,7 +51,7 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvCreateQuery TInstant startTime = TInstant::Now(); const TEvControlPlaneStorage::TEvCreateQueryRequest& event = *ev->Get(); const TString cloudId = event.CloudId; - const YandexQuery::CreateQueryRequest& request = event.Request; + const FederatedQuery::CreateQueryRequest& request = event.Request; ui64 resultLimit = 0; if (event.Quotas) { if (auto it = event.Quotas->find(QUOTA_QUERY_RESULT_LIMIT); it != event.Quotas->end()) { @@ -61,12 +61,12 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvCreateQuery auto queryType = request.content().type(); ui64 executionLimitMills = 0; if (event.Quotas) { - if (queryType == YandexQuery::QueryContent::ANALYTICS) { + if (queryType == FederatedQuery::QueryContent::ANALYTICS) { auto execTtlIt = event.Quotas->find(QUOTA_ANALYTICS_DURATION_LIMIT); if (execTtlIt != event.Quotas->end()) { executionLimitMills = execTtlIt->second.Limit.Value * 60 * 1000; } - } else if (queryType == YandexQuery::QueryContent::STREAMING) { + } else if (queryType == FederatedQuery::QueryContent::STREAMING) { auto execTtlIt = event.Quotas->find(QUOTA_STREAMING_DURATION_LIMIT); if (execTtlIt != event.Quotas->end()) { executionLimitMills = execTtlIt->second.Limit.Value * 60 * 1000; @@ -90,11 +90,11 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvCreateQuery CPS_LOG_T("CreateQueryRequest: {" << request.DebugString() << "} " << MakeUserInfo(user, token)); NYql::TIssues issues = ValidateQuery(ev); - if (request.execute_mode() != YandexQuery::SAVE && !permissions.Check(TPermissions::QUERY_INVOKE)) { + if (request.execute_mode() != FederatedQuery::SAVE && !permissions.Check(TPermissions::QUERY_INVOKE)) { issues.AddIssue(MakeErrorIssue(TIssuesIds::ACCESS_DENIED, "Permission denied to create a query with these parameters. Please receive a permission yq.queries.invoke")); } - if (request.content().acl().visibility() == YandexQuery::Acl::SCOPE && !permissions.Check(TPermissions::MANAGE_PUBLIC)) { + if (request.content().acl().visibility() == FederatedQuery::Acl::SCOPE && !permissions.Check(TPermissions::MANAGE_PUBLIC)) { issues.AddIssue(MakeErrorIssue(TIssuesIds::ACCESS_DENIED, "Permission denied to create a query with these parameters. Please receive a permission yq.resources.managePublic")); } if (request.disposition().has_from_last_checkpoint()) { @@ -105,9 +105,9 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvCreateQuery if (event.Quotas) { TQuotaMap::const_iterator it = event.Quotas->end(); - if (queryType == YandexQuery::QueryContent::ANALYTICS) { + if (queryType == FederatedQuery::QueryContent::ANALYTICS) { it = event.Quotas->find(QUOTA_ANALYTICS_COUNT_LIMIT); - } else if (queryType == YandexQuery::QueryContent::STREAMING) { + } else if (queryType == FederatedQuery::QueryContent::STREAMING) { it = event.Quotas->find(QUOTA_STREAMING_COUNT_LIMIT); } if (it != event.Quotas->end()) { @@ -133,17 +133,17 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvCreateQuery } const TString idempotencyKey = request.idempotency_key(); - const TString jobId = request.execute_mode() == YandexQuery::SAVE ? "" : GetEntityIdAsString(Config->IdsPrefix, EEntityType::JOB); + const TString jobId = request.execute_mode() == FederatedQuery::SAVE ? "" : GetEntityIdAsString(Config->IdsPrefix, EEntityType::JOB); - YandexQuery::Query query; - YandexQuery::QueryContent& content = *query.mutable_content() = request.content(); - YandexQuery::QueryMeta& meta = *query.mutable_meta(); - YandexQuery::CommonMeta& common = *meta.mutable_common() = CreateCommonMeta(queryId, user, startTime, InitialRevision); + FederatedQuery::Query query; + FederatedQuery::QueryContent& content = *query.mutable_content() = request.content(); + FederatedQuery::QueryMeta& meta = *query.mutable_meta(); + FederatedQuery::CommonMeta& common = *meta.mutable_common() = CreateCommonMeta(queryId, user, startTime, InitialRevision); meta.set_execute_mode(request.execute_mode()); - meta.set_status(request.execute_mode() == YandexQuery::SAVE ? YandexQuery::QueryMeta::COMPLETED : YandexQuery::QueryMeta::STARTING); + meta.set_status(request.execute_mode() == FederatedQuery::SAVE ? FederatedQuery::QueryMeta::COMPLETED : FederatedQuery::QueryMeta::STARTING); - YandexQuery::Job job; - if (request.execute_mode() != YandexQuery::SAVE) { + FederatedQuery::Job job; + if (request.execute_mode() != FederatedQuery::SAVE) { meta.set_last_job_query_revision(InitialRevision); meta.set_last_job_id(jobId); meta.set_started_by(user); @@ -157,17 +157,17 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvCreateQuery job.set_automatic(content.automatic()); } - std::shared_ptr<std::pair<YandexQuery::CreateQueryResult, TAuditDetails<YandexQuery::Query>>> response = std::make_shared<std::pair<YandexQuery::CreateQueryResult, TAuditDetails<YandexQuery::Query>>>(); + std::shared_ptr<std::pair<FederatedQuery::CreateQueryResult, TAuditDetails<FederatedQuery::Query>>> response = std::make_shared<std::pair<FederatedQuery::CreateQueryResult, TAuditDetails<FederatedQuery::Query>>>(); response->first.set_query_id(queryId); response->second.CloudId = cloudId; TSqlQueryBuilder readQueryBuilder(YdbConnection->TablePathPrefix, "CreateQuery(read)"); ReadIdempotencyKeyQuery(readQueryBuilder, scope, idempotencyKey); - if (request.execute_mode() != YandexQuery::SAVE) { + if (request.execute_mode() != FederatedQuery::SAVE) { readQueryBuilder.AddString("scope", scope); readQueryBuilder.AddString("user", user); - readQueryBuilder.AddInt64("scope_visibility", YandexQuery::Acl::SCOPE); + readQueryBuilder.AddInt64("scope_visibility", FederatedQuery::Acl::SCOPE); // user connections readQueryBuilder.AddText( @@ -183,7 +183,7 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvCreateQuery } auto prepareParams = [=](const TVector<TResultSet>& resultSets) mutable { - const size_t countSets = (idempotencyKey ? 1 : 0) + (request.execute_mode() != YandexQuery::SAVE ? 2 : 0); + const size_t countSets = (idempotencyKey ? 1 : 0) + (request.execute_mode() != FederatedQuery::SAVE ? 2 : 0); if (resultSets.size() != countSets) { ythrow TCodeLineException(TIssuesIds::INTERNAL_ERROR) << "Result set size is not equal to " << countSets << " but equal " << resultSets.size() << ". Please contact internal support"; } @@ -199,28 +199,28 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvCreateQuery } } - YandexQuery::Internal::QueryInternal queryInternal; + FederatedQuery::Internal::QueryInternal queryInternal; if (!Config->Proto.GetDisableCurrentIam()) { queryInternal.set_token(token); } queryInternal.set_cloud_id(cloudId); - queryInternal.set_state_load_mode(YandexQuery::StateLoadMode::EMPTY); + queryInternal.set_state_load_mode(FederatedQuery::StateLoadMode::EMPTY); queryInternal.mutable_disposition()->CopyFrom(request.disposition()); queryInternal.set_result_limit(resultLimit); *queryInternal.mutable_execution_ttl() = NProtoInterop::CastToProto(TDuration::MilliSeconds(executionLimitMills)); - if (request.execute_mode() != YandexQuery::SAVE) { + if (request.execute_mode() != FederatedQuery::SAVE) { // TODO: move to run actor priority selection TSet<TString> disabledConnections; - for (const auto& connection: GetEntities<YandexQuery::Connection>(resultSets[resultSets.size() - 2], CONNECTION_COLUMN_NAME)) { + for (const auto& connection: GetEntities<FederatedQuery::Connection>(resultSets[resultSets.size() - 2], CONNECTION_COLUMN_NAME)) { if (!Config->AvailableConnections.contains(connection.content().setting().connection_case())) { disabledConnections.insert(connection.meta().id()); continue; } - if (GetIamAuth(connection) == YandexQuery::IamAuth::kCurrentIam && Config->Proto.GetDisableCurrentIam()) { + if (GetIamAuth(connection) == FederatedQuery::IamAuth::kCurrentIam && Config->Proto.GetDisableCurrentIam()) { disabledConnections.insert(connection.meta().id()); continue; } @@ -228,7 +228,7 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvCreateQuery TSet<TString> connectionIds; if (permissions.Check(TPermissions::CONNECTIONS_USE)) { - auto connections = GetEntitiesWithVisibilityPriority<YandexQuery::Connection>(resultSets[resultSets.size() - 2], CONNECTION_COLUMN_NAME); + auto connections = GetEntitiesWithVisibilityPriority<FederatedQuery::Connection>(resultSets[resultSets.size() - 2], CONNECTION_COLUMN_NAME); for (const auto& [_, connection]: connections) { if (disabledConnections.contains(connection.meta().id())) { continue; @@ -239,7 +239,7 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvCreateQuery } if (permissions.Check(TPermissions::BINDINGS_USE)) { - auto bindings = GetEntitiesWithVisibilityPriority<YandexQuery::Binding>(resultSets[resultSets.size() - 1], BINDING_COLUMN_NAME); + auto bindings = GetEntitiesWithVisibilityPriority<FederatedQuery::Binding>(resultSets[resultSets.size() - 1], BINDING_COLUMN_NAME); for (const auto& [_, binding]: bindings) { if (!Config->AvailableBindings.contains(binding.content().setting().binding_case())) { continue; @@ -285,7 +285,7 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvCreateQuery InsertIdempotencyKey(writeQueryBuilder, scope, idempotencyKey, response->first.SerializeAsString(), startTime + Config->IdempotencyKeyTtl); - if (request.execute_mode() != YandexQuery::SAVE) { + if (request.execute_mode() != FederatedQuery::SAVE) { writeQueryBuilder.AddString("job", job.SerializeAsString()); writeQueryBuilder.AddTimestamp("zero_timestamp", TInstant::Zero()); writeQueryBuilder.AddTimestamp("now", TInstant::Now()); @@ -328,7 +328,7 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvCreateQuery auto debugInfo = Config->Proto.GetEnableDebugMode() ? std::make_shared<TDebugInfo>() : TDebugInfoPtr{}; TAsyncStatus status = ReadModifyWrite(read.Sql, read.Params, prepareParams, requestCounters, debugInfo); auto prepare = [response] { return *response; }; - auto success = SendResponse<TEvControlPlaneStorage::TEvCreateQueryResponse, YandexQuery::CreateQueryResult>( + auto success = SendResponse<TEvControlPlaneStorage::TEvCreateQueryResponse, FederatedQuery::CreateQueryResult>( "CreateQueryRequest - CreateQueryResult", NActors::TActivationContext::ActorSystem(), status, @@ -364,7 +364,7 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvListQueries permissions.SetAll(); } - const YandexQuery::ListQueriesRequest& request = event.Request; + const FederatedQuery::ListQueriesRequest& request = event.Request; const TString pageToken = request.page_token(); const int byteSize = request.ByteSize(); const int64_t limit = request.limit(); @@ -398,7 +398,7 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvListQueries filters.push_back("`" NAME_COLUMN_NAME "` ILIKE '%' || $filter_name || '%'"); } - if (request.filter().query_type() != YandexQuery::QueryContent::QUERY_TYPE_UNSPECIFIED) { + if (request.filter().query_type() != FederatedQuery::QueryContent::QUERY_TYPE_UNSPECIFIED) { queryBuilder.AddInt64("filter_query_type", request.filter().query_type()); filters.push_back("`" QUERY_TYPE_COLUMN_NAME "` = $filter_query_type"); } @@ -430,16 +430,16 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvListQueries filters.push_back("`" USER_COLUMN_NAME "` = $user"); } - if (request.filter().visibility() != YandexQuery::Acl::VISIBILITY_UNSPECIFIED) { + if (request.filter().visibility() != FederatedQuery::Acl::VISIBILITY_UNSPECIFIED) { queryBuilder.AddInt64("filter_visibility", request.filter().visibility()); filters.push_back("`" VISIBILITY_COLUMN_NAME "` = $filter_visibility"); } switch (request.filter().automatic()) { - case YandexQuery::AUTOMATIC: + case FederatedQuery::AUTOMATIC: filters.push_back("`" AUTOMATIC_COLUMN_NAME "` = true"); break; - case YandexQuery::NOT_AUTOMATIC: + case FederatedQuery::NOT_AUTOMATIC: filters.push_back("`" AUTOMATIC_COLUMN_NAME "` = false"); break; default: @@ -468,14 +468,14 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvListQueries ythrow TCodeLineException(TIssuesIds::INTERNAL_ERROR) << "Result set size is not equal to 1 but equal " << resultSets->size() << ". Please contact internal support"; } - YandexQuery::ListQueriesResult result; + FederatedQuery::ListQueriesResult result; TResultSetParser parser(resultSets->front()); while (parser.TryNextRow()) { - YandexQuery::Query query; + FederatedQuery::Query query; if (!query.ParseFromString(*parser.ColumnParser(QUERY_COLUMN_NAME).GetOptionalString())) { ythrow TCodeLineException(TIssuesIds::INTERNAL_ERROR) << "Error parsing proto message for query. Please contact internal support"; } - YandexQuery::BriefQuery briefQuery; + FederatedQuery::BriefQuery briefQuery; const auto lastJobId = query.meta().last_job_id(); query.mutable_meta()->set_last_job_id(lastJobId + "-" + query.meta().common().id()); *briefQuery.mutable_meta() = query.meta(); @@ -493,7 +493,7 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvListQueries return result; }; - auto success = SendResponse<TEvControlPlaneStorage::TEvListQueriesResponse, YandexQuery::ListQueriesResult>( + auto success = SendResponse<TEvControlPlaneStorage::TEvListQueriesResponse, FederatedQuery::ListQueriesResult>( "ListQueriesRequest - ListQueriesResult", NActors::TActivationContext::ActorSystem(), result, @@ -528,7 +528,7 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvDescribeQue permissions.SetAll(); } - const YandexQuery::DescribeQueryRequest& request = event.Request; + const FederatedQuery::DescribeQueryRequest& request = event.Request; const TString queryId = request.query_id(); const int byteSize = request.ByteSize(); CPS_LOG_T("DescribeQueryRequest: {" << request.DebugString() << "} " << MakeUserInfo(user, token)); @@ -563,7 +563,7 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvDescribeQue ythrow TCodeLineException(TIssuesIds::ACCESS_DENIED) << "Query does not exist or permission denied. Please check the id of the query or your access rights"; } - YandexQuery::DescribeQueryResult result; + FederatedQuery::DescribeQueryResult result; if (!result.mutable_query()->ParseFromString(*parser.ColumnParser(QUERY_COLUMN_NAME).GetOptionalString())) { ythrow TCodeLineException(TIssuesIds::INTERNAL_ERROR) << "Error parsing proto message for query. Please contact internal support"; } @@ -578,7 +578,7 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvDescribeQue ythrow TCodeLineException(TIssuesIds::ACCESS_DENIED) << "Query does not exist or permission denied. Please check the id of the query or your access rights"; } - YandexQuery::Internal::QueryInternal internal; + FederatedQuery::Internal::QueryInternal internal; if (!internal.ParseFromString(*parser.ColumnParser(INTERNAL_COLUMN_NAME).GetOptionalString())) { ythrow TCodeLineException(TIssuesIds::INTERNAL_ERROR) << "Error parsing proto message for query internal. Please contact internal support"; } @@ -619,7 +619,7 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvDescribeQue return result; }; - auto success = SendResponse<TEvControlPlaneStorage::TEvDescribeQueryResponse, YandexQuery::DescribeQueryResult>( + auto success = SendResponse<TEvControlPlaneStorage::TEvDescribeQueryResponse, FederatedQuery::DescribeQueryResult>( "DescribeQueryRequest - DescribeQueryResult", NActors::TActivationContext::ActorSystem(), result, @@ -653,7 +653,7 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvGetQuerySta if (IsSuperUser(user)) { permissions.SetAll(); } - const YandexQuery::GetQueryStatusRequest& request = event.Request; + const FederatedQuery::GetQueryStatusRequest& request = event.Request; const TString queryId = request.query_id(); const int byteSize = request.ByteSize(); CPS_LOG_T("GetQueryStatusRequest: {" << request.DebugString() << "} " << MakeUserInfo(user, token)); @@ -690,11 +690,11 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvGetQuerySta ythrow TCodeLineException(TIssuesIds::ACCESS_DENIED) << "Query does not exist or permission denied. Please check the id of the query or your access rights"; } - YandexQuery::GetQueryStatusResult result; - result.set_status(static_cast<YandexQuery::QueryMeta_ComputeStatus>(*parser.ColumnParser(STATUS_COLUMN_NAME).GetOptionalInt64())); + FederatedQuery::GetQueryStatusResult result; + result.set_status(static_cast<FederatedQuery::QueryMeta_ComputeStatus>(*parser.ColumnParser(STATUS_COLUMN_NAME).GetOptionalInt64())); result.set_meta_revision(parser.ColumnParser(META_REVISION_COLUMN_NAME).GetOptionalInt64().GetOrElse(0)); - const auto queryVisibility = static_cast<YandexQuery::Acl::Visibility>(*parser.ColumnParser(VISIBILITY_COLUMN_NAME).GetOptionalInt64()); + const auto queryVisibility = static_cast<FederatedQuery::Acl::Visibility>(*parser.ColumnParser(VISIBILITY_COLUMN_NAME).GetOptionalInt64()); const auto queryUser = *parser.ColumnParser(USER_COLUMN_NAME).GetOptionalString(); const bool hasViewAccess = HasViewAccess(permissions, queryVisibility, queryUser, user); if (!hasViewAccess) { @@ -704,7 +704,7 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvGetQuerySta return result; }; - auto success = SendResponse<TEvControlPlaneStorage::TEvGetQueryStatusResponse, YandexQuery::GetQueryStatusResult>( + auto success = SendResponse<TEvControlPlaneStorage::TEvGetQueryStatusResponse, FederatedQuery::GetQueryStatusResult>( "GetQueryStatusRequest - GetQueryStatusResult", NActors::TActivationContext::ActorSystem(), result, @@ -738,25 +738,25 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvModifyQuery if (IsSuperUser(user)) { permissions.SetAll(); } - YandexQuery::ModifyQueryRequest& request = event.Request; + FederatedQuery::ModifyQueryRequest& request = event.Request; const TString queryId = request.query_id(); const int byteSize = request.ByteSize(); const int64_t previousRevision = request.previous_revision(); CPS_LOG_T("ModifyQueryRequest: {" << request.DebugString() << "} " << MakeUserInfo(user, token)); - if (request.content().type() == YandexQuery::QueryContent::STREAMING && request.state_load_mode() == YandexQuery::STATE_LOAD_MODE_UNSPECIFIED) { - request.set_state_load_mode(YandexQuery::EMPTY); + if (request.content().type() == FederatedQuery::QueryContent::STREAMING && request.state_load_mode() == FederatedQuery::STATE_LOAD_MODE_UNSPECIFIED) { + request.set_state_load_mode(FederatedQuery::EMPTY); } NYql::TIssues issues = ValidateQuery(ev); - if (request.execute_mode() != YandexQuery::SAVE && !permissions.Check(TPermissions::QUERY_INVOKE)) { + if (request.execute_mode() != FederatedQuery::SAVE && !permissions.Check(TPermissions::QUERY_INVOKE)) { issues.AddIssue(MakeErrorIssue(TIssuesIds::ACCESS_DENIED, "Permission denied to create a query with these parameters. Please receive a permission yq.queries.invoke")); } - if (request.content().acl().visibility() == YandexQuery::Acl::SCOPE && !permissions.Check(TPermissions::MANAGE_PUBLIC)) { + if (request.content().acl().visibility() == FederatedQuery::Acl::SCOPE && !permissions.Check(TPermissions::MANAGE_PUBLIC)) { issues.AddIssue(MakeErrorIssue(TIssuesIds::ACCESS_DENIED, "Permission denied to create a query with these parameters. Please receive a permission yq.resources.managePublic")); } - if (request.state_load_mode() == YandexQuery::FROM_LAST_CHECKPOINT) { + if (request.state_load_mode() == FederatedQuery::FROM_LAST_CHECKPOINT) { issues.AddIssue(MakeErrorIssue(TIssuesIds::UNSUPPORTED, "State load mode \"FROM_LAST_CHECKPOINT\" is not supported")); } @@ -772,17 +772,17 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvModifyQuery const TString idempotencyKey = request.idempotency_key(); - std::shared_ptr<std::pair<YandexQuery::ModifyQueryResult, TAuditDetails<YandexQuery::Query>>> response = - std::make_shared<std::pair<YandexQuery::ModifyQueryResult, TAuditDetails<YandexQuery::Query>>>(); + std::shared_ptr<std::pair<FederatedQuery::ModifyQueryResult, TAuditDetails<FederatedQuery::Query>>> response = + std::make_shared<std::pair<FederatedQuery::ModifyQueryResult, TAuditDetails<FederatedQuery::Query>>>(); TSqlQueryBuilder readQueryBuilder(YdbConnection->TablePathPrefix, "ModifyQuery(read)"); readQueryBuilder.AddString("scope", scope); readQueryBuilder.AddString("query_id", queryId); readQueryBuilder.AddTimestamp("now", TInstant::Now()); - if (request.execute_mode() != YandexQuery::SAVE) { + if (request.execute_mode() != FederatedQuery::SAVE) { readQueryBuilder.AddString("user", user); - readQueryBuilder.AddInt64("scope_visibility", YandexQuery::Acl::SCOPE); + readQueryBuilder.AddInt64("scope_visibility", FederatedQuery::Acl::SCOPE); // user connections readQueryBuilder.AddText( "SELECT `" CONNECTION_ID_COLUMN_NAME "`, `" CONNECTION_COLUMN_NAME "` FROM `" CONNECTIONS_TABLE_NAME "`\n" @@ -802,7 +802,7 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvModifyQuery ); auto prepareParams = [=, config=Config](const TVector<TResultSet>& resultSets) { - const size_t countSets = 1 + (request.execute_mode() != YandexQuery::SAVE ? 2 : 0); + const size_t countSets = 1 + (request.execute_mode() != FederatedQuery::SAVE ? 2 : 0); if (resultSets.size() != countSets) { ythrow TCodeLineException(TIssuesIds::INTERNAL_ERROR) << "Result set size is not equal to " << countSets << " but equal " << resultSets.size() << ". Please contact internal support"; @@ -814,17 +814,17 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvModifyQuery ythrow TCodeLineException(TIssuesIds::ACCESS_DENIED) << "Query does not exist or permission denied. Please check the id of the query or your access rights"; } - YandexQuery::Query query; + FederatedQuery::Query query; if (!query.ParseFromString(*parser.ColumnParser(QUERY_COLUMN_NAME).GetOptionalString())) { ythrow TCodeLineException(TIssuesIds::INTERNAL_ERROR) << "Error parsing proto message for query. Please contact internal support"; } - YandexQuery::Internal::QueryInternal internal; + FederatedQuery::Internal::QueryInternal internal; if (!internal.ParseFromString(*parser.ColumnParser(INTERNAL_COLUMN_NAME).GetOptionalString())) { ythrow TCodeLineException(TIssuesIds::INTERNAL_ERROR) << "Error parsing proto message for query internal. Please contact internal support"; } - const TString resultId = request.execute_mode() == YandexQuery::SAVE ? parser.ColumnParser(RESULT_ID_COLUMN_NAME).GetOptionalString().GetOrElse("") : ""; + const TString resultId = request.execute_mode() == FederatedQuery::SAVE ? parser.ColumnParser(RESULT_ID_COLUMN_NAME).GetOptionalString().GetOrElse("") : ""; const auto queryVisibility = query.content().acl().visibility(); const auto queryUser = query.meta().common().created_by(); @@ -834,10 +834,10 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvModifyQuery } if (query.content().type() != request.content().type()) { - ythrow TCodeLineException(TIssuesIds::BAD_REQUEST) << "Query type cannot be changed. Please specify " << YandexQuery::QueryContent_QueryType_Name(query.content().type()) << " instead of " << YandexQuery::QueryContent_QueryType_Name(request.content().type()); + ythrow TCodeLineException(TIssuesIds::BAD_REQUEST) << "Query type cannot be changed. Please specify " << FederatedQuery::QueryContent_QueryType_Name(query.content().type()) << " instead of " << FederatedQuery::QueryContent_QueryType_Name(request.content().type()); } - if (query.content().acl().visibility() == YandexQuery::Acl::SCOPE && request.content().acl().visibility() == YandexQuery::Acl::PRIVATE) { + if (query.content().acl().visibility() == FederatedQuery::Acl::SCOPE && request.content().acl().visibility() == FederatedQuery::Acl::PRIVATE) { ythrow TCodeLineException(TIssuesIds::BAD_REQUEST) << "Changing visibility from SCOPE to PRIVATE is forbidden. Please create a new query with visibility PRIVATE"; } @@ -852,24 +852,24 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvModifyQuery *query.mutable_content() = request.content(); query.mutable_meta()->set_execute_mode(request.execute_mode()); - bool isValidMode = request.execute_mode() == YandexQuery::SAVE || + bool isValidMode = request.execute_mode() == FederatedQuery::SAVE || IsIn({ - YandexQuery::QueryMeta::ABORTED_BY_USER, - YandexQuery::QueryMeta::ABORTED_BY_SYSTEM, - YandexQuery::QueryMeta::COMPLETED, - YandexQuery::QueryMeta::FAILED, - YandexQuery::QueryMeta::PAUSED + FederatedQuery::QueryMeta::ABORTED_BY_USER, + FederatedQuery::QueryMeta::ABORTED_BY_SYSTEM, + FederatedQuery::QueryMeta::COMPLETED, + FederatedQuery::QueryMeta::FAILED, + FederatedQuery::QueryMeta::PAUSED }, query.meta().status()); if (!isValidMode) { - ythrow TCodeLineException(TIssuesIds::BAD_REQUEST) << "Conversion from status " << YandexQuery::QueryMeta::ComputeStatus_Name(query.meta().status()) << " to " << YandexQuery::QueryMeta::ComputeStatus_Name(YandexQuery::QueryMeta::STARTING) << " is not possible. Please wait for the query to complete or stop it"; + ythrow TCodeLineException(TIssuesIds::BAD_REQUEST) << "Conversion from status " << FederatedQuery::QueryMeta::ComputeStatus_Name(query.meta().status()) << " to " << FederatedQuery::QueryMeta::ComputeStatus_Name(FederatedQuery::QueryMeta::STARTING) << " is not possible. Please wait for the query to complete or stop it"; } if (!Config->Proto.GetDisableCurrentIam()) { internal.set_token(token); } - if (request.execute_mode() != YandexQuery::SAVE) { - if (request.state_load_mode() != YandexQuery::StateLoadMode::STATE_LOAD_MODE_UNSPECIFIED) { + if (request.execute_mode() != FederatedQuery::SAVE) { + if (request.state_load_mode() != FederatedQuery::StateLoadMode::STATE_LOAD_MODE_UNSPECIFIED) { internal.set_state_load_mode(request.state_load_mode()); } internal.mutable_disposition()->CopyFrom(request.disposition()); @@ -880,13 +880,13 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvModifyQuery // TODO: move to run actor priority selection TSet<TString> disabledConnections; - for (const auto& connection: GetEntities<YandexQuery::Connection>(resultSets[resultSets.size() - 3], CONNECTION_COLUMN_NAME)) { + for (const auto& connection: GetEntities<FederatedQuery::Connection>(resultSets[resultSets.size() - 3], CONNECTION_COLUMN_NAME)) { if (!Config->AvailableConnections.contains(connection.content().setting().connection_case())) { disabledConnections.insert(connection.meta().id()); continue; } - if (GetIamAuth(connection) == YandexQuery::IamAuth::kCurrentIam && Config->Proto.GetDisableCurrentIam()) { + if (GetIamAuth(connection) == FederatedQuery::IamAuth::kCurrentIam && Config->Proto.GetDisableCurrentIam()) { disabledConnections.insert(connection.meta().id()); continue; } @@ -894,7 +894,7 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvModifyQuery TSet<TString> connectionIds; if (permissions.Check(TPermissions::CONNECTIONS_USE)) { - auto connections = GetEntitiesWithVisibilityPriority<YandexQuery::Connection>(resultSets[resultSets.size() - 3], CONNECTION_COLUMN_NAME); + auto connections = GetEntitiesWithVisibilityPriority<FederatedQuery::Connection>(resultSets[resultSets.size() - 3], CONNECTION_COLUMN_NAME); for (const auto& [_, connection]: connections) { if (disabledConnections.contains(connection.meta().id())) { continue; @@ -905,7 +905,7 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvModifyQuery } if (permissions.Check(TPermissions::BINDINGS_USE)) { - auto bindings = GetEntitiesWithVisibilityPriority<YandexQuery::Binding>(resultSets[resultSets.size() - 2], BINDING_COLUMN_NAME); + auto bindings = GetEntitiesWithVisibilityPriority<FederatedQuery::Binding>(resultSets[resultSets.size() - 2], BINDING_COLUMN_NAME); for (const auto& [_, binding]: bindings) { if (!Config->AvailableBindings.contains(binding.content().setting().binding_case())) { continue; @@ -931,9 +931,9 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvModifyQuery ythrow TCodeLineException(TIssuesIds::BAD_REQUEST) << "The size of all connections and bindings in the project exceeded the limit: " << internal.ByteSizeLong() << " of " << Config->Proto.GetMaxRequestSize() << ". Please reduce the number of connections and bindings"; } - YandexQuery::Job job; - const TString jobId = request.execute_mode() == YandexQuery::SAVE ? "" : GetEntityIdAsString(Config->IdsPrefix, EEntityType::JOB); - if (request.execute_mode() != YandexQuery::SAVE) { + FederatedQuery::Job job; + const TString jobId = request.execute_mode() == FederatedQuery::SAVE ? "" : GetEntityIdAsString(Config->IdsPrefix, EEntityType::JOB); + if (request.execute_mode() != FederatedQuery::SAVE) { internal.clear_action(); query.clear_result_set_meta(); query.clear_plan(); @@ -945,7 +945,7 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvModifyQuery query.mutable_meta()->clear_finished_at(); query.mutable_meta()->set_last_job_query_revision(common.revision()); query.mutable_meta()->set_last_job_id(jobId); - query.mutable_meta()->set_status(YandexQuery::QueryMeta::STARTING); + query.mutable_meta()->set_status(FederatedQuery::QueryMeta::STARTING); query.mutable_meta()->clear_expire_at(); query.mutable_meta()->clear_result_expire_at(); query.mutable_meta()->set_started_by(user); @@ -1011,7 +1011,7 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvModifyQuery ); } - if (request.execute_mode() != YandexQuery::SAVE) { + if (request.execute_mode() != FederatedQuery::SAVE) { writeQueryBuilder.AddString("job", job.SerializeAsString()); writeQueryBuilder.AddString("user", user); writeQueryBuilder.AddTimestamp("zero_timestamp", TInstant::Zero()); @@ -1041,7 +1041,7 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvModifyQuery " `" REVISION_COLUMN_NAME "` = $revision, `" STATUS_COLUMN_NAME "` = $status, " ); writeQueryBuilder.AddText( - (request.execute_mode() != YandexQuery::SAVE ? "`" INTERNAL_COLUMN_NAME "` = $internal,\n" : TString{"\n"}) + (request.execute_mode() != FederatedQuery::SAVE ? "`" INTERNAL_COLUMN_NAME "` = $internal,\n" : TString{"\n"}) ); writeQueryBuilder.AddText( " `" QUERY_TYPE_COLUMN_NAME "` = $query_type, `" QUERY_COLUMN_NAME "` = $query,\n" @@ -1095,7 +1095,7 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvModifyQuery auto debugInfo = Config->Proto.GetEnableDebugMode() ? std::make_shared<TDebugInfo>() : TDebugInfoPtr{}; auto result = ReadModifyWrite(read.Sql, read.Params, prepareParams, requestCounters, debugInfo, validators); auto prepare = [response] { return *response; }; - auto success = SendResponse<TEvControlPlaneStorage::TEvModifyQueryResponse, YandexQuery::ModifyQueryResult>( + auto success = SendResponse<TEvControlPlaneStorage::TEvModifyQueryResponse, FederatedQuery::ModifyQueryResult>( "ModifyQueryRequest - ModifyQueryResult", NActors::TActivationContext::ActorSystem(), result, @@ -1129,7 +1129,7 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvDeleteQuery if (IsSuperUser(user)) { permissions.SetAll(); } - const YandexQuery::DeleteQueryRequest& request = event.Request; + const FederatedQuery::DeleteQueryRequest& request = event.Request; const TString queryId = request.query_id(); const int byteSize = request.ByteSize(); const int64_t previousRevision = request.previous_revision(); @@ -1144,7 +1144,7 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvDeleteQuery LWPROBE(DeleteQueryRequest, scope, queryId, user, delta, byteSize, false); return; } - std::shared_ptr<std::pair<YandexQuery::DeleteQueryResult, TAuditDetails<YandexQuery::Query>>> response = std::make_shared<std::pair<YandexQuery::DeleteQueryResult, TAuditDetails<YandexQuery::Query>>>(); + std::shared_ptr<std::pair<FederatedQuery::DeleteQueryResult, TAuditDetails<FederatedQuery::Query>>> response = std::make_shared<std::pair<FederatedQuery::DeleteQueryResult, TAuditDetails<FederatedQuery::Query>>>(); TSqlQueryBuilder queryBuilder(YdbConnection->TablePathPrefix, "DeleteQuery"); queryBuilder.AddString("scope", scope); queryBuilder.AddString("query_id", queryId); @@ -1200,7 +1200,7 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvDeleteQuery YdbConnection->TablePathPrefix)); validators.push_back(CreateQueryComputeStatusValidator( - { YandexQuery::QueryMeta::STARTING, YandexQuery::QueryMeta::ABORTED_BY_USER, YandexQuery::QueryMeta::ABORTED_BY_SYSTEM, YandexQuery::QueryMeta::COMPLETED, YandexQuery::QueryMeta::FAILED }, + { FederatedQuery::QueryMeta::STARTING, FederatedQuery::QueryMeta::ABORTED_BY_USER, FederatedQuery::QueryMeta::ABORTED_BY_SYSTEM, FederatedQuery::QueryMeta::COMPLETED, FederatedQuery::QueryMeta::FAILED }, scope, queryId, "Can't delete running query", @@ -1210,7 +1210,7 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvDeleteQuery auto debugInfo = Config->Proto.GetEnableDebugMode() ? std::make_shared<TDebugInfo>() : TDebugInfoPtr{}; auto result = Write(query.Sql, query.Params, requestCounters, debugInfo, validators); auto prepare = [response] { return *response; }; - auto success = SendResponse<TEvControlPlaneStorage::TEvDeleteQueryResponse, YandexQuery::DeleteQueryResult>( + auto success = SendResponse<TEvControlPlaneStorage::TEvDeleteQueryResponse, FederatedQuery::DeleteQueryResult>( "DeleteQueryRequest - DeleteQueryResult", NActors::TActivationContext::ActorSystem(), result, @@ -1236,7 +1236,7 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvControlQuer TRequestCounters requestCounters = Counters.GetCounters(cloudId, scope, RTS_CONTROL_QUERY, RTC_CONTROL_QUERY); requestCounters.IncInFly(); requestCounters.Common->RequestBytes->Add(event.GetByteSize()); - const YandexQuery::ControlQueryRequest& request = event.Request; + const FederatedQuery::ControlQueryRequest& request = event.Request; const TString user = event.User; const TString queryId = request.query_id(); const TString token = event.Token; @@ -1249,7 +1249,7 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvControlQuer const int byteSize = request.ByteSize(); const int64_t previousRevision = request.previous_revision(); const TString idempotencyKey = request.idempotency_key(); - const YandexQuery::QueryAction action = request.action(); + const FederatedQuery::QueryAction action = request.action(); CPS_LOG_T("ControlQueryRequest: {" << request.DebugString() << "} " << MakeUserInfo(user, token)); NYql::TIssues issues = ValidateEvent(ev); @@ -1261,7 +1261,7 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvControlQuer return; } - std::shared_ptr<std::pair<YandexQuery::ControlQueryResult, TAuditDetails<YandexQuery::Query>>> response = std::make_shared<std::pair<YandexQuery::ControlQueryResult, TAuditDetails<YandexQuery::Query>>>(); + std::shared_ptr<std::pair<FederatedQuery::ControlQueryResult, TAuditDetails<FederatedQuery::Query>>> response = std::make_shared<std::pair<FederatedQuery::ControlQueryResult, TAuditDetails<FederatedQuery::Query>>>(); TSqlQueryBuilder readQueryBuilder(YdbConnection->TablePathPrefix, "ControlQuery(read)"); readQueryBuilder.AddString("scope", scope); @@ -1282,8 +1282,8 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvControlQuer } auto now = TInstant::Now(); - YandexQuery::Query query; - YandexQuery::Internal::QueryInternal queryInternal; + FederatedQuery::Query query; + FederatedQuery::Internal::QueryInternal queryInternal; TString tenantName; { TResultSetParser parser(resultSets[0]); @@ -1301,7 +1301,7 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvControlQuer tenantName = *parser.ColumnParser(TENANT_COLUMN_NAME).GetOptionalString(); } - YandexQuery::Job job; + FederatedQuery::Job job; TString jobId; { TResultSetParser parser(resultSets[1]); @@ -1329,12 +1329,12 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvControlQuer commonQuery.set_modified_by(user); *commonQuery.mutable_modified_at() = NProtoInterop::CastToProto(now); - if (action == YandexQuery::ABORT || action == YandexQuery::ABORT_GRACEFULLY) { + if (action == FederatedQuery::ABORT || action == FederatedQuery::ABORT_GRACEFULLY) { const bool isValidStatusForAbort = IsIn({ - YandexQuery::QueryMeta::STARTING, - YandexQuery::QueryMeta::RESUMING, - YandexQuery::QueryMeta::RUNNING, - YandexQuery::QueryMeta::PAUSING + FederatedQuery::QueryMeta::STARTING, + FederatedQuery::QueryMeta::RESUMING, + FederatedQuery::QueryMeta::RUNNING, + FederatedQuery::QueryMeta::PAUSING }, metaQuery.status()); const bool isTerminalStatus = IsTerminalStatus(metaQuery.status()); @@ -1343,33 +1343,33 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvControlQuer } if (isValidStatusForAbort) { - metaQuery.set_status(YandexQuery::QueryMeta::ABORTING_BY_USER); + metaQuery.set_status(FederatedQuery::QueryMeta::ABORTING_BY_USER); metaQuery.set_aborted_by(user); } else { - ythrow TCodeLineException(TIssuesIds::INTERNAL_ERROR) << "Conversion from status " << YandexQuery::QueryMeta::ComputeStatus_Name(metaQuery.status()) << " to " << YandexQuery::QueryMeta::ComputeStatus_Name(YandexQuery::QueryMeta::ABORTING_BY_USER) << " is not possible. Please wait for the previous operation to be completed"; + ythrow TCodeLineException(TIssuesIds::INTERNAL_ERROR) << "Conversion from status " << FederatedQuery::QueryMeta::ComputeStatus_Name(metaQuery.status()) << " to " << FederatedQuery::QueryMeta::ComputeStatus_Name(FederatedQuery::QueryMeta::ABORTING_BY_USER) << " is not possible. Please wait for the previous operation to be completed"; } } - if (action == YandexQuery::PAUSE || action == YandexQuery::PAUSE_GRACEFULLY) { + if (action == FederatedQuery::PAUSE || action == FederatedQuery::PAUSE_GRACEFULLY) { const bool isValidStatusForPause = IsIn({ - YandexQuery::QueryMeta::RESUMING, - YandexQuery::QueryMeta::RUNNING + FederatedQuery::QueryMeta::RESUMING, + FederatedQuery::QueryMeta::RUNNING }, metaQuery.status()); if (isValidStatusForPause) { - metaQuery.set_status(YandexQuery::QueryMeta::PAUSING); + metaQuery.set_status(FederatedQuery::QueryMeta::PAUSING); metaQuery.set_paused_by(user); } else { - ythrow TCodeLineException(TIssuesIds::BAD_REQUEST) << "Conversion from status " << YandexQuery::QueryMeta::ComputeStatus_Name(metaQuery.status()) << " to " << YandexQuery::QueryMeta::ComputeStatus_Name(YandexQuery::QueryMeta::PAUSING) << " is not possible. Please wait for the previous operation to be completed"; + ythrow TCodeLineException(TIssuesIds::BAD_REQUEST) << "Conversion from status " << FederatedQuery::QueryMeta::ComputeStatus_Name(metaQuery.status()) << " to " << FederatedQuery::QueryMeta::ComputeStatus_Name(FederatedQuery::QueryMeta::PAUSING) << " is not possible. Please wait for the previous operation to be completed"; } } - if (action == YandexQuery::RESUME) { - const bool isValidStatusForResume = metaQuery.status() == YandexQuery::QueryMeta::PAUSED; + if (action == FederatedQuery::RESUME) { + const bool isValidStatusForResume = metaQuery.status() == FederatedQuery::QueryMeta::PAUSED; if (isValidStatusForResume) { - metaQuery.set_status(YandexQuery::QueryMeta::RESUMING); + metaQuery.set_status(FederatedQuery::QueryMeta::RESUMING); } else { - ythrow TCodeLineException(TIssuesIds::BAD_REQUEST) << "Conversion from status " << YandexQuery::QueryMeta::ComputeStatus_Name(metaQuery.status()) << " to " << YandexQuery::QueryMeta::ComputeStatus_Name(YandexQuery::QueryMeta::RESUMING) << " is not possible. Please wait for the previous operation to be completed"; + ythrow TCodeLineException(TIssuesIds::BAD_REQUEST) << "Conversion from status " << FederatedQuery::QueryMeta::ComputeStatus_Name(metaQuery.status()) << " to " << FederatedQuery::QueryMeta::ComputeStatus_Name(FederatedQuery::QueryMeta::RESUMING) << " is not possible. Please wait for the previous operation to be completed"; } } @@ -1438,7 +1438,7 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvControlQuer auto debugInfo = Config->Proto.GetEnableDebugMode() ? std::make_shared<TDebugInfo>() : TDebugInfoPtr{}; auto result = ReadModifyWrite(readQuery.Sql, readQuery.Params, prepareParams, requestCounters, debugInfo, validators); auto prepare = [response] { return *response; }; - auto success = SendResponse<TEvControlPlaneStorage::TEvControlQueryResponse, YandexQuery::ControlQueryResult>( + auto success = SendResponse<TEvControlPlaneStorage::TEvControlQueryResponse, FederatedQuery::ControlQueryResult>( "ControlQueryRequest - ControlQueryRequest", NActors::TActivationContext::ActorSystem(), result, @@ -1465,7 +1465,7 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvGetResultDa requestCounters.IncInFly(); requestCounters.Common->RequestBytes->Add(event.GetByteSize()); - const YandexQuery::GetResultDataRequest& request = event.Request; + const FederatedQuery::GetResultDataRequest& request = event.Request; const TString user = event.User; const int32_t resultSetIndex = request.result_set_index(); const int64_t offset = request.offset(); @@ -1518,7 +1518,7 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvGetResultDa ythrow TCodeLineException(TIssuesIds::INTERNAL_ERROR) << "Result set size is not equal to 2 but equal " << resultSets->size() << ". Please contact internal support"; } - YandexQuery::GetResultDataResult result; + FederatedQuery::GetResultDataResult result; auto& resultSetProto = *result.mutable_result_set(); { const auto& resultSet = (*resultSets)[0]; @@ -1527,12 +1527,12 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvGetResultDa ythrow TCodeLineException(TIssuesIds::ACCESS_DENIED) << "Query does not exist or permission denied. Please check the id of the query or your access rights"; } - YandexQuery::Query query; + FederatedQuery::Query query; if (!query.ParseFromString(*parser.ColumnParser(QUERY_COLUMN_NAME).GetOptionalString())) { ythrow TCodeLineException(TIssuesIds::INTERNAL_ERROR) << "Error parsing proto message for query. Please contact internal support"; } - YandexQuery::Acl::Visibility queryVisibility = static_cast<YandexQuery::Acl::Visibility>(parser.ColumnParser(VISIBILITY_COLUMN_NAME).GetOptionalInt64().GetOrElse(YandexQuery::Acl::VISIBILITY_UNSPECIFIED)); + FederatedQuery::Acl::Visibility queryVisibility = static_cast<FederatedQuery::Acl::Visibility>(parser.ColumnParser(VISIBILITY_COLUMN_NAME).GetOptionalInt64().GetOrElse(FederatedQuery::Acl::VISIBILITY_UNSPECIFIED)); TString queryUser = parser.ColumnParser(USER_COLUMN_NAME).GetOptionalString().GetOrElse(""); bool hasViewAccess = HasViewAccess(permissions, queryVisibility, queryUser, user); @@ -1544,7 +1544,7 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvGetResultDa ythrow TCodeLineException(TIssuesIds::BAD_REQUEST) << "Result set index out of bound: " << resultSetIndex << " >= " << query.result_set_meta_size(); } - if (YandexQuery::QueryMeta::ComputeStatus(*parser.ColumnParser(STATUS_COLUMN_NAME).GetOptionalInt64()) != YandexQuery::QueryMeta::COMPLETED) { + if (FederatedQuery::QueryMeta::ComputeStatus(*parser.ColumnParser(STATUS_COLUMN_NAME).GetOptionalInt64()) != FederatedQuery::QueryMeta::COMPLETED) { ythrow TCodeLineException(TIssuesIds::BAD_REQUEST) << "Result doesn't exist"; } @@ -1572,7 +1572,7 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvGetResultDa return result; }; - auto success = SendResponse<TEvControlPlaneStorage::TEvGetResultDataResponse, YandexQuery::GetResultDataResult>( + auto success = SendResponse<TEvControlPlaneStorage::TEvGetResultDataResponse, FederatedQuery::GetResultDataResult>( "GetResultDataRequest - GetResultDataResult", NActors::TActivationContext::ActorSystem(), result, @@ -1598,7 +1598,7 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvListJobsReq TRequestCounters requestCounters = Counters.GetCounters(cloudId, scope, RTS_LIST_JOBS_DATA, RTC_LIST_JOBS_DATA); requestCounters.IncInFly(); requestCounters.Common->RequestBytes->Add(event.GetByteSize()); - const YandexQuery::ListJobsRequest& request = event.Request; + const FederatedQuery::ListJobsRequest& request = event.Request; const TString user = event.User; TString queryId = request.query_id(); // TODO: remove it if (request.has_filter() && request.filter().query_id()) { @@ -1676,17 +1676,17 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvListJobsReq ythrow TCodeLineException(TIssuesIds::INTERNAL_ERROR) << "Result set size is not equal to 1 but equal " << resultSets->size() << ". Please contact internal support"; } - YandexQuery::ListJobsResult result; + FederatedQuery::ListJobsResult result; TResultSetParser parser(resultSets->front()); while (parser.TryNextRow()) { - YandexQuery::Job job; + FederatedQuery::Job job; if (!job.ParseFromString(*parser.ColumnParser(JOB_COLUMN_NAME).GetOptionalString())) { ythrow TCodeLineException(TIssuesIds::INTERNAL_ERROR) << "Error parsing proto message for job. Please contact internal support"; } const TString mergedId = job.meta().id() + "-" + job.query_meta().common().id(); job.mutable_meta()->set_id(mergedId); job.mutable_query_meta()->set_last_job_id(mergedId); - YandexQuery::BriefJob briefJob; + FederatedQuery::BriefJob briefJob; *briefJob.mutable_meta() = job.meta(); *briefJob.mutable_query_meta() = job.query_meta(); briefJob.set_query_name(job.query_name()); @@ -1704,7 +1704,7 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvListJobsReq return result; }; - auto success = SendResponse<TEvControlPlaneStorage::TEvListJobsResponse, YandexQuery::ListJobsResult>( + auto success = SendResponse<TEvControlPlaneStorage::TEvListJobsResponse, FederatedQuery::ListJobsResult>( "ListJobsRequest - ListJobsResult", NActors::TActivationContext::ActorSystem(), result, @@ -1730,7 +1730,7 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvDescribeJob TRequestCounters requestCounters = Counters.GetCounters(cloudId, scope, RTS_DESCRIBE_JOB, RTC_DESCRIBE_JOB); requestCounters.IncInFly(); requestCounters.Common->RequestBytes->Add(event.GetByteSize()); - const YandexQuery::DescribeJobRequest& request = event.Request; + const FederatedQuery::DescribeJobRequest& request = event.Request; const TString user = event.User; auto splittedId = SplitId(request.job_id()); @@ -1777,7 +1777,7 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvDescribeJob ythrow TCodeLineException(TIssuesIds::INTERNAL_ERROR) << "Result set size is not equal to 1 but equal " << resultSets->size() << ". Please contact internal support"; } - YandexQuery::DescribeJobResult result; + FederatedQuery::DescribeJobResult result; TResultSetParser parser(resultSets->front()); if (!parser.TryNextRow()) { ythrow TCodeLineException(TIssuesIds::ACCESS_DENIED) << "Job does not exist or permission denied. Please check the job id or your access rights"; @@ -1785,7 +1785,7 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvDescribeJob if (!result.mutable_job()->ParseFromString(*parser.ColumnParser(JOB_COLUMN_NAME).GetOptionalString())) { ythrow TCodeLineException(TIssuesIds::INTERNAL_ERROR) << "Error parsing proto message for job. Please contact internal support"; } - auto visibility = static_cast<YandexQuery::Acl::Visibility>(*parser.ColumnParser(VISIBILITY_COLUMN_NAME).GetOptionalInt64()); + auto visibility = static_cast<FederatedQuery::Acl::Visibility>(*parser.ColumnParser(VISIBILITY_COLUMN_NAME).GetOptionalInt64()); result.mutable_job()->mutable_meta()->set_id(id); bool hasViewAccces = HasViewAccess(permissions, visibility, result.job().meta().created_by(), user); @@ -1801,7 +1801,7 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvDescribeJob return result; }; - auto success = SendResponse<TEvControlPlaneStorage::TEvDescribeJobResponse, YandexQuery::DescribeJobResult>( + auto success = SendResponse<TEvControlPlaneStorage::TEvDescribeJobResponse, FederatedQuery::DescribeJobResult>( "DescribeJobRequest - DescribeJobResult", NActors::TActivationContext::ActorSystem(), result, diff --git a/ydb/core/yq/libs/control_plane_storage/ydb_control_plane_storage_quotas.cpp b/ydb/core/yq/libs/control_plane_storage/ydb_control_plane_storage_quotas.cpp index 6206a97d67..2ab43da7ff 100644 --- a/ydb/core/yq/libs/control_plane_storage/ydb_control_plane_storage_quotas.cpp +++ b/ydb/core/yq/libs/control_plane_storage/ydb_control_plane_storage_quotas.cpp @@ -12,7 +12,7 @@ #include <ydb/core/yq/libs/db_schema/db_schema.h> #include <ydb/core/yq/libs/quota_manager/quota_manager.h> -#include <ydb/public/api/protos/yq.pb.h> +#include <ydb/public/api/protos/draft/fq.pb.h> #include <ydb/public/sdk/cpp/client/ydb_value/value.h> #include <util/digest/multi.h> @@ -71,7 +71,7 @@ void TYdbControlPlaneStorageActor::Handle(TEvQuotaService::TQuotaUsageRequest::T [=](TQuotaCountExecuter& executer, const TVector<NYdb::TResultSet>& resultSets) { TResultSetParser parser(resultSets.front()); if (parser.TryNextRow()) { - YandexQuery::Internal::QueryInternal internal; + FederatedQuery::Internal::QueryInternal internal; ParseProto(executer, internal, parser, INTERNAL_COLUMN_NAME); executer.State[internal.cloud_id()] += count; } diff --git a/ydb/core/yq/libs/events/events.h b/ydb/core/yq/libs/events/events.h index dfe21235d5..662c24f3d5 100644 --- a/ydb/core/yq/libs/events/events.h +++ b/ydb/core/yq/libs/events/events.h @@ -151,12 +151,12 @@ struct TEvents { }; struct TEvQueryActionResult : NActors::TEventLocal<TEvQueryActionResult, TEventIds::EvQueryActionResult> { - explicit TEvQueryActionResult(YandexQuery::QueryAction action) + explicit TEvQueryActionResult(FederatedQuery::QueryAction action) : Action(action) { } - YandexQuery::QueryAction Action; + FederatedQuery::QueryAction Action; }; struct TEvForwardPingRequest : NActors::TEventLocal<TEvForwardPingRequest, TEventIds::EvForwardPingRequest> { @@ -170,13 +170,13 @@ struct TEvents { }; struct TEvForwardPingResponse : NActors::TEventLocal<TEvForwardPingResponse, TEventIds::EvForwardPingResponse> { - TEvForwardPingResponse(bool success, YandexQuery::QueryAction action) + TEvForwardPingResponse(bool success, FederatedQuery::QueryAction action) : Success(success) , Action(action) { } bool Success; - YandexQuery::QueryAction Action; + FederatedQuery::QueryAction Action; }; struct TEvGraphParams : public NActors::TEventLocal<TEvGraphParams, TEventIds::EvGraphParams> { diff --git a/ydb/core/yq/libs/protos/fq_private.proto b/ydb/core/yq/libs/protos/fq_private.proto index e520cbf90a..064cf39ba5 100644 --- a/ydb/core/yq/libs/protos/fq_private.proto +++ b/ydb/core/yq/libs/protos/fq_private.proto @@ -10,7 +10,7 @@ import "ydb/public/api/protos/ydb_value.proto"; import "ydb/public/api/protos/ydb_issue_message.proto"; import "ydb/public/api/protos/annotations/validation.proto"; -import "ydb/public/api/protos/yq.proto"; +import "ydb/public/api/protos/draft/fq.proto"; import "google/protobuf/duration.proto"; import "google/protobuf/timestamp.proto"; @@ -80,18 +80,18 @@ message GetTaskResult { repeated bytes dq_graph = 6; // deprecated: use dq_graph_compressed // text, connection and binding are empty if dq_graph is not empty string text = 7; - repeated YandexQuery.Connection connection = 8; - repeated YandexQuery.Binding binding = 9; + repeated FederatedQuery.Connection connection = 8; + repeated FederatedQuery.Binding binding = 9; string user_token = 10; // IAM token for debug repeated SignedIdentity service_accounts = 11; string user_id = 12; - YandexQuery.QueryContent.QueryType query_type = 13; + FederatedQuery.QueryContent.QueryType query_type = 13; string scope = 14; - YandexQuery.ExecuteMode execute_mode = 15; - YandexQuery.StateLoadMode state_load_mode = 16; - YandexQuery.QueryMeta.ComputeStatus status = 17; - repeated YandexQuery.ResultSetMeta result_set_meta = 18; + FederatedQuery.ExecuteMode execute_mode = 15; + FederatedQuery.StateLoadMode state_load_mode = 16; + FederatedQuery.QueryMeta.ComputeStatus status = 17; + repeated FederatedQuery.ResultSetMeta result_set_meta = 18; repeated TopicConsumer created_topic_consumers = 19; int32 dq_graph_index = 20; map<string, string> sensor_labels = 21; @@ -99,17 +99,17 @@ message GetTaskResult { bool automatic = 22; string query_name = 23; google.protobuf.Timestamp deadline = 24; - YandexQuery.StreamingDisposition disposition = 25; + FederatedQuery.StreamingDisposition disposition = 25; uint64 result_limit = 26; - YandexQuery.Limits limits = 27; + FederatedQuery.Limits limits = 27; google.protobuf.Duration execution_limit = 29; google.protobuf.Timestamp request_started_at = 30; repeated CompressedData dq_graph_compressed = 31; uint32 restart_count = 32; TaskResources resources = 33; - YandexQuery.QueryContent.QuerySyntax query_syntax = 34; + FederatedQuery.QueryContent.QuerySyntax query_syntax = 34; } repeated Task tasks = 1; } @@ -123,11 +123,11 @@ message PingTaskRequest { SignedIdentity query_id = 2; SignedIdentity job_id = 3; SignedIdentity result_id = 4; - YandexQuery.QueryMeta.ComputeStatus status = 5; + FederatedQuery.QueryMeta.ComputeStatus status = 5; repeated Ydb.Issue.IssueMessage issues = 6; uint32 result_set_count = 7; string statistics = 8; - repeated YandexQuery.ResultSetMeta result_set_meta = 9; + repeated FederatedQuery.ResultSetMeta result_set_meta = 9; string executer_info = 10; repeated bytes dq_graph = 11; // deprecated: use dq_graph_compressed string ast = 12; // deprecated: use ast_compressed @@ -136,8 +136,8 @@ message PingTaskRequest { Ydb.Operations.OperationParams operation_params = 15; repeated Ydb.Issue.IssueMessage transient_issues = 16; repeated TopicConsumer created_topic_consumers = 17; - YandexQuery.StateLoadMode state_load_mode = 18; - YandexQuery.StreamingDisposition disposition = 19; + FederatedQuery.StateLoadMode state_load_mode = 18; + FederatedQuery.StreamingDisposition disposition = 19; int32 dq_graph_index = 20; NYql.NDqProto.StatusIds.StatusCode status_code = 21; repeated CompressedData dq_graph_compressed = 23; @@ -153,7 +153,7 @@ message PingTaskRequest { } message PingTaskResult { - YandexQuery.QueryAction action = 1; + FederatedQuery.QueryAction action = 1; google.protobuf.Timestamp expired_at = 2; } diff --git a/ydb/core/yq/libs/result_formatter/result_formatter.cpp b/ydb/core/yq/libs/result_formatter/result_formatter.cpp index 736c7292c4..b09e6015cb 100644 --- a/ydb/core/yq/libs/result_formatter/result_formatter.cpp +++ b/ydb/core/yq/libs/result_formatter/result_formatter.cpp @@ -399,7 +399,7 @@ NJson::TJsonValue FormatColumnPrettyValue( } // namespace -TString FormatSchema(const YandexQuery::Schema& schema) +TString FormatSchema(const FederatedQuery::Schema& schema) { NYql::TExprContext ctx; TVector<std::pair<TString, const NYql::TTypeAnnotationNode*>> typedColumns; diff --git a/ydb/core/yq/libs/result_formatter/result_formatter.h b/ydb/core/yq/libs/result_formatter/result_formatter.h index 71a2c3de70..2b6904f805 100644 --- a/ydb/core/yq/libs/result_formatter/result_formatter.h +++ b/ydb/core/yq/libs/result_formatter/result_formatter.h @@ -1,6 +1,6 @@ #pragma once -#include <ydb/public/api/protos/yq.pb.h> +#include <ydb/public/api/protos/draft/fq.pb.h> #include <ydb/public/sdk/cpp/client/ydb_value/value.h> #include <ydb/public/sdk/cpp/client/ydb_result/result.h> @@ -11,6 +11,6 @@ namespace NYq { void FormatResultSet(NJson::TJsonValue& root, const NYdb::TResultSet& resultSet, bool typeNameAsString = false, bool prettyValueFormat = false); -TString FormatSchema(const YandexQuery::Schema& schema); +TString FormatSchema(const FederatedQuery::Schema& schema); } // namespace NYq diff --git a/ydb/core/yq/libs/result_formatter/result_formatter_ut.cpp b/ydb/core/yq/libs/result_formatter/result_formatter_ut.cpp index 8a820b0ff2..5becb389f7 100644 --- a/ydb/core/yq/libs/result_formatter/result_formatter_ut.cpp +++ b/ydb/core/yq/libs/result_formatter/result_formatter_ut.cpp @@ -624,13 +624,13 @@ Y_UNIT_TEST_SUITE(ResultFormatter) { } Y_UNIT_TEST(FormatEmptySchema) { - YandexQuery::Schema s; + FederatedQuery::Schema s; auto result = FormatSchema(s); UNIT_ASSERT_VALUES_EQUAL(result, R"(["StructType";[]])"); } Y_UNIT_TEST(FormatNonEmptySchema) { - YandexQuery::Schema s; + FederatedQuery::Schema s; auto& c1 = *s.Addcolumn(); c1.set_name("key"); c1.mutable_type()->set_type_id(Ydb::Type::STRING); diff --git a/ydb/core/yq/libs/test_connection/events/events.h b/ydb/core/yq/libs/test_connection/events/events.h index 115497cc0e..f569ef8634 100644 --- a/ydb/core/yq/libs/test_connection/events/events.h +++ b/ydb/core/yq/libs/test_connection/events/events.h @@ -1,6 +1,6 @@ #pragma once -#include <ydb/public/api/protos/yq.pb.h> +#include <ydb/public/api/protos/draft/fq.pb.h> #include <ydb/core/yq/libs/events/event_subspace.h> #include <ydb/core/yq/libs/control_plane_config/events/events.h> @@ -26,7 +26,7 @@ struct TEvTestConnection { struct TEvTestConnectionRequest : NActors::TEventLocal<TEvTestConnectionRequest, EvTestConnectionRequest> { explicit TEvTestConnectionRequest(const TString& scope, - const YandexQuery::TestConnectionRequest& request, + const FederatedQuery::TestConnectionRequest& request, const TString& user, const TString& token, const TString& cloudId, @@ -46,7 +46,7 @@ struct TEvTestConnection { TString CloudId; TString Scope; - YandexQuery::TestConnectionRequest Request; + FederatedQuery::TestConnectionRequest Request; TString User; TString Token; TPermissions Permissions; @@ -55,7 +55,7 @@ struct TEvTestConnection { }; struct TEvTestConnectionResponse : NActors::TEventLocal<TEvTestConnectionResponse, EvTestConnectionResponse> { - explicit TEvTestConnectionResponse(const YandexQuery::TestConnectionResult& result) + explicit TEvTestConnectionResponse(const FederatedQuery::TestConnectionResult& result) : Result(result) { } @@ -65,7 +65,7 @@ struct TEvTestConnection { { } - YandexQuery::TestConnectionResult Result; + FederatedQuery::TestConnectionResult Result; NYql::TIssues Issues; }; }; diff --git a/ydb/core/yq/libs/test_connection/request_validators.h b/ydb/core/yq/libs/test_connection/request_validators.h index ec52cbb2cf..a6bde50022 100644 --- a/ydb/core/yq/libs/test_connection/request_validators.h +++ b/ydb/core/yq/libs/test_connection/request_validators.h @@ -5,7 +5,7 @@ namespace NYq { template<typename T> -NYql::TIssues ValidateTestConnection(T& ev, size_t maxSize, const TSet<YandexQuery::ConnectionSetting::ConnectionCase>& availableConnections, bool disableCurrentIam, bool clickHousePasswordRequire = true) +NYql::TIssues ValidateTestConnection(T& ev, size_t maxSize, const TSet<FederatedQuery::ConnectionSetting::ConnectionCase>& availableConnections, bool disableCurrentIam, bool clickHousePasswordRequire = true) { const auto& request = ev->Get()->Request; NYql::TIssues issues = ValidateEvent(ev, maxSize); @@ -14,7 +14,7 @@ NYql::TIssues ValidateTestConnection(T& ev, size_t maxSize, const TSet<YandexQue issues.AddIssue(MakeErrorIssue(TIssuesIds::BAD_REQUEST, "content.setting field is not specified")); } - const YandexQuery::ConnectionSetting& setting = request.setting(); + const FederatedQuery::ConnectionSetting& setting = request.setting(); issues.AddIssues(ValidateConnectionSetting(setting, availableConnections, disableCurrentIam, clickHousePasswordRequire)); return issues; } diff --git a/ydb/core/yq/libs/test_connection/test_connection.cpp b/ydb/core/yq/libs/test_connection/test_connection.cpp index b818616d3a..40281bc713 100644 --- a/ydb/core/yq/libs/test_connection/test_connection.cpp +++ b/ydb/core/yq/libs/test_connection/test_connection.cpp @@ -49,13 +49,13 @@ class TTestConnectionActor : public NActors::TActorBootstrapped<TTestConnectionA TMap<TMetricsScope, TScopeCountersPtr> ScopeCounters; ::NMonitoring::TDynamicCounterPtr Counters; - ERequestTypeScope ToType(YandexQuery::ConnectionSetting::ConnectionCase connectionCase) { + ERequestTypeScope ToType(FederatedQuery::ConnectionSetting::ConnectionCase connectionCase) { switch (connectionCase) { - case YandexQuery::ConnectionSetting::kDataStreams: + case FederatedQuery::ConnectionSetting::kDataStreams: return RTS_TEST_DATA_STREAMS_CONNECTION; - case YandexQuery::ConnectionSetting::kObjectStorage: + case FederatedQuery::ConnectionSetting::kObjectStorage: return RTS_TEST_OBJECT_STORAGE_CONNECTION; - case YandexQuery::ConnectionSetting::kMonitoring: + case FederatedQuery::ConnectionSetting::kMonitoring: return RTS_TEST_MONITORING_CONNECTION; default: return RTS_TEST_UNSUPPORTED_CONNECTION; @@ -67,7 +67,7 @@ class TTestConnectionActor : public NActors::TActorBootstrapped<TTestConnectionA : Counters(counters) {} - TTestConnectionRequestCountersPtr GetScopeCounters(const TString& cloudId, const TString& scope, YandexQuery::ConnectionSetting::ConnectionCase connectionCase) { + TTestConnectionRequestCountersPtr GetScopeCounters(const TString& cloudId, const TString& scope, FederatedQuery::ConnectionSetting::ConnectionCase connectionCase) { ERequestTypeScope type = ToType(connectionCase); TMetricsScope key{cloudId, scope}; auto it = ScopeCounters.find(key); @@ -161,7 +161,7 @@ public: const TString& scope = ev->Get()->Scope; const TString& user = ev->Get()->User; const TString& token = ev->Get()->Token; - YandexQuery::TestConnectionRequest request = std::move(ev->Get()->Request); + FederatedQuery::TestConnectionRequest request = std::move(ev->Get()->Request); TTestConnectionRequestCountersPtr requestCounters = Counters.GetScopeCounters(cloudId, scope, request.setting().connection_case()); if (issues) { requestCounters->Error->Inc(); @@ -172,7 +172,7 @@ public: TC_LOG_T("TestConnectionRequest: " << scope << " " << user << " " << NKikimr::MaskTicket(token) << request.DebugString()); switch (request.setting().connection_case()) { - case YandexQuery::ConnectionSetting::kDataStreams: { + case FederatedQuery::ConnectionSetting::kDataStreams: { Register(CreateTestDataStreamsConnectionActor( *request.mutable_setting()->mutable_data_streams(), CommonConfig, DbResolver, ev->Sender, @@ -182,7 +182,7 @@ public: Signer, requestCounters)); break; } - case YandexQuery::ConnectionSetting::kObjectStorage: { + case FederatedQuery::ConnectionSetting::kObjectStorage: { Register(CreateTestObjectStorageConnectionActor( *request.mutable_setting()->mutable_object_storage(), CommonConfig, ev->Sender, @@ -191,7 +191,7 @@ public: Signer, requestCounters)); break; } - case YandexQuery::ConnectionSetting::kMonitoring: { + case FederatedQuery::ConnectionSetting::kMonitoring: { TString monitoringEndpoint = CommonConfig.GetMonitoringEndpoint(); Register(CreateTestMonitoringConnectionActor( *request.mutable_setting()->mutable_monitoring(), diff --git a/ydb/core/yq/libs/test_connection/test_connection.h b/ydb/core/yq/libs/test_connection/test_connection.h index e611489f28..1ab9ef8d96 100644 --- a/ydb/core/yq/libs/test_connection/test_connection.h +++ b/ydb/core/yq/libs/test_connection/test_connection.h @@ -9,7 +9,7 @@ #include <ydb/core/yq/libs/signer/signer.h> #include <ydb/library/yql/providers/common/token_accessor/client/factory.h> #include <ydb/library/yql/providers/pq/cm_client/client.h> -#include <ydb/public/api/protos/yq.pb.h> +#include <ydb/public/api/protos/draft/fq.pb.h> #include <library/cpp/actors/core/actor.h> #include <library/cpp/monlib/dynamic_counters/counters.h> @@ -54,7 +54,7 @@ NActors::IActor* CreateTestConnectionActor( const ::NMonitoring::TDynamicCounterPtr& counters); NActors::IActor* CreateTestDataStreamsConnectionActor( - const YandexQuery::DataStreams& ds, + const FederatedQuery::DataStreams& ds, const NYq::NConfig::TCommonConfig& commonConfig, const std::shared_ptr<NYql::IDatabaseAsyncResolver>& dbResolver, const NActors::TActorId& sender, @@ -70,7 +70,7 @@ NActors::IActor* CreateTestDataStreamsConnectionActor( const TTestConnectionRequestCountersPtr& counters); NActors::IActor* CreateTestObjectStorageConnectionActor( - const YandexQuery::ObjectStorageConnection& os, + const FederatedQuery::ObjectStorageConnection& os, const NYq::NConfig::TCommonConfig& commonConfig, const NActors::TActorId& sender, ui64 cookie, @@ -83,7 +83,7 @@ NActors::IActor* CreateTestObjectStorageConnectionActor( const TTestConnectionRequestCountersPtr& counters); NActors::IActor* CreateTestMonitoringConnectionActor( - const YandexQuery::Monitoring& monitoring, + const FederatedQuery::Monitoring& monitoring, const NActors::TActorId& sender, ui64 cookie, const TString& endpoint, diff --git a/ydb/core/yq/libs/test_connection/test_data_streams.cpp b/ydb/core/yq/libs/test_connection/test_data_streams.cpp index 5a0d551f33..5f3a82e6f1 100644 --- a/ydb/core/yq/libs/test_connection/test_data_streams.cpp +++ b/ydb/core/yq/libs/test_connection/test_data_streams.cpp @@ -91,7 +91,7 @@ class TTestDataStreamsConnectionActor : public NActors::TActorBootstrapped<TTest public: TTestDataStreamsConnectionActor( - const YandexQuery::DataStreams& ds, + const FederatedQuery::DataStreams& ds, const NYq::NConfig::TCommonConfig& commonConfig, const std::shared_ptr<NYql::IDatabaseAsyncResolver>& dbResolver, const TActorId& sender, @@ -244,11 +244,11 @@ private: void ReplyOk() { Counters->Ok->Inc(); - Send(Sender, new NYq::TEvTestConnection::TEvTestConnectionResponse(YandexQuery::TestConnectionResult{}), 0, Cookie); + Send(Sender, new NYq::TEvTestConnection::TEvTestConnectionResponse(FederatedQuery::TestConnectionResult{}), 0, Cookie); DestroyActor(); } - static NYql::TPqClusterConfig CreateClusterConfig(const TString& sessionName, const NYq::NConfig::TCommonConfig& commonConfig, const TString& token, const NYq::TSigner::TPtr& signer, const YandexQuery::DataStreams& ds) { + static NYql::TPqClusterConfig CreateClusterConfig(const TString& sessionName, const NYq::NConfig::TCommonConfig& commonConfig, const TString& token, const NYq::TSigner::TPtr& signer, const FederatedQuery::DataStreams& ds) { const auto& auth = ds.auth(); const TString signedAccountId = signer && auth.has_service_account() ? signer->SignAccountId(auth.service_account().id()) : TString{}; return NYq::CreatePqClusterConfig(sessionName, commonConfig.GetUseBearerForYdb(), token, signedAccountId, ds); @@ -269,7 +269,7 @@ private: }; NActors::IActor* CreateTestDataStreamsConnectionActor( - const YandexQuery::DataStreams& ds, + const FederatedQuery::DataStreams& ds, const NYq::NConfig::TCommonConfig& commonConfig, const std::shared_ptr<NYql::IDatabaseAsyncResolver>& dbResolver, const TActorId& sender, diff --git a/ydb/core/yq/libs/test_connection/test_monitoring.cpp b/ydb/core/yq/libs/test_connection/test_monitoring.cpp index 052a8344ba..2f5f51d10d 100644 --- a/ydb/core/yq/libs/test_connection/test_monitoring.cpp +++ b/ydb/core/yq/libs/test_connection/test_monitoring.cpp @@ -36,7 +36,7 @@ class TTestMonitoringConnectionActor : public NActors::TActorBootstrapped<TTestM public: TTestMonitoringConnectionActor( - const YandexQuery::Monitoring& monitoring, + const FederatedQuery::Monitoring& monitoring, const TActorId& sender, ui64 cookie, const TString& endpoint, @@ -144,13 +144,13 @@ public: void ReplyOk() { Counters->Ok->Inc(); - Send(Sender, new NYq::TEvTestConnection::TEvTestConnectionResponse(YandexQuery::TestConnectionResult{}), Cookie); + Send(Sender, new NYq::TEvTestConnection::TEvTestConnectionResponse(FederatedQuery::TestConnectionResult{}), Cookie); DestroyActor(true /* success */); } }; NActors::IActor* CreateTestMonitoringConnectionActor( - const YandexQuery::Monitoring& monitoring, + const FederatedQuery::Monitoring& monitoring, const TActorId& sender, ui64 cookie, const TString& endpoint, diff --git a/ydb/core/yq/libs/test_connection/test_object_storage.cpp b/ydb/core/yq/libs/test_connection/test_object_storage.cpp index 82cf4b217e..056b8b2f97 100644 --- a/ydb/core/yq/libs/test_connection/test_object_storage.cpp +++ b/ydb/core/yq/libs/test_connection/test_object_storage.cpp @@ -68,7 +68,7 @@ class TTestObjectStorageConnectionActor : public NActors::TActorBootstrapped<TTe public: TTestObjectStorageConnectionActor( - const YandexQuery::ObjectStorageConnection& os, + const FederatedQuery::ObjectStorageConnection& os, const NYq::NConfig::TCommonConfig& commonConfig, const TActorId& sender, ui64 cookie, @@ -208,13 +208,13 @@ private: void ReplyOk(const TString& requestId) { TC_LOG_T(Scope << " " << User << " " << NKikimr::MaskTicket(Token) << " Access is valid for object storage connection, request id: [" << requestId << "]"); Counters->Ok->Inc(); - Send(Sender, new NYq::TEvTestConnection::TEvTestConnectionResponse(YandexQuery::TestConnectionResult{}), 0, Cookie); + Send(Sender, new NYq::TEvTestConnection::TEvTestConnectionResponse(FederatedQuery::TestConnectionResult{}), 0, Cookie); DestroyActor(); } }; NActors::IActor* CreateTestObjectStorageConnectionActor( - const YandexQuery::ObjectStorageConnection& os, + const FederatedQuery::ObjectStorageConnection& os, const NYq::NConfig::TCommonConfig& commonConfig, const TActorId& sender, ui64 cookie, diff --git a/ydb/public/api/grpc/CMakeLists.darwin-x86_64.txt b/ydb/public/api/grpc/CMakeLists.darwin-x86_64.txt index ba9a001ffb..07560fa6c5 100644 --- a/ydb/public/api/grpc/CMakeLists.darwin-x86_64.txt +++ b/ydb/public/api/grpc/CMakeLists.darwin-x86_64.txt @@ -169,18 +169,6 @@ get_built_tool_path( contrib/tools/protoc/plugins/cpp_styleguide cpp_styleguide ) -get_built_tool_path( - TOOL_protoc_bin - TOOL_protoc_dependency - contrib/tools/protoc/bin - protoc -) -get_built_tool_path( - TOOL_cpp_styleguide_bin - TOOL_cpp_styleguide_dependency - contrib/tools/protoc/plugins/cpp_styleguide - cpp_styleguide -) add_library(api-grpc) set_property(TARGET api-grpc PROPERTY @@ -207,7 +195,6 @@ target_proto_messages(api-grpc PRIVATE ${CMAKE_SOURCE_DIR}/ydb/public/api/grpc/ydb_scripting_v1.proto ${CMAKE_SOURCE_DIR}/ydb/public/api/grpc/ydb_table_v1.proto ${CMAKE_SOURCE_DIR}/ydb/public/api/grpc/ydb_topic_v1.proto - ${CMAKE_SOURCE_DIR}/ydb/public/api/grpc/yq_v1.proto ) target_proto_addincls(api-grpc ./ diff --git a/ydb/public/api/grpc/CMakeLists.linux-aarch64.txt b/ydb/public/api/grpc/CMakeLists.linux-aarch64.txt index 15c07327ed..d0aa641e30 100644 --- a/ydb/public/api/grpc/CMakeLists.linux-aarch64.txt +++ b/ydb/public/api/grpc/CMakeLists.linux-aarch64.txt @@ -169,18 +169,6 @@ get_built_tool_path( contrib/tools/protoc/plugins/cpp_styleguide cpp_styleguide ) -get_built_tool_path( - TOOL_protoc_bin - TOOL_protoc_dependency - contrib/tools/protoc/bin - protoc -) -get_built_tool_path( - TOOL_cpp_styleguide_bin - TOOL_cpp_styleguide_dependency - contrib/tools/protoc/plugins/cpp_styleguide - cpp_styleguide -) add_library(api-grpc) set_property(TARGET api-grpc PROPERTY @@ -208,7 +196,6 @@ target_proto_messages(api-grpc PRIVATE ${CMAKE_SOURCE_DIR}/ydb/public/api/grpc/ydb_scripting_v1.proto ${CMAKE_SOURCE_DIR}/ydb/public/api/grpc/ydb_table_v1.proto ${CMAKE_SOURCE_DIR}/ydb/public/api/grpc/ydb_topic_v1.proto - ${CMAKE_SOURCE_DIR}/ydb/public/api/grpc/yq_v1.proto ) target_proto_addincls(api-grpc ./ diff --git a/ydb/public/api/grpc/CMakeLists.linux-x86_64.txt b/ydb/public/api/grpc/CMakeLists.linux-x86_64.txt index 15c07327ed..d0aa641e30 100644 --- a/ydb/public/api/grpc/CMakeLists.linux-x86_64.txt +++ b/ydb/public/api/grpc/CMakeLists.linux-x86_64.txt @@ -169,18 +169,6 @@ get_built_tool_path( contrib/tools/protoc/plugins/cpp_styleguide cpp_styleguide ) -get_built_tool_path( - TOOL_protoc_bin - TOOL_protoc_dependency - contrib/tools/protoc/bin - protoc -) -get_built_tool_path( - TOOL_cpp_styleguide_bin - TOOL_cpp_styleguide_dependency - contrib/tools/protoc/plugins/cpp_styleguide - cpp_styleguide -) add_library(api-grpc) set_property(TARGET api-grpc PROPERTY @@ -208,7 +196,6 @@ target_proto_messages(api-grpc PRIVATE ${CMAKE_SOURCE_DIR}/ydb/public/api/grpc/ydb_scripting_v1.proto ${CMAKE_SOURCE_DIR}/ydb/public/api/grpc/ydb_table_v1.proto ${CMAKE_SOURCE_DIR}/ydb/public/api/grpc/ydb_topic_v1.proto - ${CMAKE_SOURCE_DIR}/ydb/public/api/grpc/yq_v1.proto ) target_proto_addincls(api-grpc ./ diff --git a/ydb/public/api/grpc/CMakeLists.windows-x86_64.txt b/ydb/public/api/grpc/CMakeLists.windows-x86_64.txt index ba9a001ffb..07560fa6c5 100644 --- a/ydb/public/api/grpc/CMakeLists.windows-x86_64.txt +++ b/ydb/public/api/grpc/CMakeLists.windows-x86_64.txt @@ -169,18 +169,6 @@ get_built_tool_path( contrib/tools/protoc/plugins/cpp_styleguide cpp_styleguide ) -get_built_tool_path( - TOOL_protoc_bin - TOOL_protoc_dependency - contrib/tools/protoc/bin - protoc -) -get_built_tool_path( - TOOL_cpp_styleguide_bin - TOOL_cpp_styleguide_dependency - contrib/tools/protoc/plugins/cpp_styleguide - cpp_styleguide -) add_library(api-grpc) set_property(TARGET api-grpc PROPERTY @@ -207,7 +195,6 @@ target_proto_messages(api-grpc PRIVATE ${CMAKE_SOURCE_DIR}/ydb/public/api/grpc/ydb_scripting_v1.proto ${CMAKE_SOURCE_DIR}/ydb/public/api/grpc/ydb_table_v1.proto ${CMAKE_SOURCE_DIR}/ydb/public/api/grpc/ydb_topic_v1.proto - ${CMAKE_SOURCE_DIR}/ydb/public/api/grpc/yq_v1.proto ) target_proto_addincls(api-grpc ./ diff --git a/ydb/public/api/grpc/yq_v1.proto b/ydb/public/api/grpc/yq_v1.proto deleted file mode 100644 index 6f48bcc11f..0000000000 --- a/ydb/public/api/grpc/yq_v1.proto +++ /dev/null @@ -1,79 +0,0 @@ -syntax = "proto3"; - -package YandexQuery.V1; -option java_package = "com.yandex.query.v1"; - -import "ydb/public/api/protos/yq.proto"; - -service YandexQueryService { - // Query - // Query is the text of an SQL request, the results of the last run and the state after the last run (partitions offsets, consumer in YDS) - // Create a query object with a given SQL - rpc CreateQuery(YandexQuery.CreateQueryRequest) returns (YandexQuery.CreateQueryResponse); - - // Get a list of brief queries objects - rpc ListQueries(YandexQuery.ListQueriesRequest) returns (YandexQuery.ListQueriesResponse); - - // Get full information about the object of the query - rpc DescribeQuery(YandexQuery.DescribeQueryRequest) returns (YandexQuery.DescribeQueryResponse); - - // Get status of the query - rpc GetQueryStatus(YandexQuery.GetQueryStatusRequest) returns (YandexQuery.GetQueryStatusResponse); - - // Change the attributes of the query (acl, name, ...) - rpc ModifyQuery(YandexQuery.ModifyQueryRequest) returns (YandexQuery.ModifyQueryResponse); - - // Completely delete the query - rpc DeleteQuery(YandexQuery.DeleteQueryRequest) returns (YandexQuery.DeleteQueryResponse); - - // Change the state of the query lifecycle - rpc ControlQuery(YandexQuery.ControlQueryRequest) returns (YandexQuery.ControlQueryResponse); - - // Get a results page - rpc GetResultData(YandexQuery.GetResultDataRequest) returns (YandexQuery.GetResultDataResponse); - - // Job - // Job - appears immediately after starting the request and contains the request metadata - // Get a list of jobs - rpc ListJobs(YandexQuery.ListJobsRequest) returns (YandexQuery.ListJobsResponse); - - // Get information about the job - rpc DescribeJob(YandexQuery.DescribeJobRequest) returns (YandexQuery.DescribeJobResponse); - - // Connection - // Connection - entity that describes connection points. This can be imagined as an analogue of a network address. - // Create a connection object (ObjectStorage, YDB, YDS, ...) - rpc CreateConnection(YandexQuery.CreateConnectionRequest) returns (YandexQuery.CreateConnectionResponse); - - // Get a list of connections objects - rpc ListConnections(YandexQuery.ListConnectionsRequest) returns (YandexQuery.ListConnectionsResponse); - - // Get information about the object of the connection - rpc DescribeConnection(YandexQuery.DescribeConnectionRequest) returns (YandexQuery.DescribeConnectionResponse); - - // Change the attributes of the connection - rpc ModifyConnection(YandexQuery.ModifyConnectionRequest) returns (YandexQuery.ModifyConnectionResponse); - - // Completely delete the connection - rpc DeleteConnection(YandexQuery.DeleteConnectionRequest) returns (YandexQuery.DeleteConnectionResponse); - - // Test the connection (permissions, network, ...) - rpc TestConnection(YandexQuery.TestConnectionRequest) returns (YandexQuery.TestConnectionResponse); - - // Binding - // Binding - entity using which a schema is assigned to non-schematic data - // Create a binding object - bind schema with ObjectStorage object or YDS stream - rpc CreateBinding(YandexQuery.CreateBindingRequest) returns (YandexQuery.CreateBindingResponse); - - // Get a list of bindings objects - rpc ListBindings(YandexQuery.ListBindingsRequest) returns (YandexQuery.ListBindingsResponse); - - // Get information about the object of the binding - rpc DescribeBinding(YandexQuery.DescribeBindingRequest) returns (YandexQuery.DescribeBindingResponse); - - // Change the attributes of the binding - rpc ModifyBinding(YandexQuery.ModifyBindingRequest) returns (YandexQuery.ModifyBindingResponse); - - // Completely delete the binding - rpc DeleteBinding(YandexQuery.DeleteBindingRequest) returns (YandexQuery.DeleteBindingResponse); -} diff --git a/ydb/public/api/protos/CMakeLists.darwin-x86_64.txt b/ydb/public/api/protos/CMakeLists.darwin-x86_64.txt index f58201924d..f832d13d5d 100644 --- a/ydb/public/api/protos/CMakeLists.darwin-x86_64.txt +++ b/ydb/public/api/protos/CMakeLists.darwin-x86_64.txt @@ -387,18 +387,6 @@ get_built_tool_path( cpp_styleguide ) get_built_tool_path( - TOOL_protoc_bin - TOOL_protoc_dependency - contrib/tools/protoc/bin - protoc -) -get_built_tool_path( - TOOL_cpp_styleguide_bin - TOOL_cpp_styleguide_dependency - contrib/tools/protoc/plugins/cpp_styleguide - cpp_styleguide -) -get_built_tool_path( TOOL_enum_parser_bin TOOL_enum_parser_dependency tools/enum_parser/enum_parser @@ -463,7 +451,6 @@ target_proto_messages(api-protos PRIVATE ${CMAKE_SOURCE_DIR}/ydb/public/api/protos/ydb_table.proto ${CMAKE_SOURCE_DIR}/ydb/public/api/protos/ydb_topic.proto ${CMAKE_SOURCE_DIR}/ydb/public/api/protos/ydb_value.proto - ${CMAKE_SOURCE_DIR}/ydb/public/api/protos/yq.proto ) generate_enum_serilization(api-protos ${CMAKE_BINARY_DIR}/ydb/public/api/protos/draft/persqueue_common.pb.h diff --git a/ydb/public/api/protos/CMakeLists.linux-aarch64.txt b/ydb/public/api/protos/CMakeLists.linux-aarch64.txt index 99971e435d..789972bac7 100644 --- a/ydb/public/api/protos/CMakeLists.linux-aarch64.txt +++ b/ydb/public/api/protos/CMakeLists.linux-aarch64.txt @@ -387,18 +387,6 @@ get_built_tool_path( cpp_styleguide ) get_built_tool_path( - TOOL_protoc_bin - TOOL_protoc_dependency - contrib/tools/protoc/bin - protoc -) -get_built_tool_path( - TOOL_cpp_styleguide_bin - TOOL_cpp_styleguide_dependency - contrib/tools/protoc/plugins/cpp_styleguide - cpp_styleguide -) -get_built_tool_path( TOOL_enum_parser_bin TOOL_enum_parser_dependency tools/enum_parser/enum_parser @@ -464,7 +452,6 @@ target_proto_messages(api-protos PRIVATE ${CMAKE_SOURCE_DIR}/ydb/public/api/protos/ydb_table.proto ${CMAKE_SOURCE_DIR}/ydb/public/api/protos/ydb_topic.proto ${CMAKE_SOURCE_DIR}/ydb/public/api/protos/ydb_value.proto - ${CMAKE_SOURCE_DIR}/ydb/public/api/protos/yq.proto ) generate_enum_serilization(api-protos ${CMAKE_BINARY_DIR}/ydb/public/api/protos/draft/persqueue_common.pb.h diff --git a/ydb/public/api/protos/CMakeLists.linux-x86_64.txt b/ydb/public/api/protos/CMakeLists.linux-x86_64.txt index 99971e435d..789972bac7 100644 --- a/ydb/public/api/protos/CMakeLists.linux-x86_64.txt +++ b/ydb/public/api/protos/CMakeLists.linux-x86_64.txt @@ -387,18 +387,6 @@ get_built_tool_path( cpp_styleguide ) get_built_tool_path( - TOOL_protoc_bin - TOOL_protoc_dependency - contrib/tools/protoc/bin - protoc -) -get_built_tool_path( - TOOL_cpp_styleguide_bin - TOOL_cpp_styleguide_dependency - contrib/tools/protoc/plugins/cpp_styleguide - cpp_styleguide -) -get_built_tool_path( TOOL_enum_parser_bin TOOL_enum_parser_dependency tools/enum_parser/enum_parser @@ -464,7 +452,6 @@ target_proto_messages(api-protos PRIVATE ${CMAKE_SOURCE_DIR}/ydb/public/api/protos/ydb_table.proto ${CMAKE_SOURCE_DIR}/ydb/public/api/protos/ydb_topic.proto ${CMAKE_SOURCE_DIR}/ydb/public/api/protos/ydb_value.proto - ${CMAKE_SOURCE_DIR}/ydb/public/api/protos/yq.proto ) generate_enum_serilization(api-protos ${CMAKE_BINARY_DIR}/ydb/public/api/protos/draft/persqueue_common.pb.h diff --git a/ydb/public/api/protos/CMakeLists.windows-x86_64.txt b/ydb/public/api/protos/CMakeLists.windows-x86_64.txt index f58201924d..f832d13d5d 100644 --- a/ydb/public/api/protos/CMakeLists.windows-x86_64.txt +++ b/ydb/public/api/protos/CMakeLists.windows-x86_64.txt @@ -387,18 +387,6 @@ get_built_tool_path( cpp_styleguide ) get_built_tool_path( - TOOL_protoc_bin - TOOL_protoc_dependency - contrib/tools/protoc/bin - protoc -) -get_built_tool_path( - TOOL_cpp_styleguide_bin - TOOL_cpp_styleguide_dependency - contrib/tools/protoc/plugins/cpp_styleguide - cpp_styleguide -) -get_built_tool_path( TOOL_enum_parser_bin TOOL_enum_parser_dependency tools/enum_parser/enum_parser @@ -463,7 +451,6 @@ target_proto_messages(api-protos PRIVATE ${CMAKE_SOURCE_DIR}/ydb/public/api/protos/ydb_table.proto ${CMAKE_SOURCE_DIR}/ydb/public/api/protos/ydb_topic.proto ${CMAKE_SOURCE_DIR}/ydb/public/api/protos/ydb_value.proto - ${CMAKE_SOURCE_DIR}/ydb/public/api/protos/yq.proto ) generate_enum_serilization(api-protos ${CMAKE_BINARY_DIR}/ydb/public/api/protos/draft/persqueue_common.pb.h diff --git a/ydb/public/api/protos/yq.proto b/ydb/public/api/protos/yq.proto deleted file mode 100644 index 70a9e2d739..0000000000 --- a/ydb/public/api/protos/yq.proto +++ /dev/null @@ -1,810 +0,0 @@ -// DEPRECATED!! use fq.proto - -syntax = "proto3"; -option cc_enable_arenas = true; - -package YandexQuery; -option java_package = "com.yandex.query"; -option java_outer_classname = "YandexQueryProtos"; - -import "ydb/public/api/protos/annotations/sensitive.proto"; -import "ydb/public/api/protos/annotations/validation.proto"; -import "ydb/public/api/protos/ydb_operation.proto"; -import "ydb/public/api/protos/ydb_value.proto"; -import "ydb/public/api/protos/ydb_issue_message.proto"; - -import "google/protobuf/duration.proto"; -import "google/protobuf/timestamp.proto"; -import "google/protobuf/empty.proto"; - -//////////////////////////////////////////////////////////// - -// === Query API === - -// Header: x-yq-scope => yandexcloud://cloud_id/folder_id - -message Acl { - enum Visibility { - VISIBILITY_UNSPECIFIED = 0; - PRIVATE = 1; // Visibility only for the creator of the entity - SCOPE = 2; // Visibility for subjects within scope - } - Visibility visibility = 1; -} - -message Limits { - // Used only for streaming queries - int64 vcpu_rate_limit = 1 [(Ydb.value) = ">= 0"]; // 0.01 vcpu per second - int64 flow_rate_limit = 2 [(Ydb.value) = ">= 0"]; // Bytes per second - int64 vcpu_time_limit = 3 [(Ydb.value) = ">= 0"]; // Milliseconds per second - - // Used only for analytics queries - int64 max_result_size = 4 [(Ydb.value) = ">= 0"]; // Bytes - int64 max_result_rows = 5 [(Ydb.value) = ">= 0"]; // Count - - // Common limits - int64 memory_limit = 6 [(Ydb.value) = ">= 0"]; // Bytes - google.protobuf.Duration result_ttl = 7; - oneof timeout { - google.protobuf.Duration execution_timeout = 8; - google.protobuf.Timestamp execution_deadline = 9; - } -} - -enum ExecuteMode { - EXECUTE_MODE_UNSPECIFIED = 0; - SAVE = 1; // Save a query without changing its state - PARSE = 2; // Parse the query - COMPILE = 3; // Parse and compile the query - VALIDATE = 4; // Parse, compile and validate the query - EXPLAIN = 5; // High-level query plan that specifies only physical operations and non-temporary table names - RUN = 6; // Do all the previous + execution of the query -} - -enum QueryAction { - QUERY_ACTION_UNSPECIFIED = 0; - PAUSE = 1; // Pause the query, with the possibility of its quick resumption - PAUSE_GRACEFULLY = 2; // Similar to PAUSE, only suspends the query allowing it to pause in checkpoint. Can work for a long time - ABORT = 3; // Stop the query - ABORT_GRACEFULLY = 4; // Similar to ABORT, only stops the query in checkpoint - RESUME = 5; // Resumes the execution of the query. Works only for PAUSE queries -} - -enum StateLoadMode { - STATE_LOAD_MODE_UNSPECIFIED = 0; - EMPTY = 1; // Start the query with an empty state - FROM_LAST_CHECKPOINT = 2; // Start the query with the state that is saved in the last checkpoint -} - -// For streaming queries only -message StreamingDisposition { - message FromTime { - google.protobuf.Timestamp timestamp = 1; - } - - message TimeAgo { - google.protobuf.Duration duration = 1; - } - - message FromLastCheckpoint { - // By default if new query streams set doesn't equal to old query streams set, - // error will occur and query won't be allowed to load offsets for streams for the last checkpoint. - // If this flag is set all offsets that can be matched with previous query checkpoint will be matched. - // Others will use "fresh" streaming disposition. - bool force = 1; - } - - oneof disposition { - google.protobuf.Empty oldest = 1; // Start processing with the oldest offset - google.protobuf.Empty fresh = 2; // Start processing with the fresh offset - FromTime from_time = 3; // Start processing with offset from the specified time - TimeAgo time_ago = 4; // Start processing with offset some time ago - FromLastCheckpoint from_last_checkpoint = 5; // Start processing with offset which corresponds to the last checkpoint - } -} - -// Query information that the subject can change -message QueryContent { - enum QueryType { - QUERY_TYPE_UNSPECIFIED = 0; - ANALYTICS = 1; // Analytical query (used for analytical data processing for example to work with YDB, ClickHouse, ...) - STREAMING = 2; // Streaming query (used for streaming data processing, such as working with YDS) - } - - enum QuerySyntax { - QUERY_SYNTAX_UNSPECIFIED = 0; - YQL_V1 = 1; // YQL version 1 - PG = 2; // PostgresQL - } - - QueryType type = 1; - string name = 2 [(Ydb.length).le = 1024]; - Acl acl = 3; - Limits limits = 4; - string text = 5 [(Ydb.length).le = 102400]; // The text of the query itself - bool automatic = 6; // Is used for queries that are created by automatic systems (robots, jdbc driver, ...) - string description = 7 [(Ydb.length).le = 10240]; // Description of the query, there can be any text - // Specified settings for query's executor - // Well known settings are: - // "executor" - type of executor for this query - map<string, string> execution_settings = 10 [(Ydb.map_key).length.range = {min: 1, max: 100}, (Ydb.length).le = 4096]; - // Syntax of the text - // By default it is "yql", but additional syntax "pg" (PostreSQL SQL frontend) is supported as well - QuerySyntax syntax = 11; -} - -message CommonMeta { - string id = 1 [(Ydb.length).range = {min: 1, max: 1024}]; - string created_by = 2 [(Ydb.length).range = {min: 1, max: 1024}]; - string modified_by = 3 [(Ydb.length).range = {min: 1, max: 1024}]; - google.protobuf.Timestamp created_at = 4; - google.protobuf.Timestamp modified_at = 5; - int64 revision = 6 [(Ydb.value) = ">= 0"]; // Entity version, increases with each change -} - -message QueryMeta { - enum ComputeStatus { - COMPUTE_STATUS_UNSPECIFIED = 0; - STARTING = 1; // Start execution of the action on query - ABORTED_BY_USER = 2; // Query aborted by user - ABORTED_BY_SYSTEM = 3; // Query aborted by system - ABORTING_BY_USER = 4; // Query aborting by user - ABORTING_BY_SYSTEM = 5; // Query aborting by system - RESUMING = 6; // Resuming query execution from PAUSED status - RUNNING = 7; // Query started for execution - COMPLETED = 8; // Query completed successfully - COMPLETING = 12; // Finalizing query before become COMPLETED - FAILED = 9; // Query completed with errors - FAILING = 13; // Finalizing query before become FAILED - PAUSED = 11; // Query paused - PAUSING = 10; // Query starts pausing - } - - CommonMeta common = 1; - // Timeline (submitted_at <= started_at <= finished_at) - // sumbitted_at - // \ -> started_at - // \ -> finished_at - google.protobuf.Timestamp submitted_at = 14; // Time when the query was queued for execution - google.protobuf.Timestamp started_at = 2; // Start time of query execution - google.protobuf.Timestamp finished_at = 3; // Query completition time - ExecuteMode execute_mode = 4; - ComputeStatus status = 5; - int64 last_job_query_revision = 6; - string last_job_id = 7; - google.protobuf.Timestamp expire_at = 8; - google.protobuf.Timestamp result_expire_at = 9; - string started_by = 10; - oneof action { - string aborted_by = 11; - string paused_by = 12; - } - // One of the versions of this query has fully saved checkpoint. - // If this flag is not set streaming disposition mode "from last checkpoint" can't be used. - bool has_saved_checkpoints = 13; -} - -message BriefQuery { - QueryContent.QueryType type = 1; - string name = 2 [(Ydb.length).le = 1024]; - QueryMeta meta = 3; - Acl.Visibility visibility = 4; - bool automatic = 5; -} - -message QueryPlan { - string json = 1; // No validation because generated on server side -} - -message QueryAst { - string data = 1; -} - -message ResultSetMeta { - repeated Ydb.Column column = 1; - int64 rows_count = 2 [(Ydb.value) = ">= 0"]; - bool truncated = 3; -} - -message Query { - QueryMeta meta = 1; - QueryContent content = 2; - QueryPlan plan = 3; - repeated Ydb.Issue.IssueMessage issue = 4; - repeated Ydb.Issue.IssueMessage transient_issue = 5; - QueryStatistics statistics = 6; - repeated ResultSetMeta result_set_meta = 7; - QueryAst ast = 8; -} - -message QueryStatistics { - string json = 1; // No validation because generated on server side -} - -// Create a new query -message CreateQueryRequest { - Ydb.Operations.OperationParams operation_params = 1; - QueryContent content = 2; - ExecuteMode execute_mode = 3; - StreamingDisposition disposition = 4; - string idempotency_key = 5 [(Ydb.length).le = 1024]; -} - -message CreateQueryResponse { - Ydb.Operations.Operation operation = 1; // CreateQueryResult -} - -message CreateQueryResult { - string query_id = 1 [(Ydb.length).le = 1024]; -} - -enum AutomaticType { - AUTOMATIC_TYPE_UNSPECIFIED = 0; - AUTOMATIC = 1; - NOT_AUTOMATIC = 2; -} - -// Getting brief information about queries -message ListQueriesRequest { - Ydb.Operations.OperationParams operation_params = 1; - string page_token = 2 [(Ydb.length).le = 1024]; - int32 limit = 3 [(Ydb.value) = "[1; 100]"]; - - message Filter { - QueryContent.QueryType query_type = 1; - repeated QueryMeta.ComputeStatus status = 2 [(Ydb.size).le = 20]; - repeated ExecuteMode mode = 3 [(Ydb.size).le = 20]; - string name = 4 [(Ydb.length).le = 1024]; // queries whose name contains the filter.name substring - bool created_by_me = 5; - Acl.Visibility visibility = 6; - AutomaticType automatic = 7; - } - Filter filter = 4; -} - -message ListQueriesResponse { - Ydb.Operations.Operation operation = 1; // ListQueriesResult -} - -message ListQueriesResult { - repeated BriefQuery query = 1; - string next_page_token = 2 [(Ydb.length).le = 1024]; -} - -// Getting complete information about the query -message DescribeQueryRequest { - Ydb.Operations.OperationParams operation_params = 1; - string query_id = 2 [(Ydb.length).range = {min: 1, max: 1024}]; -} - -message DescribeQueryResponse { - Ydb.Operations.Operation operation = 1; // DescribeQueryResult -} - -message DescribeQueryResult { - Query query = 1; -} - -// Getting status of the query -message GetQueryStatusRequest { - Ydb.Operations.OperationParams operation_params = 1; - string query_id = 2 [(Ydb.length).range = {min: 1, max: 1024}]; -} - -message GetQueryStatusResponse { - Ydb.Operations.Operation operation = 1; // GetQueryStatusResult -} - -message GetQueryStatusResult { - QueryMeta.ComputeStatus status = 1; - int64 meta_revision = 2; -} - -// Complete removal of query. Recovery of the query after this operation is not possible -message DeleteQueryRequest { - Ydb.Operations.OperationParams operation_params = 1; - string query_id = 2 [(Ydb.length).range = {min: 1, max: 1024}]; - int64 previous_revision = 3 [(Ydb.value) = ">= 0"]; - string idempotency_key = 4 [(Ydb.length).le = 1024]; -} - -message DeleteQueryResponse { - Ydb.Operations.Operation operation = 1; // DeleteQueryResult -} - -message DeleteQueryResult { -} - -// Change query information with launch policy option. All fields must be filled in the request. The query changes completely -message ModifyQueryRequest { - Ydb.Operations.OperationParams operation_params = 1; - string query_id = 2 [(Ydb.length).range = {min: 1, max: 1024}]; - QueryContent content = 3; - ExecuteMode execute_mode = 4; - StreamingDisposition disposition = 5; - StateLoadMode state_load_mode = 6; - int64 previous_revision = 7 [(Ydb.value) = ">= 0"]; - string idempotency_key = 8 [(Ydb.length).le = 1024]; -} - -message ModifyQueryResponse { - Ydb.Operations.Operation operation = 1; // ModifyQueryResult -} - -message ModifyQueryResult { -} - -// Managing query status (pause, abort, resume, ...) -message ControlQueryRequest { - Ydb.Operations.OperationParams operation_params = 1; - string query_id = 2 [(Ydb.length).range = {min: 1, max: 1024}]; - QueryAction action = 3; - int64 previous_revision = 4 [(Ydb.value) = ">= 0"]; - string idempotency_key = 5 [(Ydb.length).le = 1024]; -} - -message ControlQueryResponse { - Ydb.Operations.Operation operation = 1; // ControlQueryResult -} - -message ControlQueryResult { -} - -// === Job API === - -message BriefJob { - CommonMeta meta = 1; - QueryMeta query_meta = 3; - string query_name = 9; - Acl.Visibility visibility = 10; - bool automatic = 11; - google.protobuf.Timestamp expire_at = 12; -} - -message Job { - CommonMeta meta = 1; - string text = 2; - QueryMeta query_meta = 3; - QueryPlan plan = 4; - repeated Ydb.Issue.IssueMessage issue = 5; - QueryStatistics statistics = 6; - repeated ResultSetMeta result_set_meta = 7; - QueryAst ast = 8; - string query_name = 9; - Acl acl = 10; - bool automatic = 11; - google.protobuf.Timestamp expire_at = 12; - QueryContent.QuerySyntax syntax = 13; -} - -// Information about recent query runs -message ListJobsRequest { - Ydb.Operations.OperationParams operation_params = 1; - string page_token = 2 [(Ydb.length).le = 1024]; - int32 limit = 3 [(Ydb.value) = "[1; 100]"]; - string query_id = 5; // deprecated - - message Filter { - string query_id = 1 [(Ydb.length).le = 1024]; - bool created_by_me = 2; - } - Filter filter = 4; -} - -message ListJobsResponse { - Ydb.Operations.Operation operation = 1; // ListJobsResult -} - -message ListJobsResult { - repeated BriefJob job = 1; - string next_page_token = 2 [(Ydb.length).le = 1024]; -} - -// Getting information about the job -message DescribeJobRequest { - Ydb.Operations.OperationParams operation_params = 1; - string job_id = 2 [(Ydb.length).range = {min: 1, max: 1024}]; -} - -message DescribeJobResponse { - Ydb.Operations.Operation operation = 1; // DescribeJobResult -} - -message DescribeJobResult { - Job job = 1; -} - -// === Connection API === - -message CurrentIAMTokenAuth { -} - -message NoneAuth { -} - -message ServiceAccountAuth { - string id = 1 [(Ydb.length).le = 1024]; -} - -message IamAuth { - oneof identity { - CurrentIAMTokenAuth current_iam = 1; - ServiceAccountAuth service_account = 2; - NoneAuth none = 3; - } -} - -message DataStreams { - string database_id = 1 [(Ydb.length).le = 1024]; - IamAuth auth = 2; - - // for internal usage - string endpoint = 3 [(Ydb.length).le = 1024]; - string database = 4 [(Ydb.length).le = 1024]; - bool secure = 5; -} - -message Monitoring { - string project = 1 [(Ydb.length).le = 200]; - string cluster = 2 [(Ydb.length).le = 200]; - IamAuth auth = 3; -} - -message YdbDatabase { - string database_id = 1 [(Ydb.length).le = 1024]; - IamAuth auth = 2; - - // for internal usage - string endpoint = 3 [(Ydb.length).le = 1024]; - string database = 4 [(Ydb.length).le = 1024]; - bool secure = 5; -} - -message ClickHouseCluster { - string database_id = 1 [(Ydb.length).le = 1024]; - string login = 2 [(Ydb.length).le = 1024, (Ydb.sensitive) = true]; - string password = 3 [(Ydb.length).le = 1024, (Ydb.sensitive) = true]; - IamAuth auth = 4; - - // for internal usage - string host = 5 [(Ydb.length).le = 1024]; - int32 port = 6 [(Ydb.value) = "[0; 65536]"]; - bool secure = 7; -} - -message ObjectStorageConnection { - string bucket = 1 [(Ydb.length).le = 1024]; - IamAuth auth = 2; -} - -message ConnectionSetting { - enum ConnectionType { - CONNECTION_TYPE_UNSPECIFIED = 0; - YDB_DATABASE = 1; - CLICKHOUSE_CLUSTER = 2; - DATA_STREAMS = 3; - OBJECT_STORAGE = 4; - MONITORING = 5; - } - - oneof connection { - YdbDatabase ydb_database = 1; - ClickHouseCluster clickhouse_cluster = 2; - DataStreams data_streams = 3; - ObjectStorageConnection object_storage = 4; - Monitoring monitoring = 5; - } -} - -message ConnectionContent { - string name = 1 [(Ydb.length).range = {min: 1, max: 1024}]; - ConnectionSetting setting = 2; - Acl acl = 3; - string description = 4 [(Ydb.length).le = 10240]; -} - -message Connection { - ConnectionContent content = 1; - CommonMeta meta = 2; -} - -// Create a new connection -message CreateConnectionRequest { - Ydb.Operations.OperationParams operation_params = 1; - ConnectionContent content = 2; - string idempotency_key = 3 [(Ydb.length).le = 1024]; -} - -message CreateConnectionResponse { - Ydb.Operations.Operation operation = 1; // CreateConnectionResult -} - -message CreateConnectionResult { - string connection_id = 1 [(Ydb.length).range = {min: 1, max: 1024}]; -} - -// Getting information about connections -message ListConnectionsRequest { - Ydb.Operations.OperationParams operation_params = 1; - string page_token = 2 [(Ydb.length).le = 1024]; - int32 limit = 3 [(Ydb.value) = "[1; 100]"]; - - message Filter { - string name = 1 [(Ydb.length).le = 1024]; // connections whose name contains the filter.name substring - bool created_by_me = 2; - ConnectionSetting.ConnectionType connection_type = 3; - Acl.Visibility visibility = 4; - } - Filter filter = 4; -} - -message ListConnectionsResponse { - Ydb.Operations.Operation operation = 1; // ListConnectionsResult -} - -message ListConnectionsResult { - repeated Connection connection = 1; - string next_page_token = 2 [(Ydb.length).le = 1024]; -} - -// Getting information about the connection -message DescribeConnectionRequest { - Ydb.Operations.OperationParams operation_params = 1; - string connection_id = 2 [(Ydb.length).range = {min: 1, max: 1024}]; -} - -message DescribeConnectionResponse { - Ydb.Operations.Operation operation = 1; // DescribeConnectionResult -} - -message DescribeConnectionResult { - Connection connection = 1; -} - -// Change connection information. All fields must be filled in the request. The connection changes completely -message ModifyConnectionRequest { - Ydb.Operations.OperationParams operation_params = 1; - string connection_id = 2 [(Ydb.length).range = {min: 1, max: 1024}]; - ConnectionContent content = 3; - int64 previous_revision = 4 [(Ydb.value) = ">= 0"]; - string idempotency_key = 5 [(Ydb.length).le = 1024]; -} - -message ModifyConnectionResponse { - Ydb.Operations.Operation operation = 1; // ModifyConnectionResult -} - -message ModifyConnectionResult { -} - -// Complete removal of connection. Recovery of the connection after this operation is not possible -message DeleteConnectionRequest { - Ydb.Operations.OperationParams operation_params = 1; - string connection_id = 2 [(Ydb.length).range = {min: 1, max: 1024}]; - int64 previous_revision = 3 [(Ydb.value) = ">= 0"]; - string idempotency_key = 4 [(Ydb.length).le = 1024]; -} - -message DeleteConnectionResponse { - Ydb.Operations.Operation operation = 1; // DeleteConnectionResult -} - -message DeleteConnectionResult { -} - -message TestConnectionRequest { - Ydb.Operations.OperationParams operation_params = 1; - ConnectionSetting setting = 2; -} - -message TestConnectionResponse { - Ydb.Operations.Operation operation = 1; // TestConnectionResult -} - -message TestConnectionResult { -} - -// ResultSet API - -// Getting the result of the query execution -message GetResultDataRequest { - Ydb.Operations.OperationParams operation_params = 1; - string query_id = 2 [(Ydb.length).range = {min: 1, max: 1024}]; - int32 result_set_index = 3 [(Ydb.value) = ">= 0"]; - int64 offset = 4 [(Ydb.value) = ">= 0"]; - int64 limit = 5 [(Ydb.value) = "[1; 1000]"]; -} - -message GetResultDataResponse { - Ydb.Operations.Operation operation = 1; // GetResultDataResult -} - -message GetResultDataResult { - Ydb.ResultSet result_set = 1; -} - -// Binding API - -message Schema { - repeated Ydb.Column column = 1 [(Ydb.size).le = 100]; -} - -message DataStreamsBinding { - string stream_name = 1 [(Ydb.length).range = {min: 1, max: 1024}]; - string format = 2 [(Ydb.length).le = 1024]; - string compression = 3 [(Ydb.length).le = 1024]; - Schema schema = 4; - map<string, string> format_setting = 5 [(Ydb.size).le = 100]; -} - -message ObjectStorageBinding { - message Subset { - string path_pattern = 1 [(Ydb.length).range = {min: 1, max: 1024}]; - string format = 2 [(Ydb.length).le = 1024]; - map<string, string> format_setting = 3 [(Ydb.size).le = 100]; - string compression = 4 [(Ydb.length).le = 1024]; - Schema schema = 5; - - /* - Partition projection is used to speed up the processing of highly partitioned - storages and automate the management of partitions. In partition projection, partition values and - locations are calculated from configuration rather than read from an object storage. Depending on the - specific characteristics of the query and underlying data, partition projection can significantly - reduce query execution time if it uses partitioning constraints on partition metadata retrieval. Similar - functionality is implemented in Athena: https://docs.aws.amazon.com/athena/latest/ug/partition-projection.html - Only enum, integer and date types are supported for path generation. When using projection, there must - be at least one element in partitioned_by. This behavior is introduced for symmetric query usage and - compatibility with Athena behavior. - - Example: - projection = { - "projection.enabled" : "true", // used to enable and disable partitioning - "projection.city.type" : "enum", // to generate the city column, the enum type will be used (enumeration of objects separated by commas) - "projection.city.values" : "Washington,Roma", // column values city Washington or Roma - "projection.code.type" : "enum", // to generate the code column, the enum type will be used (enumeration of objects separated by commas) - "projection.code.values" : "0,1", // column values code 0 or 1 - "storage.location.template" : "/${city}/${code}/${device_id}" // the template to which the generated values will be substituted - } - partitioned_by = [ "city", "device_id" ] // a subset of columns that are included in partitioning - - If storage.location.template and partitioned_by are specified together, then the rule from storage.location.template will be used. - - If only partitioned_by is specified, then the Hive Metastore format will be used for storage.location.template: "/city=${city}/device_id=${device_id}" - The list of paths that correspond to described projection and partitioned_by values are: - "/Washington/0/${device_id}", "/Washington/1/${device_id}", "/Roma/0/${device_id}", "/Roma/1/${device_id}" - */ - map<string, string> projection = 6; - - /* - By separating the data, it is possible to limit the amount of data scanned by each query, thereby improving - performance and reducing costs. Therefore, user data is partition by key (in practice, this is a partition by time). - The partitioned_by defines the keys on which to partition data. The columns described in partitioned_by - must be specified in the schema. If projection is not specified, the template will be generated according to - partitioned_by. Similar functionality is implemented in Athena: https://docs.aws.amazon.com/athena/latest/ug/partitions.html - - Example: - partitioned_by = [ "city", "code", "device_id" ] - The corresponding storage.location.template will be as follows: - "/city=${city}/code=${code}/device_id=${device_id}" - */ - repeated string partitioned_by = 7; - } - - repeated Subset subset = 1; -} - -message BindingSetting { - enum BindingType { - BINDING_TYPE_UNSPECIFIED = 0; - DATA_STREAMS = 1; - OBJECT_STORAGE = 2; - } - - oneof binding { - DataStreamsBinding data_streams = 1; - ObjectStorageBinding object_storage = 2; - } -} - -message BriefBinding { - string name = 1 [(Ydb.length).range = {min: 1, max: 1024}]; - string connection_id = 2 [(Ydb.length).range = {min: 1, max: 1024}]; - CommonMeta meta = 3; - BindingSetting.BindingType type = 4; - Acl.Visibility visibility = 5; -} - -message BindingContent { - string name = 1 [(Ydb.length).range = {min: 1, max: 1024}]; - string connection_id = 2 [(Ydb.length).range = {min: 1, max: 1024}]; - BindingSetting setting = 3; - Acl acl = 4; - string description = 5 [(Ydb.length).le = 10240]; -} - -message Binding { - BindingContent content = 1; - CommonMeta meta = 2; -} - -// Create a new binding -message CreateBindingRequest { - Ydb.Operations.OperationParams operation_params = 1; - BindingContent content = 2; - string idempotency_key = 3 [(Ydb.length).le = 1024]; -} - -message CreateBindingResponse { - Ydb.Operations.Operation operation = 1; // CreateBindingResult -} - -message CreateBindingResult { - string binding_id = 1 [(Ydb.length).range = {min: 1, max: 1024}]; -} - -// Getting information about bindings -message ListBindingsRequest { - Ydb.Operations.OperationParams operation_params = 1; - string page_token = 2 [(Ydb.length).le = 1024]; - int32 limit = 3 [(Ydb.value) = "[1; 100]"]; - - message Filter { - string connection_id = 1 [(Ydb.length).le = 1024]; - string name = 2 [(Ydb.length).le = 1024]; // bindings whose name contains the filter.name substring - bool created_by_me = 3; - Acl.Visibility visibility = 4; - } - Filter filter = 4; -} - -message ListBindingsResponse { - Ydb.Operations.Operation operation = 1; // ListBindingsResult -} - -message ListBindingsResult { - repeated BriefBinding binding = 1; - string next_page_token = 2 [(Ydb.length).le = 1024]; -} - -// Getting information about the binding -message DescribeBindingRequest { - Ydb.Operations.OperationParams operation_params = 1; - string binding_id = 2 [(Ydb.length).range = {min: 1, max: 1024}]; -} - -message DescribeBindingResponse { - Ydb.Operations.Operation operation = 1; // DescribeBindingResult -} - -message DescribeBindingResult { - Binding binding = 1; -} - -// Change binding information. All fields must be filled in the request. The binding changes completely -message ModifyBindingRequest { - Ydb.Operations.OperationParams operation_params = 1; - string binding_id = 2 [(Ydb.length).range = {min: 1, max: 1024}]; - BindingContent content = 3; - int64 previous_revision = 4 [(Ydb.value) = ">= 0"]; - string idempotency_key = 5 [(Ydb.length).le = 1024]; -} - -message ModifyBindingResponse { - Ydb.Operations.Operation operation = 1; // ModifyBindingResult -} - -message ModifyBindingResult { -} - -// Complete removal of binding. Recovery of the binding after this operation is not possible -message DeleteBindingRequest { - Ydb.Operations.OperationParams operation_params = 1; - string binding_id = 2 [(Ydb.length).range = {min: 1, max: 1024}]; - int64 previous_revision = 3 [(Ydb.value) = ">= 0"]; - string idempotency_key = 4 [(Ydb.length).le = 1024]; -} - -message DeleteBindingResponse { - Ydb.Operations.Operation operation = 1; // DeleteBindingResult -} - -message DeleteBindingResult { -} diff --git a/ydb/public/lib/CMakeLists.txt b/ydb/public/lib/CMakeLists.txt index 90a5fb4c19..2a991f3fa0 100644 --- a/ydb/public/lib/CMakeLists.txt +++ b/ydb/public/lib/CMakeLists.txt @@ -18,5 +18,4 @@ add_subdirectory(scheme_types) add_subdirectory(validation) add_subdirectory(value) add_subdirectory(ydb_cli) -add_subdirectory(yq) add_subdirectory(yson_value) diff --git a/ydb/public/lib/yq/CMakeLists.darwin-x86_64.txt b/ydb/public/lib/yq/CMakeLists.darwin-x86_64.txt deleted file mode 100644 index 8b300f5e99..0000000000 --- a/ydb/public/lib/yq/CMakeLists.darwin-x86_64.txt +++ /dev/null @@ -1,20 +0,0 @@ - -# This file was generated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - - -add_library(public-lib-yq) -target_link_libraries(public-lib-yq PUBLIC - contrib-libs-cxxsupp - yutil - library-cpp-json - api-grpc-draft - cpp-client-ydb_table -) -target_sources(public-lib-yq PRIVATE - ${CMAKE_SOURCE_DIR}/ydb/public/lib/yq/yq.cpp -) diff --git a/ydb/public/lib/yq/CMakeLists.linux-aarch64.txt b/ydb/public/lib/yq/CMakeLists.linux-aarch64.txt deleted file mode 100644 index 943e57a7c0..0000000000 --- a/ydb/public/lib/yq/CMakeLists.linux-aarch64.txt +++ /dev/null @@ -1,21 +0,0 @@ - -# This file was generated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - - -add_library(public-lib-yq) -target_link_libraries(public-lib-yq PUBLIC - contrib-libs-linux-headers - contrib-libs-cxxsupp - yutil - library-cpp-json - api-grpc-draft - cpp-client-ydb_table -) -target_sources(public-lib-yq PRIVATE - ${CMAKE_SOURCE_DIR}/ydb/public/lib/yq/yq.cpp -) diff --git a/ydb/public/lib/yq/CMakeLists.linux-x86_64.txt b/ydb/public/lib/yq/CMakeLists.linux-x86_64.txt deleted file mode 100644 index 943e57a7c0..0000000000 --- a/ydb/public/lib/yq/CMakeLists.linux-x86_64.txt +++ /dev/null @@ -1,21 +0,0 @@ - -# This file was generated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - - -add_library(public-lib-yq) -target_link_libraries(public-lib-yq PUBLIC - contrib-libs-linux-headers - contrib-libs-cxxsupp - yutil - library-cpp-json - api-grpc-draft - cpp-client-ydb_table -) -target_sources(public-lib-yq PRIVATE - ${CMAKE_SOURCE_DIR}/ydb/public/lib/yq/yq.cpp -) diff --git a/ydb/public/lib/yq/CMakeLists.txt b/ydb/public/lib/yq/CMakeLists.txt deleted file mode 100644 index d90657116d..0000000000 --- a/ydb/public/lib/yq/CMakeLists.txt +++ /dev/null @@ -1,17 +0,0 @@ - -# This file was generated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - -if (CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64" AND UNIX AND NOT APPLE AND NOT ANDROID) - include(CMakeLists.linux-aarch64.txt) -elseif (APPLE AND CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64") - include(CMakeLists.darwin-x86_64.txt) -elseif (WIN32 AND CMAKE_SYSTEM_PROCESSOR STREQUAL "AMD64" AND NOT HAVE_CUDA) - include(CMakeLists.windows-x86_64.txt) -elseif (CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" AND UNIX AND NOT APPLE AND NOT ANDROID AND NOT HAVE_CUDA) - include(CMakeLists.linux-x86_64.txt) -endif() diff --git a/ydb/public/lib/yq/CMakeLists.windows-x86_64.txt b/ydb/public/lib/yq/CMakeLists.windows-x86_64.txt deleted file mode 100644 index 8b300f5e99..0000000000 --- a/ydb/public/lib/yq/CMakeLists.windows-x86_64.txt +++ /dev/null @@ -1,20 +0,0 @@ - -# This file was generated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - - -add_library(public-lib-yq) -target_link_libraries(public-lib-yq PUBLIC - contrib-libs-cxxsupp - yutil - library-cpp-json - api-grpc-draft - cpp-client-ydb_table -) -target_sources(public-lib-yq PRIVATE - ${CMAKE_SOURCE_DIR}/ydb/public/lib/yq/yq.cpp -) diff --git a/ydb/public/lib/yq/yq.cpp b/ydb/public/lib/yq/yq.cpp deleted file mode 100644 index 12a13ae187..0000000000 --- a/ydb/public/lib/yq/yq.cpp +++ /dev/null @@ -1,734 +0,0 @@ -#include "yq.h" - -#define INCLUDE_YDB_INTERNAL_H -#include <ydb/public/sdk/cpp/client/impl/ydb_internal/make_request/make.h> -#undef INCLUDE_YDB_INTERNAL_H - -#include <ydb/public/sdk/cpp/client/ydb_common_client/impl/client.h> - -namespace NYdb::NYq { - -using namespace NYdb; - -class TClient::TImpl : public TClientImplCommon<TClient::TImpl> { -public: - TImpl(std::shared_ptr<TGRpcConnectionsImpl>&& connections, const TCommonClientSettings& settings) - : TClientImplCommon(std::move(connections), settings) {} - - template<class TProtoResult, class TResultWrapper> - auto MakeResultExtractor(NThreading::TPromise<TResultWrapper> promise) { - return [promise = std::move(promise)] - (google::protobuf::Any* any, TPlainStatus status) mutable { - std::unique_ptr<TProtoResult> result; - if (any) { - result.reset(new TProtoResult); - any->UnpackTo(result.get()); - } - - promise.SetValue( - TResultWrapper( - TStatus(std::move(status)), - std::move(result))); - }; - } - - TAsyncCreateQueryResult CreateQuery( - const YandexQuery::CreateQueryRequest& protoRequest, - const TCreateQuerySettings& settings) { - auto request = MakeOperationRequest<YandexQuery::CreateQueryRequest>(settings); - request = protoRequest; - - auto promise = NThreading::NewPromise<TCreateQueryResult>(); - auto future = promise.GetFuture(); - - auto extractor = MakeResultExtractor< - YandexQuery::CreateQueryResult, - TCreateQueryResult>(std::move(promise)); - - Connections_->RunDeferred< - YandexQuery::V1::YandexQueryService, - YandexQuery::CreateQueryRequest, - YandexQuery::CreateQueryResponse>( - std::move(request), - std::move(extractor), - &YandexQuery::V1::YandexQueryService::Stub::AsyncCreateQuery, - DbDriverState_, - INITIAL_DEFERRED_CALL_DELAY, - TRpcRequestSettings::Make(settings)); - - return future; - } - - TAsyncListQueriesResult ListQueries( - const YandexQuery::ListQueriesRequest& protoRequest, - const TListQueriesSettings& settings) { - auto request = MakeOperationRequest<YandexQuery::ListQueriesRequest>(settings); - request = protoRequest; - - auto promise = NThreading::NewPromise<TListQueriesResult>(); - auto future = promise.GetFuture(); - - auto extractor = MakeResultExtractor< - YandexQuery::ListQueriesResult, - TListQueriesResult>(std::move(promise)); - - Connections_->RunDeferred< - YandexQuery::V1::YandexQueryService, - YandexQuery::ListQueriesRequest, - YandexQuery::ListQueriesResponse>( - std::move(request), - std::move(extractor), - &YandexQuery::V1::YandexQueryService::Stub::AsyncListQueries, - DbDriverState_, - INITIAL_DEFERRED_CALL_DELAY, - TRpcRequestSettings::Make(settings)); - - return future; - } - - TAsyncDescribeQueryResult DescribeQuery( - const YandexQuery::DescribeQueryRequest& protoRequest, - const TDescribeQuerySettings& settings) { - auto request = MakeOperationRequest<YandexQuery::DescribeQueryRequest>(settings); - request = protoRequest; - - auto promise = NThreading::NewPromise<TDescribeQueryResult>(); - auto future = promise.GetFuture(); - - auto extractor = MakeResultExtractor< - YandexQuery::DescribeQueryResult, - TDescribeQueryResult>(std::move(promise)); - - Connections_->RunDeferred< - YandexQuery::V1::YandexQueryService, - YandexQuery::DescribeQueryRequest, - YandexQuery::DescribeQueryResponse>( - std::move(request), - std::move(extractor), - &YandexQuery::V1::YandexQueryService::Stub::AsyncDescribeQuery, - DbDriverState_, - INITIAL_DEFERRED_CALL_DELAY, - TRpcRequestSettings::Make(settings)); - - return future; - } - - TAsyncGetQueryStatusResult GetQueryStatus( - const YandexQuery::GetQueryStatusRequest& protoRequest, - const TGetQueryStatusSettings& settings) { - auto request = MakeOperationRequest<YandexQuery::GetQueryStatusRequest>(settings); - request = protoRequest; - - auto promise = NThreading::NewPromise<TGetQueryStatusResult>(); - auto future = promise.GetFuture(); - - auto extractor = MakeResultExtractor< - YandexQuery::GetQueryStatusResult, - TGetQueryStatusResult>(std::move(promise)); - - Connections_->RunDeferred< - YandexQuery::V1::YandexQueryService, - YandexQuery::GetQueryStatusRequest, - YandexQuery::GetQueryStatusResponse>( - std::move(request), - std::move(extractor), - &YandexQuery::V1::YandexQueryService::Stub::AsyncGetQueryStatus, - DbDriverState_, - INITIAL_DEFERRED_CALL_DELAY, - TRpcRequestSettings::Make(settings)); - - return future; - } - - TAsyncModifyQueryResult ModifyQuery( - const YandexQuery::ModifyQueryRequest& protoRequest, - const TModifyQuerySettings& settings) { - auto request = MakeOperationRequest<YandexQuery::ModifyQueryRequest>(settings); - request = protoRequest; - - auto promise = NThreading::NewPromise<TModifyQueryResult>(); - auto future = promise.GetFuture(); - - auto extractor = MakeResultExtractor< - YandexQuery::ModifyQueryResult, - TModifyQueryResult>(std::move(promise)); - - Connections_->RunDeferred< - YandexQuery::V1::YandexQueryService, - YandexQuery::ModifyQueryRequest, - YandexQuery::ModifyQueryResponse>( - std::move(request), - std::move(extractor), - &YandexQuery::V1::YandexQueryService::Stub::AsyncModifyQuery, - DbDriverState_, - INITIAL_DEFERRED_CALL_DELAY, - TRpcRequestSettings::Make(settings)); - - return future; - } - - TAsyncDeleteQueryResult DeleteQuery( - const YandexQuery::DeleteQueryRequest& protoRequest, - const TDeleteQuerySettings& settings) { - auto request = MakeOperationRequest<YandexQuery::DeleteQueryRequest>(settings); - request = protoRequest; - - auto promise = NThreading::NewPromise<TDeleteQueryResult>(); - auto future = promise.GetFuture(); - - auto extractor = MakeResultExtractor< - YandexQuery::DeleteQueryResult, - TDeleteQueryResult>(std::move(promise)); - - Connections_->RunDeferred< - YandexQuery::V1::YandexQueryService, - YandexQuery::DeleteQueryRequest, - YandexQuery::DeleteQueryResponse>( - std::move(request), - std::move(extractor), - &YandexQuery::V1::YandexQueryService::Stub::AsyncDeleteQuery, - DbDriverState_, - INITIAL_DEFERRED_CALL_DELAY, - TRpcRequestSettings::Make(settings)); - - return future; - } - - TAsyncControlQueryResult ControlQuery( - const YandexQuery::ControlQueryRequest& protoRequest, - const TControlQuerySettings& settings) { - auto request = MakeOperationRequest<YandexQuery::ControlQueryRequest>(settings); - request = protoRequest; - - auto promise = NThreading::NewPromise<TControlQueryResult>(); - auto future = promise.GetFuture(); - - auto extractor = MakeResultExtractor< - YandexQuery::ControlQueryResult, - TControlQueryResult>(std::move(promise)); - - Connections_->RunDeferred< - YandexQuery::V1::YandexQueryService, - YandexQuery::ControlQueryRequest, - YandexQuery::ControlQueryResponse>( - std::move(request), - std::move(extractor), - &YandexQuery::V1::YandexQueryService::Stub::AsyncControlQuery, - DbDriverState_, - INITIAL_DEFERRED_CALL_DELAY, - TRpcRequestSettings::Make(settings)); - - return future; - } - - TAsyncGetResultDataResult GetResultData( - const YandexQuery::GetResultDataRequest& protoRequest, - const TGetResultDataSettings& settings) { - auto request = MakeOperationRequest<YandexQuery::GetResultDataRequest>(settings); - request = protoRequest; - - auto promise = NThreading::NewPromise<TGetResultDataResult>(); - auto future = promise.GetFuture(); - - auto extractor = MakeResultExtractor< - YandexQuery::GetResultDataResult, - TGetResultDataResult>(std::move(promise)); - - Connections_->RunDeferred< - YandexQuery::V1::YandexQueryService, - YandexQuery::GetResultDataRequest, - YandexQuery::GetResultDataResponse>( - std::move(request), - std::move(extractor), - &YandexQuery::V1::YandexQueryService::Stub::AsyncGetResultData, - DbDriverState_, - INITIAL_DEFERRED_CALL_DELAY, - TRpcRequestSettings::Make(settings)); - - return future; - } - - TAsyncListJobsResult ListJobs( - const YandexQuery::ListJobsRequest& protoRequest, - const TListJobsSettings& settings) { - auto request = MakeOperationRequest<YandexQuery::ListJobsRequest>(settings); - request = protoRequest; - - auto promise = NThreading::NewPromise<TListJobsResult>(); - auto future = promise.GetFuture(); - - auto extractor = MakeResultExtractor< - YandexQuery::ListJobsResult, - TListJobsResult>(std::move(promise)); - - Connections_->RunDeferred< - YandexQuery::V1::YandexQueryService, - YandexQuery::ListJobsRequest, - YandexQuery::ListJobsResponse>( - std::move(request), - std::move(extractor), - &YandexQuery::V1::YandexQueryService::Stub::AsyncListJobs, - DbDriverState_, - INITIAL_DEFERRED_CALL_DELAY, - TRpcRequestSettings::Make(settings)); - - return future; - } - - TAsyncDescribeJobResult DescribeJob( - const YandexQuery::DescribeJobRequest& protoRequest, - const TDescribeJobSettings& settings) { - auto request = MakeOperationRequest<YandexQuery::DescribeJobRequest>(settings); - request = protoRequest; - - auto promise = NThreading::NewPromise<TDescribeJobResult>(); - auto future = promise.GetFuture(); - - auto extractor = MakeResultExtractor< - YandexQuery::DescribeJobResult, - TDescribeJobResult>(std::move(promise)); - - Connections_->RunDeferred< - YandexQuery::V1::YandexQueryService, - YandexQuery::DescribeJobRequest, - YandexQuery::DescribeJobResponse>( - std::move(request), - std::move(extractor), - &YandexQuery::V1::YandexQueryService::Stub::AsyncDescribeJob, - DbDriverState_, - INITIAL_DEFERRED_CALL_DELAY, - TRpcRequestSettings::Make(settings)); - - return future; - } - - TAsyncCreateConnectionResult CreateConnection( - const YandexQuery::CreateConnectionRequest& protoRequest, - const TCreateConnectionSettings& settings) { - auto request = MakeOperationRequest<YandexQuery::CreateConnectionRequest>(settings); - request = protoRequest; - - auto promise = NThreading::NewPromise<TCreateConnectionResult>(); - auto future = promise.GetFuture(); - - auto extractor = MakeResultExtractor< - YandexQuery::CreateConnectionResult, - TCreateConnectionResult>(std::move(promise)); - - Connections_->RunDeferred< - YandexQuery::V1::YandexQueryService, - YandexQuery::CreateConnectionRequest, - YandexQuery::CreateConnectionResponse>( - std::move(request), - std::move(extractor), - &YandexQuery::V1::YandexQueryService::Stub::AsyncCreateConnection, - DbDriverState_, - INITIAL_DEFERRED_CALL_DELAY, - TRpcRequestSettings::Make(settings)); - - return future; - } - - TAsyncListConnectionsResult ListConnections( - const YandexQuery::ListConnectionsRequest& protoRequest, - const TListConnectionsSettings& settings) { - auto request = MakeOperationRequest<YandexQuery::ListConnectionsRequest>(settings); - request = protoRequest; - - auto promise = NThreading::NewPromise<TListConnectionsResult>(); - auto future = promise.GetFuture(); - - auto extractor = MakeResultExtractor< - YandexQuery::ListConnectionsResult, - TListConnectionsResult>(std::move(promise)); - - Connections_->RunDeferred< - YandexQuery::V1::YandexQueryService, - YandexQuery::ListConnectionsRequest, - YandexQuery::ListConnectionsResponse>( - std::move(request), - std::move(extractor), - &YandexQuery::V1::YandexQueryService::Stub::AsyncListConnections, - DbDriverState_, - INITIAL_DEFERRED_CALL_DELAY, - TRpcRequestSettings::Make(settings)); - - return future; - } - - TAsyncDescribeConnectionResult DescribeConnection( - const YandexQuery::DescribeConnectionRequest& protoRequest, - const TDescribeConnectionSettings& settings) { - auto request = MakeOperationRequest<YandexQuery::DescribeConnectionRequest>(settings); - request = protoRequest; - - auto promise = NThreading::NewPromise<TDescribeConnectionResult>(); - auto future = promise.GetFuture(); - - auto extractor = MakeResultExtractor< - YandexQuery::DescribeConnectionResult, - TDescribeConnectionResult>(std::move(promise)); - - Connections_->RunDeferred< - YandexQuery::V1::YandexQueryService, - YandexQuery::DescribeConnectionRequest, - YandexQuery::DescribeConnectionResponse>( - std::move(request), - std::move(extractor), - &YandexQuery::V1::YandexQueryService::Stub::AsyncDescribeConnection, - DbDriverState_, - INITIAL_DEFERRED_CALL_DELAY, - TRpcRequestSettings::Make(settings)); - - return future; - } - - TAsyncModifyConnectionResult ModifyConnection( - const YandexQuery::ModifyConnectionRequest& protoRequest, - const TModifyConnectionSettings& settings) { - auto request = MakeOperationRequest<YandexQuery::ModifyConnectionRequest>(settings); - request = protoRequest; - - auto promise = NThreading::NewPromise<TModifyConnectionResult>(); - auto future = promise.GetFuture(); - - auto extractor = MakeResultExtractor< - YandexQuery::ModifyConnectionResult, - TModifyConnectionResult>(std::move(promise)); - - Connections_->RunDeferred< - YandexQuery::V1::YandexQueryService, - YandexQuery::ModifyConnectionRequest, - YandexQuery::ModifyConnectionResponse>( - std::move(request), - std::move(extractor), - &YandexQuery::V1::YandexQueryService::Stub::AsyncModifyConnection, - DbDriverState_, - INITIAL_DEFERRED_CALL_DELAY, - TRpcRequestSettings::Make(settings)); - - return future; - } - - TAsyncDeleteConnectionResult DeleteConnection( - const YandexQuery::DeleteConnectionRequest& protoRequest, - const TDeleteConnectionSettings& settings) { - auto request = MakeOperationRequest<YandexQuery::DeleteConnectionRequest>(settings); - request = protoRequest; - - auto promise = NThreading::NewPromise<TDeleteConnectionResult>(); - auto future = promise.GetFuture(); - - auto extractor = MakeResultExtractor< - YandexQuery::DeleteConnectionResult, - TDeleteConnectionResult>(std::move(promise)); - - Connections_->RunDeferred< - YandexQuery::V1::YandexQueryService, - YandexQuery::DeleteConnectionRequest, - YandexQuery::DeleteConnectionResponse>( - std::move(request), - std::move(extractor), - &YandexQuery::V1::YandexQueryService::Stub::AsyncDeleteConnection, - DbDriverState_, - INITIAL_DEFERRED_CALL_DELAY, - TRpcRequestSettings::Make(settings)); - - return future; - } - - TAsyncTestConnectionResult TestConnection( - const YandexQuery::TestConnectionRequest& protoRequest, - const TTestConnectionSettings& settings) { - auto request = MakeOperationRequest<YandexQuery::TestConnectionRequest>(settings); - request = protoRequest; - - auto promise = NThreading::NewPromise<TTestConnectionResult>(); - auto future = promise.GetFuture(); - - auto extractor = MakeResultExtractor< - YandexQuery::TestConnectionResult, - TTestConnectionResult>(std::move(promise)); - - Connections_->RunDeferred< - YandexQuery::V1::YandexQueryService, - YandexQuery::TestConnectionRequest, - YandexQuery::TestConnectionResponse>( - std::move(request), - std::move(extractor), - &YandexQuery::V1::YandexQueryService::Stub::AsyncTestConnection, - DbDriverState_, - INITIAL_DEFERRED_CALL_DELAY, - TRpcRequestSettings::Make(settings)); - - return future; - } - - TAsyncCreateBindingResult CreateBinding( - const YandexQuery::CreateBindingRequest& protoRequest, - const TCreateBindingSettings& settings) { - auto request = MakeOperationRequest<YandexQuery::CreateBindingRequest>(settings); - request = protoRequest; - - auto promise = NThreading::NewPromise<TCreateBindingResult>(); - auto future = promise.GetFuture(); - - auto extractor = MakeResultExtractor< - YandexQuery::CreateBindingResult, - TCreateBindingResult>(std::move(promise)); - - Connections_->RunDeferred< - YandexQuery::V1::YandexQueryService, - YandexQuery::CreateBindingRequest, - YandexQuery::CreateBindingResponse>( - std::move(request), - std::move(extractor), - &YandexQuery::V1::YandexQueryService::Stub::AsyncCreateBinding, - DbDriverState_, - INITIAL_DEFERRED_CALL_DELAY, - TRpcRequestSettings::Make(settings)); - - return future; - } - - TAsyncListBindingsResult ListBindings( - const YandexQuery::ListBindingsRequest& protoRequest, - const TListBindingsSettings& settings) { - auto request = MakeOperationRequest<YandexQuery::ListBindingsRequest>(settings); - request = protoRequest; - - auto promise = NThreading::NewPromise<TListBindingsResult>(); - auto future = promise.GetFuture(); - - auto extractor = MakeResultExtractor< - YandexQuery::ListBindingsResult, - TListBindingsResult>(std::move(promise)); - - Connections_->RunDeferred< - YandexQuery::V1::YandexQueryService, - YandexQuery::ListBindingsRequest, - YandexQuery::ListBindingsResponse>( - std::move(request), - std::move(extractor), - &YandexQuery::V1::YandexQueryService::Stub::AsyncListBindings, - DbDriverState_, - INITIAL_DEFERRED_CALL_DELAY, - TRpcRequestSettings::Make(settings)); - - return future; - } - - TAsyncDescribeBindingResult DescribeBinding( - const YandexQuery::DescribeBindingRequest& protoRequest, - const TDescribeBindingSettings& settings) { - auto request = MakeOperationRequest<YandexQuery::DescribeBindingRequest>(settings); - request = protoRequest; - - auto promise = NThreading::NewPromise<TDescribeBindingResult>(); - auto future = promise.GetFuture(); - - auto extractor = MakeResultExtractor< - YandexQuery::DescribeBindingResult, - TDescribeBindingResult>(std::move(promise)); - - Connections_->RunDeferred< - YandexQuery::V1::YandexQueryService, - YandexQuery::DescribeBindingRequest, - YandexQuery::DescribeBindingResponse>( - std::move(request), - std::move(extractor), - &YandexQuery::V1::YandexQueryService::Stub::AsyncDescribeBinding, - DbDriverState_, - INITIAL_DEFERRED_CALL_DELAY, - TRpcRequestSettings::Make(settings)); - - return future; - } - - TAsyncModifyBindingResult ModifyBinding( - const YandexQuery::ModifyBindingRequest& protoRequest, - const TModifyBindingSettings& settings) { - auto request = MakeOperationRequest<YandexQuery::ModifyBindingRequest>(settings); - request = protoRequest; - - auto promise = NThreading::NewPromise<TModifyBindingResult>(); - auto future = promise.GetFuture(); - - auto extractor = MakeResultExtractor< - YandexQuery::ModifyBindingResult, - TModifyBindingResult>(std::move(promise)); - - Connections_->RunDeferred< - YandexQuery::V1::YandexQueryService, - YandexQuery::ModifyBindingRequest, - YandexQuery::ModifyBindingResponse>( - std::move(request), - std::move(extractor), - &YandexQuery::V1::YandexQueryService::Stub::AsyncModifyBinding, - DbDriverState_, - INITIAL_DEFERRED_CALL_DELAY, - TRpcRequestSettings::Make(settings)); - - return future; - } - - TAsyncDeleteBindingResult DeleteBinding( - const YandexQuery::DeleteBindingRequest& protoRequest, - const TDeleteBindingSettings& settings) { - auto request = MakeOperationRequest<YandexQuery::DeleteBindingRequest>(settings); - request = protoRequest; - - auto promise = NThreading::NewPromise<TDeleteBindingResult>(); - auto future = promise.GetFuture(); - - auto extractor = MakeResultExtractor< - YandexQuery::DeleteBindingResult, - TDeleteBindingResult>(std::move(promise)); - - Connections_->RunDeferred< - YandexQuery::V1::YandexQueryService, - YandexQuery::DeleteBindingRequest, - YandexQuery::DeleteBindingResponse>( - std::move(request), - std::move(extractor), - &YandexQuery::V1::YandexQueryService::Stub::AsyncDeleteBinding, - DbDriverState_, - INITIAL_DEFERRED_CALL_DELAY, - TRpcRequestSettings::Make(settings)); - - return future; - } -}; - -TClient::TClient(const TDriver& driver, const TCommonClientSettings& settings) - : Impl_(new TImpl(CreateInternalInterface(driver), settings)) -{} - -TAsyncCreateQueryResult TClient::CreateQuery( - const YandexQuery::CreateQueryRequest& request, - const TCreateQuerySettings& settings) { - return Impl_->CreateQuery(request, settings); -} - -TAsyncListQueriesResult TClient::ListQueries( - const YandexQuery::ListQueriesRequest& request, - const TListQueriesSettings& settings) { - return Impl_->ListQueries(request, settings); -} - -TAsyncDescribeQueryResult TClient::DescribeQuery( - const YandexQuery::DescribeQueryRequest& request, - const TDescribeQuerySettings& settings) { - return Impl_->DescribeQuery(request, settings); -} - -TAsyncGetQueryStatusResult TClient::GetQueryStatus( - const YandexQuery::GetQueryStatusRequest& request, - const TGetQueryStatusSettings& settings) { - return Impl_->GetQueryStatus(request, settings); -} - -TAsyncModifyQueryResult TClient::ModifyQuery( - const YandexQuery::ModifyQueryRequest& request, - const TModifyQuerySettings& settings) { - return Impl_->ModifyQuery(request, settings); -} - -TAsyncDeleteQueryResult TClient::DeleteQuery( - const YandexQuery::DeleteQueryRequest& request, - const TDeleteQuerySettings& settings) { - return Impl_->DeleteQuery(request, settings); -} - -TAsyncControlQueryResult TClient::ControlQuery( - const YandexQuery::ControlQueryRequest& request, - const TControlQuerySettings& settings) { - return Impl_->ControlQuery(request, settings); -} - -TAsyncGetResultDataResult TClient::GetResultData( - const YandexQuery::GetResultDataRequest& request, - const TGetResultDataSettings& settings) { - return Impl_->GetResultData(request, settings); -} - -TAsyncListJobsResult TClient::ListJobs( - const YandexQuery::ListJobsRequest& request, - const TListJobsSettings& settings) { - return Impl_->ListJobs(request, settings); -} - -TAsyncDescribeJobResult TClient::DescribeJob( - const YandexQuery::DescribeJobRequest& request, - const TDescribeJobSettings& settings) { - return Impl_->DescribeJob(request, settings); -} - -TAsyncCreateConnectionResult TClient::CreateConnection( - const YandexQuery::CreateConnectionRequest& request, - const TCreateConnectionSettings& settings) { - return Impl_->CreateConnection(request, settings); -} - -TAsyncListConnectionsResult TClient::ListConnections( - const YandexQuery::ListConnectionsRequest& request, - const TListConnectionsSettings& settings) { - return Impl_->ListConnections(request, settings); -} - -TAsyncDescribeConnectionResult TClient::DescribeConnection( - const YandexQuery::DescribeConnectionRequest& request, - const TDescribeConnectionSettings& settings) { - return Impl_->DescribeConnection(request, settings); -} - -TAsyncModifyConnectionResult TClient::ModifyConnection( - const YandexQuery::ModifyConnectionRequest& request, - const TModifyConnectionSettings& settings) { - return Impl_->ModifyConnection(request, settings); -} - -TAsyncDeleteConnectionResult TClient::DeleteConnection( - const YandexQuery::DeleteConnectionRequest& request, - const TDeleteConnectionSettings& settings) { - return Impl_->DeleteConnection(request, settings); -} - -TAsyncTestConnectionResult TClient::TestConnection( - const YandexQuery::TestConnectionRequest& request, - const TTestConnectionSettings& settings) { - return Impl_->TestConnection(request, settings); -} - -TAsyncCreateBindingResult TClient::CreateBinding( - const YandexQuery::CreateBindingRequest& request, - const TCreateBindingSettings& settings) { - return Impl_->CreateBinding(request, settings); -} - -TAsyncListBindingsResult TClient::ListBindings( - const YandexQuery::ListBindingsRequest& request, - const TListBindingsSettings& settings) { - return Impl_->ListBindings(request, settings); -} - -TAsyncDescribeBindingResult TClient::DescribeBinding( - const YandexQuery::DescribeBindingRequest& request, - const TDescribeBindingSettings& settings) { - return Impl_->DescribeBinding(request, settings); -} - -TAsyncModifyBindingResult TClient::ModifyBinding( - const YandexQuery::ModifyBindingRequest& request, - const TModifyBindingSettings& settings) { - return Impl_->ModifyBinding(request, settings); -} - -TAsyncDeleteBindingResult TClient::DeleteBinding( - const YandexQuery::DeleteBindingRequest& request, - const TDeleteBindingSettings& settings) { - return Impl_->DeleteBinding(request, settings); -} - -} - diff --git a/ydb/public/lib/yq/yq.h b/ydb/public/lib/yq/yq.h deleted file mode 100644 index 31b3a6b991..0000000000 --- a/ydb/public/lib/yq/yq.h +++ /dev/null @@ -1,215 +0,0 @@ -#pragma once - -#include <ydb/public/sdk/cpp/client/ydb_table/table.h> - -#include <ydb/public/api/grpc/yq_v1.grpc.pb.h> - -namespace NYdb::NYq { - -template<class TProtoResult> -class TProtoResultWrapper : public NYdb::TStatus { - friend class TClient; - -private: - TProtoResultWrapper( - NYdb::TStatus&& status, - std::unique_ptr<TProtoResult> result) - : TStatus(std::move(status)) - , Result(std::move(result)) - { } - -public: - const TProtoResult& GetResult() const { - if (!Result) { - ythrow yexception() << "Uninitialized result: " << GetIssues().ToString(); - } - return *Result; - } - - bool HasResult() const { - return Result; - } - -private: - std::unique_ptr<TProtoResult> Result; -}; - -using TCreateQueryResult = TProtoResultWrapper<YandexQuery::CreateQueryResult>; -using TAsyncCreateQueryResult = NThreading::TFuture<TCreateQueryResult>; -struct TCreateQuerySettings : public NYdb::TOperationRequestSettings<TCreateQuerySettings> {}; - -using TListQueriesResult = TProtoResultWrapper<YandexQuery::ListQueriesResult>; -using TAsyncListQueriesResult = NThreading::TFuture<TListQueriesResult>; -struct TListQueriesSettings : public NYdb::TOperationRequestSettings<TListQueriesSettings> {}; - -using TDescribeQueryResult = TProtoResultWrapper<YandexQuery::DescribeQueryResult>; -using TAsyncDescribeQueryResult = NThreading::TFuture<TDescribeQueryResult>; -struct TDescribeQuerySettings : public NYdb::TOperationRequestSettings<TDescribeQuerySettings> {}; - -using TGetQueryStatusResult = TProtoResultWrapper<YandexQuery::GetQueryStatusResult>; -using TAsyncGetQueryStatusResult = NThreading::TFuture<TGetQueryStatusResult>; -struct TGetQueryStatusSettings : public NYdb::TOperationRequestSettings<TGetQueryStatusSettings> {}; - -using TModifyQueryResult = TProtoResultWrapper<YandexQuery::ModifyQueryResult>; -using TAsyncModifyQueryResult = NThreading::TFuture<TModifyQueryResult>; -struct TModifyQuerySettings : public NYdb::TOperationRequestSettings<TModifyQuerySettings> {}; - -using TDeleteQueryResult = TProtoResultWrapper<YandexQuery::DeleteQueryResult>; -using TAsyncDeleteQueryResult = NThreading::TFuture<TDeleteQueryResult>; -struct TDeleteQuerySettings : public NYdb::TOperationRequestSettings<TDeleteQuerySettings> {}; - -using TControlQueryResult = TProtoResultWrapper<YandexQuery::ControlQueryResult>; -using TAsyncControlQueryResult = NThreading::TFuture<TControlQueryResult>; -struct TControlQuerySettings : public NYdb::TOperationRequestSettings<TControlQuerySettings> {}; - -using TGetResultDataResult = TProtoResultWrapper<YandexQuery::GetResultDataResult>; -using TAsyncGetResultDataResult = NThreading::TFuture<TGetResultDataResult>; -struct TGetResultDataSettings : public NYdb::TOperationRequestSettings<TGetResultDataSettings> {}; - -using TListJobsResult = TProtoResultWrapper<YandexQuery::ListJobsResult>; -using TAsyncListJobsResult = NThreading::TFuture<TListJobsResult>; -struct TListJobsSettings : public NYdb::TOperationRequestSettings<TListJobsSettings> {}; - -using TDescribeJobResult = TProtoResultWrapper<YandexQuery::DescribeJobResult>; -using TAsyncDescribeJobResult = NThreading::TFuture<TDescribeJobResult>; -struct TDescribeJobSettings : public NYdb::TOperationRequestSettings<TDescribeJobSettings> {}; - -using TCreateConnectionResult = TProtoResultWrapper<YandexQuery::CreateConnectionResult>; -using TAsyncCreateConnectionResult = NThreading::TFuture<TCreateConnectionResult>; -struct TCreateConnectionSettings : public NYdb::TOperationRequestSettings<TCreateConnectionSettings> {}; - -using TListConnectionsResult = TProtoResultWrapper<YandexQuery::ListConnectionsResult>; -using TAsyncListConnectionsResult = NThreading::TFuture<TListConnectionsResult>; -struct TListConnectionsSettings : public NYdb::TOperationRequestSettings<TListConnectionsSettings> {}; - -using TDescribeConnectionResult = TProtoResultWrapper<YandexQuery::DescribeConnectionResult>; -using TAsyncDescribeConnectionResult = NThreading::TFuture<TDescribeConnectionResult>; -struct TDescribeConnectionSettings : public NYdb::TOperationRequestSettings<TDescribeConnectionSettings> {}; - -using TModifyConnectionResult = TProtoResultWrapper<YandexQuery::ModifyConnectionResult>; -using TAsyncModifyConnectionResult = NThreading::TFuture<TModifyConnectionResult>; -struct TModifyConnectionSettings : public NYdb::TOperationRequestSettings<TModifyConnectionSettings> {}; - -using TDeleteConnectionResult = TProtoResultWrapper<YandexQuery::DeleteConnectionResult>; -using TAsyncDeleteConnectionResult = NThreading::TFuture<TDeleteConnectionResult>; -struct TDeleteConnectionSettings : public NYdb::TOperationRequestSettings<TDeleteConnectionSettings> {}; - -using TTestConnectionResult = TProtoResultWrapper<YandexQuery::TestConnectionResult>; -using TAsyncTestConnectionResult = NThreading::TFuture<TTestConnectionResult>; -struct TTestConnectionSettings : public NYdb::TOperationRequestSettings<TTestConnectionSettings> {}; - -using TCreateBindingResult = TProtoResultWrapper<YandexQuery::CreateBindingResult>; -using TAsyncCreateBindingResult = NThreading::TFuture<TCreateBindingResult>; -struct TCreateBindingSettings : public NYdb::TOperationRequestSettings<TCreateBindingSettings> {}; - -using TListBindingsResult = TProtoResultWrapper<YandexQuery::ListBindingsResult>; -using TAsyncListBindingsResult = NThreading::TFuture<TListBindingsResult>; -struct TListBindingsSettings : public NYdb::TOperationRequestSettings<TListBindingsSettings> {}; - -using TDescribeBindingResult = TProtoResultWrapper<YandexQuery::DescribeBindingResult>; -using TAsyncDescribeBindingResult = NThreading::TFuture<TDescribeBindingResult>; -struct TDescribeBindingSettings : public NYdb::TOperationRequestSettings<TDescribeBindingSettings> {}; - -using TModifyBindingResult = TProtoResultWrapper<YandexQuery::ModifyBindingResult>; -using TAsyncModifyBindingResult = NThreading::TFuture<TModifyBindingResult>; -struct TModifyBindingSettings : public NYdb::TOperationRequestSettings<TModifyBindingSettings> {}; - -using TDeleteBindingResult = TProtoResultWrapper<YandexQuery::DeleteBindingResult>; -using TAsyncDeleteBindingResult = NThreading::TFuture<TDeleteBindingResult>; -struct TDeleteBindingSettings : public NYdb::TOperationRequestSettings<TDeleteBindingSettings> {}; - -class TClient { - class TImpl; - -public: - TClient(const NYdb::TDriver& driver, const NYdb::TCommonClientSettings& settings = NYdb::TCommonClientSettings()); - - TAsyncCreateQueryResult CreateQuery( - const YandexQuery::CreateQueryRequest& request, - const TCreateQuerySettings& settings = TCreateQuerySettings()); - - TAsyncListQueriesResult ListQueries( - const YandexQuery::ListQueriesRequest& request, - const TListQueriesSettings& settings = TListQueriesSettings()); - - TAsyncDescribeQueryResult DescribeQuery( - const YandexQuery::DescribeQueryRequest& request, - const TDescribeQuerySettings& settings = TDescribeQuerySettings()); - - TAsyncGetQueryStatusResult GetQueryStatus( - const YandexQuery::GetQueryStatusRequest& request, - const TGetQueryStatusSettings& settings = TGetQueryStatusSettings()); - - TAsyncModifyQueryResult ModifyQuery( - const YandexQuery::ModifyQueryRequest& request, - const TModifyQuerySettings& settings = TModifyQuerySettings()); - - TAsyncDeleteQueryResult DeleteQuery( - const YandexQuery::DeleteQueryRequest& request, - const TDeleteQuerySettings& settings = TDeleteQuerySettings()); - - TAsyncControlQueryResult ControlQuery( - const YandexQuery::ControlQueryRequest& request, - const TControlQuerySettings& settings = TControlQuerySettings()); - - TAsyncGetResultDataResult GetResultData( - const YandexQuery::GetResultDataRequest& request, - const TGetResultDataSettings& settings = TGetResultDataSettings()); - - TAsyncListJobsResult ListJobs( - const YandexQuery::ListJobsRequest& request, - const TListJobsSettings& settings = TListJobsSettings()); - - TAsyncDescribeJobResult DescribeJob( - const YandexQuery::DescribeJobRequest& request, - const TDescribeJobSettings& settings = TDescribeJobSettings()); - - TAsyncCreateConnectionResult CreateConnection( - const YandexQuery::CreateConnectionRequest& request, - const TCreateConnectionSettings& settings = TCreateConnectionSettings()); - - TAsyncListConnectionsResult ListConnections( - const YandexQuery::ListConnectionsRequest& request, - const TListConnectionsSettings& settings = TListConnectionsSettings()); - - TAsyncDescribeConnectionResult DescribeConnection( - const YandexQuery::DescribeConnectionRequest& request, - const TDescribeConnectionSettings& settings = TDescribeConnectionSettings()); - - TAsyncModifyConnectionResult ModifyConnection( - const YandexQuery::ModifyConnectionRequest& request, - const TModifyConnectionSettings& settings = TModifyConnectionSettings()); - - TAsyncDeleteConnectionResult DeleteConnection( - const YandexQuery::DeleteConnectionRequest& request, - const TDeleteConnectionSettings& settings = TDeleteConnectionSettings()); - - TAsyncTestConnectionResult TestConnection( - const YandexQuery::TestConnectionRequest& request, - const TTestConnectionSettings& settings = TTestConnectionSettings()); - - TAsyncCreateBindingResult CreateBinding( - const YandexQuery::CreateBindingRequest& request, - const TCreateBindingSettings& settings = TCreateBindingSettings()); - - TAsyncListBindingsResult ListBindings( - const YandexQuery::ListBindingsRequest& request, - const TListBindingsSettings& settings = TListBindingsSettings()); - - TAsyncDescribeBindingResult DescribeBinding( - const YandexQuery::DescribeBindingRequest& request, - const TDescribeBindingSettings& settings = TDescribeBindingSettings()); - - TAsyncModifyBindingResult ModifyBinding( - const YandexQuery::ModifyBindingRequest& request, - const TModifyBindingSettings& settings = TModifyBindingSettings()); - - TAsyncDeleteBindingResult DeleteBinding( - const YandexQuery::DeleteBindingRequest& request, - const TDeleteBindingSettings& settings = TDeleteBindingSettings()); - -private: - std::shared_ptr<TImpl> Impl_; -}; - -} // namespace NYdb::NYq diff --git a/ydb/services/CMakeLists.txt b/ydb/services/CMakeLists.txt index 4b697f067a..4884874a71 100644 --- a/ydb/services/CMakeLists.txt +++ b/ydb/services/CMakeLists.txt @@ -22,4 +22,3 @@ add_subdirectory(persqueue_cluster_discovery) add_subdirectory(persqueue_v1) add_subdirectory(rate_limiter) add_subdirectory(ydb) -add_subdirectory(yq) diff --git a/ydb/services/fq/ut_integration/fq_ut.cpp b/ydb/services/fq/ut_integration/fq_ut.cpp index e58fcc9e93..2da72b0c3e 100644 --- a/ydb/services/fq/ut_integration/fq_ut.cpp +++ b/ydb/services/fq/ut_integration/fq_ut.cpp @@ -941,7 +941,7 @@ Y_UNIT_TEST_SUITE(PrivateApi) { req.mutable_query_id()->set_value("id"); req.set_scope(scope.ToString()); req.set_owner_id("some_owner"); - req.set_status(YandexQuery::QueryMeta::COMPLETED); + req.set_status(FederatedQuery::QueryMeta::COMPLETED); auto result = client.PingTask(std::move(req)).ExtractValueSync(); result.GetIssues().PrintTo(Cerr); UNIT_ASSERT_VALUES_EQUAL(result.GetStatus(), EStatus::GENERIC_ERROR); diff --git a/ydb/services/yq/CMakeLists.darwin-x86_64.txt b/ydb/services/yq/CMakeLists.darwin-x86_64.txt deleted file mode 100644 index c43b046e76..0000000000 --- a/ydb/services/yq/CMakeLists.darwin-x86_64.txt +++ /dev/null @@ -1,24 +0,0 @@ - -# This file was generated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - -add_subdirectory(ut_integration) - -add_library(ydb-services-yq) -target_link_libraries(ydb-services-yq PUBLIC - contrib-libs-cxxsupp - yutil - cpp-grpc-server - library-cpp-retry - ydb-core-grpc_services - core-grpc_services-base - ydb-library-protobuf_printer - api-grpc -) -target_sources(ydb-services-yq PRIVATE - ${CMAKE_SOURCE_DIR}/ydb/services/yq/grpc_service.cpp -) diff --git a/ydb/services/yq/CMakeLists.linux-aarch64.txt b/ydb/services/yq/CMakeLists.linux-aarch64.txt deleted file mode 100644 index 1b28a9ba1b..0000000000 --- a/ydb/services/yq/CMakeLists.linux-aarch64.txt +++ /dev/null @@ -1,25 +0,0 @@ - -# This file was generated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - -add_subdirectory(ut_integration) - -add_library(ydb-services-yq) -target_link_libraries(ydb-services-yq PUBLIC - contrib-libs-linux-headers - contrib-libs-cxxsupp - yutil - cpp-grpc-server - library-cpp-retry - ydb-core-grpc_services - core-grpc_services-base - ydb-library-protobuf_printer - api-grpc -) -target_sources(ydb-services-yq PRIVATE - ${CMAKE_SOURCE_DIR}/ydb/services/yq/grpc_service.cpp -) diff --git a/ydb/services/yq/CMakeLists.linux-x86_64.txt b/ydb/services/yq/CMakeLists.linux-x86_64.txt deleted file mode 100644 index 1b28a9ba1b..0000000000 --- a/ydb/services/yq/CMakeLists.linux-x86_64.txt +++ /dev/null @@ -1,25 +0,0 @@ - -# This file was generated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - -add_subdirectory(ut_integration) - -add_library(ydb-services-yq) -target_link_libraries(ydb-services-yq PUBLIC - contrib-libs-linux-headers - contrib-libs-cxxsupp - yutil - cpp-grpc-server - library-cpp-retry - ydb-core-grpc_services - core-grpc_services-base - ydb-library-protobuf_printer - api-grpc -) -target_sources(ydb-services-yq PRIVATE - ${CMAKE_SOURCE_DIR}/ydb/services/yq/grpc_service.cpp -) diff --git a/ydb/services/yq/CMakeLists.txt b/ydb/services/yq/CMakeLists.txt deleted file mode 100644 index d90657116d..0000000000 --- a/ydb/services/yq/CMakeLists.txt +++ /dev/null @@ -1,17 +0,0 @@ - -# This file was generated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - -if (CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64" AND UNIX AND NOT APPLE AND NOT ANDROID) - include(CMakeLists.linux-aarch64.txt) -elseif (APPLE AND CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64") - include(CMakeLists.darwin-x86_64.txt) -elseif (WIN32 AND CMAKE_SYSTEM_PROCESSOR STREQUAL "AMD64" AND NOT HAVE_CUDA) - include(CMakeLists.windows-x86_64.txt) -elseif (CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" AND UNIX AND NOT APPLE AND NOT ANDROID AND NOT HAVE_CUDA) - include(CMakeLists.linux-x86_64.txt) -endif() diff --git a/ydb/services/yq/CMakeLists.windows-x86_64.txt b/ydb/services/yq/CMakeLists.windows-x86_64.txt deleted file mode 100644 index c43b046e76..0000000000 --- a/ydb/services/yq/CMakeLists.windows-x86_64.txt +++ /dev/null @@ -1,24 +0,0 @@ - -# This file was generated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - -add_subdirectory(ut_integration) - -add_library(ydb-services-yq) -target_link_libraries(ydb-services-yq PUBLIC - contrib-libs-cxxsupp - yutil - cpp-grpc-server - library-cpp-retry - ydb-core-grpc_services - core-grpc_services-base - ydb-library-protobuf_printer - api-grpc -) -target_sources(ydb-services-yq PRIVATE - ${CMAKE_SOURCE_DIR}/ydb/services/yq/grpc_service.cpp -) diff --git a/ydb/services/yq/grpc_service.cpp b/ydb/services/yq/grpc_service.cpp deleted file mode 100644 index 16a0801948..0000000000 --- a/ydb/services/yq/grpc_service.cpp +++ /dev/null @@ -1,78 +0,0 @@ -#include "grpc_service.h" - -#include <ydb/core/grpc_services/grpc_helper.h> -#include <ydb/core/grpc_services/grpc_request_proxy.h> -#include <ydb/core/grpc_services/rpc_calls.h> -#include <ydb/core/grpc_services/service_yq.h> -#include <ydb/library/protobuf_printer/security_printer.h> - -namespace NKikimr::NGRpcService { - -TGRpcYandexQueryService::TGRpcYandexQueryService(NActors::TActorSystem *system, - TIntrusivePtr<::NMonitoring::TDynamicCounters> counters, NActors::TActorId id) - : ActorSystem_(system) - , Counters_(counters) - , GRpcRequestProxyId_(id) {} - -void TGRpcYandexQueryService::InitService(grpc::ServerCompletionQueue *cq, NGrpc::TLoggerPtr logger) { - CQ_ = cq; - SetupIncomingRequests(std::move(logger)); -} - -void TGRpcYandexQueryService::SetGlobalLimiterHandle(NGrpc::TGlobalLimiter* limiter) { - Limiter_ = limiter; -} - -bool TGRpcYandexQueryService::IncRequest() { - return Limiter_->Inc(); -} - -void TGRpcYandexQueryService::DecRequest() { - Limiter_->Dec(); - Y_ASSERT(Limiter_->GetCurrentInFlight() >= 0); -} - -void TGRpcYandexQueryService::SetupIncomingRequests(NGrpc::TLoggerPtr logger) { - auto getCounterBlock = CreateCounterCb(Counters_, ActorSystem_); - -#ifdef ADD_REQUEST -#error ADD_REQUEST macro already defined -#endif -#define ADD_REQUEST(NAME, CB) \ -MakeIntrusive<TGRpcRequest<YandexQuery::NAME##Request, YandexQuery::NAME##Response, TGRpcYandexQueryService, TSecurityTextFormatPrinter<YandexQuery::NAME##Request>, TSecurityTextFormatPrinter<YandexQuery::NAME##Response>>>( \ - this, &Service_, CQ_, \ - [this](NGrpc::IRequestContextBase *ctx) { \ - NGRpcService::ReportGrpcReqToMon(*ActorSystem_, ctx->GetPeer()); \ - ActorSystem_->Send(GRpcRequestProxyId_, Create##NAME##RequestOperationCall(ctx).release()); \ - }, \ - &YandexQuery::V1::YandexQueryService::AsyncService::Request##NAME, \ - #NAME, logger, getCounterBlock("yq", #NAME)) \ - ->Run(); \ - - ADD_REQUEST(CreateQuery, DoYandexQueryCreateQueryRequest) - ADD_REQUEST(ListQueries, DoYandexQueryListQueriesRequest) - ADD_REQUEST(DescribeQuery, DoYandexQueryDescribeQueryRequest) - ADD_REQUEST(GetQueryStatus, DoYandexQueryGetQueryStatusRequest) - ADD_REQUEST(ModifyQuery, DoYandexQueryModifyQueryRequest) - ADD_REQUEST(DeleteQuery, DoYandexQueryDeleteQueryRequest) - ADD_REQUEST(ControlQuery, DoYandexQueryControlQueryRequest) - ADD_REQUEST(GetResultData, DoYandexQueryGetResultDataRequest) - ADD_REQUEST(ListJobs, DoYandexQueryListJobsRequest) - ADD_REQUEST(DescribeJob, DoYandexQueryDescribeJobRequest) - ADD_REQUEST(CreateConnection, DoYandexQueryCreateConnectionRequest) - ADD_REQUEST(ListConnections, DoYandexQueryListConnectionsRequest) - ADD_REQUEST(DescribeConnection, DoYandexQueryDescribeConnectionRequest) - ADD_REQUEST(ModifyConnection, DoYandexQueryModifyConnectionRequest) - ADD_REQUEST(DeleteConnection, DoYandexQueryDeleteConnectionRequest) - ADD_REQUEST(TestConnection, DoYandexQueryTestConnectionRequest) - ADD_REQUEST(CreateBinding, DoYandexQueryCreateBindingRequest) - ADD_REQUEST(ListBindings, DoYandexQueryListBindingsRequest) - ADD_REQUEST(DescribeBinding, DoYandexQueryDescribeBindingRequest) - ADD_REQUEST(ModifyBinding, DoYandexQueryModifyBindingRequest) - ADD_REQUEST(DeleteBinding, DoYandexQueryDeleteBindingRequest) - -#undef ADD_REQUEST - -} - -} // namespace NKikimr::NGRpcService diff --git a/ydb/services/yq/grpc_service.h b/ydb/services/yq/grpc_service.h deleted file mode 100644 index 33a99190a6..0000000000 --- a/ydb/services/yq/grpc_service.h +++ /dev/null @@ -1,36 +0,0 @@ -#pragma once - -#include <library/cpp/actors/core/actorsystem.h> - -#include <library/cpp/grpc/server/grpc_server.h> - -#include <ydb/public/api/grpc/yq_v1.grpc.pb.h> - -namespace NKikimr { -namespace NGRpcService { - -class TGRpcYandexQueryService - : public NGrpc::TGrpcServiceBase<YandexQuery::V1::YandexQueryService> -{ -public: - TGRpcYandexQueryService(NActors::TActorSystem* system, TIntrusivePtr<::NMonitoring::TDynamicCounters> counters, - NActors::TActorId id); - - void InitService(grpc::ServerCompletionQueue* cq, NGrpc::TLoggerPtr logger) override; - void SetGlobalLimiterHandle(NGrpc::TGlobalLimiter* limiter) override; - - bool IncRequest(); - void DecRequest(); -private: - void SetupIncomingRequests(NGrpc::TLoggerPtr logger); - - NActors::TActorSystem* ActorSystem_; - grpc::ServerCompletionQueue* CQ_ = nullptr; - - TIntrusivePtr<::NMonitoring::TDynamicCounters> Counters_; - NActors::TActorId GRpcRequestProxyId_; - NGrpc::TGlobalLimiter* Limiter_ = nullptr; -}; - -} // namespace NGRpcService -} // namespace NKikimr diff --git a/ydb/services/yq/ut_integration/CMakeLists.darwin-x86_64.txt b/ydb/services/yq/ut_integration/CMakeLists.darwin-x86_64.txt deleted file mode 100644 index 4c244ac321..0000000000 --- a/ydb/services/yq/ut_integration/CMakeLists.darwin-x86_64.txt +++ /dev/null @@ -1,83 +0,0 @@ - -# This file was generated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - - -add_executable(ydb-services-yq-ut_integration) -target_compile_options(ydb-services-yq-ut_integration PRIVATE - -DUSE_CURRENT_UDF_ABI_VERSION -) -target_include_directories(ydb-services-yq-ut_integration PRIVATE - ${CMAKE_SOURCE_DIR}/ydb/services/yq -) -target_link_libraries(ydb-services-yq-ut_integration PUBLIC - contrib-libs-cxxsupp - yutil - cpp-malloc-system - library-cpp-cpuid_check - cpp-testing-unittest_main - ydb-services-yq - library-cpp-getopt - cpp-grpc-client - cpp-regex-pcre - library-cpp-svnversion - core-testlib-default - yq-libs-control_plane_storage - yq-libs-db_schema - yq-libs-private_client - public-lib-fq - ydb-services-ydb - providers-common-db_id_async_resolver - clickhouse_client_udf - library-yql-utils -) -target_link_options(ydb-services-yq-ut_integration PRIVATE - -Wl,-no_deduplicate - -Wl,-sdk_version,10.15 - -fPIC - -fPIC - -framework - CoreFoundation -) -target_sources(ydb-services-yq-ut_integration PRIVATE - ${CMAKE_SOURCE_DIR}/ydb/services/yq/ut_integration/ut_utils.cpp - ${CMAKE_SOURCE_DIR}/ydb/services/yq/ut_integration/yq_ut.cpp -) -set_property( - TARGET - ydb-services-yq-ut_integration - PROPERTY - SPLIT_FACTOR - 10 -) -add_yunittest( - NAME - ydb-services-yq-ut_integration - TEST_TARGET - ydb-services-yq-ut_integration - TEST_ARG - --print-before-suite - --print-before-test - --fork-tests - --print-times - --show-fails -) -set_yunittest_property( - TEST - ydb-services-yq-ut_integration - PROPERTY - LABELS - MEDIUM -) -set_yunittest_property( - TEST - ydb-services-yq-ut_integration - PROPERTY - PROCESSORS - 1 -) -vcs_info(ydb-services-yq-ut_integration) diff --git a/ydb/services/yq/ut_integration/CMakeLists.linux-aarch64.txt b/ydb/services/yq/ut_integration/CMakeLists.linux-aarch64.txt deleted file mode 100644 index d55aa05583..0000000000 --- a/ydb/services/yq/ut_integration/CMakeLists.linux-aarch64.txt +++ /dev/null @@ -1,85 +0,0 @@ - -# This file was generated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - - -add_executable(ydb-services-yq-ut_integration) -target_compile_options(ydb-services-yq-ut_integration PRIVATE - -DUSE_CURRENT_UDF_ABI_VERSION -) -target_include_directories(ydb-services-yq-ut_integration PRIVATE - ${CMAKE_SOURCE_DIR}/ydb/services/yq -) -target_link_libraries(ydb-services-yq-ut_integration PUBLIC - contrib-libs-linux-headers - contrib-libs-cxxsupp - yutil - cpp-malloc-jemalloc - cpp-testing-unittest_main - ydb-services-yq - library-cpp-getopt - cpp-grpc-client - cpp-regex-pcre - library-cpp-svnversion - core-testlib-default - yq-libs-control_plane_storage - yq-libs-db_schema - yq-libs-private_client - public-lib-fq - ydb-services-ydb - providers-common-db_id_async_resolver - clickhouse_client_udf - library-yql-utils -) -target_link_options(ydb-services-yq-ut_integration PRIVATE - -ldl - -lrt - -Wl,--no-as-needed - -fPIC - -fPIC - -lpthread - -lrt - -ldl -) -target_sources(ydb-services-yq-ut_integration PRIVATE - ${CMAKE_SOURCE_DIR}/ydb/services/yq/ut_integration/ut_utils.cpp - ${CMAKE_SOURCE_DIR}/ydb/services/yq/ut_integration/yq_ut.cpp -) -set_property( - TARGET - ydb-services-yq-ut_integration - PROPERTY - SPLIT_FACTOR - 10 -) -add_yunittest( - NAME - ydb-services-yq-ut_integration - TEST_TARGET - ydb-services-yq-ut_integration - TEST_ARG - --print-before-suite - --print-before-test - --fork-tests - --print-times - --show-fails -) -set_yunittest_property( - TEST - ydb-services-yq-ut_integration - PROPERTY - LABELS - MEDIUM -) -set_yunittest_property( - TEST - ydb-services-yq-ut_integration - PROPERTY - PROCESSORS - 1 -) -vcs_info(ydb-services-yq-ut_integration) diff --git a/ydb/services/yq/ut_integration/CMakeLists.linux-x86_64.txt b/ydb/services/yq/ut_integration/CMakeLists.linux-x86_64.txt deleted file mode 100644 index 0952ca6d29..0000000000 --- a/ydb/services/yq/ut_integration/CMakeLists.linux-x86_64.txt +++ /dev/null @@ -1,87 +0,0 @@ - -# This file was generated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - - -add_executable(ydb-services-yq-ut_integration) -target_compile_options(ydb-services-yq-ut_integration PRIVATE - -DUSE_CURRENT_UDF_ABI_VERSION -) -target_include_directories(ydb-services-yq-ut_integration PRIVATE - ${CMAKE_SOURCE_DIR}/ydb/services/yq -) -target_link_libraries(ydb-services-yq-ut_integration PUBLIC - contrib-libs-linux-headers - contrib-libs-cxxsupp - yutil - cpp-malloc-tcmalloc - libs-tcmalloc-no_percpu_cache - library-cpp-cpuid_check - cpp-testing-unittest_main - ydb-services-yq - library-cpp-getopt - cpp-grpc-client - cpp-regex-pcre - library-cpp-svnversion - core-testlib-default - yq-libs-control_plane_storage - yq-libs-db_schema - yq-libs-private_client - public-lib-fq - ydb-services-ydb - providers-common-db_id_async_resolver - clickhouse_client_udf - library-yql-utils -) -target_link_options(ydb-services-yq-ut_integration PRIVATE - -ldl - -lrt - -Wl,--no-as-needed - -fPIC - -fPIC - -lpthread - -lrt - -ldl -) -target_sources(ydb-services-yq-ut_integration PRIVATE - ${CMAKE_SOURCE_DIR}/ydb/services/yq/ut_integration/ut_utils.cpp - ${CMAKE_SOURCE_DIR}/ydb/services/yq/ut_integration/yq_ut.cpp -) -set_property( - TARGET - ydb-services-yq-ut_integration - PROPERTY - SPLIT_FACTOR - 10 -) -add_yunittest( - NAME - ydb-services-yq-ut_integration - TEST_TARGET - ydb-services-yq-ut_integration - TEST_ARG - --print-before-suite - --print-before-test - --fork-tests - --print-times - --show-fails -) -set_yunittest_property( - TEST - ydb-services-yq-ut_integration - PROPERTY - LABELS - MEDIUM -) -set_yunittest_property( - TEST - ydb-services-yq-ut_integration - PROPERTY - PROCESSORS - 1 -) -vcs_info(ydb-services-yq-ut_integration) diff --git a/ydb/services/yq/ut_integration/CMakeLists.txt b/ydb/services/yq/ut_integration/CMakeLists.txt deleted file mode 100644 index d90657116d..0000000000 --- a/ydb/services/yq/ut_integration/CMakeLists.txt +++ /dev/null @@ -1,17 +0,0 @@ - -# This file was generated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - -if (CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64" AND UNIX AND NOT APPLE AND NOT ANDROID) - include(CMakeLists.linux-aarch64.txt) -elseif (APPLE AND CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64") - include(CMakeLists.darwin-x86_64.txt) -elseif (WIN32 AND CMAKE_SYSTEM_PROCESSOR STREQUAL "AMD64" AND NOT HAVE_CUDA) - include(CMakeLists.windows-x86_64.txt) -elseif (CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" AND UNIX AND NOT APPLE AND NOT ANDROID AND NOT HAVE_CUDA) - include(CMakeLists.linux-x86_64.txt) -endif() diff --git a/ydb/services/yq/ut_integration/CMakeLists.windows-x86_64.txt b/ydb/services/yq/ut_integration/CMakeLists.windows-x86_64.txt deleted file mode 100644 index af48142d84..0000000000 --- a/ydb/services/yq/ut_integration/CMakeLists.windows-x86_64.txt +++ /dev/null @@ -1,75 +0,0 @@ - -# This file was generated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - - -add_executable(ydb-services-yq-ut_integration) -target_compile_options(ydb-services-yq-ut_integration PRIVATE - -DUSE_CURRENT_UDF_ABI_VERSION -) -target_include_directories(ydb-services-yq-ut_integration PRIVATE - ${CMAKE_SOURCE_DIR}/ydb/services/yq -) -target_link_libraries(ydb-services-yq-ut_integration PUBLIC - contrib-libs-cxxsupp - yutil - cpp-malloc-system - library-cpp-cpuid_check - cpp-testing-unittest_main - ydb-services-yq - library-cpp-getopt - cpp-grpc-client - cpp-regex-pcre - library-cpp-svnversion - core-testlib-default - yq-libs-control_plane_storage - yq-libs-db_schema - yq-libs-private_client - public-lib-fq - ydb-services-ydb - providers-common-db_id_async_resolver - common-clickhouse-client - library-yql-utils -) -target_sources(ydb-services-yq-ut_integration PRIVATE - ${CMAKE_SOURCE_DIR}/ydb/services/yq/ut_integration/ut_utils.cpp - ${CMAKE_SOURCE_DIR}/ydb/services/yq/ut_integration/yq_ut.cpp -) -set_property( - TARGET - ydb-services-yq-ut_integration - PROPERTY - SPLIT_FACTOR - 10 -) -add_yunittest( - NAME - ydb-services-yq-ut_integration - TEST_TARGET - ydb-services-yq-ut_integration - TEST_ARG - --print-before-suite - --print-before-test - --fork-tests - --print-times - --show-fails -) -set_yunittest_property( - TEST - ydb-services-yq-ut_integration - PROPERTY - LABELS - MEDIUM -) -set_yunittest_property( - TEST - ydb-services-yq-ut_integration - PROPERTY - PROCESSORS - 1 -) -vcs_info(ydb-services-yq-ut_integration) diff --git a/ydb/services/yq/ut_integration/ut_utils.cpp b/ydb/services/yq/ut_integration/ut_utils.cpp deleted file mode 100644 index dd92259edc..0000000000 --- a/ydb/services/yq/ut_integration/ut_utils.cpp +++ /dev/null @@ -1,93 +0,0 @@ -#include "ut_utils.h" - -#include <ydb/public/sdk/cpp/client/ydb_driver/driver.h> -#include <ydb/public/lib/fq/scope.h> -#include <ydb/core/yq/libs/actors/proxy.h> -#include <ydb/core/yq/libs/events/events.h> - -#include <library/cpp/time_provider/time_provider.h> -#include <library/cpp/testing/common/env.h> -#include <library/cpp/protobuf/util/pb_io.h> -#include <library/cpp/actors/testlib/test_runtime.h> - -#include <ydb/library/yql/utils/bind_in_range.h> - -#include <util/system/file.h> -#include <util/stream/str.h> -#include <util/string/printf.h> -#include <util/string/builder.h> - -#include <library/cpp/protobuf/json/proto2json.h> - -using namespace NYdb; -using namespace NYdb::NFq; -using namespace NActors; - -void UpsertToExistingTable(TDriver& driver, const TString& location){ - Y_UNUSED(location); - const TString tablePrefix = "Root/yq"; - NYdb::NTable::TClientSettings settings; - NYdb::NTable::TTableClient client(driver, settings); - auto sessionOp = client.CreateSession().ExtractValueSync(); - if (!sessionOp.IsSuccess()) { - ythrow yexception() << sessionOp.GetStatus() << "\n" << sessionOp.GetIssues().ToString(); - } - auto session = sessionOp.GetSession(); - auto timeProvider = CreateDefaultTimeProvider(); - auto now = timeProvider->Now(); - NYdb::TParamsBuilder paramsBuilder; - - paramsBuilder.AddParam("$now").Timestamp(now).Build(); - auto params = paramsBuilder.Build(); - - const TString scope = TScope("some_folder_id").ToString(); - - { - auto result = session.ExecuteSchemeQuery( - Sprintf(R"___( - --!syntax_v1 - CREATE TABLE `%s/%s` ( - id String, - PRIMARY KEY (id) - ); - )___", tablePrefix.c_str(), "empty_table") - ).ExtractValueSync(); - if (!result.IsSuccess()) { - ythrow yexception() << result.GetStatus() << "\n" << result.GetIssues().ToString(); - } - } - - { - NYdb::TParamsBuilder paramsBuilder; - auto result = session.ExecuteDataQuery( - Sprintf(R"___( - --!syntax_v1 - upsert into `%s/empty_table` - (id) - values - ("test_id1"), ("test_id2"); - )___", tablePrefix.c_str()), - NYdb::NTable::TTxControl::BeginTx(NYdb::NTable::TTxSettings::SerializableRW()).CommitTx(), - paramsBuilder.Build(), - NYdb::NTable::TExecDataQuerySettings()).ExtractValueSync(); - if (!result.IsSuccess()) { - ythrow yexception() << result.GetStatus() << "\n" << result.GetIssues().ToString(); - } - } - - { - NYdb::TParamsBuilder paramsBuilder; - auto result = session.ExecuteDataQuery( - Sprintf(R"___( - --!syntax_v1 - delete from `%s/empty_table`; - )___", tablePrefix.c_str()), - NYdb::NTable::TTxControl::BeginTx(NYdb::NTable::TTxSettings::SerializableRW()).CommitTx(), - paramsBuilder.Build(), - NYdb::NTable::TExecDataQuerySettings()).ExtractValueSync(); - if (!result.IsSuccess()) { - ythrow yexception() << result.GetStatus() << "\n" << result.GetIssues().ToString(); - } - } -} - diff --git a/ydb/services/yq/ut_integration/ut_utils.h b/ydb/services/yq/ut_integration/ut_utils.h deleted file mode 100644 index a627c45929..0000000000 --- a/ydb/services/yq/ut_integration/ut_utils.h +++ /dev/null @@ -1,9 +0,0 @@ -#pragma once - -#include <ydb/public/sdk/cpp/client/ydb_driver/driver.h> -#include <util/system/shellcommand.h> -#include <contrib/libs/curl/include/curl/curl.h> -#include <library/cpp/json/json_reader.h> - -void UpsertToExistingTable(NYdb::TDriver& driver, const TString& location); - diff --git a/ydb/services/yq/ut_integration/yq_ut.cpp b/ydb/services/yq/ut_integration/yq_ut.cpp deleted file mode 100644 index b7a3640ad4..0000000000 --- a/ydb/services/yq/ut_integration/yq_ut.cpp +++ /dev/null @@ -1,998 +0,0 @@ -#include <ydb/services/ydb/ydb_common_ut.h> -#include <ydb/public/sdk/cpp/client/ydb_driver/driver.h> - -#include <ydb/public/lib/fq/fq.h> -#include <ydb/public/lib/fq/helpers.h> -#include <ydb/public/lib/fq/scope.h> -#include <ydb/core/yq/libs/db_schema/db_schema.h> -#include <ydb/core/yq/libs/mock/yql_mock.h> -#include <ydb/core/yq/libs/private_client/private_client.h> - -#include <ydb/core/yq/libs/control_plane_storage/message_builders.h> -#include <ydb/core/yq/libs/actors/database_resolver.h> - -#include <ydb/library/yql/public/issue/yql_issue_message.h> - -#include <library/cpp/protobuf/util/pb_io.h> -#include <library/cpp/retry/retry.h> -#include <util/system/mutex.h> -#include "ut_utils.h" -#include <google/protobuf/util/time_util.h> - -#include <util/system/hostname.h> - -#include <util/string/split.h> - -using namespace NYdb; -using namespace FederatedQuery; -using namespace NYdb::NFq; - -namespace { - const ui32 Retries = 10; - - void PrintProtoIssues(const NProtoBuf::RepeatedPtrField<::Ydb::Issue::IssueMessage>& protoIssues) { - if (protoIssues.empty()) { - Cerr << "No Issues" << Endl; - return; - } - NYql::TIssues issues; - NYql::IssuesFromMessage(protoIssues, issues); - Cerr << ">>> Issues: " << issues.ToString() << Endl; - } - - TString CreateNewHistoryAndWaitFinish(const TString& folderId, - NYdb::NFq::TClient& client, const TString& yqlText, - const FederatedQuery::QueryMeta::ComputeStatus& expectedStatusResult) - { - //CreateQuery - TString queryId; - { - auto request = ::NFq::TCreateQueryBuilder{} - .SetText(yqlText) - .Build(); - auto result = client.CreateQuery( - request, CreateFqSettings<TCreateQuerySettings>(folderId)) - .ExtractValueSync(); - - UNIT_ASSERT_VALUES_EQUAL_C(result.GetStatus(), EStatus::SUCCESS, result.GetIssues().ToString()); - queryId = result.GetResult().query_id(); - } - // GetQueryStatus - const auto request = ::NFq::TGetQueryStatusBuilder{} - .SetQueryId(queryId) - .Build(); - const auto result = DoWithRetryOnRetCode([&]() { - auto result = client.GetQueryStatus( - request, CreateFqSettings<TGetQueryStatusSettings>(folderId)) - .ExtractValueSync(); - UNIT_ASSERT_VALUES_EQUAL_C(result.GetStatus(), EStatus::SUCCESS, result.GetIssues().ToString()); - return result.GetResult().status() == expectedStatusResult; - }, TRetryOptions(Retries)); - UNIT_ASSERT_C(result, "the execution of the query did not end within the time limit"); - - return queryId; - } - - void CheckGetResultData( - NYdb::NFq::TClient& client, - const TString& queryId, - const TString& folderId, - const ui64 rowsCount, - const int colsSize, - const int answer) - { - const auto request = ::NFq::TGetResultDataBuilder{} - .SetQueryId(queryId) - .Build(); - const auto result = client.GetResultData( - request, CreateFqSettings<TGetResultDataSettings>(folderId)) - .ExtractValueSync(); - UNIT_ASSERT_VALUES_EQUAL_C(result.GetStatus(), EStatus::SUCCESS, result.GetIssues().ToString()); - - const auto& resultSet = result.GetResult().result_set(); - UNIT_ASSERT_VALUES_EQUAL(resultSet.rows().size(), rowsCount); - UNIT_ASSERT_VALUES_EQUAL(resultSet.columns().size(), colsSize); - if (!resultSet.rows().empty()) { - const auto& item = resultSet.rows(0).items(0); - TString str = item.DebugString(); - TVector<TString> arr; - StringSplitter(str).Split(' ').SkipEmpty().AddTo(&arr); - Y_VERIFY(arr.size() == 2, "Incorrect numeric result"); - UNIT_ASSERT_VALUES_EQUAL(std::stoi(arr.back()), answer); - } - } -} - -Y_UNIT_TEST_SUITE(Yq_1) { - Y_UNIT_TEST(Basic) { - TKikimrWithGrpcAndRootSchema server({}, {}, {}, true); - ui16 grpc = server.GetPort(); - TString location = TStringBuilder() << "localhost:" << grpc; - auto driver = TDriver(TDriverConfig().SetEndpoint(location).SetAuthToken("root@builtin")); - NYdb::NFq::TClient client(driver); - const auto folderId = "some_folder_id"; - const auto queryId = CreateNewHistoryAndWaitFinish(folderId, client, "select 1", FederatedQuery::QueryMeta::COMPLETED); - CheckGetResultData(client, queryId, folderId, 1, 1, 1); - - { - const auto request = ::NFq::TDescribeQueryBuilder() - .SetQueryId("foo") - .Build(); - const auto result = DoWithRetryOnRetCode([&]() { - auto result = client.DescribeQuery( - request, CreateFqSettings<TDescribeQuerySettings>("WTF")) - .ExtractValueSync(); - return result.GetStatus() == EStatus::BAD_REQUEST; - }, TRetryOptions(Retries)); - UNIT_ASSERT_C(result, "the execution of the query did not end within the time limit"); - } - - { - auto request = ::NFq::TListQueriesBuilder{}.Build(); - auto result = DoWithRetryOnRetCode([&]() { - auto result = client.ListQueries( - request, CreateFqSettings<TListQueriesSettings>("WTF")) - .ExtractValueSync(); - UNIT_ASSERT_VALUES_EQUAL_C(result.GetStatus(), EStatus::SUCCESS, result.GetIssues().ToString()); - UNIT_ASSERT_VALUES_EQUAL(result.GetResult().query().size(), 0); - return result.GetStatus() == EStatus::SUCCESS; - }, TRetryOptions(Retries)); - UNIT_ASSERT_C(result, "the execution of the query did not end within the time limit"); - } - - { - const auto request = ::NFq::TDescribeQueryBuilder() - .SetQueryId(queryId) - .Build(); - auto result = client.DescribeQuery( - request, CreateFqSettings<TDescribeQuerySettings>(folderId)) - .ExtractValueSync(); - UNIT_ASSERT_VALUES_EQUAL_C(result.GetStatus(), EStatus::SUCCESS, result.GetIssues().ToString()); - const auto status = result.GetResult().query().meta().status(); - UNIT_ASSERT(status == FederatedQuery::QueryMeta::COMPLETED); - } - - { - const auto request = ::NFq::TModifyQueryBuilder() - .SetQueryId(queryId) - .SetName("MODIFIED_NAME") - .Build(); - const auto result = client.ModifyQuery( - request, CreateFqSettings<TModifyQuerySettings>(folderId)) - .ExtractValueSync(); - UNIT_ASSERT_VALUES_EQUAL_C(result.GetStatus(), EStatus::SUCCESS, result.GetIssues().ToString()); - } - - { - const auto request = ::NFq::TDescribeQueryBuilder() - .SetQueryId(queryId) - .Build(); - const auto result = client.DescribeQuery( - request, CreateFqSettings<TDescribeQuerySettings>(folderId)) - .ExtractValueSync(); - UNIT_ASSERT_VALUES_EQUAL_C(result.GetStatus(), EStatus::SUCCESS, result.GetIssues().ToString()); - const auto& res = result.GetResult(); - UNIT_ASSERT_VALUES_EQUAL(res.query().content().name(), "MODIFIED_NAME"); - UNIT_ASSERT(res.query().content().acl().visibility() == static_cast<int>(Acl_Visibility_SCOPE)); - } - - { - const auto request = ::NFq::TDescribeQueryBuilder() - .SetQueryId("") - .Build(); - const auto result = client.DescribeQuery( - request, CreateFqSettings<TDescribeQuerySettings>("")) - .ExtractValueSync(); - UNIT_ASSERT_VALUES_EQUAL_C(result.GetStatus(), EStatus::BAD_REQUEST, result.GetIssues().ToString()); - } - - { - const auto request = ::NFq::TGetResultDataBuilder() - .SetQueryId("") - .Build(); - const auto result = client.GetResultData( - request, CreateFqSettings<TGetResultDataSettings>("")) - .ExtractValueSync(); - UNIT_ASSERT_VALUES_EQUAL_C(result.GetStatus(), EStatus::BAD_REQUEST, result.GetIssues().ToString()); - } - } - - Y_UNIT_TEST(Basic_EmptyTable) { - TKikimrWithGrpcAndRootSchema server({}, {}, {}, true); - ui16 grpc = server.GetPort(); - TString location = TStringBuilder() << "localhost:" << grpc; - auto driver = TDriver(TDriverConfig().SetEndpoint(location).SetAuthToken("root@builtin")); - UpsertToExistingTable(driver, location); - NYdb::NFq::TClient client(driver); - const TString folderId = "some_folder_id"; - { - const auto request = ::NFq::TCreateConnectionBuilder() - .SetName("testdbempty") - .CreateYdb("Root", location, "") - .Build(); - const auto result = client - .CreateConnection(request, CreateFqSettings<TCreateConnectionSettings>(folderId)) - .ExtractValueSync(); - UNIT_ASSERT_C(result.GetStatus() == EStatus::SUCCESS, result.GetIssues().ToString()); - } - - const TString queryId = CreateNewHistoryAndWaitFinish( - folderId, client, - "select count(*) from testdbempty.`yq/empty_table`", - FederatedQuery::QueryMeta::COMPLETED); - CheckGetResultData(client, queryId, folderId, 1, 1, 0); - } - - Y_UNIT_TEST(Basic_EmptyList) { - TKikimrWithGrpcAndRootSchema server({}, {}, {}, true); - ui16 grpc = server.GetPort(); - TString location = TStringBuilder() << "localhost:" << grpc; - auto driver = TDriver(TDriverConfig().SetEndpoint(location).SetAuthToken("root@builtin")); - NYdb::NFq::TClient client(driver); - const TString folderId = "some_folder_id"; - auto expectedStatus = FederatedQuery::QueryMeta::COMPLETED; - CreateNewHistoryAndWaitFinish(folderId, client, "select []", expectedStatus); - } - - Y_UNIT_TEST(Basic_EmptyDict) { - TKikimrWithGrpcAndRootSchema server({}, {}, {}, true); - ui16 grpc = server.GetPort(); - TString location = TStringBuilder() << "localhost:" << grpc; - auto driver = TDriver(TDriverConfig().SetEndpoint(location).SetAuthToken("root@builtin")); - NYdb::NFq::TClient client(driver); - const TString folderId = "some_folder_id"; - auto expectedStatus = FederatedQuery::QueryMeta::COMPLETED; - CreateNewHistoryAndWaitFinish(folderId, client, "select {}", expectedStatus); - } - - Y_UNIT_TEST(Basic_Null) { - TKikimrWithGrpcAndRootSchema server({}, {}, {}, true); - ui16 grpc = server.GetPort(); - TString location = TStringBuilder() << "localhost:" << grpc; - auto driver = TDriver(TDriverConfig().SetEndpoint(location).SetAuthToken("root@builtin")); - NYdb::NFq::TClient client(driver); - const TString folderId = "some_folder_id"; - auto expectedStatus = FederatedQuery::QueryMeta::COMPLETED; - CreateNewHistoryAndWaitFinish(folderId, client, "select null", expectedStatus); - } - - SIMPLE_UNIT_FORKED_TEST(Basic_Tagged) { - TKikimrWithGrpcAndRootSchema server({}, {}, {}, true); - ui16 grpc = server.GetPort(); - TString location = TStringBuilder() << "localhost:" << grpc; - auto driver = TDriver(TDriverConfig().SetEndpoint(location).SetAuthToken("root@builtin")); - NYdb::NFq::TClient client(driver); - const TString folderId = "some_folder_id"; - - - { - auto request = ::NFq::TCreateConnectionBuilder{} - .SetName("testdb00") - .CreateYdb("Root", location, "") - .Build(); - - auto result = client.CreateConnection( - request, CreateFqSettings<TCreateConnectionSettings>(folderId)) - .ExtractValueSync(); - - UNIT_ASSERT_VALUES_EQUAL_C(result.GetStatus(), EStatus::SUCCESS, result.GetIssues().ToString()); - } - - auto expectedStatus = FederatedQuery::QueryMeta::COMPLETED; - CreateNewHistoryAndWaitFinish(folderId, client, "select AsTagged(count(*), \"tag\") from testdb00.`yq/connections`", expectedStatus); - } - - Y_UNIT_TEST(Basic_TaggedLiteral) { - TKikimrWithGrpcAndRootSchema server({}, {}, {}, true); - ui16 grpc = server.GetPort(); - TString location = TStringBuilder() << "localhost:" << grpc; - auto driver = TDriver(TDriverConfig().SetEndpoint(location).SetAuthToken("root@builtin")); - NYdb::NFq::TClient client(driver); - const TString folderId = "some_folder_id"; - - auto expectedStatus = FederatedQuery::QueryMeta::COMPLETED; - CreateNewHistoryAndWaitFinish(folderId, client, "select AsTagged(1, \"tag\")", expectedStatus); - } - - // use fork for data test due to ch initialization problem - SIMPLE_UNIT_FORKED_TEST(ExtendedDatabaseId) { - TKikimrWithGrpcAndRootSchema server({}, {}, {}, true); - ui16 grpc = server.GetPort(); - TString location = TStringBuilder() << "localhost:" << grpc; - auto driver = TDriver(TDriverConfig().SetEndpoint(location).SetAuthToken("root@builtin")); - - NYdb::NFq::TClient client(driver); - const TString folderId = "folder_id_" + CreateGuidAsString(); - { - const auto request = ::NFq::TCreateConnectionBuilder() - .SetName("testdb01") - .CreateYdb("FakeDatabaseId", "") - .Build(); - const auto result = client - .CreateConnection(request, CreateFqSettings<TCreateConnectionSettings>(folderId)) - .ExtractValueSync(); - UNIT_ASSERT_C(result.GetStatus() == EStatus::SUCCESS, result.GetIssues().ToString()); - } - - { - const auto request = ::NFq::TCreateConnectionBuilder() - .SetName("testdb02") - .CreateYdb("FakeDatabaseId", "") - .Build(); - const auto result = client - .CreateConnection(request, CreateFqSettings<TCreateConnectionSettings>(folderId)) - .ExtractValueSync(); - UNIT_ASSERT_C(result.GetStatus() == EStatus::SUCCESS, result.GetIssues().ToString()); - } - - { - const auto queryId = CreateNewHistoryAndWaitFinish(folderId, client, - "select count(*) from testdb01.`yq/connections`", FederatedQuery::QueryMeta::COMPLETED); - CheckGetResultData(client, queryId, folderId, 1, 1, 2); - } - - { - // test connections db with 2 databaseId - const auto queryId = CreateNewHistoryAndWaitFinish(folderId, client, - "select count(*) from testdb02.`yq/connections`", FederatedQuery::QueryMeta::COMPLETED); - CheckGetResultData(client, queryId, folderId, 1, 1, 2); - } - } - - Y_UNIT_TEST(DescribeConnection) { - TKikimrWithGrpcAndRootSchema server({}, {}, {}, true); - ui16 grpc = server.GetPort(); - TString location = TStringBuilder() << "localhost:" << grpc; - auto driver = TDriver(TDriverConfig().SetEndpoint(location).SetAuthToken("root@builtin")); - NYdb::NFq::TClient client(driver); - const TString folderId = "some_folder_id"; - TString conId; - { - const auto request = ::NFq::TCreateConnectionBuilder() - .SetName("created_conn") - .CreateYdb("created_db", "") - .Build(); - const auto result = client - .CreateConnection(request, CreateFqSettings<TCreateConnectionSettings>(folderId)) - .ExtractValueSync(); - UNIT_ASSERT_C(result.GetStatus() == EStatus::SUCCESS, result.GetIssues().ToString()); - conId = result.GetResult().connection_id(); - } - { - auto request = ::NFq::TDescribeConnectionBuilder() - .SetConnectionId(conId) - .Build(); - auto result = client - .DescribeConnection(request, CreateFqSettings<TDescribeConnectionSettings>(folderId)) - .ExtractValueSync(); - UNIT_ASSERT_VALUES_EQUAL(result.GetStatus(), EStatus::SUCCESS); - const auto& res = result.GetResult().connection(); - UNIT_ASSERT_VALUES_EQUAL(res.meta().id(), conId); - UNIT_ASSERT_VALUES_EQUAL(res.meta().created_by(), "root@builtin"); - UNIT_ASSERT_VALUES_EQUAL(res.meta().modified_by(), "root@builtin"); - UNIT_ASSERT_VALUES_EQUAL(res.content().name(), "created_conn"); - } - } - - Y_UNIT_TEST(ListConnections) { - TKikimrWithGrpcAndRootSchema server({}, {}, {}, true); - ui16 grpc = server.GetPort(); - TString location = TStringBuilder() << "localhost:" << grpc; - auto driver = TDriver(TDriverConfig().SetEndpoint(location).SetAuthToken("root@builtin")); - NYdb::NFq::TClient client(driver); - const size_t conns = 3; - const auto folderId = TString(__func__) + "folder_id"; - {//CreateConnections - for (size_t i = 0; i < conns - 1; ++i) { - const auto request = ::NFq::TCreateConnectionBuilder() - .SetName("testdb" + ToString(i)) - .CreateYdb("FakeDatabaseId", "") - .Build(); - const auto result = client - .CreateConnection(request, CreateFqSettings<TCreateConnectionSettings>(folderId)) - .ExtractValueSync(); - UNIT_ASSERT_C(result.GetStatus() == EStatus::SUCCESS, result.GetIssues().ToString()); - } - - // yds - const auto request = ::NFq::TCreateConnectionBuilder() - .SetName("testdb2") - .CreateDataStreams("FakeDatabaseId", "") // We can use the same db in yds and ydb - .Build(); - const auto result = client - .CreateConnection(request, CreateFqSettings<TCreateConnectionSettings>(folderId)) - .ExtractValueSync(); - UNIT_ASSERT_C(result.GetStatus() == EStatus::SUCCESS, result.GetIssues().ToString()); - } - - { - const auto request = ::NFq::TListConnectionsBuilder().Build(); - auto result = client - .ListConnections(request, CreateFqSettings<TListConnectionsSettings>(folderId)) - .ExtractValueSync(); - UNIT_ASSERT_VALUES_EQUAL_C(result.GetStatus(), EStatus::SUCCESS, result.GetIssues().ToString()); - UNIT_ASSERT_VALUES_EQUAL(result.GetResult().connection().size(), conns); - size_t i = 0; - auto res = result.GetResult(); - auto* conns = res.mutable_connection(); - std::sort(conns->begin(), conns->end(), [&](const auto& lhs, const auto& rhs) { - return lhs.content().name() < rhs.content().name(); - }); - for (const auto& conn : *conns) { - const auto& content = conn.content(); - const auto& meta = conn.meta(); - UNIT_ASSERT_VALUES_EQUAL(content.name(), "testdb" + ToString(i)); - UNIT_ASSERT_VALUES_EQUAL(meta.created_by(), "root@builtin"); - UNIT_ASSERT_VALUES_EQUAL(meta.modified_by(), "root@builtin"); - if (i < 2) { - UNIT_ASSERT_C(content.setting().has_ydb_database(), content); - } else { - UNIT_ASSERT_C(content.setting().has_data_streams(), content); - } - i++; - } - } - } - - Y_UNIT_TEST(ListConnectionsOnEmptyConnectionsTable) { - TKikimrWithGrpcAndRootSchema server({}, {}, {}, true); - ui16 grpc = server.GetPort(); - TString location = TStringBuilder() << "localhost:" << grpc; - auto driver = TDriver(TDriverConfig().SetEndpoint(location).SetAuthToken("root@builtin")); - NYdb::NFq::TClient client(driver); - - { - const auto request = ::NFq::TListConnectionsBuilder().Build(); - auto result = client - .ListConnections(request, CreateFqSettings<TListConnectionsSettings>("WTF")) - .ExtractValueSync(); - UNIT_ASSERT_VALUES_EQUAL_C(result.GetStatus(), EStatus::SUCCESS, result.GetIssues().ToString()); - UNIT_ASSERT(result.GetResult().connection().empty()); - } - } - - Y_UNIT_TEST(ModifyConnections) { - TKikimrWithGrpcAndRootSchema server({}, {}, {}, true); - ui16 grpc = server.GetPort(); - TString location = TStringBuilder() << "localhost:" << grpc; - TString userToken = "root@builtin"; - TString userId = "root"; - auto driver = TDriver(TDriverConfig().SetEndpoint(location).SetAuthToken(userToken)); - NYdb::NFq::TClient client(driver); - const auto folderId = TString(__func__) + "folder_id"; - TString conId; - - { - const auto request = ::NFq::TCreateConnectionBuilder() - .SetName("created_conn") - .CreateYdb("created_db", "") - .Build(); - const auto result = client - .CreateConnection(request, CreateFqSettings<TCreateConnectionSettings>(folderId)) - .ExtractValueSync(); - UNIT_ASSERT_C(result.GetStatus() == EStatus::SUCCESS, result.GetIssues().ToString()); - conId = result.GetResult().connection_id(); - } - - {//Modify - const auto request = ::NFq::TModifyConnectionBuilder() - .SetName("modified_name") - .SetConnectionId(conId) - .CreateYdb("new ydb", "") - .SetDescription("Modified") - .Build(); - const auto result = client - .ModifyConnection(request, CreateFqSettings<TModifyConnectionSettings>(folderId)) - .ExtractValueSync(); - UNIT_ASSERT_C(result.GetStatus() == EStatus::SUCCESS, result.GetIssues().ToString()); - } - - { - auto request = ::NFq::TDescribeConnectionBuilder() - .SetConnectionId(conId) - .Build(); - auto result = client - .DescribeConnection(request, CreateFqSettings<TDescribeConnectionSettings>(folderId)) - .ExtractValueSync(); - UNIT_ASSERT_VALUES_EQUAL_C(result.GetStatus(), EStatus::SUCCESS, result.GetIssues().ToString()); - const auto& res = result.GetResult().connection(); - UNIT_ASSERT_VALUES_EQUAL(res.meta().id(), conId); - UNIT_ASSERT_VALUES_EQUAL(res.meta().created_by(), "root@builtin"); - UNIT_ASSERT_VALUES_EQUAL(res.meta().modified_by(), "root@builtin"); - UNIT_ASSERT_VALUES_EQUAL(res.content().name(), "modified_name"); - UNIT_ASSERT_VALUES_EQUAL(res.content().description(), "Modified"); - } - } - - Y_UNIT_TEST(DeleteConnections) { - TKikimrWithGrpcAndRootSchema server({}, {}, {}, true); - ui16 grpc = server.GetPort(); - TString location = TStringBuilder() << "localhost:" << grpc; - auto driver = TDriver(TDriverConfig().SetEndpoint(location).SetAuthToken("root@builtin")); - NYdb::NFq::TClient client(driver); - const auto folderId = TString(__func__) + "folder_id"; - TString conId; - - { - const auto request = ::NFq::TCreateConnectionBuilder() - .SetName("created_conn") - .CreateYdb("created_db", "") - .Build(); - const auto result = client - .CreateConnection(request, CreateFqSettings<TCreateConnectionSettings>(folderId)) - .ExtractValueSync(); - UNIT_ASSERT_C(result.GetStatus() == EStatus::SUCCESS, result.GetIssues().ToString()); - conId = result.GetResult().connection_id(); - } - - { - const auto request = ::NFq::TDeleteConnectionBuilder() - .SetConnectionId(conId) - .Build(); - - const auto result = client - .DeleteConnection(request, CreateFqSettings<TDeleteConnectionSettings>(folderId)) - .ExtractValueSync(); - UNIT_ASSERT_C(result.GetStatus() == EStatus::SUCCESS, result.GetIssues().ToString()); - } - } - - Y_UNIT_TEST(Create_And_Modify_The_Same_Connection) { - TKikimrWithGrpcAndRootSchema server({}, {}, {}, true); - ui16 grpc = server.GetPort(); - TString location = TStringBuilder() << "localhost:" << grpc; - TString userToken = "root@builtin"; - auto driver = TDriver(TDriverConfig().SetEndpoint(location).SetAuthToken(userToken)); - NYdb::NFq::TClient client(driver); - - const auto folderId = TString(__func__) + "folder_id"; - TString conId; - - { - const auto request = ::NFq::TCreateConnectionBuilder() - .SetName("created_conn") - .CreateYdb("created_db", "") - .Build(); - const auto result = client - .CreateConnection(request, CreateFqSettings<TCreateConnectionSettings>(folderId)) - .ExtractValueSync(); - UNIT_ASSERT_C(result.GetStatus() == EStatus::SUCCESS, result.GetIssues().ToString()); - conId = result.GetResult().connection_id(); - } - - { - const auto request = ::NFq::TModifyConnectionBuilder() - .SetConnectionId(conId) - .CreateYdb("modified_db", "")//TODO remove - .Build(); - const auto result = client - .ModifyConnection(request, CreateFqSettings<TModifyConnectionSettings>(folderId)) - .ExtractValueSync(); - UNIT_ASSERT_C(result.GetStatus() == EStatus::SUCCESS, result.GetIssues().ToString()); - } - } - - Y_UNIT_TEST(CreateConnection_With_Existing_Name) { - TKikimrWithGrpcAndRootSchema server({}, {}, {}, true); - ui16 grpc = server.GetPort(); - TString location = TStringBuilder() << "localhost:" << grpc; - TString userToken = "root@builtin"; - auto driver = TDriver(TDriverConfig().SetEndpoint(location).SetAuthToken(userToken)); - NYdb::NFq::TClient client(driver); - - const auto folderId = TString(__func__) + "folder_id"; - auto name = TString(__func__) + "_name"; - name.to_lower(); - - { - const auto request = ::NFq::TCreateConnectionBuilder() - .SetName(name) - .CreateYdb("created_db", "") - .Build(); - const auto result = client - .CreateConnection(request, CreateFqSettings<TCreateConnectionSettings>(folderId)) - .ExtractValueSync(); - UNIT_ASSERT_C(result.GetStatus() == EStatus::SUCCESS, result.GetIssues().ToString()); - } - - { - const auto request = ::NFq::TCreateConnectionBuilder() - .SetName(name) - .CreateYdb("created_db", "") - .Build(); - const auto result = client - .CreateConnection(request, CreateFqSettings<TCreateConnectionSettings>(folderId)) - .ExtractValueSync(); - UNIT_ASSERT_C(result.GetStatus() == EStatus::BAD_REQUEST, result.GetIssues().ToString()); //TODO status should be ALREADY_EXISTS - } - } - - Y_UNIT_TEST(CreateConnections_With_Idempotency) { - TKikimrWithGrpcAndRootSchema server({}, {}, {}, true); - ui16 grpc = server.GetPort(); - TString location = TStringBuilder() << "localhost:" << grpc; - TString userToken = "root@builtin"; - auto driver = TDriver(TDriverConfig().SetEndpoint(location).SetAuthToken(userToken)); - NYdb::NFq::TClient client(driver); - - const auto folderId = TString(__func__) + "folder_id"; - const auto name = "connection_name"; - const TString idempotencyKey = "idempotency_key"; - TString conId; - - { - const auto request = ::NFq::TCreateConnectionBuilder() - .SetName(name) - .SetIdempotencyKey(idempotencyKey) - .CreateYdb("created_db", "") - .Build(); - const auto result = client - .CreateConnection(request, CreateFqSettings<TCreateConnectionSettings>(folderId)) - .ExtractValueSync(); - UNIT_ASSERT_C(result.GetStatus() == EStatus::SUCCESS, result.GetIssues().ToString()); - conId = result.GetResult().connection_id(); - } - - { - const auto request = ::NFq::TCreateConnectionBuilder() - .SetName(name) - .SetIdempotencyKey(idempotencyKey) - .CreateYdb("created_db", "") - .Build(); - const auto result = client - .CreateConnection(request, CreateFqSettings<TCreateConnectionSettings>(folderId)) - .ExtractValueSync(); - UNIT_ASSERT_C(result.GetStatus() == EStatus::SUCCESS, result.GetIssues().ToString()); - UNIT_ASSERT_VALUES_EQUAL(conId, result.GetResult().connection_id()); - } - } - - Y_UNIT_TEST(CreateQuery_With_Idempotency) {//TODO Fix - TKikimrWithGrpcAndRootSchema server({}, {}, {}, true); - ui16 grpc = server.GetPort(); - TString location = TStringBuilder() << "localhost:" << grpc; - TString userToken = "root@builtin"; - auto driver = TDriver(TDriverConfig().SetEndpoint(location).SetAuthToken(userToken)); - NYdb::NFq::TClient client(driver); - - const auto folderId = TString(__func__) + "folder_id"; - const TString idempotencyKey = "idempotency_key"; - const TString yqlText = "select 1"; - TString queryId; - const auto request = ::NFq::TCreateQueryBuilder{} - .SetText(yqlText) - .SetIdempotencyKey(idempotencyKey) - .Build(); - - { - auto result = client.CreateQuery( - request, CreateFqSettings<TCreateQuerySettings>(folderId)) - .ExtractValueSync(); - UNIT_ASSERT_VALUES_EQUAL_C(result.GetStatus(), EStatus::SUCCESS, result.GetIssues().ToString()); - queryId = result.GetResult().query_id(); - } - - { - const auto req = ::NFq::TDescribeQueryBuilder{} - .SetQueryId(queryId) - .Build(); - const auto result = DoWithRetryOnRetCode([&]() { - auto result = client.DescribeQuery( - req, CreateFqSettings<TDescribeQuerySettings>(folderId)) - .ExtractValueSync(); - UNIT_ASSERT_VALUES_EQUAL_C(result.GetStatus(), EStatus::SUCCESS, result.GetIssues().ToString()); - const auto status = result.GetResult().query().meta().status(); - PrintProtoIssues(result.GetResult().query().issue()); - return status == FederatedQuery::QueryMeta::COMPLETED; - }, TRetryOptions(Retries)); - UNIT_ASSERT_C(result, "the execution of the query did not end within the time limit"); - } - { - auto result = client.CreateQuery( - request, CreateFqSettings<TCreateQuerySettings>(folderId)) - .ExtractValueSync(); - - UNIT_ASSERT_VALUES_EQUAL_C(result.GetStatus(), EStatus::SUCCESS, result.GetIssues().ToString()); - UNIT_ASSERT_VALUES_EQUAL(queryId, result.GetResult().query_id()); - } - CheckGetResultData(client, queryId, folderId, 1, 1, 1); - } - - // use fork for data test due to ch initialization problem - SIMPLE_UNIT_FORKED_TEST(CreateQuery_Without_Connection) { - TKikimrWithGrpcAndRootSchema server({}, {}, {}, true); - ui16 grpc = server.GetPort(); - TString location = TStringBuilder() << "localhost:" << grpc; - TString userToken = "root@builtin"; - auto driver = TDriver(TDriverConfig().SetEndpoint(location).SetAuthToken(userToken)); - NYdb::NFq::TClient client(driver); - - const TString yqlText = "select count(*) from testdbWTF.`connections`"; - CreateNewHistoryAndWaitFinish("folder_id_WTF", client, - yqlText, FederatedQuery::QueryMeta::FAILED); - } - - Y_UNIT_TEST(DeleteQuery) { - TKikimrWithGrpcAndRootSchema server({}, {}, {}, true); - ui16 grpc = server.GetPort(); - TString location = TStringBuilder() << "localhost:" << grpc; - TString userToken = "root@builtin"; - auto driver = TDriver(TDriverConfig().SetEndpoint(location).SetAuthToken(userToken)); - NYdb::NFq::TClient client(driver); - - const auto folderId = TString(__func__) + "folder_id"; - const TString yqlText = "select 1"; - const TString queryId = CreateNewHistoryAndWaitFinish(folderId, client, - yqlText, FederatedQuery::QueryMeta::COMPLETED); - CheckGetResultData(client, queryId, folderId, 1, 1, 1); - - { - const auto request = ::NFq::TDeleteQueryBuilder() - .SetQueryId(queryId) - .Build(); - auto result = client - .DeleteQuery(request, CreateFqSettings<TDeleteQuerySettings>(folderId)) - .ExtractValueSync(); - UNIT_ASSERT_VALUES_EQUAL(result.IsTransportError(), false); - UNIT_ASSERT_VALUES_EQUAL_C(result.GetStatus(), EStatus::SUCCESS, result.GetIssues().ToString()); - } - - { - auto request = ::NFq::TDescribeQueryBuilder() - .SetQueryId(queryId) - .Build(); - auto result = client - .DescribeQuery(request, CreateFqSettings<TDescribeQuerySettings>(folderId)) - .ExtractValueSync(); - UNIT_ASSERT_VALUES_EQUAL_C(result.GetStatus(), EStatus::BAD_REQUEST, result.GetIssues().ToString()); - } - } - - Y_UNIT_TEST(ModifyQuery) { - TKikimrWithGrpcAndRootSchema server({}, {}, {}, true); - ui16 grpc = server.GetPort(); - TString location = TStringBuilder() << "localhost:" << grpc; - TString userToken = "root@builtin"; - auto driver = TDriver(TDriverConfig().SetEndpoint(location).SetAuthToken(userToken)); - NYdb::NFq::TClient client(driver); - - const auto folderId = TString(__func__) + "folder_id"; - const TString yqlText = "select 1"; - const TString queryId = CreateNewHistoryAndWaitFinish(folderId, client, - yqlText, FederatedQuery::QueryMeta::COMPLETED); - CheckGetResultData(client, queryId, folderId, 1, 1, 1); - - { - const auto request = ::NFq::TModifyQueryBuilder() - .SetQueryId(queryId) - .SetName("ModifiedName") - .SetDescription("OK") - .Build(); - auto result = client - .ModifyQuery(request, CreateFqSettings<TModifyQuerySettings>(folderId)) - .ExtractValueSync(); - UNIT_ASSERT_VALUES_EQUAL(result.IsTransportError(), false); - UNIT_ASSERT_VALUES_EQUAL_C(result.GetStatus(), EStatus::SUCCESS, result.GetIssues().ToString()); - } - - { - auto request = ::NFq::TDescribeQueryBuilder() - .SetQueryId(queryId) - .Build(); - auto result = client - .DescribeQuery(request, CreateFqSettings<TDescribeQuerySettings>(folderId)) - .ExtractValueSync(); - UNIT_ASSERT_VALUES_EQUAL_C(result.GetStatus(), EStatus::SUCCESS, result.GetIssues().ToString()); - const auto& query = result.GetResult().query(); - UNIT_ASSERT_VALUES_EQUAL(query.content().name(), "ModifiedName"); - UNIT_ASSERT_VALUES_EQUAL(query.content().description(), "OK"); - } - } - - Y_UNIT_TEST(DescribeJob) { - TKikimrWithGrpcAndRootSchema server({}, {}, {}, true); - ui16 grpc = server.GetPort(); - TString location = TStringBuilder() << "localhost:" << grpc; - auto driver = TDriver(TDriverConfig().SetEndpoint(location).SetAuthToken("root@builtin")); - NYdb::NFq::TClient client(driver); - const auto folderId = "some_folder_id"; - const auto queryId = CreateNewHistoryAndWaitFinish(folderId, client, "select 1", FederatedQuery::QueryMeta::COMPLETED); - CheckGetResultData(client, queryId, folderId, 1, 1, 1); - TString jobId; - - { - auto request = ::NFq::TListJobsBuilder{}.SetQueryId(queryId).Build(); - auto result = DoWithRetryOnRetCode([&]() { - auto result = client.ListJobs( - request, CreateFqSettings<TListJobsSettings>(folderId)) - .ExtractValueSync(); - UNIT_ASSERT_VALUES_EQUAL_C(result.GetStatus(), EStatus::SUCCESS, result.GetIssues().ToString()); - UNIT_ASSERT_VALUES_EQUAL(result.GetResult().job_size(), 1); - jobId = result.GetResult().job(0).meta().id(); - return result.GetStatus() == EStatus::SUCCESS; - }, TRetryOptions(Retries)); - UNIT_ASSERT_C(result, "the execution of the query did not end within the time limit"); - } - - { - const auto request = ::NFq::TDescribeJobBuilder() - .SetJobId(jobId) - .Build(); - auto result = client.DescribeJob( - request, CreateFqSettings<TDescribeJobSettings>(folderId)) - .ExtractValueSync(); - UNIT_ASSERT_VALUES_EQUAL_C(result.GetStatus(), EStatus::SUCCESS, result.GetIssues().ToString()); - UNIT_ASSERT_VALUES_EQUAL(result.GetResult().job().query_meta().common().id(), queryId); - UNIT_ASSERT_VALUES_EQUAL(result.GetResult().job().meta().id(), jobId); - UNIT_ASSERT_VALUES_EQUAL(result.GetResult().job().query_name(), "test_query_name_1"); - } - } - - Y_UNIT_TEST(DescribeQuery) { - TKikimrWithGrpcAndRootSchema server({}, {}, {}, true); - ui16 grpc = server.GetPort(); - TString location = TStringBuilder() << "localhost:" << grpc; - auto driver = TDriver(TDriverConfig().SetEndpoint(location).SetAuthToken("root@builtin")); - NYdb::NFq::TClient client(driver); - const auto folderId = "some_folder_id"; - const auto queryId = CreateNewHistoryAndWaitFinish(folderId, client, "select 1", FederatedQuery::QueryMeta::COMPLETED); - CheckGetResultData(client, queryId, folderId, 1, 1, 1); - TString jobId; - - { - const auto request = ::NFq::TDescribeQueryBuilder() - .SetQueryId(queryId) - .Build(); - auto result = client.DescribeQuery( - request, CreateFqSettings<TDescribeQuerySettings>(folderId)) - .ExtractValueSync(); - UNIT_ASSERT_VALUES_EQUAL_C(result.GetStatus(), EStatus::SUCCESS, result.GetIssues().ToString()); - const auto query = result.GetResult().query(); - UNIT_ASSERT_VALUES_EQUAL(FederatedQuery::QueryMeta::ComputeStatus_Name(query.meta().status()), FederatedQuery::QueryMeta::ComputeStatus_Name(FederatedQuery::QueryMeta::COMPLETED)); - UNIT_ASSERT_VALUES_EQUAL(query.content().text(), "select 1"); - UNIT_ASSERT_VALUES_EQUAL(query.content().name(), "test_query_name_1"); - } - } -} - -Y_UNIT_TEST_SUITE(Yq_2) { - // use fork for data test due to ch initialization problem - Y_UNIT_TEST(Test_HostNameTrasformation) { - UNIT_ASSERT_VALUES_EQUAL(::NYq::TransformMdbHostToCorrectFormat("rc1c-p5waby2y5y1kb5ue.mdb.yandexcloud.net"), "rc1c-p5waby2y5y1kb5ue.db.yandex.net:8443"); - UNIT_ASSERT_VALUES_EQUAL(::NYq::TransformMdbHostToCorrectFormat("xxx.xxx"), "xxx.db.yandex.net:8443"); - UNIT_ASSERT_VALUES_EQUAL(::NYq::TransformMdbHostToCorrectFormat("host."), "host.db.yandex.net:8443"); - } - - SIMPLE_UNIT_FORKED_TEST(ReadFromYdbOverYq) { - TKikimrWithGrpcAndRootSchema server({}, {}, {}, true); - ui16 grpc = server.GetPort(); - TString location = TStringBuilder() << "localhost:" << grpc; - auto driver = TDriver(TDriverConfig().SetEndpoint(location).SetAuthToken("root@builtin")); - NYdb::NFq::TClient client(driver); - const auto folderId = TString(__func__) + "folder_id"; - - { - auto request = ::NFq::TCreateConnectionBuilder{} - .SetName("testdb00") - .CreateYdb("Root", location, "") - .Build(); - - auto result = client.CreateConnection( - request, CreateFqSettings<TCreateConnectionSettings>(folderId)) - .ExtractValueSync(); - - UNIT_ASSERT_VALUES_EQUAL_C(result.GetStatus(), EStatus::SUCCESS, result.GetIssues().ToString()); - } - - TString queryId; - { - auto request = ::NFq::TCreateQueryBuilder{} - .SetText("select count(*) from testdb00.`yq/connections`") - .Build(); - auto result = client.CreateQuery( - request, CreateFqSettings<TCreateQuerySettings>(folderId)) - .ExtractValueSync(); - - UNIT_ASSERT_VALUES_EQUAL_C(result.GetStatus(), EStatus::SUCCESS, result.GetIssues().ToString()); - queryId = result.GetResult().query_id(); - } - - { - auto request = ::NFq::TDescribeQueryBuilder{}.SetQueryId(queryId).Build(); - auto result = DoWithRetryOnRetCode([&]() { - auto result = client.DescribeQuery( - request, CreateFqSettings<TDescribeQuerySettings>(folderId)) - .ExtractValueSync(); - UNIT_ASSERT_VALUES_EQUAL_C(result.GetStatus(), EStatus::SUCCESS, result.GetIssues().ToString()); - const auto status = result.GetResult().query().meta().status(); - PrintProtoIssues(result.GetResult().query().issue()); - return status == FederatedQuery::QueryMeta::COMPLETED; - }, TRetryOptions(10)); - UNIT_ASSERT_C(result, "the execution of the query did not end within the time limit"); - } - - { - auto request = ::NFq::TGetResultDataBuilder{}.SetQueryId(queryId).Build(); - auto result = client.GetResultData( - request, CreateFqSettings<TGetResultDataSettings>(folderId)) - .ExtractValueSync(); - UNIT_ASSERT_VALUES_EQUAL_C(result.GetStatus(), EStatus::SUCCESS, result.GetIssues().ToString()); - - const auto& resultSet = result.GetResult().result_set(); - UNIT_ASSERT_VALUES_EQUAL(resultSet.rows().size(), 1); - UNIT_ASSERT_VALUES_EQUAL(resultSet.columns().size(), 1); - UNIT_ASSERT_VALUES_EQUAL(resultSet.rows(0).items(0).uint64_value(), 1); - } - } -} - -Y_UNIT_TEST_SUITE(PrivateApi) { - Y_UNIT_TEST(PingTask) { - TKikimrWithGrpcAndRootSchema server({}, {}, {}, true); - ui16 grpc = server.GetPort(); - TString location = TStringBuilder() << "localhost:" << grpc; - auto driver = TDriver(TDriverConfig().SetEndpoint(location).SetAuthToken("root@builtin")); - ::NFq::TPrivateClient client(driver); - const TString historyId = "id"; - const TString folderId = "folder_id"; - const TScope scope(folderId); - { - Fq::Private::PingTaskRequest req; - req.mutable_query_id()->set_value("id"); - req.set_scope(scope.ToString()); - req.set_owner_id("some_owner"); - req.set_status(YandexQuery::QueryMeta::COMPLETED); - auto result = client.PingTask(std::move(req)).ExtractValueSync(); - result.GetIssues().PrintTo(Cerr); - UNIT_ASSERT_VALUES_EQUAL(result.GetStatus(), EStatus::GENERIC_ERROR); - } - } - - Y_UNIT_TEST(GetTask) {//PendingFetcher can take task first - TKikimrWithGrpcAndRootSchema server({}, {}, {}, true); - ui16 grpc = server.GetPort(); - TString location = TStringBuilder() << "localhost:" << grpc; - auto driver = TDriver(TDriverConfig().SetEndpoint(location).SetAuthToken("root@builtin")); - ::NFq::TPrivateClient client(driver); - { - Fq::Private::GetTaskRequest req; - req.set_owner_id("owner_id"); - req.set_host("host"); - auto result = client.GetTask(std::move(req)).ExtractValueSync(); - result.GetIssues().PrintTo(Cerr); - UNIT_ASSERT_VALUES_EQUAL(result.GetStatus(), EStatus::SUCCESS); - result.GetIssues().PrintTo(Cerr); - } - } - - Y_UNIT_TEST(Nodes) { - TKikimrWithGrpcAndRootSchema server({}, {}, {}, true); - ui16 grpc = server.GetPort(); - TString location = TStringBuilder() << "localhost:" << grpc; - auto driver = TDriver(TDriverConfig().SetEndpoint(location).SetAuthToken("root@builtin")); - ::NFq::TPrivateClient client(driver); - const auto instanceId = CreateGuidAsString(); - { - Fq::Private::NodesHealthCheckRequest req; - req.set_tenant("Tenant"); - auto& node = *req.mutable_node(); - node.set_hostname("hostname"); - node.set_node_id(100500); - node.set_instance_id(instanceId); - const auto result = DoWithRetryOnRetCode([&]() { - auto r = req; - auto result = client.NodesHealthCheck(std::move(r)).ExtractValueSync(); - if (result.GetStatus() == EStatus::SUCCESS) { - const auto& res = result.GetResult(); - UNIT_ASSERT(!res.nodes().empty()); - UNIT_ASSERT_VALUES_EQUAL(res.nodes(0).hostname(), "hostname"); - UNIT_ASSERT_VALUES_EQUAL(res.nodes(0).node_id(), 100500); - UNIT_ASSERT_VALUES_EQUAL(res.nodes(0).instance_id(), instanceId); - } - // result.GetIssues().PrintTo(Cerr); - return result.GetStatus() == EStatus::SUCCESS; - }, TRetryOptions(Retries)); - UNIT_ASSERT_C(result, "the execution of the query did not end within the time limit"); - } - } -} |