Package org.apache.solr.cloud
Class DistributedClusterStateUpdater
- java.lang.Object
-
- org.apache.solr.cloud.DistributedClusterStateUpdater
-
public class DistributedClusterStateUpdater extends Object
Gives access to distributed cluster state update methods and allows code to inquire whether distributed state update is enabled.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
DistributedClusterStateUpdater.MutatingCommand
Naming of enum instances are the mutator object name (e.g.static class
DistributedClusterStateUpdater.StateChangeRecorder
Class handling the distributed updates of collection's Zookeeper filesstate.json
based on multiple updates applied to a single collection (as is sometimes done by *Cmd classes implementing the Collection API commands).
-
Constructor Summary
Constructors Constructor Description DistributedClusterStateUpdater(boolean useDistributedStateUpdate)
Builds an instance with the specified behavior regarding distribution of state updates, allowing to know distributed updates are not enabled (parameteruseDistributedStateUpdate
isfalse
), or when they are (parameter istrue)
, gives access to methods and classes allowing the execution of the updates.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DistributedClusterStateUpdater.StateChangeRecorder
createStateChangeRecorder(String collectionName, boolean isCollectionCreation)
Create a new instance ofDistributedClusterStateUpdater.StateChangeRecorder
for a given collection and a given intention (collection creation vs.void
doSingleStateUpdate(DistributedClusterStateUpdater.MutatingCommand command, org.apache.solr.common.cloud.ZkNodeProps message, org.apache.solr.client.solrj.cloud.SolrCloudManager scm, org.apache.solr.common.cloud.ZkStateReader zkStateReader)
Syntactic sugar to allow a single change to the cluster state to be made in a single call.void
executeNodeDownStateUpdate(String nodeName, org.apache.solr.common.cloud.ZkStateReader zkStateReader)
boolean
isDistributedStateUpdate()
When this method returnsfalse
the legacy behavior of enqueueing cluster state update messages to Overseer should be used and no other method of this class should be called.
-
-
-
Constructor Detail
-
DistributedClusterStateUpdater
public DistributedClusterStateUpdater(boolean useDistributedStateUpdate)
Builds an instance with the specified behavior regarding distribution of state updates, allowing to know distributed updates are not enabled (parameteruseDistributedStateUpdate
isfalse
), or when they are (parameter istrue)
, gives access to methods and classes allowing the execution of the updates.- Parameters:
useDistributedStateUpdate
- when this parameter isfalse
, only method expected to ever be called on this instance isisDistributedStateUpdate()
, and it will returnfalse
.
-
-
Method Detail
-
createStateChangeRecorder
public DistributedClusterStateUpdater.StateChangeRecorder createStateChangeRecorder(String collectionName, boolean isCollectionCreation)
Create a new instance ofDistributedClusterStateUpdater.StateChangeRecorder
for a given collection and a given intention (collection creation vs. operations on an existing collection)
-
doSingleStateUpdate
public void doSingleStateUpdate(DistributedClusterStateUpdater.MutatingCommand command, org.apache.solr.common.cloud.ZkNodeProps message, org.apache.solr.client.solrj.cloud.SolrCloudManager scm, org.apache.solr.common.cloud.ZkStateReader zkStateReader) throws org.apache.zookeeper.KeeperException, InterruptedException
Syntactic sugar to allow a single change to the cluster state to be made in a single call.- Throws:
org.apache.zookeeper.KeeperException
InterruptedException
-
executeNodeDownStateUpdate
public void executeNodeDownStateUpdate(String nodeName, org.apache.solr.common.cloud.ZkStateReader zkStateReader)
-
isDistributedStateUpdate
public boolean isDistributedStateUpdate()
When this method returnsfalse
the legacy behavior of enqueueing cluster state update messages to Overseer should be used and no other method of this class should be called.
-
-