Skip to content

Commit 855654a

Browse files
committed
Fixed describe of the transfer if topic not found
1 parent c50217b commit 855654a

File tree

2 files changed

+47
-4
lines changed

2 files changed

+47
-4
lines changed

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

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1311,5 +1311,42 @@ Y_UNIT_TEST_SUITE(Transfer)
13111311
testCase.DropTopic();
13121312
testCase.DropTable();
13131313
}
1314+
1315+
Y_UNIT_TEST(DescribeTransferWithErrorTopicNotFound)
1316+
{
1317+
MainTestCase testCase;
1318+
testCase.CreateTable(R"(
1319+
CREATE TABLE `%s` (
1320+
Key Uint64 NOT NULL,
1321+
Message Utf8,
1322+
PRIMARY KEY (Key)
1323+
) WITH (
1324+
STORE = %s
1325+
);
1326+
)");
1327+
1328+
testCase.CreateTransfer(R"(
1329+
$l = ($x) -> {
1330+
return [
1331+
<|
1332+
Key:CAST($x._offset AS Uint64),
1333+
Message:CAST($x._data AS Utf8)
1334+
|>
1335+
];
1336+
};
1337+
)", MainTestCase::CreateTransferSettings::WithLocalTopic(false));
1338+
1339+
testCase.CheckTransferStateError("Path not found");
1340+
1341+
auto d = testCase.DescribeTransfer();
1342+
UNIT_ASSERT_VALUES_EQUAL(d.GetTransferDescription().GetState(), TTransferDescription::EState::Error);
1343+
UNIT_ASSERT_VALUES_EQUAL(d.GetTransferDescription().GetSrcPath(), TStringBuilder() << "local/" << testCase.TopicName);
1344+
UNIT_ASSERT_VALUES_EQUAL(d.GetTransferDescription().GetDstPath(), TStringBuilder() << "/local/" << testCase.TableName);
1345+
1346+
testCase.DropTransfer();
1347+
testCase.DropTable();
1348+
}
1349+
1350+
13141351
}
13151352

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();

0 commit comments

Comments
 (0)