Skip to content
This repository has been archived by the owner on Apr 4, 2021. It is now read-only.

Commit

Permalink
FALCON-298. Feed update with replication delay creates holes
Browse files Browse the repository at this point in the history
  • Loading branch information
sandeepSamudrala committed Jul 25, 2016
1 parent 3ed804e commit 9e68a57
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
12 changes: 12 additions & 0 deletions common/src/main/java/org/apache/falcon/entity/EntityUtil.java
Expand Up @@ -462,6 +462,18 @@ public static Date getNextInstanceTime(Date instanceTime, Frequency frequency, T
return insCal.getTime();
}

public static Date getNextInstanceTimeWithDelay(Date instanceTime, Frequency delay, TimeZone tz) {
if (tz == null) {
tz = TimeZone.getTimeZone("UTC");
}
Calendar insCal = Calendar.getInstance(tz);
insCal.setTime(instanceTime);
final int delayAmount = delay.getFrequencyAsInt();
insCal.add(delay.getTimeUnit().getCalendarUnit(), delayAmount);

return insCal.getTime();
}

public static String md5(Entity entity) throws FalconException {
return new String(Hex.encodeHex(DigestUtils.md5(stringOf(entity))));
}
Expand Down
Expand Up @@ -1393,7 +1393,7 @@ private void updateCoords(String cluster, BundleJob bundle,

//calculate next start time based on delay.
endTime = (delay == null) ? endTime
: EntityUtil.getNextStartTime(coord.getStartTime(), delay, EntityUtil.getTimeZone(entity), endTime);
: EntityUtil.getNextInstanceTimeWithDelay(endTime, delay, EntityUtil.getTimeZone(entity));
LOG.debug("Updating endtime of coord {} to {} on cluster {}",
coord.getId(), SchemaHelper.formatDateUTC(endTime), cluster);

Expand Down

0 comments on commit 9e68a57

Please sign in to comment.