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.rs #34908

Merged
merged 5 commits into from
Jan 23, 2024
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
17 changes: 8 additions & 9 deletions runtime/src/snapshot_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ use {
bzip2::bufread::BzDecoder,
crossbeam_channel::Sender,
flate2::read::GzDecoder,
fs_err,
lazy_static::lazy_static,
log::*,
regex::Regex,
Expand Down Expand Up @@ -1046,7 +1045,7 @@ fn serialize_snapshot_data_file_capped<F>(
where
F: FnOnce(&mut BufWriter<std::fs::File>) -> Result<()>,
{
let data_file = fs_err::File::create(data_file_path)?.into();
let data_file = fs::File::create(data_file_path)?;
let mut data_file_stream = BufWriter::new(data_file);
serializer(&mut data_file_stream)?;
data_file_stream.flush()?;
Expand Down Expand Up @@ -1117,7 +1116,7 @@ fn create_snapshot_data_file_stream(
snapshot_root_file_path: impl AsRef<Path>,
maximum_file_size: u64,
) -> Result<(u64, BufReader<std::fs::File>)> {
let snapshot_file_size = fs_err::metadata(&snapshot_root_file_path)?.len();
let snapshot_file_size = fs::metadata(&snapshot_root_file_path)?.len();

if snapshot_file_size > maximum_file_size {
let error_message = format!(
Expand All @@ -1129,8 +1128,8 @@ fn create_snapshot_data_file_stream(
return Err(IoError::other(error_message).into());
}

let snapshot_data_file = fs_err::File::open(snapshot_root_file_path.as_ref())?;
let snapshot_data_file_stream = BufReader::new(snapshot_data_file.into());
let snapshot_data_file = fs::File::open(snapshot_root_file_path)?;
let snapshot_data_file_stream = BufReader::new(snapshot_data_file);

Ok((snapshot_file_size, snapshot_data_file_stream))
}
Expand Down Expand Up @@ -1413,16 +1412,16 @@ fn create_snapshot_meta_files_for_unarchived_snapshot(unpack_dir: impl AsRef<Pat
.path();

let version_file = unpack_dir.as_ref().join(SNAPSHOT_VERSION_FILENAME);
fs_err::hard_link(version_file, slot_dir.join(SNAPSHOT_VERSION_FILENAME))?;
fs::hard_link(version_file, slot_dir.join(SNAPSHOT_VERSION_FILENAME))?;

let status_cache_file = snapshots_dir.join(SNAPSHOT_STATUS_CACHE_FILENAME);
fs_err::hard_link(
fs::hard_link(
status_cache_file,
slot_dir.join(SNAPSHOT_STATUS_CACHE_FILENAME),
)?;

let state_complete_file = slot_dir.join(SNAPSHOT_STATE_COMPLETE_FILENAME);
fs_err::File::create(state_complete_file)?;
fs::File::create(state_complete_file)?;

Ok(())
}
Expand Down Expand Up @@ -1498,7 +1497,7 @@ fn streaming_snapshot_dir_files(
file_sender.send(snapshot_version_path.into())?;

for account_path in account_paths {
for file in fs_err::read_dir(account_path)? {
for file in fs::read_dir(account_path)? {
file_sender.send(file?.path())?;
}
}
Expand Down