risingwave_common/config/frontend.rs
1// Copyright 2025 RisingWave Labs
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15use super::hba::HbaConfig;
16use super::*;
17
18/// The section [`frontend`] in `risingwave.toml`.
19#[derive(Clone, Debug, Serialize, Deserialize, DefaultFromSerde, ConfigDoc)]
20pub struct FrontendConfig {
21 /// Total memory constraints for running queries.
22 #[serde(default = "default::frontend::max_total_query_size_bytes")]
23 pub max_total_query_size_bytes: u64,
24
25 /// A query of size under this threshold will never be rejected due to memory constraints.
26 #[serde(default = "default::frontend::min_single_query_size_bytes")]
27 pub min_single_query_size_bytes: u64,
28
29 /// A query of size exceeding this threshold will always be rejected due to memory constraints.
30 #[serde(default = "default::frontend::max_single_query_size_bytes")]
31 pub max_single_query_size_bytes: u64,
32
33 /// Host-based authentication configuration
34 #[serde(default = "HbaConfig::default")]
35 pub hba_config: HbaConfig,
36}
37
38pub mod default {
39
40 pub mod frontend {
41 pub fn max_total_query_size_bytes() -> u64 {
42 1024 * 1024 * 1024
43 }
44
45 pub fn min_single_query_size_bytes() -> u64 {
46 1024 * 1024
47 }
48
49 pub fn max_single_query_size_bytes() -> u64 {
50 1024 * 1024 * 1024
51 }
52 }
53}