Add Borg 2.0.0b17 features #1098

Open
opened 2025-05-23 05:20:03 +00:00 by witten · 7 comments
Owner

What I'd like to do and why

Support relevant Borg 2.0.0b17 features and changes natively in borgmatic:

  • transfer: implement --chunker-params to re-chunk while transferring
    • See borgmatic's create and recreate actions (which already have --chunker-params) for inspiration.
  • list --depth=N: list files up to N depth in path hierarchy
    • Decide whether this should be an option and a flag or just a flag. Maybe look at the existing list flags/options for inspiration.
  • BORG_REPO_PERMISSIONS=all|no-delete|write-only|read-only
    • See the changelog for more info. You may also have to dig into the ticket.
  • compact: add --iec option

Other notes / implementation ideas

No response

### What I'd like to do and why Support relevant [Borg 2.0.0b17 features and changes](https://borgbackup.readthedocs.io/en/2.0.0b17/changes.html#version-2-0-0b17-2025-05-23) natively in borgmatic: * [ ] transfer: implement --chunker-params to re-chunk while transferring * See borgmatic's `create` and `recreate` actions (which already have `--chunker-params`) for inspiration. * [ ] list --depth=N: list files up to N depth in path hierarchy * Decide whether this should be an option *and* a flag or just a flag. Maybe look at the existing `list` flags/options for inspiration. * [ ] BORG_REPO_PERMISSIONS=all|no-delete|write-only|read-only * See the changelog for more info. You may also have to dig into [the ticket](https://github.com/borgbackup/borg/issues/8823). * [ ] compact: add --iec option ### Other notes / implementation ideas _No response_

I thought I'd look into getting the no-delete permission to work with my setup but of course nothing is ever simple :)

The borg rename command needs delete permission, consequently borgmatic create doesn't work due to the way streaming process failures are handled (the archive is created with a suffix and renamed upon success).

I'm already using a pull model to prune and compact so having it do the create as well is trivial, but I'd rather let the client initiate its own backups.

Is there any other way to deal with failed streams without using rename?

I thought I'd look into getting the no-delete permission to work with my setup but of course nothing is ever simple :) The borg rename command needs delete permission, consequently borgmatic create doesn't work due to the way streaming process failures are handled (the archive is created with a suffix and renamed upon success). I'm already using a pull model to prune and compact so having it do the create as well is trivial, but I'd rather let the client initiate its own backups. Is there any other way to deal with failed streams without using rename?
Author
Owner

I thought I'd look into getting the no-delete permission to work with my setup but of course nothing is ever simple :)

The borg rename command needs delete permission, consequently borgmatic create doesn't work due to the way streaming process failures are handled (the archive is created with a suffix and renamed upon success).

I'm already using a pull model to prune and compact so having it do the create as well is trivial, but I'd rather let the client initiate its own backups.

Is there any other way to deal with failed streams without using rename?

Ugh, that's obnoxious! When designing the solution for dealing with failed database dumps, we looked at a bunch of other options, but the rename approach was the only one that ended up panning out in the end. See #1032 if you're interested in the full history.

In terms of how to proceed with this ticket, I think my inclination is for borgmatic to not do the checkpoint + rename whenever no-delete is enabled.

> I thought I'd look into getting the no-delete permission to work with my setup but of course nothing is ever simple :) > > The borg rename command needs delete permission, consequently borgmatic create doesn't work due to the way streaming process failures are handled (the archive is created with a suffix and renamed upon success). > > I'm already using a pull model to prune and compact so having it do the create as well is trivial, but I'd rather let the client initiate its own backups. > > Is there any other way to deal with failed streams without using rename? Ugh, that's obnoxious! When designing the solution for dealing with failed database dumps, we looked at a bunch of other options, but the rename approach was the only one that ended up panning out in the end. See #1032 if you're interested in the full history. In terms of how to proceed with this ticket, I think my inclination is for borgmatic to *not* do the checkpoint + rename whenever `no-delete` is enabled.

Not doing the checkpoint would work but the problem of pruning good archives in favor of bad ones would still exist. I would at least need to know when a stream fails so I could deal with it manually somehow. I also wonder if rename really needs the delete permission but that's way above my pay grade

Seems like the magic pipe solution might still be viable and almost working? I'm already neck deep on a tangent, but once I get some free cycles I might give that a go if no one beats me to it

Not doing the checkpoint would work but the problem of pruning good archives in favor of bad ones would still exist. I would at least need to know when a stream fails so I could deal with it manually somehow. I also wonder if rename really needs the delete permission but that's way above my pay grade Seems like the magic pipe solution might still be viable and almost working? I'm already neck deep on a tangent, but once I get some free cycles I might give that a go if no one beats me to it
Author
Owner

Not doing the checkpoint would work but the problem of pruning good archives in favor of bad ones would still exist. I would at least need to know when a stream fails so I could deal with it manually somehow.

