Skip to content

Commit 990ef8d

Browse files
committed
working implementation
1 parent 49c976e commit 990ef8d

File tree

4 files changed

+33
-3
lines changed

4 files changed

+33
-3
lines changed

ydb/core/tx/schemeshard/schemeshard_build_index.cpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ void TSchemeShard::Handle(TEvPrivate::TEvIndexBuildingMakeABill::TPtr& ev, const
3434

3535
void TSchemeShard::PersistCreateBuildIndex(NIceDb::TNiceDb& db, const TIndexBuildInfo::TPtr info) {
3636
Y_ABORT_UNLESS(info->BuildKind != TIndexBuildInfo::EBuildKind::BuildKindUnspecified);
37-
db.Table<Schema::IndexBuild>().Key(info->Id).Update(
37+
auto persistedBuildIndex = db.Table<Schema::IndexBuild>().Key(info->Id);
38+
persistedBuildIndex.Update(
3839
NIceDb::TUpdate<Schema::IndexBuild::Uid>(info->Uid),
3940
NIceDb::TUpdate<Schema::IndexBuild::DomainOwnerId>(info->DomainPathId.OwnerId),
4041
NIceDb::TUpdate<Schema::IndexBuild::DomainLocalId>(info->DomainPathId.LocalPathId),
@@ -48,6 +49,17 @@ void TSchemeShard::PersistCreateBuildIndex(NIceDb::TNiceDb& db, const TIndexBuil
4849
NIceDb::TUpdate<Schema::IndexBuild::MaxRetries>(info->Limits.MaxRetries),
4950
NIceDb::TUpdate<Schema::IndexBuild::BuildKind>(ui32(info->BuildKind))
5051
);
52+
// Persist details of the index build operation: ImplTableDescription.
53+
// We have chosen TIndexCreationConfig's string representation as the serialization format.
54+
{
55+
NKikimrSchemeOp::TIndexCreationConfig serializableRepresentation;
56+
57+
*serializableRepresentation.MutableIndexImplTableDescription() = info->ImplTableDescription;
58+
59+
persistedBuildIndex.Update(
60+
NIceDb::TUpdate<Schema::IndexBuild::CreationConfig>(serializableRepresentation.SerializeAsString())
61+
);
62+
}
5163

5264
ui32 columnNo = 0;
5365
for (ui32 i = 0; i < info->IndexColumns.size(); ++i, ++columnNo) {

ydb/core/tx/schemeshard/schemeshard_info_types.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3092,6 +3092,14 @@ struct TIndexBuildInfo: public TSimpleRefCount<TIndexBuildInfo> {
30923092
indexInfo->IndexName = row.template GetValue<Schema::IndexBuild::IndexName>();
30933093
indexInfo->IndexType = row.template GetValue<Schema::IndexBuild::IndexType>();
30943094

3095+
// Restore the operation details: ImplTableDescription.
3096+
if (row.template HaveValue<Schema::IndexBuild::CreationConfig>()) {
3097+
NKikimrSchemeOp::TIndexCreationConfig creationConfig;
3098+
Y_ABORT_UNLESS(creationConfig.ParseFromString(row.template GetValue<Schema::IndexBuild::CreationConfig>()));
3099+
3100+
indexInfo->ImplTableDescription = std::move(*creationConfig.MutableIndexImplTableDescription());
3101+
}
3102+
30953103
indexInfo->State = TIndexBuildInfo::EState(
30963104
row.template GetValue<Schema::IndexBuild::State>());
30973105
indexInfo->Issue =

ydb/core/tx/schemeshard/schemeshard_schema.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1318,6 +1318,9 @@ struct Schema : NIceDb::Schema {
13181318
struct AlterMainTableTxStatus : Column<32, NScheme::NTypeIds::Uint32> { using Type = NKikimrScheme::EStatus; };
13191319
struct AlterMainTableTxDone : Column<33, NScheme::NTypeIds::Bool> {};
13201320

1321+
// Serialized as string NKikimrSchemeOp::TIndexCreationConfig protobuf.
1322+
struct CreationConfig : Column<34, NScheme::NTypeIds::String> { using Type = TString; };
1323+
13211324
using TKey = TableKey<Id>;
13221325
using TColumns = TableColumns<
13231326
Id,
@@ -1352,7 +1355,8 @@ struct Schema : NIceDb::Schema {
13521355
BuildKind,
13531356
AlterMainTableTxId,
13541357
AlterMainTableTxStatus,
1355-
AlterMainTableTxDone
1358+
AlterMainTableTxDone,
1359+
CreationConfig
13561360
>;
13571361
};
13581362

ydb/tests/functional/scheme_tests/canondata/tablet_scheme_tests.TestTabletSchemes.test_tablet_schemes_flat_schemeshard_/flat_schemeshard.schema

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4788,6 +4788,11 @@
47884788
"ColumnId": 33,
47894789
"ColumnName": "AlterMainTableTxDone",
47904790
"ColumnType": "Bool"
4791+
},
4792+
{
4793+
"ColumnId": 34,
4794+
"ColumnName": "CreationConfig",
4795+
"ColumnType": "String"
47914796
}
47924797
],
47934798
"ColumnsDropped": [],
@@ -4826,7 +4831,8 @@
48264831
30,
48274832
31,
48284833
32,
4829-
33
4834+
33,
4835+
34
48304836
],
48314837
"RoomID": 0,
48324838
"Codec": 0,

0 commit comments

Comments
 (0)