Skip to content

Commit

Permalink
SYMMETRICDS-562 - Fix DataService bug. Max data id that is currently …
Browse files Browse the repository at this point in the history
…handled in 2.x is Integer.MAX_VALUE. It should go all the way up to Long.MAX_VALUE
  • Loading branch information
chenson42 committed Dec 5, 2011
1 parent 26fd252 commit 090c98e
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 17 deletions.
Expand Up @@ -73,7 +73,7 @@ public void afterRouting() {
long ts = System.currentTimeMillis();
final int dataIdIncrementBy = parameterService.getInt(ParameterConstants.DATA_ID_INCREMENT_BY);
long lastDataId = (Long) jdbcTemplate.query(sqlProvider.getSql("selectDistinctDataIdFromDataEventSql"),
new Object[] { ref.getRefDataId() }, new int[] { Types.INTEGER },
new Object[] { ref.getRefDataId() }, new int[] { Types.NUMERIC },
new ResultSetExtractor<Long>() {
public Long extractData(ResultSet rs) throws SQLException, DataAccessException {
long lastDataId = ref.getRefDataId();
Expand Down
Expand Up @@ -251,7 +251,7 @@ public void insertDataEvent(JdbcTemplate template, long dataId, long batchId, St
try {
template.update(getSql("insertIntoDataEventSql"), new Object[] { dataId, batchId,
StringUtils.isBlank(routerId) ? Constants.UNKNOWN_ROUTER_ID : routerId },
new int[] { Types.INTEGER, Types.INTEGER, Types.VARCHAR });
new int[] { Types.NUMERIC, Types.NUMERIC, Types.VARCHAR });
} catch (RuntimeException ex) {
log.error("DataEventInsertFailed", ex, dataId, batchId, routerId);
throw ex;
Expand Down Expand Up @@ -618,30 +618,30 @@ public long findMaxDataEventDataId() {
public void insertDataGap(DataGap gap) {
jdbcTemplate.update(getSql("insertDataGapSql"), new Object[] { DataGap.Status.GP.name(),
AppUtils.getHostName(), gap.getStartId(), gap.getEndId() }, new int[] {
Types.VARCHAR, Types.VARCHAR, Types.INTEGER, Types.INTEGER });
Types.VARCHAR, Types.VARCHAR, Types.NUMERIC, Types.NUMERIC });
}

public void updateDataGap(DataGap gap, DataGap.Status status) {
jdbcTemplate.update(
getSql("updateDataGapSql"),
new Object[] { status.name(), AppUtils.getHostName(), gap.getStartId(),
gap.getEndId() }, new int[] { Types.VARCHAR, Types.VARCHAR, Types.INTEGER,
Types.INTEGER });
gap.getEndId() }, new int[] { Types.VARCHAR, Types.VARCHAR, Types.NUMERIC,
Types.NUMERIC });
}

public void saveDataRef(DataRef dataRef) {
if (0 >= jdbcTemplate.update(getSql("updateDataRefSql"), new Object[] {
dataRef.getRefDataId(), dataRef.getRefTime() }, new int[] { Types.INTEGER,
dataRef.getRefDataId(), dataRef.getRefTime() }, new int[] { Types.NUMERIC,
Types.TIMESTAMP })) {
jdbcTemplate.update(getSql("insertDataRefSql"), new Object[] { dataRef.getRefDataId(),
dataRef.getRefTime() }, new int[] { Types.INTEGER, Types.TIMESTAMP });
dataRef.getRefTime() }, new int[] { Types.NUMERIC, Types.TIMESTAMP });
}
}

