roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From snoopd...@apache.org
Subject [08/16] roller git commit: ROL-1760 Scheduled tasks do not run on Oracle (or other DBs with high precision timestamps)
Date Sat, 28 Jan 2017 22:22:42 GMT
ROL-1760 Scheduled tasks do not run on Oracle (or other DBs with high precision timestamps)

git-svn-id: https://svn.apache.org/repos/asf/roller/trunk@1723976 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/roller/repo
Commit: http://git-wip-us.apache.org/repos/asf/roller/commit/fc356f51
Tree: http://git-wip-us.apache.org/repos/asf/roller/tree/fc356f51
Diff: http://git-wip-us.apache.org/repos/asf/roller/diff/fc356f51

Branch: refs/heads/bootstrap-ui
Commit: fc356f513378dec662352b36423dcf39ff26e257
Parents: e7dd3b5
Author: Kohei Nozaki <kohei@apache.org>
Authored: Mon Jan 11 03:15:29 2016 +0000
Committer: Kohei Nozaki <kohei@apache.org>
Committed: Mon Jan 11 03:15:29 2016 +0000

----------------------------------------------------------------------
 .../weblogger/business/jpa/JPAThreadManagerImpl.java    | 11 ++++++-----
 .../org/apache/roller/weblogger/pojos/TaskLock.orm.xml  |  2 +-
 app/src/main/resources/sql/510-to-520-migration.vm      | 12 ++++++------
 app/src/main/resources/sql/db2.properties               |  4 ++--
 app/src/main/resources/sql/hsqldb.properties            |  4 ++--
 app/src/main/resources/sql/macros.vm                    |  4 ++++
 app/src/main/resources/sql/mssql.properties             |  4 ++--
 7 files changed, 23 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/roller/blob/fc356f51/app/src/main/java/org/apache/roller/weblogger/business/jpa/JPAThreadManagerImpl.java
