Skip to content

Commit 3623f27

Browse files
authored
Fixed describe of the paused state of the transfer (#22553)
1 parent 879cdf4 commit 3623f27

File tree

3 files changed

+46
-4
lines changed

3 files changed

+46
-4
lines changed

ydb/core/transfer/ut/functional/transfer_ut.cpp

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -570,6 +570,41 @@ Y_UNIT_TEST_SUITE(Transfer)
570570
testCase.DropTopic();
571571
}
572572

573+
Y_UNIT_TEST(DescribeTransferWithErrorTopicNotFound)
574+
{
575+
MainTestCase testCase;
576+
testCase.CreateTable(R"(
577+
CREATE TABLE `%s` (
578+
Key Uint64 NOT NULL,
579+
Message Utf8,
580+
PRIMARY KEY (Key)
581+
) WITH (
582+
STORE = %s
583+
);
584+
)");
585+
586+
testCase.CreateTransfer(R"(
587+
$l = ($x) -> {
588+
return [
589+
<|
590+
Key:CAST($x._offset AS Uint64),
591+
Message:CAST($x._data AS Utf8)
592+
|>
593+
];
594+
};
595+
)", MainTestCase::CreateTransferSettings::WithLocalTopic(false));
596+
597+
testCase.CheckTransferStateError("Path not found");
598+
599+
auto d = testCase.DescribeTransfer();
600+
UNIT_ASSERT_VALUES_EQUAL(d.GetTransferDescription().GetState(), TTransferDescription::EState::Error);
601+
UNIT_ASSERT_VALUES_EQUAL(d.GetTransferDescription().GetSrcPath(), TStringBuilder() << "local/" << testCase.TopicName);
602+
UNIT_ASSERT_VALUES_EQUAL(d.GetTransferDescription().GetDstPath(), TStringBuilder() << "/local/" << testCase.TableName);
603+
604+
testCase.DropTransfer();
605+
testCase.DropTable();
606+
}
607+
573608
Y_UNIT_TEST(CustomConsumer)
574609
{
575610
MainTestCase testCase;

ydb/core/tx/replication/controller/tx_describe_replication.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,16 @@ class TController::TTxDescribeReplication: public TTxBase {
198198
}
199199

200200
bool isTransfer = replication->GetConfig().HasTransferSpecific();
201+
if (isTransfer) {
202+
auto& specific = replication->GetConfig().GetTransferSpecific();
203+
204+
auto& transferSpecific = *Result->Record.MutableTransferSpecific();
205+
transferSpecific.MutableTarget()->SetSrcPath(specific.GetTarget().GetSrcPath());
206+
transferSpecific.MutableTarget()->SetDstPath(specific.GetTarget().GetDstPath());
207+
transferSpecific.MutableTarget()->SetTransformLambda(specific.GetTarget().GetTransformLambda());
208+
transferSpecific.MutableBatching()->CopyFrom(specific.GetBatching());
209+
}
210+
201211
for (ui64 tid = 0; tid < replication->GetNextTargetId(); ++tid) {
202212
auto* target = replication->FindTarget(tid);
203213
if (!target) {
@@ -209,11 +219,7 @@ class TController::TTxDescribeReplication: public TTxBase {
209219
auto& specific = replication->GetConfig().GetTransferSpecific();
210220

211221
auto& transferSpecific = *Result->Record.MutableTransferSpecific();
212-
transferSpecific.MutableTarget()->SetSrcPath(target->GetSrcPath());
213-
transferSpecific.MutableTarget()->SetDstPath(target->GetDstPath());
214222
transferSpecific.MutableTarget()->SetConsumerName(target->GetStreamConsumerName() ? target->GetStreamConsumerName() : specific.GetTarget().GetConsumerName());
215-
transferSpecific.MutableTarget()->SetTransformLambda(specific.GetTarget().GetTransformLambda());
216-
transferSpecific.MutableBatching()->CopyFrom(specific.GetBatching());
217223
}
218224

219225
auto& item = *Result->Record.AddTargets();

ydb/public/lib/ydb_cli/commands/ydb_service_scheme.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -613,6 +613,7 @@ int TCommandDescribe::PrintTransferResponsePretty(const NYdb::NReplication::TDes
613613
Cout << Endl << "State: ";
614614
switch (desc.GetState()) {
615615
case NReplication::TTransferDescription::EState::Running:
616+
case NReplication::TTransferDescription::EState::Paused:
616617
Cout << desc.GetState();
617618
break;
618619
case NReplication::TTransferDescription::EState::Error:

0 commit comments

Comments
 (0)