hubcio commented on code in PR #2917:
URL: https://github.com/apache/iggy/pull/2917#discussion_r2920802859
##########
core/server/src/shard/system/stats.rs:
##########
@@ -118,6 +120,20 @@ impl IggyShard {
}
}
+ let data_path = std::path::Path::new(&self.config.system.path);
+ let data_path =
+ std::fs::canonicalize(data_path).unwrap_or_else(|_|
data_path.to_path_buf());
+ let disks = sysinfo::Disks::new_with_refreshed_list();
+ let mut best_mount_len = 0usize;
+ for disk in disks.list() {
+ let mount = disk.mount_point();
+ if data_path.starts_with(mount) && mount.as_os_str().len() >
best_mount_len {
+ best_mount_len = mount.as_os_str().len();
+ stats.free_disk_space = disk.available_space().into();
+ stats.total_disk_space = disk.total_space().into();
+ }
+ }
Review Comment:
how much time does this take when there are 10k++ files in local_data
directory of iggy? this is blocking code, we dont want to introduce latency
spikes
##########
core/server/src/shard/system/stats.rs:
##########
@@ -118,6 +120,20 @@ impl IggyShard {
}
}
+ let data_path = std::path::Path::new(&self.config.system.path);
+ let data_path =
+ std::fs::canonicalize(data_path).unwrap_or_else(|_|
data_path.to_path_buf());
+ let disks = sysinfo::Disks::new_with_refreshed_list();
+ let mut best_mount_len = 0usize;
+ for disk in disks.list() {
+ let mount = disk.mount_point();
+ if data_path.starts_with(mount) && mount.as_os_str().len() >
best_mount_len {
+ best_mount_len = mount.as_os_str().len();
+ stats.free_disk_space = disk.available_space().into();
+ stats.total_disk_space = disk.total_space().into();
+ }
+ }
Review Comment:
how much time does this take when there are 10k++ files in local_data
directory of iggy? this is blocking code, we dont want to introduce latency
spikes on shard 0
--
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]