Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replaces fs-err in snapshot_utils fns #34883

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 15 additions & 6 deletions runtime/src/snapshot_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -928,9 +928,12 @@ pub fn archive_snapshot_package(
/// Get the bank snapshots in a directory
pub fn get_bank_snapshots(bank_snapshots_dir: impl AsRef<Path>) -> Vec<BankSnapshotInfo> {
let mut bank_snapshots = Vec::default();
match fs_err::read_dir(bank_snapshots_dir.as_ref()) {
match fs::read_dir(&bank_snapshots_dir) {
Err(err) => {
info!("Unable to read bank snapshots directory: {err}");
info!(
"Unable to read bank snapshots directory '{}': {err}",
bank_snapshots_dir.as_ref().display(),
);
}
Ok(paths) => paths
.filter_map(|entry| {
Expand Down Expand Up @@ -1761,10 +1764,13 @@ where
F: Fn(PathBuf) -> Result<T>,
{
let walk_dir = |dir: &Path| -> Vec<T> {
let entry_iter = fs_err::read_dir(dir);
let entry_iter = fs::read_dir(dir);
match entry_iter {
Err(err) => {
info!("Unable to read snapshot archives directory: {err}");
info!(
"Unable to read snapshot archives directory '{}': {err}",
dir.display(),
);
vec![]
}
Ok(entries) => entries
Expand Down Expand Up @@ -1892,9 +1898,12 @@ pub fn purge_old_snapshot_archives(
fn remove_archives<T: SnapshotArchiveInfoGetter>(archives: &[T]) {
for path in archives.iter().map(|a| a.path()) {
trace!("Removing snapshot archive: {}", path.display());
let result = fs_err::remove_file(path);
let result = fs::remove_file(path);
if let Err(err) = result {
info!("Failed to remove snapshot archive: {err}",);
info!(
"Failed to remove snapshot archive '{}': {err}",
path.display()
);
}
}
}
Expand Down