yihua commented on code in PR #18408:
URL: https://github.com/apache/hudi/pull/18408#discussion_r3048801346
##########
hudi-common/src/main/java/org/apache/hudi/common/table/timeline/versioning/v1/ArchivedTimelineV1.java:
##########
@@ -320,8 +320,10 @@ private InstantsLoader(boolean loadInstantDetails) {
public void accept(String instantTime, GenericRecord record) {
Option<HoodieInstant> instant = readCommit(instantTime, record,
loadInstantDetails, null);
if (instant.isPresent()) {
- instantsInRange.computeIfAbsent(instant.get().requestedTime(), s ->
new ArrayList<>())
- .add(instant.get());
+ List<HoodieInstant> instantsForTime =
instantsInRange.computeIfAbsent(instant.get().requestedTime(), s -> new
ArrayList<>());
+ if (!instantsForTime.contains(instant.get())) {
+ instantsForTime.add(instant.get());
Review Comment:
🤖 Since both call sites (`loadInstants` and `loadAndCacheInstantsWithLimit`)
already call `.sorted()` after flattening the values, ordering within each
bucket doesn't matter. `ConcurrentHashMap.newKeySet()` gives O(1) add/contains
and is also thread-safe for concurrent `accept()` calls, which `TreeSet` would
not be without external synchronization. I think the current choice is
appropriate.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]