Skip to content

Staggered File Versioning - intervals as parameters #8352

Description

@mziehm

I'm concerned about the maximum storage need of Staggered File Versioning. If I understand correctly, for the first 1 hour alone a maximum um 120 copies might be kept, and for the first day 24 additional, meaning with only 1 day Maximum Age, one would need to ensure the 144 fold storage space of the synced folder to be save. Otherwise an adversary (human or software e.g. ransomware) can prevent any syncing by flooding the versioned storage.
While I do not doubt that there are use cases where the current setup is ideal and either backed by sufficient storage or the risk is acceptable, I would like to suggest and ask for making the staggered intervals configurable, which would be also in general a welcome increase in flexibility with very limited additional code complexity.

fields to allow configuring interval (i.e. parameterize line 50 to 53 of staggered.go (https://github.com/syncthing/syncthing/blob/main/lib/versioner/staggered.go)

			{30, 60 * 60},                     // first hour -> 30 sec between versions
			{60 * 60, 24 * 60 * 60},           // next day -> 1 h between versions
			{24 * 60 * 60, 30 * 24 * 60 * 60}, // next 30 days -> 1 day between versions
			{7 * 24 * 60 * 60, maxAge},        // next year -> 1 week between versions

(Users can tune the staggering to their usecase, and syncing needs resulting in e.g.
{15 * 60, 2 * 60 * 60}, //first 2 hours -> 15min between version
{2 * 60 * 60, 24 * 60 * 60} //next day -> 2h between versions,
...

So one would need a input table with two columns and fixed or variable number of rows:
bin | duration
30 | 3600
3600 | 86400
86400 | 2592000
604800 | maxAge
would be the current setup (and then default)

Advantage:

  • parameterization should not be to hard and no other changes to the code or test needed
  • adjustable usecases, storage and risk settings

This suggestion would also solve #4717

Please consider and many thanks for this great piece of software

Activity

  1. added
    enhancement
    needs-triage
    on May 21, 2022
  2. removed
    needs-triage
    on Sep 11, 2022
  3. added 2 commits that reference this issue on Sep 10, 2023
    9dfe23f
    1003d67
  4. added theissue type on May 30, 2025
  5. ccjmne commented on Sep 14, 2026

    @ccjmne

    Hey @calmh,
    I'm interested in trying my hands at this one :-)

    I don't have a lot of experience with Golang, but just going through your CONTRIBUTING.md makes me actually wanna try my best.
    I'm interested in this feature, and think the UI could be somewhat digestible, if pre-selected with some sane defaults (the current configuration). Otherwise, maybe we could keep "staggered" as it is, and have another entry for "customised staggered" (probably not labelled that, though!)...

    In any case, before I jump into it, considering your comment from 2018, I figure I should ask whether you've changed your opinion since then :-)
    And if you have, maybe there's some reason you'd wanna share? Maybe you have some idea in mind?

    In short:

    1. shall I give it a go?
    2. any wish or idea you (or anybody else) have in particular?
  6. tomasz1986 commented on Sep 15, 2026

    @tomasz1986
    Member

    @ccjmne I had a somewhat working solution in #9094, but then "life happened" and I couldn't finish the PR. You may want to check it out and read the comments made by maintainers and other contributors to see what kind of approach could be used to solve this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions