[ https://issues.apache.org/jira/browse/KAFKA-15271?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Ismael Juma resolved KAFKA-15271. --------------------------------- Resolution: Fixed > Historicalterator can exposes elements that are too new > ------------------------------------------------------- > > Key: KAFKA-15271 > URL: https://issues.apache.org/jira/browse/KAFKA-15271 > Project: Kafka > Issue Type: Bug > Reporter: David Jacot > Assignee: Colin McCabe > Priority: Major > > Example: > {code:java} > @Test > public void bug() { > SnapshotRegistry snapshotRegistry = new SnapshotRegistry(new > LogContext()); > // Topic -> Partition -> Offset > TimelineHashMap<String, TimelineHashMap<Integer, Long>> offsets = > new TimelineHashMap<>(snapshotRegistry, 0); > snapshotRegistry.getOrCreateSnapshot(0); > offsets > .computeIfAbsent("foo", __ -> new > TimelineHashMap<>(snapshotRegistry, 0)) > .put(0, 100L); > snapshotRegistry.getOrCreateSnapshot(1); > offsets > .computeIfAbsent("foo", __ -> new > TimelineHashMap<>(snapshotRegistry, 0)) > .put(1, 110L); > snapshotRegistry.getOrCreateSnapshot(2); > offsets > .computeIfAbsent("foo", __ -> new > TimelineHashMap<>(snapshotRegistry, 0)) > .put(1, 111L); > assertNull(offsets.get("foo", 1).get(1, 1)); > offsets.entrySet(1).forEach(topicEntry -> { > System.out.println(topicEntry.getKey()); > topicEntry.getValue().entrySet(1).forEach(partitionEntry -> { > System.out.println(partitionEntry.getKey() + " : " + > partitionEntry.getValue()); > }); > }); > /* > The above code prints: > foo > 0 : 100 > 1 : 110 > but should rather print: > foo > 0 : 100 > */ > } {code} > It yields the expected result when the third put is removed. `get(key, > epoch)` is always correct as well. It seems that `entrySet` has an issue. -- This message was sent by Atlassian Jira (v8.20.10#820010)