Fix problem with lost entries

This commit is contained in:
Per Minborg
2021-08-16 17:08:11 +02:00
parent 9345b8129b
commit a223d3acbd
2 changed files with 9 additions and 2 deletions
@@ -38,8 +38,6 @@ import net.openhft.chronicle.values.Values;
import net.openhft.chronicle.wire.WireIn;
import net.openhft.chronicle.wire.WireOut;
import org.jetbrains.annotations.NotNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.util.ArrayList;
@@ -23,6 +23,7 @@ import net.openhft.chronicle.hash.replication.ReplicableEntry;
import net.openhft.chronicle.map.MapAbsentEntry;
import net.openhft.chronicle.map.MapSegmentContext;
import net.openhft.chronicle.map.ReplicatedChronicleMap;
import net.openhft.chronicle.map.impl.CompiledReplicatedMapQueryContext;
import net.openhft.chronicle.map.impl.IterationContext;
import net.openhft.chronicle.map.impl.ReplicatedChronicleMapHolder;
import net.openhft.sg.StageRef;
@@ -73,6 +74,14 @@ public class ReplicatedQueryAlloc extends QueryAlloc {
long firstAttemptedTierIndex = s.tierIndex;
long firstAttemptedTierBaseAddr = s.tierBaseAddr;
boolean cleanedFirstAttemptedTier = forcedOldDeletedEntriesCleanup(prevPos);
if (cleanedFirstAttemptedTier) {
// Force recalculation of some properties as new slots may
// have become available and there might be "holes"
// created by removed entries.
((CompiledReplicatedMapQueryContext) (Object) this).closeSearchKey();
}
s.goToFirstTier();
while (true) {
boolean visitingFirstAttemptedTier = s.tier == firstAttemptedTier;