@@ -270,7 +270,7 @@ class TConfigureParts: public TSubOperationState {
270
270
271
271
txState->ClearShardsInProgress ();
272
272
273
- Y_ABORT_UNLESS (tableInfo->ColumnShards .empty () || tableInfo->OwnedColumnShards .empty ());
273
+ Y_ABORT_UNLESS (tableInfo->GetColumnShards () .empty () || tableInfo->OwnedColumnShards .empty ());
274
274
275
275
TString columnShardTxBody;
276
276
auto seqNo = context.SS ->StartRound (*txState);
@@ -280,7 +280,7 @@ class TConfigureParts: public TSubOperationState {
280
280
{
281
281
NKikimrTxColumnShard::TCreateTable* create{};
282
282
if (tableInfo->IsStandalone ()) {
283
- Y_ABORT_UNLESS (tableInfo->ColumnShards .empty ());
283
+ Y_ABORT_UNLESS (tableInfo->GetColumnShards () .empty ());
284
284
Y_ABORT_UNLESS (tableInfo->Description .HasSchema ());
285
285
286
286
auto * init = tx.MutableInitShard ();
@@ -392,11 +392,7 @@ class TPropose: public TSubOperationState {
392
392
393
393
auto table = context.SS ->ColumnTables .TakeAlterVerified (pathId);
394
394
if (table->IsStandalone ()) {
395
- Y_ABORT_UNLESS (table->ColumnShards .empty ());
396
- auto currentLayout = TColumnTablesLayout::BuildTrivial (TColumnTablesLayout::ShardIdxToTabletId (table->OwnedColumnShards , *context.SS ));
397
- auto layoutPolicy = std::make_shared<TOlapStoreInfo::TMinimalTablesCountLayout>();
398
- bool isNewGroup;
399
- Y_ABORT_UNLESS (table.InitShardingTablets (currentLayout, table->OwnedColumnShards .size (), layoutPolicy, isNewGroup));
395
+ table->SetColumnShards (TColumnTablesLayout::ShardIdxToTabletId (table->OwnedColumnShards , *context.SS ));
400
396
}
401
397
402
398
context.SS ->PersistColumnTableAlterRemove (db, pathId);
@@ -584,7 +580,7 @@ class TCreateColumnTable: public TSubOperation {
584
580
const auto acceptExisted = !Transaction.GetFailOnExist ();
585
581
const TString& parentPathStr = Transaction.GetWorkingDir ();
586
582
587
- // Copy CreateColumnTable for changes. Update defaut sharding if not set.
583
+ // Copy CreateColumnTable for changes. Update default sharding if not set.
588
584
auto createDescription = Transaction.GetCreateColumnTable ();
589
585
if (!createDescription.HasColumnShardCount ()) {
590
586
createDescription.SetColumnShardCount (TTableConstructorBase::DEFAULT_SHARDS_COUNT);
@@ -705,12 +701,12 @@ class TCreateColumnTable: public TSubOperation {
705
701
tableInfo = tableConstructor.BuildTableInfo (errors);
706
702
if (tableInfo) {
707
703
auto layoutPolicy = storeInfo->GetTablesLayoutPolicy ();
708
- auto currentLayout = context.SS ->ColumnTables .GetTablesLayout (
709
- TColumnTablesLayout::ShardIdxToTabletId (storeInfo-> GetColumnShards (), *context. SS ) );
710
- TTablesStorage::TTableCreateOperator createOperator (tableInfo );
711
- if (!createOperator. InitShardingTablets (currentLayout, shardsCount, layoutPolicy, needUpdateObject)) {
712
- result-> SetError (NKikimrScheme::StatusPreconditionFailed,
713
- " cannot layout table by shards " );
704
+ auto currentLayout = context.SS ->ColumnTables .GetTablesLayout (TColumnTablesLayout::ShardIdxToTabletId (storeInfo-> GetColumnShards (), *context. SS ));
705
+ auto layoutConclusion = layoutPolicy-> Layout (currentLayout, shardsCount );
706
+ needUpdateObject = layoutConclusion-> GetIsNewGroup ( );
707
+ tableInfo-> SetColumnShards ( std::move (layoutConclusion-> MutableTabletIds ()));
708
+ if (layoutConclusion. IsFail ()) {
709
+ result-> SetError (NKikimrScheme::StatusPreconditionFailed, layoutConclusion. GetErrorMessage () );
714
710
return result;
715
711
}
716
712
}
@@ -746,9 +742,9 @@ class TCreateColumnTable: public TSubOperation {
746
742
auto olapStorePath = parentPath.FindOlapStore ();
747
743
748
744
txState.State = TTxState::ConfigureParts;
749
- txState.Shards .reserve (tableInfo->ColumnShards .size ());
745
+ txState.Shards .reserve (tableInfo->GetColumnShards () .size ());
750
746
751
- for (ui64 columnShardId : tableInfo->ColumnShards ) {
747
+ for (ui64 columnShardId : tableInfo->GetColumnShards () ) {
752
748
auto tabletId = TTabletId (columnShardId);
753
749
auto shardIdx = context.SS ->TabletIdToShardIdx .at (tabletId);
754
750
TShardInfo& shardInfo = context.SS ->ShardInfos .at (shardIdx);
0 commit comments