Skip to content
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

sanoid should warn if it can't find the template requested via use_template #938

Open
ssokolow opened this issue Jul 13, 2024 · 2 comments

Comments

@ssokolow
Copy link

I've got sanoid and syncoid set up using the following configuration file, but sanoid appears to be retaining 48 hourly snapshots for the backup datasets, rather than the 36 that the configuration specifies, which it successfully obeys for the source ones.

/etc/sanoid/sanoid.conf
[zroot/ROOT/ubuntu]
        use_template = production
        recursive = no
[zroot/home]
        use_template = production
        recursive = no
[bulk]
        use_template = production
        recursive = no

[bulk/BACKUPS/ubuntu]
        use_template = template_syncoid_backups
        recursive = no
[bulk/BACKUPS/home]
        use_template = template_syncoid_backups
        recursive = no

#############################
# templates below this line #
#############################

[template_production]
        frequently = 0
        hourly = 36
        daily = 30
        monthly = 3
        yearly = 0
        autosnap = yes
        autoprune = yes

[template_syncoid_backups]
        frequently = 0
        hourly = 36
        daily = 30
        monthly = 3
        yearly = 0
        autosnap = no
        autoprune = yes

% sanoid --version
/usr/sbin/sanoid version 2.1.0
(Getopt::Long::GetOptions version 2.52; Perl version 5.34.0)
@lckarssen
Copy link

Can you try and remove the template_ part from the use_template lines for the backup sections? That shouldn't be there (see your production blocks). So just use use_template = syncoid_backups.

@ssokolow
Copy link
Author

ssokolow commented Jul 13, 2024

That was the problem.

As someone who's spent 25+ years programming strongly typed languages, I seem to have built an instinctive blindness to "identifiers must not be letter-for-letter matches for things to work" and, still remembering an ignored key 'recursive' from 'production' template. message from a while back, I trusted that it'd warn me if it was ignoring those lines for lack of a template being found.

(Hell, if I'd written it, I'd probably have made template name resolution a fatal error on the premise that "better to fail loudly while attention is present than to do the wrong thing quietly after attention has shifted away" is the only right thing to do for something that could silently result in fewer backups being made or more backups being purged than you expect... though I can certainly understand how adding fatal anything at this stage is difficult to do responsibly, even with a major version number bump.)

@ssokolow ssokolow changed the title sanoid autoprune on syncoid output preserving too many snapshots sanoid should warn if it can't find the template requested via use_template Jul 13, 2024
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

No branches or pull requests

2 participants