Bug 578927 - March sar data was appended to February data
Summary: March sar data was appended to February data
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: sysstat
Version: 4.8
Hardware: All
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Ivana Varekova
QA Contact: BaseOS QE - Apps
URL:
Whiteboard:
Depends On:
Blocks: 485811
TreeView+ depends on / blocked
 
Reported: 2010-04-01 18:58 UTC by Jeff Bastian
Modified: 2018-11-30 20:30 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 578929 (view as bug list)
Environment:
Last Closed: 2011-02-16 14:06:52 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
demo program for find rounding errors (729 bytes, text/plain)
2010-04-01 19:03 UTC, Jeff Bastian
no flags Details
patch for the history patch (867 bytes, patch)
2010-04-01 19:15 UTC, Jeff Bastian
no flags Details | Diff


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2011:0224 0 normal SHIPPED_LIVE sysstat bug fix update 2011-02-15 16:35:28 UTC

Description Jeff Bastian 2010-04-01 18:58:53 UTC
Description of problem:
For bug 475255, the max history for sar data was shortened to 26 days to prevent today's data from being appended to last month's data.  From sysstat-5.0.5-history.patch:
    < +[ ${HISTORY} -gt 28 ] && HISTORY=28
    ---
    > +[ ${HISTORY} -gt 26 ] && HISTORY=26

Unfortunately, 26 days is still too long.

Given that
  1. February only has 28 days, and 
  2. that 'find ... -mtime +26' finds files that were modified 27 
     or more days ago, and 
  3. find ignores fractional days and thus has rounding errors, and
  4. the DST changes take place within sar's $HISTORY window
     (as of 2007, the second Sunday in March[1], or March 14, 2010
     this year)
then /usr/lib/sa/sa2 is only deleting files that are 28 days 
or older (not 27).

As a result, sar data from March 15 to March 28 was getting appended
to the data from February instead of replacing it.  You can see the files
from March 15 to 28 are 2x the size of normal files.
   # ls -al
   ...
   -rw-r--r--  1 root root  813552 Mar 12 23:50 sa12
   -rw-r--r--  1 root root  813552 Mar 13 23:50 sa13
   -rw-r--r--  1 root root  779664 Mar 14 23:50 sa14
   -rw-r--r--  1 root root 1626864 Mar 15 23:50 sa15
   -rw-r--r--  1 root root 1626864 Mar 16 23:50 sa16
   -rw-r--r--  1 root root 1626864 Mar 17 23:50 sa17
   ...
   -rw-r--r--  1 root root 1626864 Mar 26 23:50 sa26
   -rw-r--r--  1 root root 1626864 Mar 27 23:50 sa27
   -rw-r--r--  1 root root 1626864 Mar 28 23:50 sa28
   -rw-r--r--  1 root root  813552 Mar 29 23:50 sa29
   -rw-r--r--  1 root root  339120 Mar 30 09:50 sa30
   ...

The max needs to be 25 days to account for DST now.


Version-Release number of selected component (if applicable):
sysstat-5.0.5-25.el4

How reproducible:
every time

Steps to Reproduce:
1. run sar through Febrary and March 2010
  
Actual results:
March 15-28 data is appended to February 15-28 data

Expected results:
March data replaces February data

Additional info:

Comment 1 Jeff Bastian 2010-04-01 19:00:05 UTC
Ooops, I forgot the referenced link
  [1] http://en.wikipedia.org/wiki/Energy_Policy_Act_of_2005#Change_to_daylight_saving_time

Comment 2 Jeff Bastian 2010-04-01 19:03:28 UTC
Created attachment 404072 [details]
demo program for find rounding errors

Attached is a demo script to show how 'find ... -mtime +26 ...' fails to find files that are 27 days old when dealing with the DST time change on March 14, 2010.

It touches a series of files, sa10 to sa20, with timestamps from February 10 to February 20 at 23:53.  It then sets the date to March 15 and finds files that are older than 26 days.  (And finally restores the date.)

# ./find26.sh
Stopping ntpd:                                             [  OK  ]
Stopping crond:                                            [  OK  ]
Mon Mar 15 23:53:00 EDT 2010
-rw-r--r-- 1 root root 0 Feb 15 23:53 /root/timestamp/sa15
-rw-r--r-- 1 root root 0 Feb 14 23:53 /root/timestamp/sa14
-rw-r--r-- 1 root root 0 Feb 13 23:53 /root/timestamp/sa13
-rw-r--r-- 1 root root 0 Feb 12 23:53 /root/timestamp/sa12
-rw-r--r-- 1 root root 0 Feb 11 23:53 /root/timestamp/sa11
-rw-r--r-- 1 root root 0 Feb 10 23:53 /root/timestamp/sa10
Thu Apr  1 12:35:12 EDT 2010
Starting crond:                                            [  OK  ]
Starting ntpd:                                             [  OK  ]

You can see that youngest file it found was from February 15 which is 28 days old on March 15.  It does not find sa16 which is 27 days (in our thinking) even though we specified +26.  This is due to the rounding errors from find ignoring fractional parts of days.

Comment 3 Jeff Bastian 2010-04-01 19:15:35 UTC
Created attachment 404076 [details]
patch for the history patch

Comment 7 errata-xmlrpc 2011-02-16 14:06:52 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2011-0224.html


Note You need to log in before you can comment on or make changes to this bug.