[ 
https://issues.apache.org/jira/browse/OAK-3645?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15089044#comment-15089044
 ] 

Axel Hanikel commented on OAK-3645:
-----------------------------------

AFAICT the following change fixes the issue:

{noformat}
[axel@ahanikel-osx:/Users/axel/Documents/git/jackrabbit-oak|Fri Jan  8 11:34:34 
CET 2016|1.3.9]$ git diff
diff --git 
a/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBDocumentStoreDB.java
 
b/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBDocumentStoreDB.java
index 589c0a7..905f9ab 100755
--- 
a/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBDocumentStoreDB.java
+++ 
b/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBDocumentStoreDB.java
@@ -110,6 +110,11 @@ public enum RDBDocumentStoreDB {
         }
 
         @Override
+        public String getCurrentTimeStampInMsSyntax() {
+            return "(CURRENT_TIMESTAMP(4) - CURRENT_TIMEZONE) || ' +00:00'";
+        }
+
+        @Override
         public String getAdditionalDiagnostics(RDBConnectionHandler ch, String 
tableName) {
             Connection con = null;
             PreparedStatement stmt = null;
{noformat}

Can we please add this change for the next release? It won't affect other 
database types because the enum is DB-specific anyway. Thanks!

> RDBDocumentStore: server time detection for DB2 fails due to timezone/dst 
> differences
> -------------------------------------------------------------------------------------
>
>                 Key: OAK-3645
>                 URL: https://issues.apache.org/jira/browse/OAK-3645
>             Project: Jackrabbit Oak
>          Issue Type: Technical task
>          Components: rdbmk
>    Affects Versions: 1.3.10, 1.2.8, 1.0.24
>            Reporter: Julian Reschke
>            Assignee: Tomek Rękawek
>
> We use {{CURRENT_TIMESTAMP(4)}} to ask the DB for it's system time.
> Apparently, at least with DB2, this might return a value that is off by a 
> multiple of one hour (3600 * 1000ms) depending on whether the OAK instance 
> and the DB run in different timezones.
> Known to work: both on the same machine.
> Known to fail: OAK in CET, DB2 in UTC, in which case we're getting a 
> timestamp one hour in the past.
> At this time it's not clear whether the same problem occurs for other 
> databases.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to