Skip to content

Retag a snapshot made earlier in the same run when it took longer than an hour - #593

Open
martin152 wants to merge 1 commit into
linuxmint:masterfrom
martin152:fix-retag-after-long-snapshot
Open

martin152 wants to merge 1 commit into
linuxmint:masterfrom
martin152:fix-retag-after-long-snapshot

Conversation

@martin152

Copy link
Copy Markdown

My weekly and monthly snapshots fell due in the same hourly check. The weekly one took 82 minutes.
The monthly pass then didn't reuse it and made a second snapshot with the same name, in the same
folder, and that run's info.json only kept "monthly". The next hourly check saw no weekly snapshot
and took another one.

From the log (Timeshift 25.12.4, rsync mode):

[18:00:04] Last weekly snapshot is more than 1 week old
[18:00:04] Creating new snapshot...(RSYNC)
[19:22:52] Tagged snapshot '2026-11-23_18-00-04': weekly
[19:22:52] Last monthly snapshot is more than 1 month old
[19:22:52] Creating new snapshot...(RSYNC)
[19:22:52] Linking from snapshot: 2026-11-23_18-00-04
[19:32:37] Created control file: .../snapshots/2026-11-23_18-00-04/info.json
[19:32:38] Tagged snapshot '2026-11-23_18-00-04': monthly

create_snapshot_for_tags() looks for a snapshot from the last hour using a fresh now, but the
snapshot it should find is dated with dt_created, the time the run started. This change measures
the hour from dt_created. A run that finishes within the hour behaves exactly as before.

I tested it on a scratch disk image, with the clock sped up 3600 times through faketime so that
the first snapshot "took" a few hours. Both levels due, empty repository:

master:  Tagged snapshot '2026-11-24_00-25-17': W
         Creating new snapshot...(RSYNC)          <- second copy, same name
         Tagged snapshot '2026-11-24_00-25-17': M
         -> one folder, tags "monthly"
branch:  Tagged snapshot '2026-11-24_00-25-32': W
         Tagged snapshot '2026-11-24_00-25-32': M
         -> one folder, tags "weekly monthly"

The retag window in create_snapshot_for_tags() was measured from the
current time, while the snapshot name comes from the time the run
started. When the first snapshot of a run took longer than an hour,
the next level due in the same run (for example monthly after weekly)
did not find it, created a second snapshot with the same name in the
same folder, and its control file replaced the first one's tags.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant