Author: boisvert
Date: Sat Nov 15 05:53:06 2008
New Revision: 714259
URL: http://svn.apache.org/viewvc?rev=714259&view=rev
Log:
ODE-425: SimpleScheduler recovery is O(n) with respect to outstanding jobs
Modified:
ode/branches/APACHE_ODE_1.X/scheduler-simple/src/main/java/org/apache/ode/scheduler/simple/JdbcDelegate.java
Modified:
ode/branches/APACHE_ODE_1.X/scheduler-simple/src/main/java/org/apache/ode/scheduler/simple/JdbcDelegate.java
URL:
http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/scheduler-simple/src/main/java/org/apache/ode/scheduler/simple/JdbcDelegate.java?rev=714259&r1=714258&r2=714259&view=diff
==============================================================================
---
ode/branches/APACHE_ODE_1.X/scheduler-simple/src/main/java/org/apache/ode/scheduler/simple/JdbcDelegate.java
(original)
+++
ode/branches/APACHE_ODE_1.X/scheduler-simple/src/main/java/org/apache/ode/scheduler/simple/JdbcDelegate.java
Sat Nov 15 05:53:06 2008
@@ -51,10 +51,10 @@
private static final String UPDATE_REASSIGN = "update ODE_JOB set nodeid =
?, scheduled = 0 where nodeid = ?";
- private static final String UPGRADE_JOB_DEFAULT = "update ODE_JOB set
nodeid = ? where nodeid is null and scheduled = 0 "
+ private static final String UPGRADE_JOB_DEFAULT = "update ODE_JOB set
nodeid = ? where nodeid is null "
+ "and mod(ts,?) = ? and ts < ?";
- private static final String UPGRADE_JOB_SQLSERVER = "update ODE_JOB set
nodeid = ? where nodeid is null and scheduled = 0 "
+ private static final String UPGRADE_JOB_SQLSERVER = "update ODE_JOB set
nodeid = ? where nodeid is null "
+ "and (ts % ?) = ? and ts < ?";
private static final String SAVE_JOB = "insert into ODE_JOB "
@@ -63,7 +63,7 @@
private static final String GET_NODEIDS = "select distinct nodeid from
ODE_JOB";
private static final String SCHEDULE_IMMEDIATE = "select jobid, ts,
transacted, scheduled, details from ODE_JOB "
- + "where nodeid = ? and scheduled = 0 and ts < ? order by ts";
+ + "where nodeid = ? and ts < ? order by ts";
private static final String UPDATE_SCHEDULED = "update ODE_JOB set
scheduled = 1 where jobid in (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
@@ -179,24 +179,6 @@
}
rs.close();
ps.close();
-
- // mark jobs as scheduled, UPDATE_SCHEDULED_SLOTS at a time
- int j = 0;
- int updateCount = 0;
- ps = con.prepareStatement(UPDATE_SCHEDULED);
- for (int updates = 1; updates <= (ret.size() /
UPDATE_SCHEDULED_SLOTS) + 1; updates++) {
- for (int i = 1; i <= UPDATE_SCHEDULED_SLOTS; i++) {
- ps.setString(i, j < ret.size() ? ret.get(j).jobId : "");
- j++;
- }
- ps.execute();
- updateCount += ps.getUpdateCount();
- }
- if (updateCount != ret.size()) {
- throw new DatabaseException(
- "Updating scheduled jobs failed to update all jobs;
expected=" + ret.size()
- + " actual=" + updateCount);
- }
} catch (SQLException se) {
throw new DatabaseException(se);
} finally {