suneet-s commented on a change in pull request #9441: Improve
OvershadowableManager performance
URL: https://github.com/apache/druid/pull/9441#discussion_r389944874
##########
File path:
core/src/main/java/org/apache/druid/timeline/partition/OvershadowableManager.java
##########
@@ -105,12 +105,46 @@
this.overshadowedGroups = new TreeMap<>();
}
- OvershadowableManager(OvershadowableManager<T> other)
+ public OvershadowableManager<T> copyVisible()
{
- this.knownPartitionChunks = new HashMap<>(other.knownPartitionChunks);
- this.standbyGroups = new TreeMap<>(other.standbyGroups);
- this.visibleGroupPerRange = new TreeMap<>(other.visibleGroupPerRange);
- this.overshadowedGroups = new TreeMap<>(other.overshadowedGroups);
+ final OvershadowableManager<T> copy = new OvershadowableManager<>();
+ visibleGroupPerRange.forEach((partitionRange, versionToGroups) -> {
+ // There should be only one group per partition range
+ final AtomicUpdateGroup<T> group =
versionToGroups.values().iterator().next();
+ group.getChunks().forEach(chunk ->
copy.knownPartitionChunks.put(chunk.getChunkNumber(), chunk));
+
+ copy.visibleGroupPerRange.put(
+ partitionRange,
+ new SingleEntryShort2ObjectSortedMap<>(group.getMinorVersion(),
AtomicUpdateGroup.copy(group))
+ );
+ });
+ return copy;
+ }
+
+ public OvershadowableManager<T> deepCopy()
Review comment:
should this override `public OvershadowableManager<T> clone()` instead?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]