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.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
-
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 boolean
amISubShardLeader(org.apache.solr.common.cloud.DocCollection coll, org.apache.solr.common.cloud.Slice parentSlice, String id, org.apache.solr.common.SolrInputDocument doc)
ForCollectionParams.CollectionAction.SPLITSHARD
protected org.apache.solr.common.cloud.Replica.Type
computeReplicaType()
protected void
doClose()
Override to implement resource release logic that *must* be called at the end of a request.protected void
doDeleteById(DeleteUpdateCommand cmd)
protected void
doDeleteByQuery(DeleteUpdateCommand cmd)
for implementing classes to setup request data(nodes, replicas)protected void
doDistribAdd(AddUpdateCommand cmd)
protected void
doDistribDeleteById(DeleteUpdateCommand cmd)
This method can be overridden to tamper with the cmd after the localDeleteById operationprotected void
doDistribDeleteByQuery(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 void
doDistribFinish()
protected String
getLeaderUrl(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.MIGRATE
protected List<SolrCmdDistributor.Node>
getReplicaNodesForLeader(String shardId, org.apache.solr.common.cloud.Replica leaderReplica)
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
void
processAdd(AddUpdateCommand cmd)
void
processCommit(CommitUpdateCommand cmd)
void
processDelete(DeleteUpdateCommand cmd)
void
processMergeIndexes(MergeIndexesCommand cmd)
void
processRollback(RollbackUpdateCommand cmd)
protected List<SolrCmdDistributor.Node>
setupRequest(String id, org.apache.solr.common.SolrInputDocument doc, String route, UpdateCommand updateCommand)
protected boolean
shouldCloneCmdDoc()
-
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:
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, org.apache.solr.common.cloud.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, org.apache.solr.common.SolrInputDocument doc, String route, UpdateCommand updateCommand)
-
shouldCloneCmdDoc
protected boolean shouldCloneCmdDoc()
- Overrides:
shouldCloneCmdDoc
in 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 InterruptedException
ForCollectionParams.CollectionAction.SPLITSHARD
- Throws:
InterruptedException
-
getReplicaNodesForLeader
protected List<SolrCmdDistributor.Node> getReplicaNodesForLeader(String shardId, org.apache.solr.common.cloud.Replica leaderReplica)
-
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: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
-
-