Skip to content

Commit 8e7a11a

Browse files
authored
24-3: Allow to alter cdc topic's retention period (#8289)
1 parent 1a88bb4 commit 8e7a11a

File tree

3 files changed

+17
-7
lines changed

3 files changed

+17
-7
lines changed

ydb/core/kqp/ut/scheme/kqp_scheme_ut.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3903,6 +3903,22 @@ Y_UNIT_TEST_SUITE(KqpScheme) {
39033903
UNIT_ASSERT_VALUES_EQUAL(desc.GetTopicDescription().GetRetentionPeriod(), TDuration::Hours(1));
39043904
}
39053905

3906+
{ // alter
3907+
auto query = R"(
3908+
--!syntax_v1
3909+
ALTER TOPIC `/Root/table/feed_2` SET (
3910+
RETENTION_PERIOD = Interval("PT2H")
3911+
);
3912+
)";
3913+
3914+
const auto result = session.ExecuteSchemeQuery(query).GetValueSync();
3915+
UNIT_ASSERT_VALUES_EQUAL_C(result.GetStatus(), EStatus::SUCCESS, result.GetIssues().ToString());
3916+
3917+
auto desc = pq.DescribeTopic("/Root/table/feed_2").ExtractValueSync();
3918+
UNIT_ASSERT_C(desc.IsSuccess(), desc.GetIssues().ToString());
3919+
UNIT_ASSERT_VALUES_EQUAL(desc.GetTopicDescription().GetRetentionPeriod(), TDuration::Hours(2));
3920+
}
3921+
39063922
{ // non-positive (invalid)
39073923
auto query = R"(
39083924
--!syntax_v1

ydb/core/tx/datashard/datashard_ut_change_exchange.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1825,18 +1825,13 @@ Y_UNIT_TEST_SUITE(Cdc) {
18251825
UNIT_ASSERT_VALUES_EQUAL(res.GetStatus(), NYdb::EStatus::BAD_REQUEST);
18261826
}
18271827

1828-
// try to update retention period
1829-
{
1830-
auto res = client.AlterTopic("/Root/Table/Stream", NYdb::NTopic::TAlterTopicSettings()
1831-
.SetRetentionPeriod(TDuration::Hours(48))).ExtractValueSync();
1832-
UNIT_ASSERT_VALUES_EQUAL(res.GetStatus(), NYdb::EStatus::BAD_REQUEST);
1833-
}
18341828
// try to update supported codecs
18351829
{
18361830
auto res = client.AlterTopic("/Root/Table/Stream", NYdb::NTopic::TAlterTopicSettings()
18371831
.AppendSetSupportedCodecs(NYdb::NTopic::ECodec(5))).ExtractValueSync();
18381832
UNIT_ASSERT_VALUES_EQUAL(res.GetStatus(), NYdb::EStatus::BAD_REQUEST);
18391833
}
1834+
18401835
// try to update retention storage
18411836
{
18421837
auto res = client.AlterTopic("/Root/Table/Stream", NYdb::NTopic::TAlterTopicSettings()

ydb/services/lib/actors/pq_schema_actor.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1314,7 +1314,6 @@ namespace NKikimr::NGRpcProxy::V1 {
13141314
}
13151315

13161316
if (request.has_set_retention_period()) {
1317-
CHECK_CDC;
13181317
partConfig->SetLifetimeSeconds(request.set_retention_period().seconds());
13191318
}
13201319

0 commit comments

Comments
 (0)