----------------------------------------------------------------------
diff --git a/app/src/main/java/org/apache/roller/weblogger/business/jpa/JPAThreadManagerImpl.java
b/app/src/main/java/org/apache/roller/weblogger/business/jpa/JPAThreadManagerImpl.java
index 516e60a..d493ae4 100644
--- a/app/src/main/java/org/apache/roller/weblogger/business/jpa/JPAThreadManagerImpl.java
+++ b/app/src/main/java/org/apache/roller/weblogger/business/jpa/JPAThreadManagerImpl.java
@@ -111,11 +111,12 @@ public class JPAThreadManagerImpl extends ThreadManagerImpl {
                 Query q = strategy.getNamedUpdate(
                         "TaskLock.updateClient&Timeacquired&Timeleased&LastRunByName&Timeacquired");
                 q.setParameter(1, task.getClientId());
-                q.setParameter(2, task.getLeaseTime());
-                q.setParameter(3, new Timestamp(runTime.getTime()));
-                q.setParameter(4, task.getName());
-                q.setParameter(5, taskLock.getTimeAcquired());
-                q.setParameter(6, new Timestamp(leaseExpiration.getTime()));
+                q.setParameter(2, new Timestamp(currentTime.getTime()));
+                q.setParameter(3, task.getLeaseTime());
+                q.setParameter(4, new Timestamp(runTime.getTime()));
+                q.setParameter(5, task.getName());
+                q.setParameter(6, taskLock.getTimeAcquired());
+                q.setParameter(7, new Timestamp(leaseExpiration.getTime()));
                 int result = q.executeUpdate();
 
                 if(result == 1) {

http://git-wip-us.apache.org/repos/asf/roller/blob/fc356f51/app/src/main/resources/org/apache/roller/weblogger/pojos/TaskLock.orm.xml
----------------------------------------------------------------------
diff --git a/app/src/main/resources/org/apache/roller/weblogger/pojos/TaskLock.orm.xml b/app/src/main/resources/org/apache/roller/weblogger/pojos/TaskLock.orm.xml
index 222b307..db243e0 100644
--- a/app/src/main/resources/org/apache/roller/weblogger/pojos/TaskLock.orm.xml
+++ b/app/src/main/resources/org/apache/roller/weblogger/pojos/TaskLock.orm.xml
@@ -12,7 +12,7 @@
         </named-query>
         
         <named-query name="TaskLock.updateClient&amp;Timeacquired&amp;Timeleased&amp;LastRunByName&amp;Timeacquired">
-            <query> UPDATE TaskLock t SET t.clientId=?1, t.timeAcquired= CURRENT_TIMESTAMP,
t.timeLeased= ?2, t.lastRun= ?3 WHERE t.name=?4 AND t.timeAcquired=?5 AND ?6 &lt; CURRENT_TIMESTAMP</query>
+            <query> UPDATE TaskLock t SET t.clientId=?1, t.timeAcquired= ?2, t.timeLeased=
?3, t.lastRun= ?4 WHERE t.name=?5 AND t.timeAcquired=?6 AND ?7 &lt; CURRENT_TIMESTAMP</query>
         </named-query>
         
         <named-query name="TaskLock.updateTimeLeasedByName&amp;Client">

http://git-wip-us.apache.org/repos/asf/roller/blob/fc356f51/app/src/main/resources/sql/510-to-520-migration.vm
----------------------------------------------------------------------
diff --git a/app/src/main/resources/sql/510-to-520-migration.vm b/app/src/main/resources/sql/510-to-520-migration.vm
index 794ecc8..a06e998 100644
--- a/app/src/main/resources/sql/510-to-520-migration.vm
+++ b/app/src/main/resources/sql/510-to-520-migration.vm
@@ -8,9 +8,9 @@
  PostgreSQL respects original not null attribute.
  **#
 #macro(expandTimestamp $tableName $columnName)
-#if($db.DBTYPE == "MYSQL")
+#if($db.DBTYPE == "MYSQL" || $db.DBTYPE == "MSSQL")
 #alterColumnType($tableName $columnName 'datetime(3)')
-#elseif ($db.DBTYPE == "ORACLE")
+#elseif ($db.DBTYPE == "ORACLE" || $db.DBTYPE == "DB2" || $db.DBTYPE == "HSQLDB")
 #alterColumnType($tableName $columnName 'timestamp(3)')
 #elseif ($db.DBTYPE == "POSTGRESQL")
 #alterColumnType($tableName $columnName 'timestamp(3) with time zone')
@@ -18,17 +18,17 @@
 #end
 
 #macro(expandTimestampNotNull $tableName $columnName)
-#if($db.DBTYPE == "MYSQL")
+#if($db.DBTYPE == "MYSQL" || $db.DBTYPE == "MSSQL")
 #alterColumnType($tableName $columnName 'datetime(3) not null')
-#elseif ($db.DBTYPE == "ORACLE")
+#elseif ($db.DBTYPE == "ORACLE" || $db.DBTYPE == "DB2" || $db.DBTYPE == "HSQLDB")
 #alterColumnType($tableName $columnName 'timestamp(3) not null')
 #elseif ($db.DBTYPE == "POSTGRESQL")
 #alterColumnType($tableName $columnName 'timestamp(3) with time zone')
 #end
 #end
 
--- Expanding datetime or timestamp columns
--- Affects only for MySQL, Oracle, PostgreSQL
+-- Adjusting precision of datetime or timestamp columns
+-- Not affects for Derby
 
 #expandTimestampNotNull('pingqueueentry' 'entrytime')
 #expandTimestamp('pingtarget' 'lastsuccess')

http://git-wip-us.apache.org/repos/asf/roller/blob/fc356f51/app/src/main/resources/sql/db2.properties
----------------------------------------------------------------------
diff --git a/app/src/main/resources/sql/db2.properties b/app/src/main/resources/sql/db2.properties
index 324f9d9..93d44bc 100644
--- a/app/src/main/resources/sql/db2.properties
+++ b/app/src/main/resources/sql/db2.properties
@@ -24,5 +24,5 @@ BOOLEAN_TRUE =1
 INDEXSIZE=
 INDEXSIZE_LARGE=
 ADDL_FK_PARAMS=on delete no action on update no action enforced enable query optimization
-TIMESTAMP_SQL_TYPE_NULL=timestamp
-TIMESTAMP_SQL_TYPE=timestamp
+TIMESTAMP_SQL_TYPE_NULL=timestamp(3)
+TIMESTAMP_SQL_TYPE=timestamp(3)

http://git-wip-us.apache.org/repos/asf/roller/blob/fc356f51/app/src/main/resources/sql/hsqldb.properties
----------------------------------------------------------------------
diff --git a/app/src/main/resources/sql/hsqldb.properties b/app/src/main/resources/sql/hsqldb.properties
index fcf8748..79c921a 100644
--- a/app/src/main/resources/sql/hsqldb.properties
+++ b/app/src/main/resources/sql/hsqldb.properties
@@ -24,5 +24,5 @@ BOOLEAN_TRUE=1
 INDEXSIZE=
 INDEXSIZE_LARGE=
 ADDL_FK_PARAMS=
-TIMESTAMP_SQL_TYPE_NULL=timestamp null
-TIMESTAMP_SQL_TYPE=timestamp
+TIMESTAMP_SQL_TYPE_NULL=timestamp(3) null
+TIMESTAMP_SQL_TYPE=timestamp(3)

http://git-wip-us.apache.org/repos/asf/roller/blob/fc356f51/app/src/main/resources/sql/macros.vm
----------------------------------------------------------------------
diff --git a/app/src/main/resources/sql/macros.vm b/app/src/main/resources/sql/macros.vm
index b60dc4b..7754c60 100644
--- a/app/src/main/resources/sql/macros.vm
+++ b/app/src/main/resources/sql/macros.vm
@@ -153,6 +153,10 @@ drop table if exists $tableName;
 alter table $tableName modify $columnName $columnType;
 #elseif ($db.DBTYPE == "POSTGRESQL")
 alter table $tableName alter column $columnName type $columnType;
+#elseif ($db.DBTYPE == "DB2")
+alter table $tableName alter column $columnName set data type $columnType;
+#elseif ($db.DBTYPE == "HSQLDB" || $db.DBTYPE == "MSSQL")
+alter table $tableName alter column $columnName $columnType;
 #else
 -- You should alter type of column $columnName of table $tableName to $columnType
 #end

http://git-wip-us.apache.org/repos/asf/roller/blob/fc356f51/app/src/main/resources/sql/mssql.properties
----------------------------------------------------------------------
diff --git a/app/src/main/resources/sql/mssql.properties b/app/src/main/resources/sql/mssql.properties
index cafd7a3..ed895ce 100644
--- a/app/src/main/resources/sql/mssql.properties
+++ b/app/src/main/resources/sql/mssql.properties
@@ -24,5 +24,5 @@ BOOLEAN_TRUE=1
 INDEXSIZE=
 INDEXSIZE_LARGE=
 ADDL_FK_PARAMS=
-TIMESTAMP_SQL_TYPE_NULL=datetime null
-TIMESTAMP_SQL_TYPE=datetime
+TIMESTAMP_SQL_TYPE_NULL=datetime(3) null
+TIMESTAMP_SQL_TYPE=datetime(3)


Mime
View raw message