in src/com/amazon/kinesis/streaming/agent/tailing/TrackedFileRotationAnalyzer.java [215:248]
public Map<TrackedFile, String> getIncomingAnomalies() {
if(incomingAnomalies == null) {
incomingAnomalies = new LinkedHashMap<>();
// For any matched files after the first one (to guard against Truncate rotation),
// the order, timestamp and size should remain the same.
int previousCounterpartIndex = -1;
List<String> otherAnomalies = new ArrayList<>();
boolean foundFirstMatch = false;
for(int i = 1; i < incoming.size(); ++i) {
otherAnomalies.clear();
TrackedFile f = incoming.get(i);
if(hasCounterpart(f)) {
int counterpartIndex = getCounterpartIndex(f);
if(foundFirstMatch) {
TrackedFile counterpart = getCounterpart(f);
if(counterpart.getSize() != f.getSize())
otherAnomalies.add("size changed from " + counterpart.getSize() + " to " + f.getSize());
if(counterpart.getLastModifiedTime() != f.getLastModifiedTime())
otherAnomalies.add("last modified time changed from " + counterpart.getLastModifiedTime() + " to " + f.getLastModifiedTime());
if(previousCounterpartIndex >= 0) {
if(counterpartIndex < previousCounterpartIndex)
otherAnomalies.add("file relative position changed (expected to be after position " + previousCounterpartIndex + ")");
}
} else {
foundFirstMatch = true;
}
previousCounterpartIndex = counterpartIndex;
}
if(!otherAnomalies.isEmpty())
incomingAnomalies.put(f, Joiner.on("; ").join(otherAnomalies));
}
}
return incomingAnomalies;
}