Class DistributedCollectionConfigSetCommandRunner
- java.lang.Object
-
- org.apache.solr.cloud.api.collections.DistributedCollectionConfigSetCommandRunner
-
public class DistributedCollectionConfigSetCommandRunner extends Object
Class for execution Collection API and Config Set API commands in a distributed way, without going through Overseer andOverseerCollectionMessageHandler
orOverseerConfigSetMessageHandler
.This class is only called when Collection and Config Set API calls are configured to be distributed, which implies cluster state updates are distributed as well.
-
-
Field Summary
Fields Modifier and Type Field Description static String
ZK_PATH_SEPARATOR
-
Constructor Summary
Constructors Constructor Description DistributedCollectionConfigSetCommandRunner(CoreContainer coreContainer)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
deleteAllAsyncIds()
boolean
deleteSingleAsyncId(String asyncId)
org.apache.solr.common.util.Pair<org.apache.solr.client.solrj.response.RequestStatusState,OverseerSolrResponse>
getAsyncTaskRequestStatus(String asyncId)
static String
getCollectionName(org.apache.solr.common.cloud.ZkNodeProps message)
Collection name can be found in either of two message parameters (why??).OverseerSolrResponse
runCollectionCommand(org.apache.solr.common.cloud.ZkNodeProps message, org.apache.solr.common.params.CollectionParams.CollectionAction action, long timeoutMs)
WhenCollectionsHandler.invokeAction(org.apache.solr.request.SolrQueryRequest, org.apache.solr.response.SolrQueryResponse, org.apache.solr.core.CoreContainer, org.apache.solr.common.params.CollectionParams.CollectionAction, org.apache.solr.handler.admin.CollectionsHandler.CollectionOperation)
does not enqueue to overseer queue and instead calls this method, this method is expected to do the equivalent of what Overseer does inOverseerCollectionMessageHandler.processMessage(org.apache.solr.common.cloud.ZkNodeProps, java.lang.String)
.void
runConfigSetCommand(SolrQueryResponse rsp, org.apache.solr.common.params.ConfigSetParams.ConfigSetAction action, Map<String,Object> result, long timeoutMs)
WhenCollectionsHandler.invokeAction(org.apache.solr.request.SolrQueryRequest, org.apache.solr.response.SolrQueryResponse, org.apache.solr.core.CoreContainer, org.apache.solr.common.params.CollectionParams.CollectionAction, org.apache.solr.handler.admin.CollectionsHandler.CollectionOperation)
does not enqueue to overseer queue and instead calls this method, this method is expected to do the equivalent of what Overseer does inOverseerConfigSetMessageHandler.processMessage(org.apache.solr.common.cloud.ZkNodeProps, java.lang.String)
.void
stopAndWaitForPendingTasksToComplete()
Best effort wait for termination of all tasks for a (short) while, then return.
-
-
-
Field Detail
-
ZK_PATH_SEPARATOR
public static final String ZK_PATH_SEPARATOR
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
DistributedCollectionConfigSetCommandRunner
public DistributedCollectionConfigSetCommandRunner(CoreContainer coreContainer)
-
-
Method Detail
-
getAsyncTaskRequestStatus
public org.apache.solr.common.util.Pair<org.apache.solr.client.solrj.response.RequestStatusState,OverseerSolrResponse> getAsyncTaskRequestStatus(String asyncId) throws Exception
- Throws:
Exception
-
deleteSingleAsyncId
public boolean deleteSingleAsyncId(String asyncId) throws Exception
- Throws:
Exception
-
runConfigSetCommand
public void runConfigSetCommand(SolrQueryResponse rsp, org.apache.solr.common.params.ConfigSetParams.ConfigSetAction action, Map<String,Object> result, long timeoutMs) throws Exception
WhenCollectionsHandler.invokeAction(org.apache.solr.request.SolrQueryRequest, org.apache.solr.response.SolrQueryResponse, org.apache.solr.core.CoreContainer, org.apache.solr.common.params.CollectionParams.CollectionAction, org.apache.solr.handler.admin.CollectionsHandler.CollectionOperation)
does not enqueue to overseer queue and instead calls this method, this method is expected to do the equivalent of what Overseer does inOverseerConfigSetMessageHandler.processMessage(org.apache.solr.common.cloud.ZkNodeProps, java.lang.String)
.The steps leading to that call in the Overseer execution path are (and the equivalent is done here):
OverseerTaskProcessor.run()
gets the message from the ZK queue, grabs the corresponding locks (write lock on the config set target of the API command and a read lock on the base config set if any - the case for config set creation) then executes the command using an executor service (it also checks the asyncId if any is specified but async calls are not supported for Config Set API calls).- In
OverseerTaskProcessor
.Runner.run()
(run on an executor thread) a call is made toOverseerConfigSetMessageHandler.processMessage(org.apache.solr.common.cloud.ZkNodeProps, java.lang.String)
which does a few checks and calls the appropriate Config Set method.
- Throws:
Exception
-
runCollectionCommand
public OverseerSolrResponse runCollectionCommand(org.apache.solr.common.cloud.ZkNodeProps message, org.apache.solr.common.params.CollectionParams.CollectionAction action, long timeoutMs)
WhenCollectionsHandler.invokeAction(org.apache.solr.request.SolrQueryRequest, org.apache.solr.response.SolrQueryResponse, org.apache.solr.core.CoreContainer, org.apache.solr.common.params.CollectionParams.CollectionAction, org.apache.solr.handler.admin.CollectionsHandler.CollectionOperation)
does not enqueue to overseer queue and instead calls this method, this method is expected to do the equivalent of what Overseer does inOverseerCollectionMessageHandler.processMessage(org.apache.solr.common.cloud.ZkNodeProps, java.lang.String)
.The steps leading to that call in the Overseer execution path are (and the equivalent is done here):
OverseerTaskProcessor.run()
gets the message from the ZK queue, grabs the corresponding lock (Collection API calls do locking to prevent non compatible concurrent modifications of a collection), marks the async id of the task as running then executes the command using an executor service- In
OverseerTaskProcessor
.Runner.run()
(run on an executor thread) a call is made toOverseerCollectionMessageHandler.processMessage(org.apache.solr.common.cloud.ZkNodeProps, java.lang.String)
which sets the logging context, callsCollApiCmds.CollectionApiCommand.call(org.apache.solr.common.cloud.ClusterState, org.apache.solr.common.cloud.ZkNodeProps, org.apache.solr.common.util.NamedList<java.lang.Object>)
-
stopAndWaitForPendingTasksToComplete
public void stopAndWaitForPendingTasksToComplete()
Best effort wait for termination of all tasks for a (short) while, then return. This method is called when the JVM shuts down so tasks that did not complete are expected to be stopped mid processing.
-
getCollectionName
public static String getCollectionName(org.apache.solr.common.cloud.ZkNodeProps message)
Collection name can be found in either of two message parameters (why??). Return it from where it's defined. (see also parametercollectionNameParamName
ofMutatingCommand(CollectionParams.CollectionAction, String)
)
-
-