Skip to content

Commit ff5385f

Browse files
authored
Rename incr backup system columns (#7847)
1 parent 0b8a6e9 commit ff5385f

8 files changed

+21
-14
lines changed

ydb/core/backup/impl/table_writer_impl.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ class TChangeRecord: public NChangeExchange::TChangeRecordBase {
9797
*upsert.MutableTags() = {
9898
ProtoBody.GetCdcDataChange().GetUpsert().GetTags().begin(),
9999
ProtoBody.GetCdcDataChange().GetUpsert().GetTags().end()};
100-
auto it = Schema->ValueColumns.find("__incrBackupImpl_deleted");
100+
auto it = Schema->ValueColumns.find("__ydb_incrBackupImpl_deleted");
101101
Y_ABORT_UNLESS(it != Schema->ValueColumns.end(), "Invariant violation");
102102
upsert.AddTags(it->second.Tag);
103103

@@ -119,7 +119,7 @@ class TChangeRecord: public NChangeExchange::TChangeRecordBase {
119119

120120
for (const auto& [name, value] : Schema->ValueColumns) {
121121
tags.push_back(value.Tag);
122-
if (name != "__incrBackupImpl_deleted") {
122+
if (name != "__ydb_incrBackupImpl_deleted") {
123123
cells.emplace_back();
124124
} else {
125125
cells.emplace_back(TCell::Make<bool>(true));

ydb/core/backup/impl/table_writer_ut.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Y_UNIT_TEST_SUITE(TableWriter) {
1414
.Tag = 1,
1515
.Type = NScheme::TTypeInfo{NScheme::NTypeIds::Uint64},
1616
});
17-
schema->ValueColumns.emplace("__incrBackupImpl_deleted", TLightweightSchema::TColumn{
17+
schema->ValueColumns.emplace("__ydb_incrBackupImpl_deleted", TLightweightSchema::TColumn{
1818
.Tag = 123,
1919
.Type = NScheme::TTypeInfo{NScheme::NTypeIds::Bool},
2020
});
@@ -59,10 +59,10 @@ Y_UNIT_TEST_SUITE(TableWriter) {
5959
TString out = TSerializedCellVec::Serialize(outCells);
6060

6161
UNIT_ASSERT_VALUES_EQUAL(TSerializedCellVec::Serialize(keyCells), result.GetKey());
62-
UNIT_ASSERT_VALUES_EQUAL(out, result.GetUpsert().GetData());
6362
UNIT_ASSERT(result.GetUpsert().TagsSize() == 2);
6463
UNIT_ASSERT(result.GetUpsert().GetTags(0) == 1);
6564
UNIT_ASSERT(result.GetUpsert().GetTags(1) == 123);
65+
UNIT_ASSERT_VALUES_EQUAL(out, result.GetUpsert().GetData());
6666
}
6767

6868
{
@@ -93,17 +93,17 @@ Y_UNIT_TEST_SUITE(TableWriter) {
9393
record->Serialize(result, ctx);
9494

9595
TVector<TCell> outCells{
96-
TCell::Make<bool>(true),
9796
TCell(),
97+
TCell::Make<bool>(true),
9898
};
9999

100100
TString out = TSerializedCellVec::Serialize(outCells);
101101

102102
UNIT_ASSERT_VALUES_EQUAL(TSerializedCellVec::Serialize(keyCells), result.GetKey());
103-
UNIT_ASSERT_VALUES_EQUAL(out, result.GetUpsert().GetData());
104103
UNIT_ASSERT(result.GetUpsert().TagsSize() == 2);
105-
UNIT_ASSERT(result.GetUpsert().GetTags(0) == 123);
106-
UNIT_ASSERT(result.GetUpsert().GetTags(1) == 1);
104+
UNIT_ASSERT(result.GetUpsert().GetTags(1) == 123);
105+
UNIT_ASSERT(result.GetUpsert().GetTags(0) == 1);
106+
UNIT_ASSERT_VALUES_EQUAL(out, result.GetUpsert().GetData());
107107
}
108108
}
109109

@@ -148,9 +148,9 @@ Y_UNIT_TEST_SUITE(TableWriter) {
148148
record->Serialize(result, ctx);
149149

150150
UNIT_ASSERT_VALUES_EQUAL(TSerializedCellVec::Serialize(keyCells), result.GetKey());
151-
UNIT_ASSERT_VALUES_EQUAL(upsert.GetData(), result.GetUpsert().GetData());
152151
UNIT_ASSERT(result.GetUpsert().TagsSize() == 1);
153152
UNIT_ASSERT(result.GetUpsert().GetTags(0) == 1);
153+
UNIT_ASSERT_VALUES_EQUAL(upsert.GetData(), result.GetUpsert().GetData());
154154
}
155155

156156
}

ydb/core/tx/datashard/cdc_stream_scan.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ class TDataShard::TTxCdcStreamScanProgress
218218
const auto tag = tags.at(pos);
219219
auto it = table->Columns.find(tag);
220220
Y_ABORT_UNLESS(it != table->Columns.end());
221-
if (it->second.Name == "__incrBackupImpl_deleted") {
221+
if (it->second.Name == "__ydb_incrBackupImpl_deleted") {
222222
if (const auto& cell = cells.at(pos); !cell.IsNull() && cell.AsValue<bool>()) {
223223
return std::nullopt;
224224
}

ydb/core/tx/datashard/datashard_ut_incremental_backup.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,13 +274,14 @@ Y_UNIT_TEST_SUITE(IncrementalBackup) {
274274
"/Root",
275275
"IncrBackupImpl",
276276
SimpleTable()
277+
.AllowSystemColumnNames(true)
277278
.Columns({
278279
{"key", "Uint32", true, false},
279280
{"value", "Uint32", false, false},
280-
{"__incrBackupImpl_deleted", "Bool", false, false}}));
281+
{"__ydb_incrBackupImpl_deleted", "Bool", false, false}}));
281282

282283
ExecSQL(server, edgeActor, R"(
283-
UPSERT INTO `/Root/IncrBackupImpl` (key, value, __incrBackupImpl_deleted) VALUES
284+
UPSERT INTO `/Root/IncrBackupImpl` (key, value, __ydb_incrBackupImpl_deleted) VALUES
284285
(1, 10, NULL),
285286
(2, NULL, true),
286287
(3, 30, NULL),

ydb/core/tx/datashard/ut_common/datashard_ut_common.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1184,6 +1184,10 @@ std::tuple<TVector<ui64>, TTableId> CreateShardedTable(
11841184
UNIT_ASSERT(desc);
11851185
desc->SetName(name);
11861186

1187+
if (opts.AllowSystemColumnNames_) {
1188+
desc->SetSystemColumnNamesAllowed(true);
1189+
}
1190+
11871191
std::vector<TString> defaultFromSequences;
11881192

11891193
for (const auto& column : opts.Columns_) {

ydb/core/tx/datashard/ut_common/datashard_ut_common.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -487,6 +487,7 @@ struct TShardedTableOptions {
487487
TABLE_OPTION(std::optional<EReplicationConsistency>, ReplicationConsistency, std::nullopt);
488488
TABLE_OPTION(TAttributes, Attributes, {});
489489
TABLE_OPTION(bool, Sequences, false);
490+
TABLE_OPTION(bool, AllowSystemColumnNames, false);
490491

491492
#undef TABLE_OPTION
492493
#undef TABLE_OPTION_IMPL

ydb/core/tx/schemeshard/schemeshard__operation_alter_continuous_backup.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ void DoCreateIncrBackupTable(const TOperationId& opId, const TPath& dst, NKikimr
4444
auto& desc = *outTx.MutableCreateTable();
4545
desc.CopyFrom(tableDesc);
4646
desc.SetName(dst.LeafName());
47+
desc.SetSystemColumnNamesAllowed(true);
4748

4849
auto& attrsDesc = *outTx.MutableAlterUserAttributes();
4950
attrsDesc.SetPathName(dst.LeafName());
@@ -59,7 +60,7 @@ void DoCreateIncrBackupTable(const TOperationId& opId, const TPath& dst, NKikimr
5960
// TODO: cleanup all sequences
6061

6162
auto* col = desc.AddColumns();
62-
col->SetName("__incrBackupImpl_deleted");
63+
col->SetName("__ydb_incrBackupImpl_deleted");
6364
col->SetType("Bool");
6465

6566
result.push_back(CreateNewTable(NextPartId(opId, result), outTx));

ydb/core/tx/schemeshard/ut_continuous_backup/ut_continuous_backup.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ Y_UNIT_TEST_SUITE(TContinuousBackupTests) {
125125
TestDescribeResult(DescribePrivatePath(runtime, "/MyRoot/IncrBackupImpl"), {
126126
NLs::PathExist,
127127
NLs::IsTable,
128-
NLs::CheckColumns("IncrBackupImpl", {"key", "value", "__incrBackupImpl_deleted"}, {}, {"key"}),
128+
NLs::CheckColumns("IncrBackupImpl", {"key", "value", "__ydb_incrBackupImpl_deleted"}, {}, {"key"}),
129129
});
130130
}
131131
} // TCdcStreamWithInitialScanTests

0 commit comments

Comments
 (0)