-
Couldn't load subscription status.
- Fork 0
SOLR-17877: Move distributedCollectionCommandRunner from CoreContainer to ZkController #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
2818ad1
0b21071
1e5d216
4bf80ab
1d31b1b
befe22b
c5bf0b3
af0871b
e7430f2
07b5495
24fad22
3a3e6b2
cfc9e5b
653165d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -45,7 +45,6 @@ | |
| import java.util.List; | ||
| import java.util.Locale; | ||
| import java.util.Map; | ||
| import java.util.Optional; | ||
| import java.util.Properties; | ||
| import java.util.Set; | ||
| import java.util.UUID; | ||
|
|
@@ -77,9 +76,7 @@ | |
| import org.apache.solr.client.solrj.util.SolrIdentifierValidator; | ||
| import org.apache.solr.cloud.CloudDescriptor; | ||
| import org.apache.solr.cloud.ClusterSingleton; | ||
| import org.apache.solr.cloud.OverseerTaskQueue; | ||
| import org.apache.solr.cloud.ZkController; | ||
| import org.apache.solr.cloud.api.collections.DistributedCollectionConfigSetCommandRunner; | ||
| import org.apache.solr.cluster.events.ClusterEventProducer; | ||
| import org.apache.solr.cluster.events.impl.ClusterEventProducerFactory; | ||
| import org.apache.solr.cluster.placement.PlacementPluginConfig; | ||
|
|
@@ -326,14 +323,6 @@ && getZkController().getOverseer() != null | |
| private ExecutorService coreContainerAsyncTaskExecutor = | ||
| ExecutorUtil.newMDCAwareCachedThreadPool("Core Container Async Task"); | ||
|
|
||
| /** | ||
| * Non-empty if the Collection API is executed in a distributed way and not on Overseer, once the | ||
| * CoreContainer has been initialized properly, i.e. method {@link #load()} called. Until then it | ||
| * is null, and it is not expected to be read. | ||
| */ | ||
| private volatile Optional<DistributedCollectionConfigSetCommandRunner> | ||
| distributedCollectionCommandRunner; | ||
|
|
||
| private enum CoreInitFailedAction { | ||
| fromleader, | ||
| none | ||
|
|
@@ -686,7 +675,6 @@ protected CoreContainer(Object testConstructor) { | |
| cfg = null; | ||
| containerProperties = null; | ||
| replayUpdatesExecutor = null; | ||
| distributedCollectionCommandRunner = Optional.empty(); | ||
| allowPaths = null; | ||
| allowListUrlChecker = null; | ||
| indexSearcherExecutor = null; | ||
|
|
@@ -900,19 +888,6 @@ private void loadInternal() { | |
| createHandler( | ||
| ZK_STATUS_PATH, ZookeeperStatusHandler.class.getName(), ZookeeperStatusHandler.class); | ||
|
|
||
| // CoreContainer is initialized enough at this stage so we can set | ||
| // distributedCollectionCommandRunner (the construction of | ||
| // DistributedCollectionConfigSetCommandRunner uses Zookeeper so can't be done from the | ||
| // CoreContainer constructor because there Zookeeper is not yet ready). Given this is used in | ||
| // the CollectionsHandler created next line, this is the latest point where | ||
| // distributedCollectionCommandRunner can be initialized without refactoring this method... | ||
| // TODO: manage to completely build CoreContainer in the constructor and not in the load() | ||
| // method... Requires some test refactoring. | ||
| this.distributedCollectionCommandRunner = | ||
| isZooKeeperAware() && cfg.getCloudConfig().getDistributedCollectionConfigSetExecution() | ||
| ? Optional.of(new DistributedCollectionConfigSetCommandRunner(this)) | ||
| : Optional.empty(); | ||
|
|
||
| collectionsHandler = | ||
| createHandler( | ||
| COLLECTIONS_HANDLER_PATH, cfg.getCollectionsHandlerClass(), CollectionsHandler.class); | ||
|
|
@@ -1246,9 +1221,7 @@ protected void configure() { | |
| throw new SolrException(ErrorCode.SERVER_ERROR, e); | ||
| } | ||
| } | ||
| if (!distributedCollectionCommandRunner.isPresent()) { | ||
| zkSys.getZkController().checkOverseerDesignate(); | ||
| } | ||
| zkSys.getZkController().checkOverseerDesignate(); | ||
| } | ||
|
|
||
| // This is a bit redundant but these are two distinct concepts for all they're accomplished at | ||
|
|
@@ -1318,14 +1291,7 @@ public void shutdown() { | |
|
|
||
| ZkController zkController = getZkController(); | ||
| if (zkController != null) { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @copilot This logic of waiting for pending tasks to complete should be moved to ZkController -- a new method maybe named There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added waitForPendingTasksToComplete() method to ZkController and updated CoreContainer.shutdown() to use it. This cleanly encapsulates the pending task logic within ZkController. (1d31b1b) |
||
| if (distributedCollectionCommandRunner.isPresent()) { | ||
| // Local (i.e. distributed) Collection API processing | ||
| distributedCollectionCommandRunner.get().stopAndWaitForPendingTasksToComplete(); | ||
| } else { | ||
| // Overseer based processing | ||
| OverseerTaskQueue overseerCollectionQueue = zkController.getOverseerCollectionQueue(); | ||
| overseerCollectionQueue.allowOverseerPendingTasksToComplete(); | ||
| } | ||
| zkController.waitForPendingTasksToComplete(); | ||
| } | ||
| if (log.isInfoEnabled()) { | ||
| log.info("Shutting down CoreContainer instance={}", System.identityHashCode(this)); | ||
|
|
@@ -2595,11 +2561,6 @@ public PlacementPluginFactory<? extends PlacementPluginConfig> getPlacementPlugi | |
| return placementPluginFactory; | ||
| } | ||
|
|
||
| public Optional<DistributedCollectionConfigSetCommandRunner> | ||
| getDistributedCollectionCommandRunner() { | ||
| return this.distributedCollectionCommandRunner; | ||
| } | ||
|
|
||
| /** | ||
| * A general-purpose HTTP/2 Solr client. | ||
| * | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot No need to do this here since
stopAndWaitForPendingTasksToCompleteis already called earlier before close is called.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed the duplicate cleanup logic since stopAndWaitForPendingTasksToComplete is already called earlier. (1d31b1b)