Skip to content

24-3: Allow to alter cdc topic's retention period #8289

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions ydb/core/kqp/ut/scheme/kqp_scheme_ut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3903,6 +3903,22 @@ Y_UNIT_TEST_SUITE(KqpScheme) {
UNIT_ASSERT_VALUES_EQUAL(desc.GetTopicDescription().GetRetentionPeriod(), TDuration::Hours(1));
}

{ // alter
auto query = R"(
--!syntax_v1
ALTER TOPIC `/Root/table/feed_2` SET (
RETENTION_PERIOD = Interval("PT2H")
);
)";

const auto result = session.ExecuteSchemeQuery(query).GetValueSync();
UNIT_ASSERT_VALUES_EQUAL_C(result.GetStatus(), EStatus::SUCCESS, result.GetIssues().ToString());

auto desc = pq.DescribeTopic("/Root/table/feed_2").ExtractValueSync();
UNIT_ASSERT_C(desc.IsSuccess(), desc.GetIssues().ToString());
UNIT_ASSERT_VALUES_EQUAL(desc.GetTopicDescription().GetRetentionPeriod(), TDuration::Hours(2));
}

{ // non-positive (invalid)
auto query = R"(
--!syntax_v1
Expand Down
7 changes: 1 addition & 6 deletions ydb/core/tx/datashard/datashard_ut_change_exchange.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1825,18 +1825,13 @@ Y_UNIT_TEST_SUITE(Cdc) {
UNIT_ASSERT_VALUES_EQUAL(res.GetStatus(), NYdb::EStatus::BAD_REQUEST);
}

// try to update retention period
{
auto res = client.AlterTopic("/Root/Table/Stream", NYdb::NTopic::TAlterTopicSettings()
.SetRetentionPeriod(TDuration::Hours(48))).ExtractValueSync();
UNIT_ASSERT_VALUES_EQUAL(res.GetStatus(), NYdb::EStatus::BAD_REQUEST);
}
// try to update supported codecs
{
auto res = client.AlterTopic("/Root/Table/Stream", NYdb::NTopic::TAlterTopicSettings()
.AppendSetSupportedCodecs(NYdb::NTopic::ECodec(5))).ExtractValueSync();
UNIT_ASSERT_VALUES_EQUAL(res.GetStatus(), NYdb::EStatus::BAD_REQUEST);
}

// try to update retention storage
{
auto res = client.AlterTopic("/Root/Table/Stream", NYdb::NTopic::TAlterTopicSettings()
Expand Down
1 change: 0 additions & 1 deletion ydb/services/lib/actors/pq_schema_actor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1314,7 +1314,6 @@ namespace NKikimr::NGRpcProxy::V1 {
}

if (request.has_set_retention_period()) {
CHECK_CDC;
partConfig->SetLifetimeSeconds(request.set_retention_period().seconds());
}

Expand Down
Loading