10
10
use std:: time:: Duration ;
11
11
12
12
use mz_compute_client:: protocol:: command:: ComputeParameters ;
13
+ use mz_compute_types:: dataflows:: YieldSpec ;
13
14
use mz_orchestrator:: scheduling_config:: { ServiceSchedulingConfig , ServiceTopologySpreadConfig } ;
14
15
use mz_ore:: cast:: CastFrom ;
15
16
use mz_ore:: error:: ErrorExt ;
16
17
use mz_persist_client:: cfg:: { PersistParameters , RetryParameters } ;
17
18
use mz_service:: params:: GrpcClientParameters ;
18
- use mz_sql:: session:: vars:: SystemVars ;
19
+ use mz_sql:: session:: vars:: { SystemVars , DEFAULT_LINEAR_JOIN_YIELDING } ;
19
20
use mz_storage_types:: parameters:: {
20
21
StorageMaxInflightBytesConfig , StorageParameters , UpsertAutoSpillConfig ,
21
22
} ;
22
23
use mz_tracing:: params:: TracingParameters ;
23
24
24
25
/// Return the current compute configuration, derived from the system configuration.
25
26
pub 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
+
26
33
ComputeParameters {
27
34
max_result_size : Some ( config. max_result_size ( ) ) ,
28
35
dataflow_max_inflight_bytes : Some ( config. dataflow_max_inflight_bytes ( ) ) ,
29
- linear_join_yielding : None ,
36
+ linear_join_yielding : Some ( linear_join_yielding ) ,
30
37
enable_mz_join_core : Some ( config. enable_mz_join_core ( ) ) ,
31
38
enable_jemalloc_profiling : Some ( config. enable_jemalloc_profiling ( ) ) ,
32
39
enable_specialized_arrangements : Some ( config. enable_specialized_arrangements ( ) ) ,
@@ -36,6 +43,22 @@ pub fn compute_config(config: &SystemVars) -> ComputeParameters {
36
43
}
37
44
}
38
45
46
+ fn parse_yield_spec ( s : & str ) -> Option < YieldSpec > {
47
+ let parts: Vec < _ > = s. split ( ':' ) . collect ( ) ;
48
+ match & parts[ ..] {
49
+ [ "work" , amount] => {
50
+ let amount = amount. parse ( ) . ok ( ) ?;
51
+ Some ( YieldSpec :: ByWork ( amount) )
52
+ }
53
+ [ "time" , millis] => {
54
+ let millis = millis. parse ( ) . ok ( ) ?;
55
+ let duration = Duration :: from_millis ( millis) ;
56
+ Some ( YieldSpec :: ByTime ( duration) )
57
+ }
58
+ _ => None ,
59
+ }
60
+ }
61
+
39
62
/// Return the current storage configuration, derived from the system configuration.
40
63
pub fn storage_config ( config : & SystemVars ) -> StorageParameters {
41
64
StorageParameters {
0 commit comments