Skip to content

Commit

Permalink
stranded range query was too limiting, f.e. didn't work when only OK
Browse files Browse the repository at this point in the history
batches and got range of 55 to 54 instead of 55 to 55
  • Loading branch information
erilong committed Mar 24, 2018
1 parent 6dc4022 commit 21307b2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
Expand Up @@ -205,8 +205,7 @@ private long purgeStranded(final Calendar time) {
int maxNumOfDataEventsToPurgeInTx = parameterService
.getInt(ParameterConstants.PURGE_MAX_NUMBER_OF_EVENT_BATCH_IDS);
long minGapStartId = sqlTemplate.queryForLong(getSql("minDataGapStartId"));
long[] minMaxEvent = queryForMinMax(getSql("selectStrandedDataEventRangeSql"), new Object[] { time.getTime(),
OutgoingBatch.Status.OK.name() });
long[] minMaxEvent = queryForMinMax(getSql("selectStrandedDataEventRangeSql"), new Object[] { time.getTime() });
int strandedEventDeletedCount = purgeByMinMax(minMaxEvent, minGapStartId, MinMaxDeleteSql.STRANDED_DATA_EVENT,
time.getTime(), maxNumOfDataEventsToPurgeInTx);
statisticManager.incrementPurgedDataEventRows(strandedEventDeletedCount);
Expand Down
Expand Up @@ -115,9 +115,9 @@ public PurgeServiceSqlMap(IDatabasePlatform platform, Map<String, String> replac
putSql("deleteExtractRequestByCreateTimeSql", "delete from $(extract_request) where create_time < ?");

putSql("selectStrandedDataEventRangeSql" ,
"select min(batch_id) as min_id, max(batch_id) as max_id from $(data_event) " +
"select min(batch_id) as min_id, max(batch_id)+1 as max_id from $(data_event) " +
"where create_time < ? " +
"and batch_id < (select min(batch_id) from $(outgoing_batch) where status != ?)");
"and batch_id < (select min(batch_id) from $(outgoing_batch))");

putSql("deleteStrandedDataEvent",
"delete from $(data_event) " +
Expand Down

0 comments on commit 21307b2

Please sign in to comment.