Yeah, fortunately borgmatic does error when a database stream fails—it just won't cleanup the partial archive if that checkpoint/rename feature is disabled.

I also wonder if rename really needs the delete permission but that's way above my pay grade

Mine too. 😄 You could ask in the #borgbackup IRC channel on libera.chat on you could file a Borg issue/discussion about it.

Seems like the magic pipe solution might still be viable and almost working? I'm already neck deep on a tangent, but once I get some free cycles I might give that a go if no one beats me to it

The sentinel named pipe? IIRC, I wasn't actually able to get that approach working in prototyping. You're welcome to try again, but it might just be easier to deal with the occasional partial archives since you should find out when such errors occur.

> Not doing the checkpoint would work but the problem of pruning good archives in favor of bad ones would still exist. I would at least need to know when a stream fails so I could deal with it manually somehow. Yeah, fortunately borgmatic [does error](https://projects.torsion.org/borgmatic-collective/borgmatic/issues/1032) when a database stream fails—it just won't cleanup the partial archive if that checkpoint/rename feature is disabled. > I also wonder if rename really needs the delete permission but that's way above my pay grade Mine too. 😄 You could ask in the #borgbackup IRC channel on libera.chat on you could file a [Borg issue/discussion](https://github.com/borgbackup/borg/) about it. > Seems like the magic pipe solution might still be viable and almost working? I'm already neck deep on a tangent, but once I get some free cycles I might give that a go if no one beats me to it The sentinel named pipe? IIRC, I wasn't actually able to get that approach working in prototyping. You're welcome to try again, but it might just be easier to deal with the occasional partial archives since you should find out when such errors occur.

The sentinel named pipe? IIRC, I wasn't actually able to get that approach working in prototyping. You're welcome to try again, but it might just be easier to deal with the occasional partial archives since you should find out when such errors occur.

I assumed they were all the same thing, but the OP of #1032 attempted a FIFO pipe solution and I got the impression it might still be feasible even though I'm a pessimist.

But yes, much easier to just disable it and deal with the errors. I guess I just need to figure out how to tell if no_delete is set

> The sentinel named pipe? IIRC, I wasn't actually able to get that approach working in prototyping. You're welcome to try again, but it might just be easier to deal with the occasional partial archives since you should find out when such errors occur. I assumed they were all the same thing, but the OP of #1032 attempted a FIFO pipe solution and I got the impression it might still be feasible even though I'm a pessimist. But yes, much easier to just disable it and deal with the errors. I guess I just need to figure out how to tell if _no_delete_ is set
Author
Owner

The sentinel named pipe? IIRC, I wasn't actually able to get that approach working in prototyping. You're welcome to try again, but it might just be easier to deal with the occasional partial archives since you should find out when such errors occur.

I assumed they were all the same thing, but the OP of #1032 attempted a FIFO pipe solution and I got the impression it might still be feasible even though I'm a pessimist.

Yup, the sentinel named pipe / FIFO pipe solution is all the same thing. Maybe it's feasible, but yeah it would take some more poking to find out.

But yes, much easier to just disable it and deal with the errors. I guess I just need to figure out how to tell if no_delete is set

So I'm assuming BORG_REPO_PERMISSIONS would be represented in borgmatic with a configuration file option. If that's the case, then it might be as easy as checking that config.get('borg_repo_permissions') == 'no-delete' or whatever, assuming that the configuration has already been loaded into an available config dict (which is the case almost everywhere in borgmatic).

> > The sentinel named pipe? IIRC, I wasn't actually able to get that approach working in prototyping. You're welcome to try again, but it might just be easier to deal with the occasional partial archives since you should find out when such errors occur. > > I assumed they were all the same thing, but the OP of #1032 attempted a FIFO pipe solution and I got the impression it might still be feasible even though I'm a pessimist. Yup, the sentinel named pipe / FIFO pipe solution is all the same thing. Maybe it's feasible, but yeah it would take some more poking to find out. > But yes, much easier to just disable it and deal with the errors. I guess I just need to figure out how to tell if _no_delete_ is set So I'm assuming `BORG_REPO_PERMISSIONS` would be represented in borgmatic with a configuration file option. If that's the case, then it might be as easy as checking that `config.get('borg_repo_permissions') == 'no-delete'` or whatever, assuming that the configuration has already been loaded into an available `config` dict (which is the case almost everywhere in borgmatic).
Contributor

TY for the mention on #1032 @witten. Just drawing your attention to:

#1032 (comment)

IMHO the sentinel named pipe solution is prone to deadlocking between borg / borgmatic (but that's just a gut feeling).

TY for the mention on #1032 @witten. Just drawing your attention to: https://projects.torsion.org/borgmatic-collective/borgmatic/issues/1032#issuecomment-11308 IMHO the sentinel named pipe solution is prone to deadlocking between borg / borgmatic (but that's just a gut feeling).
Sign in to join this conversation.
No milestone
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
borgmatic-collective/borgmatic#1098
No description provided.