@@ -100,6 +100,7 @@ pub struct Server<C = HttpConnector, A = AddrIncoming, D = HttpsConnector<HttpCo
100
100
pub heartbeat_config : Option < HeartbeatConfig > ,
101
101
pub disable_namespaces : bool ,
102
102
pub shutdown : Arc < Notify > ,
103
+ pub max_active_namespaces : usize ,
103
104
}
104
105
105
106
impl < C , A , D > Default for Server < C , A , D > {
@@ -117,6 +118,7 @@ impl<C, A, D> Default for Server<C, A, D> {
117
118
heartbeat_config : Default :: default ( ) ,
118
119
disable_namespaces : true ,
119
120
shutdown : Default :: default ( ) ,
121
+ max_active_namespaces : 100 ,
120
122
}
121
123
}
122
124
}
@@ -384,6 +386,7 @@ where
384
386
db_config : self . db_config . clone ( ) ,
385
387
base_path : self . path . clone ( ) ,
386
388
auth : auth. clone ( ) ,
389
+ max_active_namespaces : self . max_active_namespaces ,
387
390
} ;
388
391
let ( namespaces, proxy_service, replication_service) = replica. configure ( ) . await ?;
389
392
self . rpc_client_config = None ;
@@ -422,6 +425,7 @@ where
422
425
extensions,
423
426
base_path : self . path . clone ( ) ,
424
427
disable_namespaces : self . disable_namespaces ,
428
+ max_active_namespaces : self . max_active_namespaces ,
425
429
join_set : & mut join_set,
426
430
auth : auth. clone ( ) ,
427
431
} ;
@@ -487,6 +491,7 @@ struct Primary<'a, A> {
487
491
extensions : Arc < [ PathBuf ] > ,
488
492
base_path : Arc < Path > ,
489
493
disable_namespaces : bool ,
494
+ max_active_namespaces : usize ,
490
495
auth : Arc < Auth > ,
491
496
join_set : & ' a mut JoinSet < anyhow:: Result < ( ) > > ,
492
497
}
@@ -520,12 +525,12 @@ where
520
525
let meta_store_path = conf. base_path . join ( "metastore" ) ;
521
526
522
527
let factory = PrimaryNamespaceMaker :: new ( conf) ;
523
-
524
528
let namespaces = NamespaceStore :: new (
525
529
factory,
526
530
false ,
527
531
self . db_config . snapshot_at_shutdown ,
528
532
meta_store_path,
533
+ self . max_active_namespaces ,
529
534
)
530
535
. await ?;
531
536
@@ -602,6 +607,7 @@ struct Replica<C> {
602
607
db_config : DbConfig ,
603
608
base_path : Arc < Path > ,
604
609
auth : Arc < Auth > ,
610
+ max_active_namespaces : usize ,
605
611
}
606
612
607
613
impl < C : Connector > Replica < C > {
@@ -627,7 +633,14 @@ impl<C: Connector> Replica<C> {
627
633
let meta_store_path = conf. base_path . join ( "metastore" ) ;
628
634
629
635
let factory = ReplicaNamespaceMaker :: new ( conf) ;
630
- let namespaces = NamespaceStore :: new ( factory, true , false , meta_store_path) . await ?;
636
+ let namespaces = NamespaceStore :: new (
637
+ factory,
638
+ true ,
639
+ false ,
640
+ meta_store_path,
641
+ self . max_active_namespaces ,
642
+ )
643
+ . await ?;
631
644
let replication_service = ReplicationLogProxyService :: new ( channel. clone ( ) , uri. clone ( ) ) ;
632
645
let proxy_service = ReplicaProxyService :: new ( channel, uri, self . auth . clone ( ) ) ;
633
646
0 commit comments