use std::time::Duration;
use mz_dyncfg::{Config, ConfigSet};
pub const ENABLE_MZ_JOIN_CORE: Config<bool> = Config::new(
"enable_mz_join_core",
true,
"Whether compute should use `mz_join_core` rather than DD's `JoinCore::join_core` to render \
linear joins.",
);
pub const ENABLE_MATERIALIZED_VIEW_SINK_V2: Config<bool> = Config::new(
"enable_compute_materialized_view_sink_v2",
true,
"Whether compute should use the new MV sink implementation.",
);
pub const LINEAR_JOIN_YIELDING: Config<&str> = Config::new(
"linear_join_yielding",
"work:1000000,time:100",
"The yielding behavior compute rendering should apply for linear join operators. Either \
'work:<amount>' or 'time:<milliseconds>' or 'work:<amount>,time:<milliseconds>'. Note \
that omitting one of 'work' or 'time' will entirely disable join yielding by time or \
work, respectively, rather than falling back to some default.",
);
pub const ENABLE_COLUMNATION_LGALLOC: Config<bool> = Config::new(
"enable_columnation_lgalloc",
false,
"Enable allocating regions from lgalloc.",
);
pub const ENABLE_LGALLOC_EAGER_RECLAMATION: Config<bool> = Config::new(
"enable_lgalloc_eager_reclamation",
true,
"Enable lgalloc's eager return behavior.",
);
pub const ENABLE_CHUNKED_STACK: Config<bool> = Config::new(
"enable_compute_chunked_stack",
false,
"Enable the chunked stack implementation in compute.",
);
pub const COMPUTE_SERVER_MAINTENANCE_INTERVAL: Config<Duration> = Config::new(
"compute_server_maintenance_interval",
Duration::from_millis(10),
"The interval at which the compute server performs maintenance tasks. Zero enables maintenance on every iteration.",
);
pub const DATAFLOW_MAX_INFLIGHT_BYTES: Config<Option<usize>> = Config::new(
"compute_dataflow_max_inflight_bytes",
None,
"The maximum number of in-flight bytes emitted by persist_sources feeding \
compute dataflows in non-cc clusters.",
);
pub const DATAFLOW_MAX_INFLIGHT_BYTES_CC: Config<Option<usize>> = Config::new(
"compute_dataflow_max_inflight_bytes_cc",
None,
"The maximum number of in-flight bytes emitted by persist_sources feeding \
compute dataflows in cc clusters.",
);
pub const LGALLOC_BACKGROUND_INTERVAL: Config<Duration> = Config::new(
"lgalloc_background_interval",
Duration::from_secs(1),
"Scheduling interval for lgalloc's background worker.",
);
pub const LGALLOC_SLOW_CLEAR_BYTES: Config<usize> = Config::new(
"lgalloc_slow_clear_bytes",
32 << 20,
"Clear byte size per size class for every invocation",
);
pub const HYDRATION_CONCURRENCY: Config<usize> = Config::new(
"compute_hydration_concurrency",
4,
"Controls how many compute dataflows may hydrate concurrently.",
);
pub const COPY_TO_S3_PARQUET_ROW_GROUP_FILE_RATIO: Config<usize> = Config::new(
"copy_to_s3_parquet_row_group_file_ratio",
20,
"The ratio (defined as a percentage) of row-group size to max-file-size. \
Must be <= 100.",
);
pub const COPY_TO_S3_ARROW_BUILDER_BUFFER_RATIO: Config<usize> = Config::new(
"copy_to_s3_arrow_builder_buffer_ratio",
150,
"The ratio (defined as a percentage) of arrow-builder size to row-group size. \
Must be >= 100.",
);
pub const COPY_TO_S3_MULTIPART_PART_SIZE_BYTES: Config<usize> = Config::new(
"copy_to_s3_multipart_part_size_bytes",
1024 * 1024 * 8,
"The size of each part in a multipart upload to S3.",
);
pub const ENABLE_COMPUTE_REPLICA_EXPIRATION: Config<bool> = Config::new(
"enable_compute_replica_expiration",
true,
"Main switch to disable replica expiration.",
);
pub const COMPUTE_REPLICA_EXPIRATION_OFFSET: Config<Duration> = Config::new(
"compute_replica_expiration_offset",
Duration::ZERO,
"The expiration time offset for replicas. Zero disables expiration.",
);
pub fn all_dyncfgs(configs: ConfigSet) -> ConfigSet {
configs
.add(&ENABLE_MZ_JOIN_CORE)
.add(&ENABLE_MATERIALIZED_VIEW_SINK_V2)
.add(&LINEAR_JOIN_YIELDING)
.add(&ENABLE_COLUMNATION_LGALLOC)
.add(&ENABLE_LGALLOC_EAGER_RECLAMATION)
.add(&ENABLE_CHUNKED_STACK)
.add(&COMPUTE_SERVER_MAINTENANCE_INTERVAL)
.add(&DATAFLOW_MAX_INFLIGHT_BYTES)
.add(&DATAFLOW_MAX_INFLIGHT_BYTES_CC)
.add(&LGALLOC_BACKGROUND_INTERVAL)
.add(&LGALLOC_SLOW_CLEAR_BYTES)
.add(&HYDRATION_CONCURRENCY)
.add(©_TO_S3_PARQUET_ROW_GROUP_FILE_RATIO)
.add(©_TO_S3_ARROW_BUILDER_BUFFER_RATIO)
.add(©_TO_S3_MULTIPART_PART_SIZE_BYTES)
.add(&ENABLE_COMPUTE_REPLICA_EXPIRATION)
.add(&COMPUTE_REPLICA_EXPIRATION_OFFSET)
}