@@ -234,8 +234,7 @@ impl NodeConfigBuilder {
234234 let node_id = self . node_id . resolve ( env_vars) . map ( NodeId :: new) ?;
235235 let availability_zone = self . availability_zone . resolve_optional ( env_vars) ?;
236236
237- self . indexer_config . enable_standalone_compactors =
238- self . enable_standalone_compactors . resolve ( env_vars) ?;
237+ let enable_standalone_compactors = self . enable_standalone_compactors . resolve ( env_vars) ?;
239238
240239 let enabled_services: HashSet < QuickwitService > = self
241240 . enabled_services
@@ -343,6 +342,7 @@ impl NodeConfigBuilder {
343342 ingest_api_config : self . ingest_api_config ,
344343 jaeger_config : self . jaeger_config ,
345344 compactor_config : self . compactor_config ,
345+ enable_standalone_compactors,
346346 } ;
347347
348348 validate ( & node_config) ?;
@@ -361,7 +361,7 @@ fn validate(node_config: &NodeConfig) -> anyhow::Result<()> {
361361 warn ! ( "peer seeds are empty" ) ;
362362 }
363363 if node_config. is_service_enabled ( QuickwitService :: Compactor )
364- && !node_config. indexer_config . enable_standalone_compactors
364+ && !node_config. enable_standalone_compactors
365365 {
366366 bail ! (
367367 "the `compactor` service can only be enabled when `enable_standalone_compactors` is \
@@ -552,6 +552,7 @@ pub fn node_config_for_tests_from_ports(
552552 ingest_api_config : IngestApiConfig :: default ( ) ,
553553 jaeger_config : JaegerConfig :: default ( ) ,
554554 compactor_config : CompactorConfig :: default ( ) ,
555+ enable_standalone_compactors : false ,
555556 }
556557}
557558
@@ -681,7 +682,6 @@ mod tests {
681682 cpu_capacity: IndexerConfig :: default_cpu_capacity( ) ,
682683 enable_cooperative_indexing: false ,
683684 max_merge_write_throughput: Some ( ByteSize :: mb( 100 ) ) ,
684- enable_standalone_compactors: false ,
685685 parquet_merge_use_streaming_engine: true ,
686686 }
687687 ) ;
@@ -977,6 +977,49 @@ mod tests {
977977 . unwrap ( ) ;
978978 }
979979
980+ #[ tokio:: test]
981+ async fn test_compactor_service_requires_standalone_flag ( ) {
982+ // Compactor service enabled while `enable_standalone_compactors` is off is an
983+ // invalid combination: the default indexer-local merge pipeline is in use, so a
984+ // dedicated compactor must not run.
985+ let error = NodeConfigBuilder {
986+ enabled_services : ConfigValue :: for_test ( List ( vec ! [
987+ "indexer" . to_string( ) ,
988+ "compactor" . to_string( ) ,
989+ ] ) ) ,
990+ ..Default :: default ( )
991+ }
992+ . build_and_validate ( & HashMap :: new ( ) )
993+ . await
994+ . unwrap_err ( ) ;
995+ assert ! (
996+ error. to_string( ) . contains( "enable_standalone_compactors" ) ,
997+ "expected error to mention `enable_standalone_compactors`, got: {error}" ,
998+ ) ;
999+ }
1000+
1001+ #[ tokio:: test]
1002+ async fn test_compactor_service_with_standalone_flag_validates ( ) {
1003+ // All services enabled, including the compactor, with the standalone flag on
1004+ // is a valid configuration.
1005+ let node_config = NodeConfigBuilder {
1006+ enabled_services : ConfigValue :: for_test ( List ( vec ! [
1007+ "control_plane" . to_string( ) ,
1008+ "indexer" . to_string( ) ,
1009+ "searcher" . to_string( ) ,
1010+ "janitor" . to_string( ) ,
1011+ "metastore" . to_string( ) ,
1012+ "compactor" . to_string( ) ,
1013+ ] ) ) ,
1014+ enable_standalone_compactors : ConfigValue :: for_test ( true ) ,
1015+ ..Default :: default ( )
1016+ }
1017+ . build_and_validate ( & HashMap :: new ( ) )
1018+ . await
1019+ . unwrap ( ) ;
1020+ assert ! ( node_config. is_service_enabled( QuickwitService :: Compactor ) ) ;
1021+ }
1022+
9801023 #[ tokio:: test]
9811024 async fn test_peer_socket_addrs ( ) {
9821025 {
0 commit comments