@@ -374,19 +374,18 @@ fn validate(node_config: &NodeConfig) -> anyhow::Result<()> {
374374
375375/// Validates the configuration of the [`QuickwitService::MetastoreReadReplica`] role.
376376///
377- /// The [`QuickwitService::MetastoreReadReplica`] role serves the same gRPC service as
378- /// [`QuickwitService::Metastore`], so the two cannot run on the same node, and the read-replica
379- /// role requires `metastore_read_replica_uri` to connect to.
377+ /// The [`QuickwitService::MetastoreReadReplica`] role serves the same gRPC service as a read-only
378+ /// metastore, so it must run standalone and requires `metastore_read_replica_uri` to connect to.
380379fn validate_metastore_read_replica ( node_config : & NodeConfig ) -> anyhow:: Result < ( ) > {
381380 let read_replica_enabled =
382381 node_config. is_service_enabled ( QuickwitService :: MetastoreReadReplica ) ;
383382 if !read_replica_enabled {
384383 return Ok ( ( ) ) ;
385384 }
386- if node_config. is_service_enabled ( QuickwitService :: Metastore ) {
385+ if node_config. enabled_services . len ( ) != 1 {
387386 bail ! (
388- "a node cannot run both the `metastore` and `metastore_read_replica` services: they \
389- expose the same gRPC service and must be deployed as separate nodes "
387+ "the `metastore_read_replica` service must run standalone and cannot be combined with \
388+ any other service"
390389 ) ;
391390 }
392391 match & node_config. metastore_read_replica_uri {
@@ -1122,23 +1121,37 @@ mod tests {
11221121 }
11231122
11241123 #[ tokio:: test]
1125- async fn test_metastore_and_read_replica_roles_are_mutually_exclusive ( ) {
1126- let config_yaml = r#"
1127- version: 0.8
1128- node_id: test-node
1129- enabled_services:
1130- - metastore
1131- - metastore_read_replica
1132- metastore_read_replica_uri: postgres://user:pass@host:5432/db
1133- "# ;
1134- let error = load_node_config_with_env (
1135- ConfigFormat :: Yaml ,
1136- config_yaml. as_bytes ( ) ,
1137- & Default :: default ( ) ,
1138- )
1139- . await
1140- . unwrap_err ( ) ;
1141- assert ! ( error. to_string( ) . contains( "cannot run both" ) ) ;
1124+ async fn test_metastore_read_replica_role_must_run_standalone ( ) {
1125+ for service in [
1126+ QuickwitService :: ControlPlane ,
1127+ QuickwitService :: Indexer ,
1128+ QuickwitService :: Searcher ,
1129+ QuickwitService :: Janitor ,
1130+ QuickwitService :: Metastore ,
1131+ ] {
1132+ let config_yaml = format ! (
1133+ r#"
1134+ version: 0.8
1135+ node_id: test-node
1136+ enabled_services:
1137+ - metastore_read_replica
1138+ - {}
1139+ metastore_read_replica_uri: postgres://user:pass@host:5432/db
1140+ "# ,
1141+ service. as_str( )
1142+ ) ;
1143+ let error = load_node_config_with_env (
1144+ ConfigFormat :: Yaml ,
1145+ config_yaml. as_bytes ( ) ,
1146+ & Default :: default ( ) ,
1147+ )
1148+ . await
1149+ . unwrap_err ( ) ;
1150+ assert ! (
1151+ error. to_string( ) . contains( "must run standalone" ) ,
1152+ "{service} should not be allowed with metastore_read_replica: {error}"
1153+ ) ;
1154+ }
11421155 }
11431156
11441157 #[ tokio:: test]
0 commit comments