Fix a bug in HashSegmentIteration.forEachTierWhile()

This commit is contained in:
leventov
2015-11-29 01:52:57 +03:00
parent 2d7e25985a
commit a0c982374d
4 changed files with 62 additions and 13 deletions
@@ -35,19 +35,23 @@ public class OverflowAllocationDuringIterationTest {
map.put(i, x);
}
for (int i = 0; i < 3; i++) {
final String currentX = x;
map.forEachEntry(e -> {
String v = e.value().get().toString();
if (!currentX.contentEquals(v)) {
throw new AssertionError(currentX + " != " + v + "<=" + e.key());
}
e.doReplaceValue(e.context().wrapValueAsData(v + v));
});
x = x + x;
for (int j = 0; j < entries; j++) {
if (map.get(j) == null || !x.contentEquals(map.get(j))) {
throw new AssertionError();
try {
final String currentX = x;
map.forEachEntry(e -> {
String v = e.value().get().toString();
if (!currentX.contentEquals(v)) {
throw new AssertionError(currentX + " != " + v + "<=" + e.key());
}
e.doReplaceValue(e.context().wrapValueAsData(v + v));
});
x = x + x;
for (int j = 0; j < entries; j++) {
if (map.get(j) == null || !x.contentEquals(map.get(j))) {
throw new AssertionError();
}
}
} finally {
((VanillaChronicleMap) map).verifyTierCountersAreaData();
}
}
}