@@ -128,14 +128,16 @@ class TDqPqReadActor : public NActors::TActor<TDqPqReadActor>, public NYql::NDq:
128
128
std::shared_ptr<NYdb::ICredentialsProviderFactory> credentialsProviderFactory,
129
129
const NActors::TActorId& computeActorId,
130
130
const ::NMonitoring::TDynamicCounterPtr& counters,
131
- i64 bufferSize)
131
+ i64 bufferSize,
132
+ const IPqGateway::TPtr& pqGateway)
132
133
: TActor<TDqPqReadActor>(&TDqPqReadActor::StateFunc)
133
134
, TDqPqReadActorBase(inputIndex, taskId, this ->SelfId (), txId, std::move(sourceParams), std::move(readParams), computeActorId)
134
135
, Metrics(txId, taskId, counters)
135
136
, BufferSize(bufferSize)
136
137
, HolderFactory(holderFactory)
137
138
, Driver(std::move(driver))
138
139
, CredentialsProviderFactory(std::move(credentialsProviderFactory))
140
+ , PqGateway(pqGateway)
139
141
{
140
142
MetadataFields.reserve (SourceParams.MetadataFieldsSize ());
141
143
TPqMetaExtractor fieldsExtractor;
@@ -185,9 +187,9 @@ class TDqPqReadActor : public NActors::TActor<TDqPqReadActor>, public NYql::NDq:
185
187
}
186
188
}
187
189
188
- NYdb::NTopic::TTopicClient & GetTopicClient () {
190
+ ITopicClient & GetTopicClient () {
189
191
if (!TopicClient) {
190
- TopicClient = std::make_unique<NYdb::NTopic::TTopicClient> (Driver, GetTopicClientSettings ());
192
+ TopicClient = PqGateway-> GetTopicClient (Driver, GetTopicClientSettings ());
191
193
}
192
194
return *TopicClient;
193
195
}
@@ -229,7 +231,7 @@ class TDqPqReadActor : public NActors::TActor<TDqPqReadActor>, public NYql::NDq:
229
231
ReadSession->Close (TDuration::Zero ());
230
232
ReadSession.reset ();
231
233
}
232
- TopicClient.reset ();
234
+ TopicClient.Reset ();
233
235
TActor<TDqPqReadActor>::PassAway ();
234
236
}
235
237
@@ -568,7 +570,7 @@ class TDqPqReadActor : public NActors::TActor<TDqPqReadActor>, public NYql::NDq:
568
570
const THolderFactory& HolderFactory;
569
571
NYdb::TDriver Driver;
570
572
std::shared_ptr<NYdb::ICredentialsProviderFactory> CredentialsProviderFactory;
571
- std::unique_ptr<NYdb::NTopic::TTopicClient> TopicClient;
573
+ ITopicClient::TPtr TopicClient;
572
574
std::shared_ptr<NYdb::NTopic::IReadSession> ReadSession;
573
575
NThreading::TFuture<void > EventFuture;
574
576
std::queue<std::pair<ui64, NYdb::NTopic::TDeferredCommit>> DeferredCommits;
@@ -578,6 +580,7 @@ class TDqPqReadActor : public NActors::TActor<TDqPqReadActor>, public NYql::NDq:
578
580
std::queue<TReadyBatch> ReadyBuffer;
579
581
TMaybe<TDqSourceWatermarkTracker<TPartitionKey>> WatermarkTracker;
580
582
TMaybe<TInstant> NextIdlenesCheckAt;
583
+ IPqGateway::TPtr PqGateway;
581
584
};
582
585
583
586
std::pair<IDqComputeActorAsyncInput*, NActors::IActor*> CreateDqPqReadActor (
@@ -593,6 +596,7 @@ std::pair<IDqComputeActorAsyncInput*, NActors::IActor*> CreateDqPqReadActor(
593
596
const NActors::TActorId& computeActorId,
594
597
const NKikimr::NMiniKQL::THolderFactory& holderFactory,
595
598
const ::NMonitoring::TDynamicCounterPtr& counters,
599
+ IPqGateway::TPtr pqGateway,
596
600
i64 bufferSize
597
601
)
598
602
{
@@ -618,15 +622,16 @@ std::pair<IDqComputeActorAsyncInput*, NActors::IActor*> CreateDqPqReadActor(
618
622
CreateCredentialsProviderFactoryForStructuredToken (credentialsFactory, token, addBearerToToken),
619
623
computeActorId,
620
624
counters,
621
- bufferSize
625
+ bufferSize,
626
+ pqGateway
622
627
);
623
628
624
629
return {actor, actor};
625
630
}
626
631
627
- void RegisterDqPqReadActorFactory (TDqAsyncIoFactory& factory, NYdb::TDriver driver, ISecuredServiceAccountCredentialsFactory::TPtr credentialsFactory, const ::NMonitoring::TDynamicCounterPtr& counters) {
632
+ void RegisterDqPqReadActorFactory (TDqAsyncIoFactory& factory, NYdb::TDriver driver, ISecuredServiceAccountCredentialsFactory::TPtr credentialsFactory, const IPqGateway::TPtr& pqGateway, const ::NMonitoring::TDynamicCounterPtr& counters) {
628
633
factory.RegisterSource <NPq::NProto::TDqPqTopicSource>(" PqSource" ,
629
- [driver = std::move (driver), credentialsFactory = std::move (credentialsFactory), counters](
634
+ [driver = std::move (driver), credentialsFactory = std::move (credentialsFactory), counters, pqGateway ](
630
635
NPq::NProto::TDqPqTopicSource&& settings,
631
636
IDqAsyncIoFactory::TSourceArguments&& args)
632
637
{
@@ -646,6 +651,7 @@ void RegisterDqPqReadActorFactory(TDqAsyncIoFactory& factory, NYdb::TDriver driv
646
651
args.ComputeActorId ,
647
652
args.HolderFactory ,
648
653
counters,
654
+ pqGateway,
649
655
PQReadDefaultFreeSpace);
650
656
}
651
657
0 commit comments