1010use std:: time:: Duration ;
1111
1212use mz_compute_client:: protocol:: command:: ComputeParameters ;
13+ use mz_compute_types:: dataflows:: YieldSpec ;
1314use mz_orchestrator:: scheduling_config:: { ServiceSchedulingConfig , ServiceTopologySpreadConfig } ;
1415use mz_ore:: cast:: CastFrom ;
1516use mz_ore:: error:: ErrorExt ;
1617use mz_persist_client:: cfg:: { PersistParameters , RetryParameters } ;
1718use mz_service:: params:: GrpcClientParameters ;
18- use mz_sql:: session:: vars:: SystemVars ;
19+ use mz_sql:: session:: vars:: { SystemVars , DEFAULT_LINEAR_JOIN_YIELDING } ;
1920use mz_storage_types:: parameters:: {
2021 StorageMaxInflightBytesConfig , StorageParameters , UpsertAutoSpillConfig ,
2122} ;
2223use mz_tracing:: params:: TracingParameters ;
2324
2425/// Return the current compute configuration, derived from the system configuration.
2526pub fn compute_config ( config : & SystemVars ) -> ComputeParameters {
27+ let linear_join_yielding = config. linear_join_yielding ( ) ;
28+ let linear_join_yielding = parse_yield_spec ( linear_join_yielding) . unwrap_or_else ( || {
29+ tracing:: error!( "invalid `linear_join_yielding` config: {linear_join_yielding}" ) ;
30+ parse_yield_spec ( & DEFAULT_LINEAR_JOIN_YIELDING ) . expect ( "default is valid" )
31+ } ) ;
32+
2633 ComputeParameters {
2734 max_result_size : Some ( config. max_result_size ( ) ) ,
2835 dataflow_max_inflight_bytes : Some ( config. dataflow_max_inflight_bytes ( ) ) ,
29- linear_join_yielding : None ,
36+ linear_join_yielding : Some ( linear_join_yielding ) ,
3037 enable_mz_join_core : Some ( config. enable_mz_join_core ( ) ) ,
3138 enable_jemalloc_profiling : Some ( config. enable_jemalloc_profiling ( ) ) ,
3239 persist : persist_config ( config) ,
@@ -35,6 +42,22 @@ pub fn compute_config(config: &SystemVars) -> ComputeParameters {
3542 }
3643}
3744
45+ fn parse_yield_spec ( s : & str ) -> Option < YieldSpec > {
46+ let parts: Vec < _ > = s. split ( ':' ) . collect ( ) ;
47+ match & parts[ ..] {
48+ [ "work" , amount] => {
49+ let amount = amount. parse ( ) . ok ( ) ?;
50+ Some ( YieldSpec :: ByWork ( amount) )
51+ }
52+ [ "time" , millis] => {
53+ let millis = millis. parse ( ) . ok ( ) ?;
54+ let duration = Duration :: from_millis ( millis) ;
55+ Some ( YieldSpec :: ByTime ( duration) )
56+ }
57+ _ => None ,
58+ }
59+ }
60+
3861/// Return the current storage configuration, derived from the system configuration.
3962pub fn storage_config ( config : & SystemVars ) -> StorageParameters {
4063 StorageParameters {
0 commit comments