-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
fix: support --flush=false
in files rm
#10848
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
base: master
Are you sure you want to change the base?
Conversation
err = pdir.Unlink(name) | ||
if err != nil { | ||
return err | ||
if err := pdir.Unlink(name); err != nil { | ||
return err | ||
} | ||
} | ||
|
||
return pdir.Flush() |
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.
cc @gammazero @hsanjuan For a sanity check: Do you know if always flushing the parent of the removed item here, while ignoring --flush=false
, was a bug or a conscious design decision?
As this PR stands now, I've "fixed" it by adding support for --flush=false
, which allows users to skip flushing the parent of the removed item.
Let me know if you have any concerns about this.
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.
fI do not know if it was intentional. My concern is that this was done for safety, so that the parent would no longer see the child item, which would invalidate any further actions on the child (e.g. moving the child from the parent to another parent).
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.
One comment, and one concern about not flushing parent.
Passing '--flush=false' may improve performance for large numbers of file | ||
operations, but it does so at the cost of consistency guarantees and unbound | ||
growth of the directories' in-memory caches. | ||
Make sure to call 'ipfs files flush' after each batch of work. |
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.
If this warning text is identical for the different commands, please define a const
and use that in the help text. Ex: https://go.dev/play/p/8CP7Sz13CzD
err = pdir.Unlink(name) | ||
if err != nil { | ||
return err | ||
if err := pdir.Unlink(name); err != nil { | ||
return err | ||
} | ||
} | ||
|
||
return pdir.Flush() |
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.
fI do not know if it was intentional. My concern is that this was done for safety, so that the parent would no longer see the child item, which would invalidate any further actions on the child (e.g. moving the child from the parent to another parent).
Triage notes:
|
This PR aims to close #10842:
--flush=false
to--help
text inipfs files
commands that support itipfs files rm
ignored--flush=false
and always flushed the parent