public Date findCreateTimeOfEvent(long dataId) {
try {
return (Date) jdbcTemplate.queryForObject(getSql("findDataEventCreateTimeSql"),
new Object[] { dataId }, new int[] { Types.INTEGER }, Date.class);
new Object[] { dataId }, new int[] { Types.NUMERIC }, Date.class);
} catch (EmptyResultDataAccessException ex) {
return null;
}
Expand All @@ -650,7 +650,7 @@ public Date findCreateTimeOfEvent(long dataId) {
public Date findCreateTimeOfData(long dataId) {
try {
return (Date) jdbcTemplate.queryForObject(getSql("findDataCreateTimeSql"),
new Object[] { dataId }, new int[] { Types.INTEGER }, Date.class);
new Object[] { dataId }, new int[] { Types.NUMERIC }, Date.class);
} catch (EmptyResultDataAccessException ex) {
return null;
}
Expand Down
Expand Up @@ -112,13 +112,13 @@ public void updateOutgoingBatch(OutgoingBatch outgoingBatch) {
outgoingBatch.getFailedDataId(),
outgoingBatch.getLastUpdatedHostName(),
outgoingBatch.getLastUpdatedTime(), outgoingBatch.getBatchId() },
new int[] { Types.CHAR, Types.INTEGER, Types.INTEGER, Types.BIGINT,
new int[] { Types.CHAR, Types.NUMERIC, Types.NUMERIC, Types.BIGINT,
Types.BIGINT, Types.BIGINT, Types.BIGINT, Types.BIGINT,
Types.BIGINT, Types.BIGINT, Types.BIGINT, Types.BIGINT,
Types.BIGINT, Types.BIGINT, Types.BIGINT, Types.BIGINT,
Types.BIGINT, Types.BIGINT, Types.VARCHAR, Types.INTEGER,
Types.BIGINT, Types.BIGINT, Types.VARCHAR, Types.NUMERIC,
Types.VARCHAR, Types.BIGINT, Types.VARCHAR, Types.TIMESTAMP,
Types.INTEGER });
Types.NUMERIC });
}

public void insertOutgoingBatch(final OutgoingBatch outgoingBatch) {
Expand All @@ -144,7 +144,7 @@ public Object doInPreparedStatement(PreparedStatement ps) throws SQLException,
public OutgoingBatch findOutgoingBatch(long batchId) {
List<OutgoingBatch> list = (List<OutgoingBatch>) jdbcTemplate.query(
getSql("selectOutgoingBatchPrefixSql", "findOutgoingBatchSql"),
new Object[] { batchId }, new int[] { Types.INTEGER }, new OutgoingBatchMapper());
new Object[] { batchId }, new int[] { Types.NUMERIC }, new OutgoingBatchMapper());
if (list != null && list.size() > 0) {
return list.get(0);
} else {
Expand Down
Expand Up @@ -211,8 +211,8 @@ private int purgeByMinMax(long[] minMax, String deleteSql, Date retentionTime, i

MapSqlParameterSource parameterSource = new MapSqlParameterSource();
parameterSource.registerSqlType(PARAM_CUTOFF_TIME, Types.TIMESTAMP);
parameterSource.registerSqlType(PARAM_MIN, Types.INTEGER);
parameterSource.registerSqlType(PARAM_MAX, Types.INTEGER);
parameterSource.registerSqlType(PARAM_MIN, Types.NUMERIC);
parameterSource.registerSqlType(PARAM_MAX, Types.NUMERIC);
parameterSource.addValue(PARAM_CUTOFF_TIME, new Timestamp(retentionTime.getTime()));

while (minId <= purgeUpToId) {
Expand Down
Expand Up @@ -587,15 +587,15 @@ public void saveTriggerRouter(TriggerRouter triggerRouter, boolean updateTrigger
triggerRouter.getLastUpdateTime(),
triggerRouter.getTrigger().getTriggerId(),
triggerRouter.getRouter().getRouterId() },
new int[] { Types.INTEGER, Types.VARCHAR, Types.SMALLINT, Types.VARCHAR, Types.TIMESTAMP,
new int[] { Types.NUMERIC, Types.VARCHAR, Types.SMALLINT, Types.VARCHAR, Types.TIMESTAMP,
Types.VARCHAR, Types.VARCHAR })) {
triggerRouter.setCreateTime(triggerRouter.getLastUpdateTime());
jdbcTemplate.update(getSql("insertTriggerRouterSql"), new Object[] {
triggerRouter.getInitialLoadOrder(), triggerRouter.getInitialLoadSelect(),
triggerRouter.isPingBackEnabled() ? 1 : 0,
triggerRouter.getCreateTime(), triggerRouter.getLastUpdateBy(),
triggerRouter.getLastUpdateTime(), triggerRouter.getTrigger().getTriggerId(),
triggerRouter.getRouter().getRouterId() }, new int[] { Types.INTEGER,
triggerRouter.getRouter().getRouterId() }, new int[] { Types.NUMERIC,
Types.VARCHAR, Types.SMALLINT, Types.TIMESTAMP, Types.VARCHAR, Types.TIMESTAMP, Types.VARCHAR,
Types.VARCHAR });
}
Expand Down

0 comments on commit 090c98e

Please sign in to comment.