Skip to content

Commit

Permalink
0003559: Log expiration of data gaps at info level
Browse files Browse the repository at this point in the history
  • Loading branch information
mmichalek committed Jun 1, 2018
1 parent b017650 commit 926c1a6
Showing 1 changed file with 46 additions and 10 deletions.
Expand Up @@ -192,7 +192,9 @@ public void afterRouting() {
} else if (lastBusyExpireRunTime != 0) {
setLastBusyExpireRunTime(0);
}


List<DataGap> skippedDataGaps = new ArrayList<>();

try {
long ts = System.currentTimeMillis();
long lastDataId = -1;
Expand Down Expand Up @@ -237,14 +239,7 @@ public void afterRouting() {
expireChecked++;
}
if (isAllDataRead || isGapEmpty) {
if (dataGap.getStartId() == dataGap.getEndId()) {
log.info("Found a gap in data_id at {}. Skipping it because " +
(supportsTransactionViews ? "there are no pending transactions" : "the gap expired"), dataGap.getStartId());
} else {
log.info("Found a gap in data_id from {} to {}. Skipping it because " +
(supportsTransactionViews ? "there are no pending transactions" : "the gap expired"),
dataGap.getStartId(), dataGap.getEndId());
}
skippedDataGaps.add(dataGap);
gapsDeleted.add(dataGap);
gapsAll.remove(dataGap);
}
Expand Down Expand Up @@ -299,6 +294,8 @@ public void afterRouting() {
} catch (RuntimeException ex) {
processInfo.setStatus(ProcessStatus.ERROR);
throw ex;
} finally {
logSkippedDataGaps(skippedDataGaps);
}
}

Expand Down Expand Up @@ -529,7 +526,46 @@ protected void fixOverlappingGaps(List<DataGap> gapsToCheck, ProcessInfo process
throw ex;
}
}


protected void logSkippedDataGaps(List<DataGap> skippedDataGaps) {
if (skippedDataGaps.isEmpty()) {
return;
}

if (log.isDebugEnabled()) {
for (DataGap dataGap : skippedDataGaps) {
if (dataGap.getStartId() == dataGap.getEndId()) {
log.debug("Expired data gap at data_id {} create_time {}. Skipping it because " +
(supportsTransactionViews ? "there are no pending transactions" : "the gap expired"), dataGap.getStartId(), dataGap.getCreateTime());
} else {
log.debug("Expired data gap between data_id {} and {} create_time {}. Skipping it because " +
(supportsTransactionViews ? "there are no pending transactions" : "the gap expired"),
dataGap.getStartId(), dataGap.getEndId(), dataGap.getCreateTime());
}
}
return;
}

Date minDate = skippedDataGaps.get(0).getCreateTime();
Date maxDate = skippedDataGaps.get(0).getCreateTime();
long minDataId = skippedDataGaps.get(0).getStartId();
long maxDataId = skippedDataGaps.get(0).getEndId();

for (DataGap dataGap : skippedDataGaps) {
if (dataGap.getCreateTime().before(minDate)) {
minDate = dataGap.getCreateTime();
}
if (dataGap.getCreateTime().after(maxDate)) {
maxDate = dataGap.getCreateTime();
}
minDataId = Math.min(minDataId, dataGap.getStartId());
maxDataId = Math.min(maxDataId, dataGap.getEndId());
}

log.info("Expired {} data gap(s) between data_id {} and {} and between create_time {} and {}",
skippedDataGaps.size(), minDataId, maxDataId, minDate, maxDate);

}

public Long mapRow(Row row) {
return row.getLong("data_id");
Expand Down

0 comments on commit 926c1a6

Please sign in to comment.