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_r280014102
##########
File path:
server/src/main/java/org/apache/druid/server/coordinator/CuratorLoadQueuePeon.java
##########
@@ -219,199 +220,182 @@ public void unmarkSegmentToDrop(DataSegment
dataSegment)
segmentsMarkedToDrop.remove(dataSegment);
}
- private void processSegmentChangeRequest()
+ private class SegmentChangeProcessor implements Runnable
{
- if (currentlyProcessing != null) {
- log.debug(
- "Server[%s] skipping processSegmentChangeRequest because something
is currently loading[%s].",
- basePath,
- currentlyProcessing.getSegmentId()
- );
+ private final SegmentHolder segmentHolder;
- return;
- }
-
- if (!segmentsToDrop.isEmpty()) {
- currentlyProcessing = segmentsToDrop.firstEntry().getValue();
- log.debug("Server[%s] dropping [%s]", basePath,
currentlyProcessing.getSegmentId());
- } else if (!segmentsToLoad.isEmpty()) {
- currentlyProcessing = segmentsToLoad.firstEntry().getValue();
- log.debug("Server[%s] loading [%s]", basePath,
currentlyProcessing.getSegmentId());
- } else {
- return;
+ private SegmentChangeProcessor(SegmentHolder segmentHolder)
+ {
+ this.segmentHolder = segmentHolder;
}
- try {
- final String path = ZKPaths.makePath(basePath,
currentlyProcessing.getSegmentId().toString());
- final byte[] payload =
jsonMapper.writeValueAsBytes(currentlyProcessing.getChangeRequest());
- curator.create().withMode(CreateMode.EPHEMERAL).forPath(path, payload);
-
- processingExecutor.schedule(
- () -> {
- try {
- if (curator.checkExists().forPath(path) != null) {
- failAssign(new ISE("%s was never removed! Failing this
operation!", path));
+ @Override
+ public void run()
+ {
+ try {
+ final String path = ZKPaths.makePath(basePath,
segmentHolder.getSegmentIdentifier());
+ final byte[] payload =
jsonMapper.writeValueAsBytes(segmentHolder.getChangeRequest());
+ curator.create().withMode(CreateMode.EPHEMERAL).forPath(path, payload);
+ log.debug(
+ "ZKNode created for server to [%s] %s [%s]",
+ basePath,
+ segmentHolder.getType() == LOAD ? "load" : "drop",
+ segmentHolder.getSegmentIdentifier()
+ );
+ final ScheduledFuture<?> future = monitorNodeRemovedExecutor.schedule(
+ () -> {
+ try {
+ if (curator.checkExists().forPath(path) != null) {
+ failAssign(segmentHolder, new ISE("%s was never removed!
Failing this operation!", path));
Review comment:
I mistook my change of removing monitorNodeRemovedExecutor as the reason
behind integration tests failing. Turned out it wasn't the case. Removed the
pool for good.
----------------------------------------------------------------
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]