Skip to content

Commit a72bdc4

Browse files
stanislav-shchetininblinkov
authored andcommitted
Fix for a bug with backward compatibility in the export of changefeeds (#15435)
1 parent 2c56e2c commit a72bdc4

File tree

4 files changed

+28
-22
lines changed

4 files changed

+28
-22
lines changed

ydb/core/protos/feature_flags.proto

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,4 +197,5 @@ message TFeatureFlags {
197197
optional bool EnablePermissionsExport = 171 [default = false];
198198
optional bool EnableDataErasure = 172 [default = false];
199199
optional bool EnableShowCreate = 173 [default = false];
200+
optional bool EnableChangefeedsExport = 174 [default = false];
200201
}

ydb/core/tx/datashard/export_s3_uploader.cpp

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -918,29 +918,31 @@ IActor* TS3Export::CreateUploader(const TActorId& dataShard, ui64 txId) const {
918918
? GenYdbScheme(Columns, Task.GetTable())
919919
: Nothing();
920920

921-
const auto& persQueues = Task.GetChangefeedUnderlyingTopics();
922-
const auto& cdcStreams = Task.GetTable().GetTable().GetCdcStreams();
923-
Y_ASSERT(persQueues.size() == cdcStreams.size());
924-
925-
const int changefeedsCount = cdcStreams.size();
926921
TVector <TChangefeedExportDescriptions> changefeeds;
927-
changefeeds.reserve(changefeedsCount);
928-
929-
for (int i = 0; i < changefeedsCount; ++i) {
930-
Ydb::Table::ChangefeedDescription changefeed;
931-
const auto& cdcStream = cdcStreams.at(i);
932-
FillChangefeedDescription(changefeed, cdcStream);
933-
934-
Ydb::Topic::DescribeTopicResult topic;
935-
const auto& pq = persQueues.at(i);
936-
Ydb::StatusIds::StatusCode status;
937-
TString error;
938-
FillTopicDescription(topic, pq.GetPersQueueGroup(), pq.GetSelf(), cdcStream.GetName(), status, error);
939-
// Unnecessary fields
940-
topic.clear_self();
941-
topic.clear_topic_stats();
942-
943-
changefeeds.emplace_back(changefeed, topic);
922+
if (AppData()->FeatureFlags.GetEnableChangefeedsExport()) {
923+
const auto& persQueues = Task.GetChangefeedUnderlyingTopics();
924+
const auto& cdcStreams = Task.GetTable().GetTable().GetCdcStreams();
925+
Y_ASSERT(persQueues.size() == cdcStreams.size());
926+
927+
const int changefeedsCount = cdcStreams.size();
928+
changefeeds.reserve(changefeedsCount);
929+
930+
for (int i = 0; i < changefeedsCount; ++i) {
931+
Ydb::Table::ChangefeedDescription changefeed;
932+
const auto& cdcStream = cdcStreams.at(i);
933+
FillChangefeedDescription(changefeed, cdcStream);
934+
935+
Ydb::Topic::DescribeTopicResult topic;
936+
const auto& pq = persQueues.at(i);
937+
Ydb::StatusIds::StatusCode status;
938+
TString error;
939+
FillTopicDescription(topic, pq.GetPersQueueGroup(), pq.GetSelf(), cdcStream.GetName(), status, error);
940+
// Unnecessary fields
941+
topic.clear_self();
942+
topic.clear_topic_stats();
943+
944+
changefeeds.emplace_back(changefeed, topic);
945+
}
944946
}
945947

946948
auto permissions = (Task.GetEnablePermissions() && Task.GetShardNum() == 0)

ydb/core/tx/schemeshard/ut_export/ut_export.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2632,6 +2632,8 @@ attributes {
26322632
)", port);
26332633

26342634
TTestEnv env(runtime, TTestEnvOptions().EnableChecksumsExport(true));
2635+
runtime.GetAppData().FeatureFlags.SetEnableChangefeedsExport(true);
2636+
26352637
Run(runtime, env, TVector<TString>{
26362638
R"(
26372639
Name: "Table"

ydb/services/ydb/backup_ut/ydb_backup_ut.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2261,6 +2261,7 @@ Y_UNIT_TEST_SUITE(BackupRestoreS3) {
22612261
NTopic::TTopicClient topicClient(testEnv.GetDriver());
22622262

22632263
constexpr const char* table = "/Root/table";
2264+
testEnv.GetServer().GetRuntime()->GetAppData().FeatureFlags.SetEnableChangefeedsExport(true);
22642265
testEnv.GetServer().GetRuntime()->GetAppData().FeatureFlags.SetEnableChangefeedsImport(true);
22652266

22662267
TestChangefeedAndTopicDescriptionsIsPreserved(

0 commit comments

Comments
 (0)