diff --git a/crates/config/src/constants/scanner.rs b/crates/config/src/constants/scanner.rs index 2afd15a72..3b8b5e45a 100644 --- a/crates/config/src/constants/scanner.rs +++ b/crates/config/src/constants/scanner.rs @@ -65,11 +65,12 @@ pub const ENV_SCANNER_ALERT_EXCESS_VERSION_SIZE: &str = "RUSTFS_SCANNER_ALERT_EX pub const DEFAULT_SCANNER_ALERT_EXCESS_VERSION_SIZE: u64 = 1024 * 1024 * 1024 * 1024; /// Environment variable that controls how many subfolders trigger scanner alerts. -/// - Example: `export RUSTFS_SCANNER_ALERT_EXCESS_FOLDERS=50000` +/// - Example: `export RUSTFS_SCANNER_ALERT_EXCESS_FOLDERS=65538` pub const ENV_SCANNER_ALERT_EXCESS_FOLDERS: &str = "RUSTFS_SCANNER_ALERT_EXCESS_FOLDERS"; /// Default subfolder count that triggers scanner alerts. -pub const DEFAULT_SCANNER_ALERT_EXCESS_FOLDERS: u64 = 50_000; +/// Allows Proxmox Backup Server's chunk namespace layout. +pub const DEFAULT_SCANNER_ALERT_EXCESS_FOLDERS: u64 = 65_538; /// Environment variable that controls whether the scanner sleeps between operations. /// When `true` (default), the scanner throttles itself. When `false`, it runs at full speed. diff --git a/crates/scanner/src/scanner_folder.rs b/crates/scanner/src/scanner_folder.rs index b4814a8b4..76bd0b406 100644 --- a/crates/scanner/src/scanner_folder.rs +++ b/crates/scanner/src/scanner_folder.rs @@ -1666,7 +1666,7 @@ mod tests { #[cfg(unix)] use std::os::unix::fs::{PermissionsExt, symlink}; use std::sync::atomic::AtomicBool; - use temp_env::with_var; + use temp_env::{with_var, with_var_unset}; use uuid::Uuid; async fn build_test_scanner() -> (FolderScanner, std::path::PathBuf) { @@ -1808,6 +1808,14 @@ mod tests { }); } + #[test] + #[serial] + fn test_excessive_folders_threshold_default_supports_pbs_layout() { + with_var_unset(rustfs_config::ENV_SCANNER_ALERT_EXCESS_FOLDERS, || { + assert_eq!(scanner_excess_folders_threshold(), 65_538); + }); + } + #[tokio::test] #[serial] async fn test_record_failed_prunes_to_max_entries() {