Bug #31997 Graphs are not drawing the data from the DST repeated (fall back) hour
Submitted: 31 Oct 2007 16:48 Modified: 15 Oct 2008 12:22
Reporter: Bill Weber Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Enterprise Monitor: Server Severity:S3 (Non-critical)
Version:1.2.0.7879 OS:Any
Assigned to: Darren Oldag CPU Architecture:Any

[31 Oct 2007 16:48] Bill Weber
Description:
During the repeated hour of Daylight Savings Time (when 2am turns back into 1am), the graphs are not drawing the data. Instead, there is a straight line from the point at 1:00 to the second 1:00, which is what happens if there is a gap (no data). The repository does, however, have data for this hour.

How to repeat:
- install dashboard and agent(s)
- start and collect data before, during, and after (spans) Daylight Savings Time
- notice that there is a straight line on all graphs from 1:00 to 1:00
[31 Oct 2007 18:59] Darren Oldag
Turns out jfreechart doesn't handle DST like we thought it did.  let's examine the following test code.

            // 1:30am, PDT
            Date pdt130 = DateUtil.toDateNotNull("2007-11-04T08:30:00Z");
            // 1:30am, PST
            Date pst130 = DateUtil.toDateNotNull("2007-11-04T09:30:00Z");
            System.out.println(pdt130);
            System.out.println(pst130);
            assertTrue(pdt130.compareTo(pst130) < 0);
            assertTrue(pst130.compareTo(pdt130) > 0);
            
            final Second s1 = new Second(pdt130, pacific);
            final Second s2 = new Second(pst130, pacific);
            if (s1.equals(s2)) {
                System.out.println("These are not equal!");
                System.out.println(s1);
                System.out.println(s2);
            }
            
            System.out.println(s1.compareTo(s2));
            assertTrue(s1.compareTo(s2) < 0);
            assertTrue(s2.compareTo(s1) > 0);

------output -------
Sun Nov 04 01:30:00 PDT 2007
Sun Nov 04 01:30:00 PST 2007
These are not equal!
Sun Nov 04 01:30:00 PST 2007
Sun Nov 04 01:30:00 PST 2007
0

---------------------

as you can see, we create two dates.  1:30am in PDT and PST.  java confirms these are separate and not equal, and compare properly.

we put them in the JFreeChart Second class, and the PDT information is lost.

The recommended solution from JFreeChart forums is to use the FixedMillis time period.  I believe this is possible, but when i tested it, it lost timezone settings (always used the system timezone instead of the configured user time).  It is still possible, but then it would mean hacking in our own timezone offset calculations before passing the Date to jfreechart.  I'm not very comfortable with that level of change for 1.2 (which is already GA).

This is only a display problem, and no data is really lost anywhere.  Knowing that we will want to improve our graphing mechanism in the next release anyway, maybe we can ignore this for now.  Otherwise, I suggest leaving alone for 1.2.0 (or 1.2.1), maybe mark it is a fix for the next maintenance release.  Or, ignore it alltogether until the new graphing subsystem is implemented.
[8 Aug 2008 23:21] Darren Oldag
turns out, you can use FixedMilliseconds class, as long as you create the DateAxis in the correct timezone.
[9 Aug 2008 2:24] Darren Oldag
corrected which jfreechart 'time period' object to use that doesn't break dst/timezone issues.

pushed into trunk, awaiting build.
[13 Aug 2008 0:36] Bill Weber
verified fixed in pre-release 2.0 build 2.0.0.7023
[15 Oct 2008 12:22] Tony Bedford
An entry was added to the 2.0 changelog:

During the repeated hour of Daylight Savings Time (when 2am turns back into 1am), the graphs were not drawing data. Instead, there was a straight line from the point at 1:00 to the second 1:00, which is what happens if there is no data. The repository did, however, have data for this hour.