diff --git a/ydb/core/protos/config.proto b/ydb/core/protos/config.proto index 5a85cb70829e..7b289b2c1b04 100644 --- a/ydb/core/protos/config.proto +++ b/ydb/core/protos/config.proto @@ -1858,6 +1858,10 @@ message TSchemeShardConfig { // number of shards per table optional uint32 MaxCdcInitialScanShardsInFlight = 5 [default = 32]; + + // number of shards per table + // 0 means default - NKikimrIndexBuilder.TIndexBuildSettings.max_shards_in_flight + optional uint32 MaxRestoreBuildIndexShardsInFlight = 6 [default = 1000]; } message TCompactionConfig { diff --git a/ydb/core/tablet/resource_broker.cpp b/ydb/core/tablet/resource_broker.cpp index ca3468f8e2cb..05f4f79b772d 100644 --- a/ydb/core/tablet/resource_broker.cpp +++ b/ydb/core/tablet/resource_broker.cpp @@ -1397,7 +1397,7 @@ NKikimrResourceBroker::TResourceBrokerConfig MakeDefaultConfig() queue = config.AddQueues(); queue->SetName("queue_restore"); queue->SetWeight(100); - queue->MutableLimit()->SetCpu(2); + queue->MutableLimit()->SetCpu(10); queue = config.AddQueues(); queue->SetName(NLocalDb::KqpResourceManagerQueue); diff --git a/ydb/core/tx/schemeshard/schemeshard_impl.cpp b/ydb/core/tx/schemeshard/schemeshard_impl.cpp index c5c9b6ec7404..9e79ca806094 100644 --- a/ydb/core/tx/schemeshard/schemeshard_impl.cpp +++ b/ydb/core/tx/schemeshard/schemeshard_impl.cpp @@ -4650,6 +4650,7 @@ void TSchemeShard::OnActivateExecutor(const TActorContext &ctx) { ConfigureStatsBatching(appData->SchemeShardConfig, ctx); ConfigureStatsOperations(appData->SchemeShardConfig, ctx); MaxCdcInitialScanShardsInFlight = appData->SchemeShardConfig.GetMaxCdcInitialScanShardsInFlight(); + MaxRestoreBuildIndexShardsInFlight = appData->SchemeShardConfig.GetMaxRestoreBuildIndexShardsInFlight(); ConfigureBackgroundCleaningQueue(appData->BackgroundCleaningConfig, ctx); ConfigureDataErasureManager(appData->DataErasureConfig); @@ -7223,6 +7224,7 @@ void TSchemeShard::ApplyConsoleConfigs(const NKikimrConfig::TAppConfig& appConfi ConfigureStatsBatching(schemeShardConfig, ctx); ConfigureStatsOperations(schemeShardConfig, ctx); MaxCdcInitialScanShardsInFlight = schemeShardConfig.GetMaxCdcInitialScanShardsInFlight(); + MaxRestoreBuildIndexShardsInFlight = schemeShardConfig.GetMaxRestoreBuildIndexShardsInFlight(); } if (appConfig.HasTableProfilesConfig()) { diff --git a/ydb/core/tx/schemeshard/schemeshard_impl.h b/ydb/core/tx/schemeshard/schemeshard_impl.h index f4bf218201ac..cba9966da885 100644 --- a/ydb/core/tx/schemeshard/schemeshard_impl.h +++ b/ydb/core/tx/schemeshard/schemeshard_impl.h @@ -359,6 +359,7 @@ class TSchemeShard TActorId TabletMigrator; ui32 MaxCdcInitialScanShardsInFlight = 10; + ui32 MaxRestoreBuildIndexShardsInFlight = 0; TDuration StatsMaxExecuteTime; TDuration StatsBatchTimeout; diff --git a/ydb/core/tx/schemeshard/schemeshard_import_flow_proposals.cpp b/ydb/core/tx/schemeshard/schemeshard_import_flow_proposals.cpp index ca3fbab64d71..368b8a06a6c2 100644 --- a/ydb/core/tx/schemeshard/schemeshard_import_flow_proposals.cpp +++ b/ydb/core/tx/schemeshard/schemeshard_import_flow_proposals.cpp @@ -207,6 +207,9 @@ THolder BuildIndexPropose( const TPath dstPath = TPath::Init(item.DstPathId, ss); settings.set_source_path(dstPath.PathString()); + if (ss->MaxRestoreBuildIndexShardsInFlight) { + settings.set_max_shards_in_flight(ss->MaxRestoreBuildIndexShardsInFlight); + } Y_ABORT_UNLESS(item.NextIndexIdx < item.Scheme.indexes_size()); settings.mutable_index()->CopyFrom(item.Scheme.indexes(item.NextIndexIdx));