samarthjain commented on a change in pull request #7088: Improve parallelism of
zookeeper based segment change processing
URL: https://github.com/apache/incubator-druid/pull/7088#discussion_r279482955
##########
File path:
server/src/main/java/org/apache/druid/server/coordinator/CuratorLoadQueuePeon.java
##########
@@ -152,29 +176,18 @@ public int getNumberOfSegmentsInQueue()
@Override
public void loadSegment(final DataSegment segment, final LoadPeonCallback
callback)
{
- synchronized (lock) {
- if ((currentlyProcessing != null) &&
- currentlyProcessing.getSegmentId().equals(segment.getId())) {
- if (callback != null) {
- currentlyProcessing.addCallback(callback);
- }
- return;
- }
- }
+ SegmentHolder segmentHolder = new SegmentHolder(segment, LOAD,
Collections.singletonList(callback));
Review comment:
I actually like the way this code reads.
If I end up passing a null element in the singleton list, then downstream
code like this
`List<LoadPeonCallback> snapshotCallbacks()
{
synchronized (callbacks) {
// Return an immutable copy so that callers don't have to worry
about concurrent modification
return ImmutableList.copyOf(callbacks);
}
}`
would break. It is not worth the change, IMHO.
----------------------------------------------------------------
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]