roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ko...@apache.org
Subject svn commit: r1723976 - in /roller/trunk/app/src/main: java/org/apache/roller/weblogger/business/jpa/ resources/org/apache/roller/weblogger/pojos/ resources/sql/
Date Mon, 11 Jan 2016 03:15:29 GMT
Author: kohei
Date: Mon Jan 11 03:15:29 2016
New Revision: 1723976

URL: http://svn.apache.org/viewvc?rev=1723976&view=rev
Log:
ROL-1760 Scheduled tasks do not run on Oracle (or other DBs with high precision timestamps)

Modified:
    roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/jpa/JPAThreadManagerImpl.java
    roller/trunk/app/src/main/resources/org/apache/roller/weblogger/pojos/TaskLock.orm.xml
    roller/trunk/app/src/main/resources/sql/510-to-520-migration.vm
    roller/trunk/app/src/main/resources/sql/db2.properties
    roller/trunk/app/src/main/resources/sql/hsqldb.properties
    roller/trunk/app/src/main/resources/sql/macros.vm
    roller/trunk/app/src/main/resources/sql/mssql.properties

Modified: roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/jpa/JPAThreadManagerImpl.java
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/jpa/JPAThreadManagerImpl.java?rev=1723976&r1=1723975&r2=1723976&view=diff
==============================================================================
--- roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/jpa/JPAThreadManagerImpl.java
(original)
+++ roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/jpa/JPAThreadManagerImpl.java
Mon Jan 11 03:15:29 2016
@@ -111,11 +111,12 @@ public class JPAThreadManagerImpl extend
                 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) {

Modified: roller/trunk/app/src/main/resources/org/apache/roller/weblogger/pojos/TaskLock.orm.xml
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/resources/org/apache/roller/weblogger/pojos/TaskLock.orm.xml?rev=1723976&r1=1723975&r2=1723976&view=diff
==============================================================================
--- roller/trunk/app/src/main/resources/org/apache/roller/weblogger/pojos/TaskLock.orm.xml
(original)
+++ roller/trunk/app/src/main/resources/org/apache/roller/weblogger/pojos/TaskLock.orm.xml
Mon Jan 11 03:15:29 2016
@@ -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">

Modified: roller/trunk/app/src/main/resources/sql/510-to-520-migration.vm
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/resources/sql/510-to-520-migration.vm?rev=1723976&r1=1723975&r2=1723976&view=diff
==============================================================================
--- roller/trunk/app/src/main/resources/sql/510-to-520-migration.vm (original)
+++ roller/trunk/app/src/main/resources/sql/510-to-520-migration.vm Mon Jan 11 03:15:29 2016
@@ -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')

Modified: roller/trunk/app/src/main/resources/sql/db2.properties
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/resources/sql/db2.properties?rev=1723976&r1=1723975&r2=1723976&view=diff
==============================================================================
--- roller/trunk/app/src/main/resources/sql/db2.properties (original)
+++ roller/trunk/app/src/main/resources/sql/db2.properties Mon Jan 11 03:15:29 2016
@@ -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)

Modified: roller/trunk/app/src/main/resources/sql/hsqldb.properties
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/resources/sql/hsqldb.properties?rev=1723976&r1=1723975&r2=1723976&view=diff
==============================================================================
--- roller/trunk/app/src/main/resources/sql/hsqldb.properties (original)
+++ roller/trunk/app/src/main/resources/sql/hsqldb.properties Mon Jan 11 03:15:29 2016
@@ -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)

Modified: roller/trunk/app/src/main/resources/sql/macros.vm
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/resources/sql/macros.vm?rev=1723976&r1=1723975&r2=1723976&view=diff
==============================================================================
--- roller/trunk/app/src/main/resources/sql/macros.vm (original)
+++ roller/trunk/app/src/main/resources/sql/macros.vm Mon Jan 11 03:15:29 2016
@@ -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

Modified: roller/trunk/app/src/main/resources/sql/mssql.properties
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/resources/sql/mssql.properties?rev=1723976&r1=1723975&r2=1723976&view=diff
==============================================================================
--- roller/trunk/app/src/main/resources/sql/mssql.properties (original)
+++ roller/trunk/app/src/main/resources/sql/mssql.properties Mon Jan 11 03:15:29 2016
@@ -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