-
-
Notifications
You must be signed in to change notification settings - Fork 0
Fix fsync CLI plumbing #2014
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
Fix fsync CLI plumbing #2014
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -142,6 +142,7 @@ where | |
| stats, | ||
| partial, | ||
| preallocate, | ||
| fsync, | ||
| delay_updates, | ||
| partial_dir, | ||
| temp_dir, | ||
|
|
@@ -435,6 +436,7 @@ where | |
| stats, | ||
| partial, | ||
| preallocate, | ||
| fsync, | ||
| delay_updates, | ||
| partial_dir: partial_dir.as_ref(), | ||
| temp_dir: temp_dir.as_ref(), | ||
|
|
@@ -583,6 +585,7 @@ where | |
| } = metadata; | ||
|
|
||
| let prune_empty_dirs_flag = prune_empty_dirs.unwrap_or(false); | ||
| let fsync_flag = fsync.unwrap_or(false); | ||
| let inplace_enabled = inplace.unwrap_or(false); | ||
| let append_enabled = append.unwrap_or(false); | ||
| let whole_file_enabled = whole_file_option.unwrap_or(true); | ||
|
|
@@ -653,6 +656,7 @@ where | |
| debug_flags_list, | ||
| partial, | ||
| preallocate, | ||
| fsync: fsync_flag, | ||
| partial_dir: partial_dir.clone(), | ||
|
Comment on lines
656
to
660
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Useful? React with 👍 / 👎. |
||
| temp_dir: temp_dir.clone(), | ||
| delay_updates, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| use crate::local_copy::{ | ||
| test_support::take_fsync_call_count, LocalCopyExecution, LocalCopyOptions, LocalCopyPlan, | ||
| }; | ||
|
|
||
| #[test] | ||
| fn execute_performs_fsync_when_requested() { | ||
| let temp = tempdir().expect("tempdir"); | ||
| let source = temp.path().join("source.txt"); | ||
| let destination = temp.path().join("dest.txt"); | ||
| fs::write(&source, b"payload").expect("write source"); | ||
|
|
||
| let operands = vec![ | ||
| source.into_os_string(), | ||
| destination.clone().into_os_string(), | ||
| ]; | ||
| let plan = LocalCopyPlan::from_operands(&operands).expect("plan"); | ||
|
|
||
| // Clear any previous instrumentation counts. | ||
| take_fsync_call_count(); | ||
|
|
||
| let options = LocalCopyOptions::default().fsync(true); | ||
| plan | ||
|
Comment on lines
+1
to
+22
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The added tests import Useful? React with 👍 / 👎. |
||
| .execute_with_options(LocalCopyExecution::Apply, options) | ||
| .expect("copy succeeds"); | ||
|
|
||
| assert_eq!(take_fsync_call_count(), 1); | ||
| assert!(destination.exists()); | ||
| } | ||
|
|
||
| #[test] | ||
| fn execute_skips_fsync_when_not_requested() { | ||
| let temp = tempdir().expect("tempdir"); | ||
| let source = temp.path().join("source.txt"); | ||
| let destination = temp.path().join("dest.txt"); | ||
| fs::write(&source, b"payload").expect("write source"); | ||
|
|
||
| let operands = vec![ | ||
| source.into_os_string(), | ||
| destination.clone().into_os_string(), | ||
| ]; | ||
| let plan = LocalCopyPlan::from_operands(&operands).expect("plan"); | ||
|
|
||
| take_fsync_call_count(); | ||
|
|
||
| plan | ||
| .execute_with_options(LocalCopyExecution::Apply, LocalCopyOptions::default()) | ||
| .expect("copy succeeds"); | ||
|
|
||
| assert_eq!(take_fsync_call_count(), 0); | ||
| assert!(destination.exists()); | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new
fsyncfield is supplied when building the remote fallback context, butFallbackArgumentsContextinfallback_plan.rshas no such member and the fallback pipeline never consumes it. As written this initializer fails to compile and, even once compilation is fixed, the flag still won’t reach the fallback arguments unless the struct and downstreamFallbackInputsare extended.Useful? React with 👍 / 👎.