Giter VIP home page Giter VIP logo

Comments (9)

jimsalterjrs avatar jimsalterjrs commented on May 17, 2024

Odd. Thank you for reporting.

Mind telling me what TZ you are in? I'm wondering if the TZDATA for you is part of the problem - I'm in the NY tz (edt) with 50-ish hosts running this in production and have not seen this error.

FWIW, Ubuntu 14.04 is my target platform, though I'm also using Sanoid on quite a few 12.04 hosts, and a couple of older FreeBSD boxes.

from sanoid.

jimsalterjrs avatar jimsalterjrs commented on May 17, 2024

On line 641:

$datestamp{'mon'} = sprintf ("%02u", ($datestamp{'mon'} + 1));

This alters $datestamp{'mon'} from the original output of localtime(time) so that it will be correct to human eyes (humans expect months to be numbered 1-12, instead of being numbered 0-11).

So in further instances of the code, when $datestamp{'mon]} is decremented, this should be returning it to the original value returned by localtime(time) - even if I'd misunderstood how localtime(time) works, it's just undoing a +1 that was present in the original declaration.

Let's take a look at line 318, where you're actually having the out of range error.

} elsif ($type eq 'yearly')  {
     push @preferredtime,0; # try to hit 0 seconds
     push @preferredtime,$config{$section}{'monthly_min'};
     push @preferredtime,$config{$section}{'monthly_hour'};
     push @preferredtime,$config{$section}{'monthly_mday'};
     push @preferredtime,($config{$section}{'monthly_mon'}-1); # january is month 0
     push @preferredtime,$datestamp{'year'};

I think that's where our answer lies - line 318 doesn't refer to ($datestamp{'mon'}-1), it refers to ($config{$section}{'monthly_mon'}-1) - so for whatever section of your sanoid.conf is being processed, it looks like you set the desired month to take the annual snapshot to 0, which would definitely end up producing your out of range error.

Can you please check your sanoid.conf and confirm, or if it looks clean to you, paste it here for me to look at?

from sanoid.

stevenolen avatar stevenolen commented on May 17, 2024

Wow, great detail -- thank you! I was thinking it may just be because I opted out of including your template_default section of the conf file, but after adding that it still happens. Here is my conf file:

[zroot/tmp]
 use_template = backup

#### TEMPLATES ####
[template_backup]
 template = yes
 hourly = 30
 daily = 1
 monthly = 1
 yearly = 1
 autosnap = yes
 autoprune = yes

###################################################################################
# default template - contains same values as hardcoded, unless you override here. #
#                    ALL values set here, so useful as documentation even if      #
#                    nothing is actually overridden.                              #
###################################################################################

[template_default]
template = yes

# If any snapshot type is set to 0, we will not take snapshots for it - and will immediately
# prune any of those type snapshots already present.
#
# Otherwise, if autoprune is set, we will prune any snapshots of that type which are older
# than (setting * periodicity) - so if daily = 90, we'll prune any dailies older than 90 days.
autoprune = yes
hourly = 48
daily = 90
monthly = 6
yearly = 0
min_percent_free = 10

# We will automatically take snapshots if autosnap is on, at the desired times configured
# below (or immediately, if we don't have one since the last preferred time for that type).
#
# Note that we will not take snapshots for a given type if that type is set to 0 above, 
# regardless of the autosnap setting - for example, if yearly=0 we will not take yearlies
# even if we've defined a preferred time for yearlies and autosnap is on.
autosnap = 1;
# hourly - top of the hour
hourly_min = 0;
# daily - at 23:59 (most people expect a daily to contain everything done DURING that day)
daily_hour = 23;
daily_min = 59;
# monthly - immediately at the beginning of the month (ie 00:00 of day 1)
monthly_mday = 1;
monthly_hour = 0;
monthly_min = 0;
# yearly - immediately at the beginning of the year (ie 00:00 on Jan 1)
yearly_yday = 1;
yearly_hour = 0;
yearly_min = 0;

# monitoring plugin - define warn / crit levels for each snapshot type by age, in units of one period down
# example hourly_warn = 90 means issue WARNING if most recent hourly snapshot is not less than 90 minutes old,
# daily_crit = 36 means issue CRITICAL if most recent daily snapshot is not less than 36 hours old,
# monthly_warn = 36 means issue WARNING if most recent monthly snapshot is not less than 36 days old... etc.
#
# monitor_dont_warn = yes will cause the monitoring service to report warnings as text, but with status OK.
# monitor_dont_crit = yes will cause the monitoring service to report criticals as text, but with status OK.
#
# setting any value to 0 will keep the monitoring service from monitoring that snapshot type on that section at all.
monitor = yes
monitor_dont_warn = no
monitor_dont_crit = no
hourly_warn = 90
hourly_crit = 360 
daily_warn = 28
daily_crit = 32
monthly_warn = 32
monthly_crit = 35
yearly_warn = 0
yearly_crit = 0

Additionally, I'm in PST (Los Angeles) but I've been working on this in a vagrant instance and have tried setting it to UTC,PST and EST with the same results. Thanks so much for your help!

from sanoid.

jimsalterjrs avatar jimsalterjrs commented on May 17, 2024

Oh, I think I see the problem - that should be yearly_mon, not monthly_mon. It looks like I copied in the section from monthly defaults (that's the chunk of code that picks out the optimum time to take a snapshot of a given time) to the yearly defaults, but never replaced the references to monthly to references to yearly. And I haven't been using yearly snapshots anywhere, I don't think, so I didn't catch the bug. Let me test the theory real quick. Don't monkey-patch anything until I get back to you. :)

from sanoid.

jimsalterjrs avatar jimsalterjrs commented on May 17, 2024

Yep. Bingo, told my workstation to take a yearly snapshot, and immediately reproduced your result. Hang on, will have us patched in a moment. Thank you for your report!

from sanoid.

stevenolen avatar stevenolen commented on May 17, 2024

why certainly! a perl whiz I am not, so I'll wait for you 👍

from sanoid.

jimsalterjrs avatar jimsalterjrs commented on May 17, 2024

OK, 1.0.11 is uploaded and will properly fix your issue. Thank you for the bug report.

from sanoid.

stevenolen avatar stevenolen commented on May 17, 2024

fantastic, thanks so much!

from sanoid.

jimsalterjrs avatar jimsalterjrs commented on May 17, 2024

btw, pushed a second minor fix to set things properly in the default sanoid.conf provided. I'd fixed the hardcoded settings in sanoid, and that was enough to fix your issue, but updating in sanoid.conf makes sure to document how to change things in the future.

from sanoid.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.