NIFI-8299: Because we now iterate over stored events in an unordered map, we need to update maxEventId to Math.max( <current value>, <next value> ) instead of just assigning the next value.

Signed-off-by: Pierre Villard <pierre.villard.fr@gmail.com>

This closes #4873.
This commit is contained in:
Mark Payne 2021-03-08 15:02:42 -05:00 committed by Pierre Villard
parent 98ab42aebc
commit dc94ef568a
No known key found for this signature in database
GPG Key ID: F92A93B30C07C6D5

View File

@ -329,7 +329,7 @@ public class WriteAheadStorePartition implements EventStorePartition {
final StorageSummary summaryWithIndex = new StorageSummary(writerSummary.getEventId(), writerSummary.getStorageLocation(), this.partitionName,
writerSummary.getBlockIndex(), writerSummary.getSerializedLength(), writerSummary.getBytesWritten());
locationMap.put(eventRecord, summaryWithIndex);
maxId = summaryWithIndex.getEventId();
maxId = Math.max(maxId, summaryWithIndex.getEventId());
numEvents++;
}