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#[serde_with::apply(Option => #[serde(with = "none_as_empty_string")])]
20#[derive(Clone, Debug, Serialize, Deserialize, DefaultFromSerde, ConfigDoc)]
21pub struct FrontendConfig {
22    /// Total memory constraints for running queries.
23    #[serde(default = "default::frontend::max_total_query_size_bytes")]
24    pub max_total_query_size_bytes: u64,
25
26    /// A query of size under this threshold will never be rejected due to memory constraints.
27    #[serde(default = "default::frontend::min_single_query_size_bytes")]
28    pub min_single_query_size_bytes: u64,
29
30    /// A query of size exceeding this threshold will always be rejected due to memory constraints.
31    #[serde(default = "default::frontend::max_single_query_size_bytes")]
32    pub max_single_query_size_bytes: u64,
33
34    /// Host-based authentication configuration
35    #[serde(default = "HbaConfig::default")]
36    pub hba_config: HbaConfig,
37}
38
39pub mod default {
40
41    pub mod frontend {
42        pub fn max_total_query_size_bytes() -> u64 {
43            1024 * 1024 * 1024
44        }
45
46        pub fn min_single_query_size_bytes() -> u64 {
47            1024 * 1024
48        }
49
50        pub fn max_single_query_size_bytes() -> u64 {
51            1024 * 1024 * 1024
52        }
53    }
54}