Skip to content

Commit 3c06027

Browse files
authored
Allow to alter cdc topic's retention period (#8264)
1 parent b7e3633 commit 3c06027

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
@@ -4213,6 +4213,22 @@ Y_UNIT_TEST_SUITE(KqpScheme) {
42134213
UNIT_ASSERT_VALUES_EQUAL(desc.GetTopicDescription().GetRetentionPeriod(), TDuration::Hours(1));
42144214
}
42154215

4216+
{ // alter
4217+
auto query = R"(
4218+
--!syntax_v1
4219+
ALTER TOPIC `/Root/table/feed_2` SET (
4220+
RETENTION_PERIOD = Interval("PT2H")
4221+
);
4222+
)";
4223+
4224+
const auto result = session.ExecuteSchemeQuery(query).GetValueSync();
4225+
UNIT_ASSERT_VALUES_EQUAL_C(result.GetStatus(), EStatus::SUCCESS, result.GetIssues().ToString());
4226+
4227+
auto desc = pq.DescribeTopic("/Root/table/feed_2").ExtractValueSync();
4228+
UNIT_ASSERT_C(desc.IsSuccess(), desc.GetIssues().ToString());
4229+
UNIT_ASSERT_VALUES_EQUAL(desc.GetTopicDescription().GetRetentionPeriod(), TDuration::Hours(2));
4230+
}
4231+
42164232
{ // non-positive (invalid)
42174233
auto query = R"(
42184234
--!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
@@ -1321,7 +1321,6 @@ namespace NKikimr::NGRpcProxy::V1 {
13211321
}
13221322

13231323
if (request.has_set_retention_period()) {
1324-
CHECK_CDC;
13251324
partConfig->SetLifetimeSeconds(request.set_retention_period().seconds());
13261325
}
13271326

0 commit comments

Comments
 (0)