Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,15 @@ public void normaliseShouldResumeFromPreviousNormalisation() {
excerptAppender.normaliseEOFs();
}
final Pattern logPattern = Pattern.compile("Normalising from cycle (\\d+)");
// Note a defensive copy of exceptionMap is used as this code has yielded concurrent modification exceptions leading to flakiness under load
final List<Integer> startIndices = new LinkedHashMap<>(exceptionMap).keySet().stream()
.map(exceptionKey -> logPattern.matcher(exceptionKey.message))
.filter(Matcher::matches)
.map(matcher -> Integer.parseInt(matcher.group(1)))
.collect(Collectors.toList());
// Note: lock the exceptionMap to avoid a concurrent modification exceptions leading to flakiness under load
final List<Integer> startIndices;
synchronized (exceptionMap) {
startIndices = exceptionMap.keySet().stream()
.map(exceptionKey -> logPattern.matcher(exceptionKey.message))
.filter(Matcher::matches)
.map(matcher -> Integer.parseInt(matcher.group(1)))
.collect(Collectors.toList());
}

// There is at least 5 calls to normaliseEOF and the start index increases each time
assertTrue(startIndices.size() >= 5);
Expand Down