Line data Source code
1 : use camino::Utf8PathBuf;
2 :
3 : #[cfg(test)]
4 : mod tests;
5 :
6 : use const_format::formatcp;
7 : pub const DEFAULT_PG_LISTEN_PORT: u16 = 64000;
8 : pub const DEFAULT_PG_LISTEN_ADDR: &str = formatcp!("127.0.0.1:{DEFAULT_PG_LISTEN_PORT}");
9 : pub const DEFAULT_HTTP_LISTEN_PORT: u16 = 9898;
10 : pub const DEFAULT_HTTP_LISTEN_ADDR: &str = formatcp!("127.0.0.1:{DEFAULT_HTTP_LISTEN_PORT}");
11 :
12 : use postgres_backend::AuthType;
13 : use remote_storage::RemoteStorageConfig;
14 : use serde_with::serde_as;
15 : use std::{
16 : collections::HashMap,
17 : num::{NonZeroU64, NonZeroUsize},
18 : str::FromStr,
19 : time::Duration,
20 : };
21 : use utils::logging::LogFormat;
22 :
23 : use crate::models::ImageCompressionAlgorithm;
24 : use crate::models::LsnLease;
25 :
26 : // Certain metadata (e.g. externally-addressable name, AZ) is delivered
27 : // as a separate structure. This information is not neeed by the pageserver
28 : // itself, it is only used for registering the pageserver with the control
29 : // plane and/or storage controller.
30 : //
31 5 : #[derive(PartialEq, Eq, Debug, serde::Serialize, serde::Deserialize)]
32 : pub struct NodeMetadata {
33 : #[serde(rename = "host")]
34 : pub postgres_host: String,
35 : #[serde(rename = "port")]
36 : pub postgres_port: u16,
37 : pub http_host: String,
38 : pub http_port: u16,
39 :
40 : // Deployment tools may write fields to the metadata file beyond what we
41 : // use in this type: this type intentionally only names fields that require.
42 : #[serde(flatten)]
43 : pub other: HashMap<String, serde_json::Value>,
44 : }
45 :
46 : /// `pageserver.toml`
47 : ///
48 : /// We use serde derive with `#[serde(default)]` to generate a deserializer
49 : /// that fills in the default values for each config field.
50 : ///
51 : /// If there cannot be a static default value because we need to make runtime
52 : /// checks to determine the default, make it an `Option` (which defaults to None).
53 : /// The runtime check should be done in the consuming crate, i.e., `pageserver`.
54 : #[serde_as]
55 22 : #[derive(Clone, Debug, serde::Deserialize, serde::Serialize)]
56 : #[serde(default, deny_unknown_fields)]
57 : pub struct ConfigToml {
58 : // types mapped 1:1 into the runtime PageServerConfig type
59 : pub listen_pg_addr: String,
60 : pub listen_http_addr: String,
61 : pub availability_zone: Option<String>,
62 : #[serde(with = "humantime_serde")]
63 : pub wait_lsn_timeout: Duration,
64 : #[serde(with = "humantime_serde")]
65 : pub wal_redo_timeout: Duration,
66 : pub superuser: String,
67 : pub locale: String,
68 : pub page_cache_size: usize,
69 : pub max_file_descriptors: usize,
70 : pub pg_distrib_dir: Option<Utf8PathBuf>,
71 : #[serde_as(as = "serde_with::DisplayFromStr")]
72 : pub http_auth_type: AuthType,
73 : #[serde_as(as = "serde_with::DisplayFromStr")]
74 : pub pg_auth_type: AuthType,
75 : pub auth_validation_public_key_path: Option<Utf8PathBuf>,
76 : pub remote_storage: Option<RemoteStorageConfig>,
77 : pub tenant_config: TenantConfigToml,
78 : #[serde_as(as = "serde_with::DisplayFromStr")]
79 : pub broker_endpoint: storage_broker::Uri,
80 : #[serde(with = "humantime_serde")]
81 : pub broker_keepalive_interval: Duration,
82 : #[serde_as(as = "serde_with::DisplayFromStr")]
83 : pub log_format: LogFormat,
84 : pub concurrent_tenant_warmup: NonZeroUsize,
85 : pub concurrent_tenant_size_logical_size_queries: NonZeroUsize,
86 : #[serde(with = "humantime_serde")]
87 : pub metric_collection_interval: Duration,
88 : pub metric_collection_endpoint: Option<reqwest::Url>,
89 : pub metric_collection_bucket: Option<RemoteStorageConfig>,
90 : #[serde(with = "humantime_serde")]
91 : pub synthetic_size_calculation_interval: Duration,
92 : pub disk_usage_based_eviction: Option<DiskUsageEvictionTaskConfig>,
93 : pub test_remote_failures: u64,
94 : pub ondemand_download_behavior_treat_error_as_warn: bool,
95 : #[serde(with = "humantime_serde")]
96 : pub background_task_maximum_delay: Duration,
97 : pub control_plane_api: Option<reqwest::Url>,
98 : pub control_plane_api_token: Option<String>,
99 : pub control_plane_emergency_mode: bool,
100 : /// Unstable feature: subject to change or removal without notice.
101 : /// See <https://github.com/neondatabase/neon/pull/9218>.
102 : pub import_pgdata_upcall_api: Option<reqwest::Url>,
103 : /// Unstable feature: subject to change or removal without notice.
104 : /// See <https://github.com/neondatabase/neon/pull/9218>.
105 : pub import_pgdata_upcall_api_token: Option<String>,
106 : /// Unstable feature: subject to change or removal without notice.
107 : /// See <https://github.com/neondatabase/neon/pull/9218>.
108 : pub import_pgdata_aws_endpoint_url: Option<reqwest::Url>,
109 : pub heatmap_upload_concurrency: usize,
110 : pub secondary_download_concurrency: usize,
111 : pub virtual_file_io_engine: Option<crate::models::virtual_file::IoEngineKind>,
112 : pub ingest_batch_size: u64,
113 : pub max_vectored_read_bytes: MaxVectoredReadBytes,
114 : pub image_compression: ImageCompressionAlgorithm,
115 : pub timeline_offloading: bool,
116 : pub ephemeral_bytes_per_memory_kb: usize,
117 : pub l0_flush: Option<crate::models::L0FlushConfig>,
118 : pub virtual_file_io_mode: Option<crate::models::virtual_file::IoMode>,
119 : #[serde(skip_serializing_if = "Option::is_none")]
120 : pub no_sync: Option<bool>,
121 : #[serde(with = "humantime_serde")]
122 : pub server_side_batch_timeout: Option<Duration>,
123 : }
124 :
125 4 : #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
126 : #[serde(deny_unknown_fields)]
127 : pub struct DiskUsageEvictionTaskConfig {
128 : pub max_usage_pct: utils::serde_percent::Percent,
129 : pub min_avail_bytes: u64,
130 : #[serde(with = "humantime_serde")]
131 : pub period: Duration,
132 : #[cfg(feature = "testing")]
133 : pub mock_statvfs: Option<statvfs::mock::Behavior>,
134 : /// Select sorting for evicted layers
135 : #[serde(default)]
136 : pub eviction_order: EvictionOrder,
137 : }
138 :
139 : pub mod statvfs {
140 : pub mod mock {
141 0 : #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
142 : #[serde(tag = "type")]
143 : pub enum Behavior {
144 : Success {
145 : blocksize: u64,
146 : total_blocks: u64,
147 : name_filter: Option<utils::serde_regex::Regex>,
148 : },
149 : #[cfg(feature = "testing")]
150 : Failure { mocked_error: MockedError },
151 : }
152 :
153 : #[cfg(feature = "testing")]
154 0 : #[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
155 : #[allow(clippy::upper_case_acronyms)]
156 : pub enum MockedError {
157 : EIO,
158 : }
159 :
160 : #[cfg(feature = "testing")]
161 : impl From<MockedError> for nix::Error {
162 0 : fn from(e: MockedError) -> Self {
163 0 : match e {
164 0 : MockedError::EIO => nix::Error::EIO,
165 0 : }
166 0 : }
167 : }
168 : }
169 : }
170 :
171 0 : #[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
172 : #[serde(tag = "type", content = "args")]
173 : pub enum EvictionOrder {
174 : RelativeAccessed {
175 : highest_layer_count_loses_first: bool,
176 : },
177 : }
178 :
179 : impl Default for EvictionOrder {
180 2 : fn default() -> Self {
181 2 : Self::RelativeAccessed {
182 2 : highest_layer_count_loses_first: true,
183 2 : }
184 2 : }
185 : }
186 :
187 0 : #[derive(Copy, Clone, Debug, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
188 : #[serde(transparent)]
189 : pub struct MaxVectoredReadBytes(pub NonZeroUsize);
190 :
191 : /// A tenant's calcuated configuration, which is the result of merging a
192 : /// tenant's TenantConfOpt with the global TenantConf from PageServerConf.
193 : ///
194 : /// For storing and transmitting individual tenant's configuration, see
195 : /// TenantConfOpt.
196 4 : #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
197 : #[serde(deny_unknown_fields, default)]
198 : pub struct TenantConfigToml {
199 : // Flush out an inmemory layer, if it's holding WAL older than this
200 : // This puts a backstop on how much WAL needs to be re-digested if the
201 : // page server crashes.
202 : // This parameter actually determines L0 layer file size.
203 : pub checkpoint_distance: u64,
204 : // Inmemory layer is also flushed at least once in checkpoint_timeout to
205 : // eventually upload WAL after activity is stopped.
206 : #[serde(with = "humantime_serde")]
207 : pub checkpoint_timeout: Duration,
208 : // Target file size, when creating image and delta layers.
209 : // This parameter determines L1 layer file size.
210 : pub compaction_target_size: u64,
211 : // How often to check if there's compaction work to be done.
212 : // Duration::ZERO means automatic compaction is disabled.
213 : #[serde(with = "humantime_serde")]
214 : pub compaction_period: Duration,
215 : // Level0 delta layer threshold for compaction.
216 : pub compaction_threshold: usize,
217 : pub compaction_algorithm: crate::models::CompactionAlgorithmSettings,
218 : // Determines how much history is retained, to allow
219 : // branching and read replicas at an older point in time.
220 : // The unit is #of bytes of WAL.
221 : // Page versions older than this are garbage collected away.
222 : pub gc_horizon: u64,
223 : // Interval at which garbage collection is triggered.
224 : // Duration::ZERO means automatic GC is disabled
225 : #[serde(with = "humantime_serde")]
226 : pub gc_period: Duration,
227 : // Delta layer churn threshold to create L1 image layers.
228 : pub image_creation_threshold: usize,
229 : // Determines how much history is retained, to allow
230 : // branching and read replicas at an older point in time.
231 : // The unit is time.
232 : // Page versions older than this are garbage collected away.
233 : #[serde(with = "humantime_serde")]
234 : pub pitr_interval: Duration,
235 : /// Maximum amount of time to wait while opening a connection to receive wal, before erroring.
236 : #[serde(with = "humantime_serde")]
237 : pub walreceiver_connect_timeout: Duration,
238 : /// Considers safekeepers stalled after no WAL updates were received longer than this threshold.
239 : /// A stalled safekeeper will be changed to a newer one when it appears.
240 : #[serde(with = "humantime_serde")]
241 : pub lagging_wal_timeout: Duration,
242 : /// Considers safekeepers lagging when their WAL is behind another safekeeper for more than this threshold.
243 : /// A lagging safekeeper will be changed after `lagging_wal_timeout` time elapses since the last WAL update,
244 : /// to avoid eager reconnects.
245 : pub max_lsn_wal_lag: NonZeroU64,
246 : pub eviction_policy: crate::models::EvictionPolicy,
247 : pub min_resident_size_override: Option<u64>,
248 : // See the corresponding metric's help string.
249 : #[serde(with = "humantime_serde")]
250 : pub evictions_low_residence_duration_metric_threshold: Duration,
251 :
252 : /// If non-zero, the period between uploads of a heatmap from attached tenants. This
253 : /// may be disabled if a Tenant will not have secondary locations: only secondary
254 : /// locations will use the heatmap uploaded by attached locations.
255 : #[serde(with = "humantime_serde")]
256 : pub heatmap_period: Duration,
257 :
258 : /// If true then SLRU segments are dowloaded on demand, if false SLRU segments are included in basebackup
259 : pub lazy_slru_download: bool,
260 :
261 : pub timeline_get_throttle: crate::models::ThrottleConfig,
262 :
263 : // How much WAL must be ingested before checking again whether a new image layer is required.
264 : // Expresed in multiples of checkpoint distance.
265 : pub image_layer_creation_check_threshold: u8,
266 :
267 : /// The length for an explicit LSN lease request.
268 : /// Layers needed to reconstruct pages at LSN will not be GC-ed during this interval.
269 : #[serde(with = "humantime_serde")]
270 : pub lsn_lease_length: Duration,
271 :
272 : /// The length for an implicit LSN lease granted as part of `get_lsn_by_timestamp` request.
273 : /// Layers needed to reconstruct pages at LSN will not be GC-ed during this interval.
274 : #[serde(with = "humantime_serde")]
275 : pub lsn_lease_length_for_ts: Duration,
276 :
277 : /// Enable auto-offloading of timelines.
278 : /// (either this flag or the pageserver-global one need to be set)
279 : pub timeline_offloading: bool,
280 : }
281 :
282 : pub mod defaults {
283 : use crate::models::ImageCompressionAlgorithm;
284 :
285 : pub use storage_broker::DEFAULT_ENDPOINT as BROKER_DEFAULT_ENDPOINT;
286 :
287 : pub const DEFAULT_WAIT_LSN_TIMEOUT: &str = "300 s";
288 : pub const DEFAULT_WAL_REDO_TIMEOUT: &str = "60 s";
289 :
290 : pub const DEFAULT_SUPERUSER: &str = "cloud_admin";
291 : pub const DEFAULT_LOCALE: &str = if cfg!(target_os = "macos") {
292 : "C"
293 : } else {
294 : "C.UTF-8"
295 : };
296 :
297 : pub const DEFAULT_PAGE_CACHE_SIZE: usize = 8192;
298 : pub const DEFAULT_MAX_FILE_DESCRIPTORS: usize = 100;
299 :
300 : pub const DEFAULT_LOG_FORMAT: &str = "plain";
301 :
302 : pub const DEFAULT_CONCURRENT_TENANT_WARMUP: usize = 8;
303 :
304 : pub const DEFAULT_CONCURRENT_TENANT_SIZE_LOGICAL_SIZE_QUERIES: usize = 1;
305 :
306 : pub const DEFAULT_METRIC_COLLECTION_INTERVAL: &str = "10 min";
307 : pub const DEFAULT_METRIC_COLLECTION_ENDPOINT: Option<reqwest::Url> = None;
308 : pub const DEFAULT_SYNTHETIC_SIZE_CALCULATION_INTERVAL: &str = "10 min";
309 : pub const DEFAULT_BACKGROUND_TASK_MAXIMUM_DELAY: &str = "10s";
310 :
311 : pub const DEFAULT_HEATMAP_UPLOAD_CONCURRENCY: usize = 8;
312 : pub const DEFAULT_SECONDARY_DOWNLOAD_CONCURRENCY: usize = 1;
313 :
314 : pub const DEFAULT_INGEST_BATCH_SIZE: u64 = 100;
315 :
316 : /// Soft limit for the maximum size of a vectored read.
317 : ///
318 : /// This is determined by the largest NeonWalRecord that can exist (minus dbdir and reldir keys
319 : /// which are bounded by the blob io limits only). As of this writing, that is a `NeonWalRecord::ClogSetCommitted` record,
320 : /// with 32k xids. That's the max number of XIDS on a single CLOG page. The size of such a record
321 : /// is `sizeof(Transactionid) * 32768 + (some fixed overhead from 'timestamp`, the Vec length and whatever extra serde serialization adds)`.
322 : /// That is, slightly above 128 kB.
323 : pub const DEFAULT_MAX_VECTORED_READ_BYTES: usize = 130 * 1024; // 130 KiB
324 :
325 : pub const DEFAULT_IMAGE_COMPRESSION: ImageCompressionAlgorithm =
326 : ImageCompressionAlgorithm::Zstd { level: Some(1) };
327 :
328 : pub const DEFAULT_EPHEMERAL_BYTES_PER_MEMORY_KB: usize = 0;
329 :
330 : pub const DEFAULT_IO_BUFFER_ALIGNMENT: usize = 512;
331 :
332 : pub const DEFAULT_SERVER_SIDE_BATCH_TIMEOUT: Option<&str> = None;
333 : }
334 :
335 : impl Default for ConfigToml {
336 210 : fn default() -> Self {
337 : use defaults::*;
338 :
339 210 : Self {
340 210 : listen_pg_addr: (DEFAULT_PG_LISTEN_ADDR.to_string()),
341 210 : listen_http_addr: (DEFAULT_HTTP_LISTEN_ADDR.to_string()),
342 210 : availability_zone: (None),
343 210 : wait_lsn_timeout: (humantime::parse_duration(DEFAULT_WAIT_LSN_TIMEOUT)
344 210 : .expect("cannot parse default wait lsn timeout")),
345 210 : wal_redo_timeout: (humantime::parse_duration(DEFAULT_WAL_REDO_TIMEOUT)
346 210 : .expect("cannot parse default wal redo timeout")),
347 210 : superuser: (DEFAULT_SUPERUSER.to_string()),
348 210 : locale: DEFAULT_LOCALE.to_string(),
349 210 : page_cache_size: (DEFAULT_PAGE_CACHE_SIZE),
350 210 : max_file_descriptors: (DEFAULT_MAX_FILE_DESCRIPTORS),
351 210 : pg_distrib_dir: None, // Utf8PathBuf::from("./pg_install"), // TODO: formely, this was std::env::current_dir()
352 210 : http_auth_type: (AuthType::Trust),
353 210 : pg_auth_type: (AuthType::Trust),
354 210 : auth_validation_public_key_path: (None),
355 210 : remote_storage: None,
356 210 : broker_endpoint: (storage_broker::DEFAULT_ENDPOINT
357 210 : .parse()
358 210 : .expect("failed to parse default broker endpoint")),
359 210 : broker_keepalive_interval: (humantime::parse_duration(
360 210 : storage_broker::DEFAULT_KEEPALIVE_INTERVAL,
361 210 : )
362 210 : .expect("cannot parse default keepalive interval")),
363 210 : log_format: (LogFormat::from_str(DEFAULT_LOG_FORMAT).unwrap()),
364 210 :
365 210 : concurrent_tenant_warmup: (NonZeroUsize::new(DEFAULT_CONCURRENT_TENANT_WARMUP)
366 210 : .expect("Invalid default constant")),
367 210 : concurrent_tenant_size_logical_size_queries: NonZeroUsize::new(
368 210 : DEFAULT_CONCURRENT_TENANT_SIZE_LOGICAL_SIZE_QUERIES,
369 210 : )
370 210 : .unwrap(),
371 210 : metric_collection_interval: (humantime::parse_duration(
372 210 : DEFAULT_METRIC_COLLECTION_INTERVAL,
373 210 : )
374 210 : .expect("cannot parse default metric collection interval")),
375 210 : synthetic_size_calculation_interval: (humantime::parse_duration(
376 210 : DEFAULT_SYNTHETIC_SIZE_CALCULATION_INTERVAL,
377 210 : )
378 210 : .expect("cannot parse default synthetic size calculation interval")),
379 210 : metric_collection_endpoint: (DEFAULT_METRIC_COLLECTION_ENDPOINT),
380 210 :
381 210 : metric_collection_bucket: (None),
382 210 :
383 210 : disk_usage_based_eviction: (None),
384 210 :
385 210 : test_remote_failures: (0),
386 210 :
387 210 : ondemand_download_behavior_treat_error_as_warn: (false),
388 210 :
389 210 : background_task_maximum_delay: (humantime::parse_duration(
390 210 : DEFAULT_BACKGROUND_TASK_MAXIMUM_DELAY,
391 210 : )
392 210 : .unwrap()),
393 210 :
394 210 : control_plane_api: (None),
395 210 : control_plane_api_token: (None),
396 210 : control_plane_emergency_mode: (false),
397 210 :
398 210 : import_pgdata_upcall_api: (None),
399 210 : import_pgdata_upcall_api_token: (None),
400 210 : import_pgdata_aws_endpoint_url: (None),
401 210 :
402 210 : heatmap_upload_concurrency: (DEFAULT_HEATMAP_UPLOAD_CONCURRENCY),
403 210 : secondary_download_concurrency: (DEFAULT_SECONDARY_DOWNLOAD_CONCURRENCY),
404 210 :
405 210 : ingest_batch_size: (DEFAULT_INGEST_BATCH_SIZE),
406 210 :
407 210 : virtual_file_io_engine: None,
408 210 :
409 210 : max_vectored_read_bytes: (MaxVectoredReadBytes(
410 210 : NonZeroUsize::new(DEFAULT_MAX_VECTORED_READ_BYTES).unwrap(),
411 210 : )),
412 210 : image_compression: (DEFAULT_IMAGE_COMPRESSION),
413 210 : timeline_offloading: false,
414 210 : ephemeral_bytes_per_memory_kb: (DEFAULT_EPHEMERAL_BYTES_PER_MEMORY_KB),
415 210 : l0_flush: None,
416 210 : virtual_file_io_mode: None,
417 210 : server_side_batch_timeout: DEFAULT_SERVER_SIDE_BATCH_TIMEOUT
418 210 : .map(|duration| humantime::parse_duration(duration).unwrap()),
419 210 : tenant_config: TenantConfigToml::default(),
420 210 : no_sync: None,
421 210 : }
422 210 : }
423 : }
424 :
425 : pub mod tenant_conf_defaults {
426 :
427 : // FIXME: This current value is very low. I would imagine something like 1 GB or 10 GB
428 : // would be more appropriate. But a low value forces the code to be exercised more,
429 : // which is good for now to trigger bugs.
430 : // This parameter actually determines L0 layer file size.
431 : pub const DEFAULT_CHECKPOINT_DISTANCE: u64 = 256 * 1024 * 1024;
432 : pub const DEFAULT_CHECKPOINT_TIMEOUT: &str = "10 m";
433 :
434 : // FIXME the below configs are only used by legacy algorithm. The new algorithm
435 : // has different parameters.
436 :
437 : // Target file size, when creating image and delta layers.
438 : // This parameter determines L1 layer file size.
439 : pub const DEFAULT_COMPACTION_TARGET_SIZE: u64 = 128 * 1024 * 1024;
440 :
441 : pub const DEFAULT_COMPACTION_PERIOD: &str = "20 s";
442 : pub const DEFAULT_COMPACTION_THRESHOLD: usize = 10;
443 : pub const DEFAULT_COMPACTION_ALGORITHM: crate::models::CompactionAlgorithm =
444 : crate::models::CompactionAlgorithm::Legacy;
445 :
446 : pub const DEFAULT_GC_HORIZON: u64 = 64 * 1024 * 1024;
447 :
448 : // Large DEFAULT_GC_PERIOD is fine as long as PITR_INTERVAL is larger.
449 : // If there's a need to decrease this value, first make sure that GC
450 : // doesn't hold a layer map write lock for non-trivial operations.
451 : // Relevant: https://github.com/neondatabase/neon/issues/3394
452 : pub const DEFAULT_GC_PERIOD: &str = "1 hr";
453 : pub const DEFAULT_IMAGE_CREATION_THRESHOLD: usize = 3;
454 : pub const DEFAULT_PITR_INTERVAL: &str = "7 days";
455 : pub const DEFAULT_WALRECEIVER_CONNECT_TIMEOUT: &str = "10 seconds";
456 : pub const DEFAULT_WALRECEIVER_LAGGING_WAL_TIMEOUT: &str = "10 seconds";
457 : // The default limit on WAL lag should be set to avoid causing disconnects under high throughput
458 : // scenarios: since the broker stats are updated ~1/s, a value of 1GiB should be sufficient for
459 : // throughputs up to 1GiB/s per timeline.
460 : pub const DEFAULT_MAX_WALRECEIVER_LSN_WAL_LAG: u64 = 1024 * 1024 * 1024;
461 : pub const DEFAULT_EVICTIONS_LOW_RESIDENCE_DURATION_METRIC_THRESHOLD: &str = "24 hour";
462 : // By default ingest enough WAL for two new L0 layers before checking if new image
463 : // image layers should be created.
464 : pub const DEFAULT_IMAGE_LAYER_CREATION_CHECK_THRESHOLD: u8 = 2;
465 : }
466 :
467 : impl Default for TenantConfigToml {
468 394 : fn default() -> Self {
469 : use tenant_conf_defaults::*;
470 394 : Self {
471 394 : checkpoint_distance: DEFAULT_CHECKPOINT_DISTANCE,
472 394 : checkpoint_timeout: humantime::parse_duration(DEFAULT_CHECKPOINT_TIMEOUT)
473 394 : .expect("cannot parse default checkpoint timeout"),
474 394 : compaction_target_size: DEFAULT_COMPACTION_TARGET_SIZE,
475 394 : compaction_period: humantime::parse_duration(DEFAULT_COMPACTION_PERIOD)
476 394 : .expect("cannot parse default compaction period"),
477 394 : compaction_threshold: DEFAULT_COMPACTION_THRESHOLD,
478 394 : compaction_algorithm: crate::models::CompactionAlgorithmSettings {
479 394 : kind: DEFAULT_COMPACTION_ALGORITHM,
480 394 : },
481 394 : gc_horizon: DEFAULT_GC_HORIZON,
482 394 : gc_period: humantime::parse_duration(DEFAULT_GC_PERIOD)
483 394 : .expect("cannot parse default gc period"),
484 394 : image_creation_threshold: DEFAULT_IMAGE_CREATION_THRESHOLD,
485 394 : pitr_interval: humantime::parse_duration(DEFAULT_PITR_INTERVAL)
486 394 : .expect("cannot parse default PITR interval"),
487 394 : walreceiver_connect_timeout: humantime::parse_duration(
488 394 : DEFAULT_WALRECEIVER_CONNECT_TIMEOUT,
489 394 : )
490 394 : .expect("cannot parse default walreceiver connect timeout"),
491 394 : lagging_wal_timeout: humantime::parse_duration(DEFAULT_WALRECEIVER_LAGGING_WAL_TIMEOUT)
492 394 : .expect("cannot parse default walreceiver lagging wal timeout"),
493 394 : max_lsn_wal_lag: NonZeroU64::new(DEFAULT_MAX_WALRECEIVER_LSN_WAL_LAG)
494 394 : .expect("cannot parse default max walreceiver Lsn wal lag"),
495 394 : eviction_policy: crate::models::EvictionPolicy::NoEviction,
496 394 : min_resident_size_override: None,
497 394 : evictions_low_residence_duration_metric_threshold: humantime::parse_duration(
498 394 : DEFAULT_EVICTIONS_LOW_RESIDENCE_DURATION_METRIC_THRESHOLD,
499 394 : )
500 394 : .expect("cannot parse default evictions_low_residence_duration_metric_threshold"),
501 394 : heatmap_period: Duration::ZERO,
502 394 : lazy_slru_download: false,
503 394 : timeline_get_throttle: crate::models::ThrottleConfig::disabled(),
504 394 : image_layer_creation_check_threshold: DEFAULT_IMAGE_LAYER_CREATION_CHECK_THRESHOLD,
505 394 : lsn_lease_length: LsnLease::DEFAULT_LENGTH,
506 394 : lsn_lease_length_for_ts: LsnLease::DEFAULT_LENGTH_FOR_TS,
507 394 : timeline_offloading: false,
508 394 : }
509 394 : }
510 : }
|