Package org.apache.solr.update.processor
Class DistributedZkUpdateProcessor
- java.lang.Object
-
- org.apache.solr.update.processor.UpdateRequestProcessor
-
- org.apache.solr.update.processor.DistributedUpdateProcessor
-
- org.apache.solr.update.processor.DistributedZkUpdateProcessor
-
- All Implemented Interfaces:
Closeable,AutoCloseable
public class DistributedZkUpdateProcessor extends DistributedUpdateProcessor
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.solr.update.processor.DistributedUpdateProcessor
DistributedUpdateProcessor.DistribPhase, DistributedUpdateProcessor.DistributedUpdatesAsyncException, DistributedUpdateProcessor.LeaderRequestReplicationTracker, DistributedUpdateProcessor.RollupRequestReplicationTracker
-
-
Field Summary
Fields Modifier and Type Field Description protected org.apache.solr.common.cloud.ClusterStateclusterStateprotected List<SolrCmdDistributor.Node>nodes-
Fields inherited from class org.apache.solr.update.processor.DistributedUpdateProcessor
COMMIT_END_POINT, DISTRIB_FROM, DISTRIB_FROM_COLLECTION, DISTRIB_FROM_PARENT, DISTRIB_FROM_SHARD, DISTRIB_INPLACE_PREVVERSION, forwardToLeader, isIndexChanged, isLeader, isSubShardLeader, LOG_REPLAY, maxRetriesOnForward, maxRetriesToFollowers, replicaType, req, rsp, TEST_DISTRIB_SKIP_SERVERS
-
Fields inherited from class org.apache.solr.update.processor.UpdateRequestProcessor
next
-
-
Constructor Summary
Constructors Constructor Description DistributedZkUpdateProcessor(SolrQueryRequest req, SolrQueryResponse rsp, UpdateRequestProcessor next)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleanamISubShardLeader(org.apache.solr.common.cloud.DocCollection coll, org.apache.solr.common.cloud.Slice parentSlice, String id, org.apache.solr.common.SolrInputDocument doc)ForCollectionParams.CollectionAction.SPLITSHARDprotected org.apache.solr.common.cloud.Replica.TypecomputeReplicaType()protected voiddoClose()Override to implement resource release logic that *must* be called at the end of a request.protected voiddoDeleteById(DeleteUpdateCommand cmd)protected voiddoDeleteByQuery(DeleteUpdateCommand cmd)for implementing classes to setup request data(nodes, replicas)protected voiddoDistribAdd(AddUpdateCommand cmd)protected voiddoDistribDeleteById(DeleteUpdateCommand cmd)This method can be overridden to tamper with the cmd after the localDeleteById operationprotected voiddoDistribDeleteByQuery(DeleteUpdateCommand cmd, List<SolrCmdDistributor.Node> replicas, org.apache.solr.common.cloud.DocCollection coll)This runs after versionDeleteByQuery is invoked, should be used to tamper or forward DeleteCommandprotected voiddoDistribFinish()protected StringgetLeaderUrl(String id)protected List<SolrCmdDistributor.Node>getNodesByRoutingRules(org.apache.solr.common.cloud.ClusterState cstate, org.apache.solr.common.cloud.DocCollection coll, String id, org.apache.solr.common.SolrInputDocument doc)ForCollectionParams.CollectionAction.MIGRATEprotected List<SolrCmdDistributor.Node>getReplicaNodesForLeader(String shardId, org.apache.solr.common.cloud.Replica leaderReplica, int maxRetries)protected List<SolrCmdDistributor.Node>getSubShardLeaders(org.apache.solr.common.cloud.DocCollection coll, String shardId, String docId, org.apache.solr.common.SolrInputDocument doc)ForCollectionParams.CollectionAction.SPLITSHARDvoidprocessAdd(AddUpdateCommand cmd)voidprocessCommit(CommitUpdateCommand cmd)voidprocessDelete(DeleteUpdateCommand cmd)voidprocessMergeIndexes(MergeIndexesCommand cmd)voidprocessRollback(RollbackUpdateCommand cmd)protected List<SolrCmdDistributor.Node>setupRequest(String id, org.apache.solr.common.SolrInputDocument doc, String route, UpdateCommand updateCommand)protected booleanshouldCloneCmdDoc()-
Methods inherited from class org.apache.solr.update.processor.DistributedUpdateProcessor
bucketHash, doDeleteByQuery, doLocalCommit, filterParams, finish, getNonZkLeaderAssumption, versionAdd, versionDelete, versionDeleteByQuery
-
Methods inherited from class org.apache.solr.update.processor.UpdateRequestProcessor
close
-
-
-
-
Field Detail
-
nodes
protected List<SolrCmdDistributor.Node> nodes
-
clusterState
protected org.apache.solr.common.cloud.ClusterState clusterState
-
-
Constructor Detail
-
DistributedZkUpdateProcessor
public DistributedZkUpdateProcessor(SolrQueryRequest req, SolrQueryResponse rsp, UpdateRequestProcessor next)
-
-
Method Detail
-
computeReplicaType
protected org.apache.solr.common.cloud.Replica.Type computeReplicaType()
- Overrides:
computeReplicaTypein classDistributedUpdateProcessor- Returns:
- the replica type of the collection.
-
processCommit
public void processCommit(CommitUpdateCommand cmd) throws IOException
- Overrides:
processCommitin classDistributedUpdateProcessor- Throws:
IOException
-
processAdd
public void processAdd(AddUpdateCommand cmd) throws IOException
- Overrides:
processAddin classDistributedUpdateProcessor- Throws:
IOException
-
doDistribAdd
protected void doDistribAdd(AddUpdateCommand cmd) throws IOException
- Overrides:
doDistribAddin classDistributedUpdateProcessor- Throws:
IOException
-
processDelete
public void processDelete(DeleteUpdateCommand cmd) throws IOException
- Overrides:
processDeletein classDistributedUpdateProcessor- Throws:
IOException
-
doDeleteById
protected void doDeleteById(DeleteUpdateCommand cmd) throws IOException
- Overrides:
doDeleteByIdin classDistributedUpdateProcessor- Throws:
IOException
-
doDistribDeleteById
protected void doDistribDeleteById(DeleteUpdateCommand cmd) throws IOException
Description copied from class:DistributedUpdateProcessorThis method can be overridden to tamper with the cmd after the localDeleteById operation- Overrides:
doDistribDeleteByIdin classDistributedUpdateProcessor- Parameters:
cmd- the delete command- Throws:
IOException- in case post processing failed
-
doDeleteByQuery
protected void doDeleteByQuery(DeleteUpdateCommand cmd) throws IOException
Description copied from class:DistributedUpdateProcessorfor implementing classes to setup request data(nodes, replicas)- Overrides:
doDeleteByQueryin classDistributedUpdateProcessor- Parameters:
cmd- the delete command being processed- Throws:
IOException
-
doDistribDeleteByQuery
protected void doDistribDeleteByQuery(DeleteUpdateCommand cmd, List<SolrCmdDistributor.Node> replicas, org.apache.solr.common.cloud.DocCollection coll) throws IOException
Description copied from class:DistributedUpdateProcessorThis runs after versionDeleteByQuery is invoked, should be used to tamper or forward DeleteCommand- Overrides:
doDistribDeleteByQueryin classDistributedUpdateProcessor- Parameters:
cmd- delete commandreplicas- list of Nodes replicascoll- the collection in zookeeperDocCollection.- Throws:
IOException- in case post processing failed
-
getLeaderUrl
protected String getLeaderUrl(String id)
- Overrides:
getLeaderUrlin classDistributedUpdateProcessor- Parameters:
id- id of doc- Returns:
- url of leader, or null if not found.
-
setupRequest
protected List<SolrCmdDistributor.Node> setupRequest(String id, org.apache.solr.common.SolrInputDocument doc, String route, UpdateCommand updateCommand)
-
shouldCloneCmdDoc
protected boolean shouldCloneCmdDoc()
- Overrides:
shouldCloneCmdDocin classDistributedUpdateProcessor- Returns:
- whether cmd doc should be cloned before localAdd
-
amISubShardLeader
protected boolean amISubShardLeader(org.apache.solr.common.cloud.DocCollection coll, org.apache.solr.common.cloud.Slice parentSlice, String id, org.apache.solr.common.SolrInputDocument doc) throws InterruptedExceptionForCollectionParams.CollectionAction.SPLITSHARD- Throws:
InterruptedException
-
getReplicaNodesForLeader
protected List<SolrCmdDistributor.Node> getReplicaNodesForLeader(String shardId, org.apache.solr.common.cloud.Replica leaderReplica, int maxRetries)
-
getSubShardLeaders
protected List<SolrCmdDistributor.Node> getSubShardLeaders(org.apache.solr.common.cloud.DocCollection coll, String shardId, String docId, org.apache.solr.common.SolrInputDocument doc)
ForCollectionParams.CollectionAction.SPLITSHARD
-
getNodesByRoutingRules
protected List<SolrCmdDistributor.Node> getNodesByRoutingRules(org.apache.solr.common.cloud.ClusterState cstate, org.apache.solr.common.cloud.DocCollection coll, String id, org.apache.solr.common.SolrInputDocument doc)
ForCollectionParams.CollectionAction.MIGRATE
-
doClose
protected void doClose()
Description copied from class:UpdateRequestProcessorOverride to implement resource release logic that *must* be called at the end of a request.- Overrides:
doClosein classUpdateRequestProcessor
-
processMergeIndexes
public void processMergeIndexes(MergeIndexesCommand cmd) throws IOException
- Overrides:
processMergeIndexesin classUpdateRequestProcessor- Throws:
IOException
-
processRollback
public void processRollback(RollbackUpdateCommand cmd) throws IOException
- Overrides:
processRollbackin classUpdateRequestProcessor- Throws:
IOException
-
doDistribFinish
protected void doDistribFinish()
- Overrides:
doDistribFinishin classDistributedUpdateProcessor
-
-