Skip to content

Commit 6966047

Browse files
authored
Added ability to add a transfer and a async replication to subdirecto… (#22503)
1 parent b51b4d0 commit 6966047

File tree

3 files changed

+42
-3
lines changed

3 files changed

+42
-3
lines changed

ydb/core/transfer/ut/common/utils.h

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,10 @@ struct MainTestCase {
426426
};
427427

428428
void CreateTransfer(const std::string& lambda, const CreateTransferSettings& settings = CreateTransferSettings()) {
429+
CreateTransfer(TransferName, lambda, settings);
430+
}
431+
432+
void CreateTransfer(const std::string& name, const std::string& lambda, const CreateTransferSettings& settings = CreateTransferSettings()) {
429433
std::vector<std::string> options;
430434
if (!settings.LocalTopic) {
431435
options.push_back(TStringBuilder() << "CONNECTION_STRING = 'grpc://" << ConnectionString << "'");
@@ -457,7 +461,7 @@ struct MainTestCase {
457461
WITH (
458462
%s
459463
);
460-
)", lambda.data(), TransferName.data(), topicName.data(), TableName.data(), optionsStr.data());
464+
)", lambda.data(), name.data(), topicName.data(), TableName.data(), optionsStr.data());
461465

462466
ExecuteDDL(ddl, true, settings.ExpectedError);
463467
}
@@ -497,6 +501,10 @@ struct MainTestCase {
497501
}
498502

499503
void AlterTransfer(const AlterTransferSettings& settings, bool success = true) {
504+
AlterTransfer(TransferName, settings, success);
505+
}
506+
507+
void AlterTransfer(const std::string& name, const AlterTransferSettings& settings, bool success = true) {
500508
std::string lambda = settings.TransformLambda ? *settings.TransformLambda : "";
501509
std::string setLambda = settings.TransformLambda ? "SET USING $l" : "";
502510

@@ -523,7 +531,7 @@ struct MainTestCase {
523531
ALTER TRANSFER `%s`
524532
%s
525533
%s;
526-
)", lambda.data(), TransferName.data(), setLambda.data(), setOptions.data()), success);
534+
)", lambda.data(), name.data(), setLambda.data(), setOptions.data()), success);
527535
}
528536

529537
void DropTransfer() {

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

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1311,5 +1311,36 @@ Y_UNIT_TEST_SUITE(Transfer)
13111311
testCase.DropTopic();
13121312
testCase.DropTable();
13131313
}
1314+
1315+
Y_UNIT_TEST(CreateAndAlterTransferInDirectory)
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+
testCase.CreateTopic(1);
1328+
1329+
testCase.CreateDirectory("/local/subdir");
1330+
testCase.CreateTransfer(TStringBuilder() << "subdir/" << testCase.TransferName, Sprintf(R"(
1331+
$l = ($x) -> {
1332+
return [
1333+
<|
1334+
Key:CAST($x._offset AS Uint64),
1335+
Message:CAST($x._data AS Utf8)
1336+
|>
1337+
];
1338+
};
1339+
)", testCase.TableName.data()));
1340+
1341+
testCase.AlterTransfer(TStringBuilder() << "subdir/" << testCase.TransferName,
1342+
MainTestCase::AlterTransferSettings::WithBatching(TDuration::Seconds(1), 1));
1343+
}
1344+
13141345
}
13151346

ydb/core/tx/schemeshard/schemeshard__operation_create_replication.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ class TCreateReplication: public TSubOperation {
382382
return result;
383383
}
384384

385-
auto path = parentPath.Child(name);
385+
auto path = parentPath.Child(name, TPath::TSplitChildTag{});
386386
{
387387
const auto checks = path.Check();
388388
checks

0 commit comments

Comments
 (0)