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
- Direct Known Subclasses:
CdcrUpdateProcessor
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 ClusterState
clusterState
protected 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, updateCommand
-
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
-
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 ClusterState clusterState
-
-
Constructor Detail
-
DistributedZkUpdateProcessor
public DistributedZkUpdateProcessor(SolrQueryRequest req, SolrQueryResponse rsp, UpdateRequestProcessor next)
-
-
Method Detail
-
computeReplicaType
protected Replica.Type computeReplicaType()
- Overrides:
computeReplicaType
in classDistributedUpdateProcessor
- Returns:
- the replica type of the collection.
-
processCommit
public void processCommit(CommitUpdateCommand cmd) throws IOException
- Overrides:
processCommit
in classDistributedUpdateProcessor
- Throws:
IOException
-
processAdd
public void processAdd(AddUpdateCommand cmd) throws IOException
- Overrides:
processAdd
in classDistributedUpdateProcessor
- Throws:
IOException
-
doDistribAdd
protected void doDistribAdd(AddUpdateCommand cmd) throws IOException
- Overrides:
doDistribAdd
in classDistributedUpdateProcessor
- Throws:
IOException
-
processDelete
public void processDelete(DeleteUpdateCommand cmd) throws IOException
- Overrides:
processDelete
in classDistributedUpdateProcessor
- Throws:
IOException
-
doDeleteById
protected void doDeleteById(DeleteUpdateCommand cmd) throws IOException
- Overrides:
doDeleteById
in classDistributedUpdateProcessor
- Throws:
IOException
-
doDistribDeleteById
protected void doDistribDeleteById(DeleteUpdateCommand cmd) throws IOException
Description copied from class:DistributedUpdateProcessor
This method can be overridden to tamper with the cmd after the localDeleteById operation- Overrides:
doDistribDeleteById
in 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:DistributedUpdateProcessor
for implementing classes to setup request data(nodes, replicas)- Overrides:
doDeleteByQuery
in classDistributedUpdateProcessor
- Parameters:
cmd
- the delete command being processed- Throws:
IOException
-
doDistribDeleteByQuery
protected void doDistribDeleteByQuery(DeleteUpdateCommand cmd, List<SolrCmdDistributor.Node> replicas, DocCollection coll) throws IOException
Description copied from class:DistributedUpdateProcessor
This runs after versionDeleteByQuery is invoked, should be used to tamper or forward DeleteCommand- Overrides:
doDistribDeleteByQuery
in 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:
getLeaderUrl
in classDistributedUpdateProcessor
- Parameters:
id
- id of doc- Returns:
- url of leader, or null if not found.
-
setupRequest
protected List<SolrCmdDistributor.Node> setupRequest(String id, SolrInputDocument doc)
-
setupRequest
protected List<SolrCmdDistributor.Node> setupRequest(String id, SolrInputDocument doc, String route)
-
shouldCloneCmdDoc
protected boolean shouldCloneCmdDoc()
- Overrides:
shouldCloneCmdDoc
in classDistributedUpdateProcessor
- Returns:
- whether cmd doc should be cloned before localAdd
-
amISubShardLeader
protected boolean amISubShardLeader(DocCollection coll, Slice parentSlice, String id, SolrInputDocument doc) throws InterruptedException
- Throws:
InterruptedException
-
getReplicaNodesForLeader
protected List<SolrCmdDistributor.Node> getReplicaNodesForLeader(String shardId, Replica leaderReplica)
-
getSubShardLeaders
protected List<SolrCmdDistributor.Node> getSubShardLeaders(DocCollection coll, String shardId, String docId, SolrInputDocument doc)
-
getNodesByRoutingRules
protected List<SolrCmdDistributor.Node> getNodesByRoutingRules(ClusterState cstate, DocCollection coll, String id, SolrInputDocument doc)
-
doClose
protected void doClose()
Description copied from class:UpdateRequestProcessor
Override to implement resource release logic that *must* be called at the end of a request.- Overrides:
doClose
in classUpdateRequestProcessor
-
processMergeIndexes
public void processMergeIndexes(MergeIndexesCommand cmd) throws IOException
- Overrides:
processMergeIndexes
in classUpdateRequestProcessor
- Throws:
IOException
-
processRollback
public void processRollback(RollbackUpdateCommand cmd) throws IOException
- Overrides:
processRollback
in classUpdateRequestProcessor
- Throws:
IOException
-
doDistribFinish
protected void doDistribFinish()
- Overrides:
doDistribFinish
in classDistributedUpdateProcessor
-
-