diff --git a/web-console/src/dialogs/compaction-dialog/__snapshots__/compaction-dialog.spec.tsx.snap b/web-console/src/dialogs/compaction-dialog/__snapshots__/compaction-dialog.spec.tsx.snap index 57ead473d8f..2cbd2bec745 100644 --- a/web-console/src/dialogs/compaction-dialog/__snapshots__/compaction-dialog.spec.tsx.snap +++ b/web-console/src/dialogs/compaction-dialog/__snapshots__/compaction-dialog.spec.tsx.snap @@ -80,7 +80,26 @@ exports[`CompactionDialog matches snapshot with compactionConfig (dynamic partit Object { "defined": [Function], "info": - Directly specify the number of shards to create. If this is specified and 'intervals' is specified in the granularitySpec, the index task can skip the determine intervals/partitions pass through the data. +

+ If the segments generated are a sub-optimal size for the requested partition dimensions, consider setting this field. +

+

+ A target row count for each partition. Each partition will have a row count close to the target assuming evenly distributed keys. Defaults to 5 million if numShards is null. +

+
, + "label": "Target rows per segment", + "name": "tuningConfig.partitionsSpec.targetRowsPerSegment", + "type": "number", + }, + Object { + "defined": [Function], + "info": +

+ If you know the optimal number of shards and want to speed up the time it takes for compaction to run, set this field. +

+

+ Directly specify the number of shards to create. If this is specified and 'intervals' is specified in the granularitySpec, the index task can skip the determine intervals/partitions pass through the data. +

, "label": "Num shards", "name": "tuningConfig.partitionsSpec.numShards", @@ -298,7 +317,26 @@ exports[`CompactionDialog matches snapshot with compactionConfig (hashed partiti Object { "defined": [Function], "info": - Directly specify the number of shards to create. If this is specified and 'intervals' is specified in the granularitySpec, the index task can skip the determine intervals/partitions pass through the data. +

+ If the segments generated are a sub-optimal size for the requested partition dimensions, consider setting this field. +

+

+ A target row count for each partition. Each partition will have a row count close to the target assuming evenly distributed keys. Defaults to 5 million if numShards is null. +

+
, + "label": "Target rows per segment", + "name": "tuningConfig.partitionsSpec.targetRowsPerSegment", + "type": "number", + }, + Object { + "defined": [Function], + "info": +

+ If you know the optimal number of shards and want to speed up the time it takes for compaction to run, set this field. +

+

+ Directly specify the number of shards to create. If this is specified and 'intervals' is specified in the granularitySpec, the index task can skip the determine intervals/partitions pass through the data. +

, "label": "Num shards", "name": "tuningConfig.partitionsSpec.numShards", @@ -516,7 +554,26 @@ exports[`CompactionDialog matches snapshot with compactionConfig (single_dim par Object { "defined": [Function], "info": - Directly specify the number of shards to create. If this is specified and 'intervals' is specified in the granularitySpec, the index task can skip the determine intervals/partitions pass through the data. +

+ If the segments generated are a sub-optimal size for the requested partition dimensions, consider setting this field. +

+

+ A target row count for each partition. Each partition will have a row count close to the target assuming evenly distributed keys. Defaults to 5 million if numShards is null. +

+
, + "label": "Target rows per segment", + "name": "tuningConfig.partitionsSpec.targetRowsPerSegment", + "type": "number", + }, + Object { + "defined": [Function], + "info": +

+ If you know the optimal number of shards and want to speed up the time it takes for compaction to run, set this field. +

+

+ Directly specify the number of shards to create. If this is specified and 'intervals' is specified in the granularitySpec, the index task can skip the determine intervals/partitions pass through the data. +

, "label": "Num shards", "name": "tuningConfig.partitionsSpec.numShards", @@ -734,7 +791,26 @@ exports[`CompactionDialog matches snapshot without compactionConfig 1`] = ` Object { "defined": [Function], "info": - Directly specify the number of shards to create. If this is specified and 'intervals' is specified in the granularitySpec, the index task can skip the determine intervals/partitions pass through the data. +

+ If the segments generated are a sub-optimal size for the requested partition dimensions, consider setting this field. +

+

+ A target row count for each partition. Each partition will have a row count close to the target assuming evenly distributed keys. Defaults to 5 million if numShards is null. +

+
, + "label": "Target rows per segment", + "name": "tuningConfig.partitionsSpec.targetRowsPerSegment", + "type": "number", + }, + Object { + "defined": [Function], + "info": +

+ If you know the optimal number of shards and want to speed up the time it takes for compaction to run, set this field. +

+

+ Directly specify the number of shards to create. If this is specified and 'intervals' is specified in the granularitySpec, the index task can skip the determine intervals/partitions pass through the data. +

, "label": "Num shards", "name": "tuningConfig.partitionsSpec.numShards", diff --git a/web-console/src/dialogs/compaction-dialog/compaction-dialog.tsx b/web-console/src/dialogs/compaction-dialog/compaction-dialog.tsx index 44bee9a88b0..d2b805526bc 100644 --- a/web-console/src/dialogs/compaction-dialog/compaction-dialog.tsx +++ b/web-console/src/dialogs/compaction-dialog/compaction-dialog.tsx @@ -74,16 +74,44 @@ const COMPACTION_CONFIG_FIELDS: Field[] = [ info: <>Total number of rows in segments waiting for being pushed., }, // partitionsSpec type: hashed + { + name: 'tuningConfig.partitionsSpec.targetRowsPerSegment', + label: 'Target rows per segment', + type: 'number', + defined: (t: CompactionConfig) => + deepGet(t, 'tuningConfig.partitionsSpec.type') === 'hashed' && + !deepGet(t, 'tuningConfig.partitionsSpec.numShards'), + info: ( + <> +

+ If the segments generated are a sub-optimal size for the requested partition dimensions, + consider setting this field. +

+

+ A target row count for each partition. Each partition will have a row count close to the + target assuming evenly distributed keys. Defaults to 5 million if numShards is null. +

+ + ), + }, { name: 'tuningConfig.partitionsSpec.numShards', label: 'Num shards', type: 'number', - defined: (t: CompactionConfig) => deepGet(t, 'tuningConfig.partitionsSpec.type') === 'hashed', + defined: (t: CompactionConfig) => + deepGet(t, 'tuningConfig.partitionsSpec.type') === 'hashed' && + !deepGet(t, 'tuningConfig.partitionsSpec.targetRowsPerSegment'), info: ( <> - Directly specify the number of shards to create. If this is specified and 'intervals' is - specified in the granularitySpec, the index task can skip the determine intervals/partitions - pass through the data. +

+ If you know the optimal number of shards and want to speed up the time it takes for + compaction to run, set this field. +

+

+ Directly specify the number of shards to create. If this is specified and 'intervals' is + specified in the granularitySpec, the index task can skip the determine + intervals/partitions pass through the data. +

), }, @@ -211,7 +239,12 @@ function validCompactionConfig(compactionConfig: CompactionConfig): boolean { deepGet(compactionConfig, 'tuningConfig.partitionsSpec.type') || 'dynamic'; switch (partitionsSpecType) { // case 'dynamic': // Nothing to check for dynamic - // case 'hashed': // Nothing to check for hashed + case 'hashed': + return !( + Boolean(deepGet(compactionConfig, 'tuningConfig.partitionsSpec.targetRowsPerSegment')) && + Boolean(deepGet(compactionConfig, 'tuningConfig.partitionsSpec.numShards')) + ); + break; case 'single_dim': if (!deepGet(compactionConfig, 'tuningConfig.partitionsSpec.partitionDimension')) { return false; diff --git a/web-console/src/utils/ingestion-spec.tsx b/web-console/src/utils/ingestion-spec.tsx index 996f8e0207e..73f6d43297f 100644 --- a/web-console/src/utils/ingestion-spec.tsx +++ b/web-console/src/utils/ingestion-spec.tsx @@ -2114,6 +2114,11 @@ export function invalidTuningConfig(tuningConfig: TuningConfig, intervals: any): if (!intervals) return true; switch (deepGet(tuningConfig, 'partitionsSpec.type')) { + case 'hashed': + return ( + Boolean(deepGet(tuningConfig, 'partitionsSpec.targetRowsPerSegment')) && + Boolean(deepGet(tuningConfig, 'partitionsSpec.numShards')) + ); case 'single_dim': if (!deepGet(tuningConfig, 'partitionsSpec.partitionDimension')) return true; const hasTargetRowsPerSegment = Boolean( @@ -2181,16 +2186,45 @@ export function getPartitionRelatedTuningSpecFormFields( info: <>Total number of rows in segments waiting for being pushed., }, // partitionsSpec type: hashed + { + name: 'partitionsSpec.targetRowsPerSegment', + label: 'Target rows per segment', + type: 'number', + defined: (t: TuningConfig) => + deepGet(t, 'partitionsSpec.type') === 'hashed' && + !deepGet(t, 'partitionsSpec.numShards'), + info: ( + <> +

+ If the segments generated are a sub-optimal size for the requested partition + dimensions, consider setting this field. +

+

+ A target row count for each partition. Each partition will have a row count close to + the target assuming evenly distributed keys. Defaults to 5 million if numShards is + null. +

+ + ), + }, { name: 'partitionsSpec.numShards', label: 'Num shards', type: 'number', - defined: (t: TuningConfig) => deepGet(t, 'partitionsSpec.type') === 'hashed', + defined: (t: TuningConfig) => + deepGet(t, 'partitionsSpec.type') === 'hashed' && + !deepGet(t, 'partitionsSpec.targetRowsPerSegment'), info: ( <> - Directly specify the number of shards to create. If this is specified and 'intervals' - is specified in the granularitySpec, the index task can skip the determine - intervals/partitions pass through the data. +

+ If you know the optimal number of shards and want to speed up the time it takes for + compaction to run, set this field. +

+

+ Directly specify the number of shards to create. If this is specified and + 'intervals' is specified in the granularitySpec, the index task can skip the + determine intervals/partitions pass through the data. +

), },