9
9
#include < ydb/core/fq/libs/control_plane_proxy/events/events.h>
10
10
#include < ydb/core/fq/libs/control_plane_storage/control_plane_storage.h>
11
11
#include < ydb/public/api/protos/draft/fq.pb.h>
12
+ #include < ydb/public/lib/fq/scope.h>
12
13
#include < ydb/public/sdk/cpp/client/ydb_table/table.h>
13
14
14
15
namespace NFq ::NPrivate {
@@ -418,7 +419,7 @@ class TGenerateRecoverySQLIfExternalDataSourceAlreadyExistsActor :
418
419
419
420
event->IsExactNameMatch = true ;
420
421
421
- TBase::Send (NFq::ControlPlaneStorageServiceActorId (), event);
422
+ TBase::Send (:: NFq::ControlPlaneStorageServiceActorId (), event);
422
423
}
423
424
424
425
STRICT_STFUNC (StateFunc, cFunc(NActors::TEvents::TSystem::Wakeup, TBase::HandleTimeout);
@@ -493,7 +494,7 @@ class TGenerateRecoverySQLIfExternalDataTableAlreadyExistsActor :
493
494
494
495
event->IsExactNameMatch = true ;
495
496
496
- TBase::Send (NFq::ControlPlaneStorageServiceActorId (), event);
497
+ TBase::Send (:: NFq::ControlPlaneStorageServiceActorId (), event);
497
498
}
498
499
499
500
STRICT_STFUNC (StateFunc, cFunc(NActors::TEvents::TSystem::Wakeup, TBase::HandleTimeout);
@@ -543,7 +544,7 @@ IActor* MakeCreateConnectionActor(
543
544
TCounters& counters,
544
545
TPermissions permissions,
545
546
const TCommonConfig& commonConfig,
546
- const NFq::TComputeConfig& computeConfig,
547
+ const :: NFq::TComputeConfig& computeConfig,
547
548
TSigner::TPtr signer,
548
549
bool withoutRollback,
549
550
TMaybe<TString> connectionId) {
@@ -557,10 +558,13 @@ IActor* MakeCreateConnectionActor(
557
558
computeConfig](const TEvControlPlaneProxy::TEvCreateConnectionRequest::TPtr& req)
558
559
-> std::vector<TSchemaQueryTask> {
559
560
auto & connectionContent = req->Get ()->Request .content ();
561
+ const auto & scope = req->Get ()->Scope ;
562
+ const TString folderId = NYdb::NFq::TScope{scope}.ParseFolder ();
560
563
561
564
auto createSecretStatement = CreateSecretObjectQuery (connectionContent.setting (),
562
565
connectionContent.name (),
563
- signer);
566
+ signer,
567
+ folderId);
564
568
565
569
std::vector<TSchemaQueryTask> statements;
566
570
if (createSecretStatement) {
@@ -603,7 +607,7 @@ IActor* MakeCreateConnectionActor(
603
607
statements.push_back (TSchemaQueryTask{
604
608
.SQL = MakeCreateExternalDataSourceQuery (
605
609
connectionContent, signer, commonConfig,
606
- computeConfig.IsReplaceIfExistsSyntaxSupported ()),
610
+ computeConfig.IsReplaceIfExistsSyntaxSupported (), folderId ),
607
611
.ScheduleErrorRecoverySQLGeneration =
608
612
withoutRollback
609
613
? NoRecoverySQLGeneration ()
@@ -647,7 +651,7 @@ IActor* MakeModifyConnectionActor(
647
651
TDuration requestTimeout,
648
652
TCounters& counters,
649
653
const TCommonConfig& commonConfig,
650
- const NFq::TComputeConfig& computeConfig,
654
+ const :: NFq::TComputeConfig& computeConfig,
651
655
TSigner::TPtr signer) {
652
656
auto queryFactoryMethod =
653
657
[signer = std::move (signer),
@@ -659,21 +663,24 @@ IActor* MakeModifyConnectionActor(
659
663
auto & oldConnectionContent = (*request->Get ()->OldConnectionContent );
660
664
auto & oldBindings = request->Get ()->OldBindingContents ;
661
665
auto & newConnectionContent = request->Get ()->Request .content ();
666
+ const auto & scope = request->Get ()->Scope ;
667
+ const TString folderId = NYdb::NFq::TScope{scope}.ParseFolder ();
662
668
663
669
auto dropOldSecret =
664
- DropSecretObjectQuery (oldConnectionContent.name ());
670
+ DropSecretObjectQuery (oldConnectionContent.name (), folderId );
665
671
auto createNewSecret =
666
672
CreateSecretObjectQuery (newConnectionContent.setting (),
667
673
newConnectionContent.name (),
668
- signer);
674
+ signer,
675
+ folderId);
669
676
670
677
bool replaceSupported = computeConfig.IsReplaceIfExistsSyntaxSupported ();
671
678
if (replaceSupported &&
672
679
oldConnectionContent.name () == newConnectionContent.name ()) {
673
680
// CREATE OR REPLACE
674
681
auto createSecretStatement =
675
682
CreateSecretObjectQuery (newConnectionContent.setting (),
676
- newConnectionContent.name (), signer);
683
+ newConnectionContent.name (), signer, folderId );
677
684
678
685
std::vector<TSchemaQueryTask> statements;
679
686
if (createSecretStatement) {
@@ -683,7 +690,7 @@ IActor* MakeModifyConnectionActor(
683
690
684
691
statements.push_back (TSchemaQueryTask{
685
692
.SQL = MakeCreateExternalDataSourceQuery (
686
- newConnectionContent, signer, commonConfig, replaceSupported)});
693
+ newConnectionContent, signer, commonConfig, replaceSupported, folderId )});
687
694
return statements;
688
695
}
689
696
@@ -712,26 +719,26 @@ IActor* MakeModifyConnectionActor(
712
719
statements.push_back (TSchemaQueryTask{
713
720
.SQL = TString{MakeDeleteExternalDataSourceQuery (oldConnectionContent.name ())},
714
721
.RollbackSQL = TString{MakeCreateExternalDataSourceQuery (
715
- oldConnectionContent, signer, commonConfig, false )},
722
+ oldConnectionContent, signer, commonConfig, false , folderId )},
716
723
.ShouldSkipStepOnError = IsPathDoesNotExistIssue});
717
724
718
725
if (dropOldSecret) {
719
726
statements.push_back (TSchemaQueryTask{
720
727
.SQL = *dropOldSecret,
721
728
.RollbackSQL = CreateSecretObjectQuery (oldConnectionContent.setting (),
722
729
oldConnectionContent.name (),
723
- signer),
730
+ signer, folderId ),
724
731
.ShouldSkipStepOnError = IsPathDoesNotExistIssue});
725
732
}
726
733
if (createNewSecret) {
727
734
statements.push_back (TSchemaQueryTask{.SQL = *createNewSecret,
728
735
.RollbackSQL = DropSecretObjectQuery (
729
- newConnectionContent.name ())});
736
+ newConnectionContent.name (), folderId )});
730
737
}
731
738
732
739
statements.push_back (
733
740
TSchemaQueryTask{.SQL = TString{MakeCreateExternalDataSourceQuery (
734
- newConnectionContent, signer, commonConfig, false )},
741
+ newConnectionContent, signer, commonConfig, false , folderId )},
735
742
.RollbackSQL = TString{MakeDeleteExternalDataSourceQuery (
736
743
newConnectionContent.name ())}});
737
744
@@ -787,23 +794,25 @@ IActor* MakeDeleteConnectionActor(
787
794
const TEvControlPlaneProxy::TEvDeleteConnectionRequest::TPtr& request)
788
795
-> std::vector<TSchemaQueryTask> {
789
796
auto & connectionContent = *request->Get ()->ConnectionContent ;
797
+ const auto & scope = request->Get ()->Scope ;
798
+ const TString folderId = NYdb::NFq::TScope{scope}.ParseFolder ();
790
799
791
800
auto dropSecret =
792
- DropSecretObjectQuery (connectionContent.name ());
801
+ DropSecretObjectQuery (connectionContent.name (), folderId );
793
802
794
803
std::vector statements = {
795
804
TSchemaQueryTask{.SQL = TString{MakeDeleteExternalDataSourceQuery (
796
805
connectionContent.name ())},
797
806
.RollbackSQL = MakeCreateExternalDataSourceQuery (
798
- connectionContent, signer, commonConfig, false ),
807
+ connectionContent, signer, commonConfig, false , folderId ),
799
808
.ShouldSkipStepOnError = IsPathDoesNotExistIssue}};
800
809
if (dropSecret) {
801
810
statements.push_back (
802
811
TSchemaQueryTask{.SQL = *dropSecret,
803
812
.RollbackSQL =
804
813
CreateSecretObjectQuery (connectionContent.setting (),
805
814
connectionContent.name (),
806
- signer),
815
+ signer, folderId ),
807
816
.ShouldSkipStepOnError = IsPathDoesNotExistIssue});
808
817
}
809
818
return statements;
@@ -832,7 +841,7 @@ IActor* MakeCreateBindingActor(const TActorId& proxyActorId,
832
841
TDuration requestTimeout,
833
842
TCounters& counters,
834
843
TPermissions permissions,
835
- const NFq::TComputeConfig& computeConfig,bool withoutRollback,
844
+ const :: NFq::TComputeConfig& computeConfig,bool withoutRollback,
836
845
TMaybe<TString> bindingId) {
837
846
auto queryFactoryMethod =
838
847
[requestTimeout, &counters, permissions, withoutRollback, computeConfig](
@@ -916,7 +925,7 @@ IActor* MakeModifyBindingActor(const TActorId& proxyActorId,
916
925
TEvControlPlaneProxy::TEvModifyBindingRequest::TPtr request,
917
926
TDuration requestTimeout,
918
927
TCounters& counters,
919
- const NFq::TComputeConfig& computeConfig) {
928
+ const :: NFq::TComputeConfig& computeConfig) {
920
929
auto queryFactoryMethod =
921
930
[computeConfig](const TEvControlPlaneProxy::TEvModifyBindingRequest::TPtr& request)
922
931
-> std::vector<TSchemaQueryTask> {
0 commit comments