Skip to content

Conversation

lidel
Copy link
Member

@lidel lidel commented Jun 24, 2025

This PR aims to close #10842:

  • adds WARNING about --flush=false to --help text in ipfs files commands that support it
  • fixes a gap where ipfs files rm ignored --flush=false and always flushed the parent

@lidel lidel changed the title Fix flush files rm fix: support --flush=false in files rm Jun 24, 2025
Comment on lines -1339 to -1344
err = pdir.Unlink(name)
if err != nil {
return err
if err := pdir.Unlink(name); err != nil {
return err
}
}

return pdir.Flush()
Copy link
Member Author

@lidel lidel Jun 24, 2025

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.

Copy link
Contributor

@gammazero gammazero Jun 30, 2025

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).

@lidel lidel marked this pull request as ready for review June 24, 2025 17:42
@lidel lidel requested a review from a team as a code owner June 24, 2025 17:42
Copy link
Contributor

@gammazero gammazero left a 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.
Copy link
Contributor

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

Comment on lines -1339 to -1344
err = pdir.Unlink(name)
if err != nil {
return err
if err := pdir.Unlink(name); err != nil {
return err
}
}

return pdir.Flush()
Copy link
Contributor

@gammazero gammazero Jun 30, 2025

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).

@lidel lidel marked this pull request as draft July 8, 2025 14:16
@lidel lidel mentioned this pull request Jul 14, 2025
51 tasks
@lidel
Copy link
Member Author

lidel commented Jul 22, 2025

Triage notes:

  • this is ancient code, we are unsure if the inability to flush on rm was a bug or a feature
  • too many unknowns, we are parking this until we get some user feedback
  • [Bug Report] MFS files rm is hanging and not resolving #10842 seems to be resolved (?) by user re-shuffling the way they do CLI calls to ipfs files rm and others (smarter batching?), if we don't see any engagement on that issue, we will close this PR without merging

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug Report] MFS files rm is hanging and not resolving
2 participants