Skip to content

Commit

Permalink
0002479: Data gaps expire immediately, data is never routed
Browse files Browse the repository at this point in the history
  • Loading branch information
erilong committed Jan 15, 2016
1 parent 552fcab commit c1ff3d7
Showing 1 changed file with 5 additions and 7 deletions.
Expand Up @@ -165,7 +165,7 @@ public void beforeRouting() {
if (symmetricDialect.supportsTransactionViews()) {
long transactionViewClockSyncThresholdInMs = parameterService.getLong(
ParameterConstants.DBDIALECT_ORACLE_TRANSACTION_VIEW_CLOCK_SYNC_THRESHOLD_MS, 60000);
Date createTime = dataService.findCreateTimeOfData(dataGap.getEndId() + 1);
Date createTime = dataGap.getCreateTime();
if (createTime != null
&& !symmetricDialect.areDatabaseTransactionsPendingSince(createTime.getTime()
+ transactionViewClockSyncThresholdInMs)) {
Expand All @@ -184,7 +184,7 @@ public void beforeRouting() {
gapsDeleted++;
}
}
} else if (isDataGapExpired(dataGap.getEndId() + 1, databaseTime)) {
} else if (isDataGapExpired(dataGap, databaseTime)) {
if (dataGap.getStartId() == dataGap.getEndId()) {
log.info("Found a gap in data_id at {}. Skipping it because the gap expired", dataGap.getStartId());
} else {
Expand Down Expand Up @@ -244,13 +244,11 @@ public void beforeRouting() {

}

protected boolean isDataGapExpired(long dataId, long databaseTime) {
protected boolean isDataGapExpired(DataGap dataGap, long databaseTime) {
long gapTimoutInMs = parameterService
.getLong(ParameterConstants.ROUTING_STALE_DATA_ID_GAP_TIME);
Date createTime = dataService.findCreateTimeOfData(dataId);
if (createTime == null) {
createTime = dataService.findNextCreateTimeOfDataStartingAt(dataId);
}

Date createTime = dataGap.getCreateTime();
if (createTime != null && databaseTime - createTime.getTime() > gapTimoutInMs) {
return true;
} else {
Expand Down

0 comments on commit c1ff3d7

Please sign in to comment.