You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "Lily Wei (JIRA)" <ji...@apache.org> on 2010/07/16 07:02:51 UTC

[jira] Updated: (DERBY-4582) Timestamps inserted with GMT calendar are 1 hour later when subsequently read with GMT calendar (Server Mode Only).

     [ https://issues.apache.org/jira/browse/DERBY-4582?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Lily Wei updated DERBY-4582:
----------------------------

    Attachment: derby-4582-10.5.diff

Wow! Porting to 10.5 for this issue is a little bit hairy. From reading all the comments, I figure I might only need to port changelist 940460.
After executing 'svn merge -c940460 https://svn.apache.org/repos/asf/db/derby/code/branches/10.6/', I was able to compile 10.5 branch. Yeah! However, running DaylightSavingTest failed with the following message:
1) testConversionToGMTAroundDSTChange(org.apache.derbyTesting.functionTests.test
s.jdbcapi.DaylightSavingTest)junit.framework.AssertionFailedError: TS expected:<
2010-03-13 20:01:00.0> but was:<2010-03-13 21:01:00.0>
        at org.apache.derbyTesting.functionTests.tests.jdbcapi.DaylightSavingTes
t.testConversionToGMTAroundDSTChange(DaylightSavingTest.java:129)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

I am thinking I will port more changes to try to fix this issue.
I port changelist 936218 and 937170 with comment 'svn merge -c936218 https://svn.apache.org/repos/asf/db/derby/code/trunk/' and 'svn merge -c937170 https://svn.apache.org/repos/asf/db/derby/code/trunk/'. DaylightSavingTest is still giving me the same failure information and I am able to compile 10.5 branch. I am attaching the diff I have at this point with derby-4582-10.5.diff

Due to the fact DaylightSavingTest is still failing, I then port changelist 935869. I was not able to compile 10.5 branch at this point.
Compile failed at:
compile:
    [javac] Compiling 141 source files to c:\derby\10.5\classes
    [javac] c:\derby\10.5\java\client\org\apache\derby\client\net\Request.java:1
559: timestampToTimestampBytes(byte[],int,org.apache.derby.client.am.DateTimeVal
ue,boolean) in org.apache.derby.client.am.DateTime cannot be applied to (byte[],
int,org.apache.derby.client.am.DateTimeValue)
    [javac]             org.apache.derby.client.am.DateTime.timestampToTimestamp
Bytes(bytes_, offset_, timestamp);
    [javac]                                                ^
I notice my merge for Request.java at java/client/org/apache/derby/client/net/ is very different than the diff in JIRI DERBY-4582 http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/net/Request.java?p2=%2Fdb%2Fderby%2Fcode%2Ftrunk%2Fjava%2Fclient%2Forg%2Fapache%2Fderby%2Fclient%2Fnet%2FRequest.java&p1=%2Fdb%2Fderby%2Fcode%2Ftrunk%2Fjava%2Fclient%2Forg%2Fapache%2Fderby%2Fclient%2Fnet%2FRequest.java&r1=935868&r2=935867&view=diff&pathrev=935868
At line 1553, I have diff as following:
-    final void writeTimestamp(java.sql.Timestamp timestamp) throws SqlException
 {
+    final void writeTimestamp(DateTimeValue timestamp) throws SqlException {
         try{
             ensureLength(offset_ + 26);
             org.apache.derby.client.am.DateTime.timestampToTimestampBytes(bytes
_, offset_, timestamp);

I can try to manually change this. However, I have a feeling I might need to change Connection.java in order to have method serverSupportsTimestampNanoseconds

Should I keep trying to port this issue to 10.5 branch? Any suggestion is welcome.


> Timestamps inserted with GMT calendar are 1 hour later when subsequently read with GMT calendar (Server Mode Only).
> -------------------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-4582
>                 URL: https://issues.apache.org/jira/browse/DERBY-4582
>             Project: Derby
>          Issue Type: Bug
>          Components: Network Client
>    Affects Versions: 10.5.3.0
>         Environment: Windows XP Professional Version 2002 Service Pack 3,  Central Standard Time Zone (America/Chicago)
>            Reporter: Keith Kruse
>            Assignee: Lily Wei
>             Fix For: 10.6.1.1, 10.7.0.0
>
>         Attachments: calendar.diff, derby-4582-10.5.diff, derby-4582-1a-client-send.diff, derby-4582-2a-server-receive.diff, derby-4582-3a-server-send.diff, derby-4582-4a-client-receive.diff, derby-4582-5a-bugfix.diff, derby-4582-6a-javame.diff, DerbyTest.java, junit.diff, junit.diff, upd-rs-test.diff
>
>
> This issue only appears to happen in Network Server/Client mode.  Embedded mode does not have the issue.
> My timezone is American/Chicago.  Saving timestamps with values for the 6 hours prior to DST start are being read back in as values 1 hour later than written.  (I believe the issue happens on the write because values written in Network Server/Client mode and read in Embedded mode are incorrect, while values written and read in Embedded mode are corect.)
> Values between 3/13/2010 - 20:00 CST and 3/14/2010 - 02:00 CST will return timstamps 1 hour off.  The "setTimestamp" method is being passed a GMT calendar with the timestamp:
> I have a complete test class I can attach, but here is a summary:
> private final TimeZone gmtTZ = TimeZone.getTimeZone("GMT");
> private final Calendar gmtCal = Calendar.getInstance(gmtTZ);
> ...
> String sql = "INSERT INTO app.dst_test (id, gmt_timestamp, milli_time) VALUES(?,?,?)";
> String sql2 = "SELECT * from app.dst_test where id=?";
> ...
> ps.setTimestamp(2, ts, gmtCal);
> ...
> Timestamp tsRead = rs.getTimestamp("gmt_timestamp", gmtCal);
> ...

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.