Svecco commented on code in PR #2452:
URL: https://github.com/apache/iggy/pull/2452#discussion_r2636797359
##########
core/server/src/log/logger.rs:
##########
@@ -417,6 +457,160 @@ impl Logging {
)
}
}
+
+ fn calculate_max_files(max_total_size_bytes: u64, max_file_size_bytes:
u64) -> usize {
+ if max_file_size_bytes == 0 {
+ return 10;
+ }
+
+ let max_files = max_total_size_bytes / max_file_size_bytes;
+ max_files.clamp(1, 1000) as usize
+ }
+
+ // Use a mutex lock to ensure log rotation operations do not produce race
conditions.
+ fn _install_log_rotation_handler(&self, config: &LoggingConfig, logs_path:
Option<&PathBuf>) {
+ if let Some(logs_path) = logs_path {
+ let path = logs_path.to_path_buf();
+ let max_size = config.max_size.as_bytes_u64();
+ let retention = config.retention.get_duration();
+ let rotation_mutex = Arc::new(Mutex::new(()));
Review Comment:
During the early debugging phase, a thread error was accidentally triggered.
At the time, I naturally suspected it was a race condition, so I implemented it
this way. Currently, this issue can no longer be reproduced.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]