@@ -85,6 +85,12 @@ pub struct EnvVarsStore {
8585 /// this. Set by `GRAPH_STORE_BATCH_TIMEOUT`. Unlimited by default
8686 pub batch_timeout : Option < Duration > ,
8787
88+ /// The number of workers to use for batch operations. If there are idle
89+ /// connectiosn, each subgraph copy operation will use up to this many
90+ /// workers to copy tables in parallel. Defaults to 1 and must be at
91+ /// least 1
92+ pub batch_workers : usize ,
93+
8894 /// Prune tables where we will remove at least this fraction of entity
8995 /// versions by rebuilding the table. Set by
9096 /// `GRAPH_STORE_HISTORY_REBUILD_THRESHOLD`. The default is 0.5
@@ -175,6 +181,7 @@ impl TryFrom<InnerStore> for EnvVarsStore {
175181 write_queue_size : x. write_queue_size ,
176182 batch_target_duration : Duration :: from_secs ( x. batch_target_duration_in_secs ) ,
177183 batch_timeout : x. batch_timeout_in_secs . map ( Duration :: from_secs) ,
184+ batch_workers : x. batch_workers ,
178185 rebuild_threshold : x. rebuild_threshold . 0 ,
179186 delete_threshold : x. delete_threshold . 0 ,
180187 history_slack_factor : x. history_slack_factor . 0 ,
@@ -194,6 +201,9 @@ impl TryFrom<InnerStore> for EnvVarsStore {
194201 ) ;
195202 }
196203 }
204+ if vars. batch_workers < 1 {
205+ bail ! ( "GRAPH_STORE_BATCH_WORKERS must be at least 1" ) ;
206+ }
197207 Ok ( vars)
198208 }
199209}
@@ -239,6 +249,8 @@ pub struct InnerStore {
239249 batch_target_duration_in_secs : u64 ,
240250 #[ envconfig( from = "GRAPH_STORE_BATCH_TIMEOUT" ) ]
241251 batch_timeout_in_secs : Option < u64 > ,
252+ #[ envconfig( from = "GRAPH_STORE_BATCH_WORKERS" , default = "1" ) ]
253+ batch_workers : usize ,
242254 #[ envconfig( from = "GRAPH_STORE_HISTORY_REBUILD_THRESHOLD" , default = "0.5" ) ]
243255 rebuild_threshold : ZeroToOneF64 ,
244256 #[ envconfig( from = "GRAPH_STORE_HISTORY_DELETE_THRESHOLD" , default = "0.05" ) ]
0 commit comments