Class SplitShardCmd
- java.lang.Object
- 
- org.apache.solr.cloud.api.collections.SplitShardCmd
 
- 
- All Implemented Interfaces:
- CollApiCmds.CollectionApiCommand
 
 public class SplitShardCmd extends Object implements CollApiCmds.CollectionApiCommand SolrCloud logic for splitting a shard. It's complicated! Seesplit()below.
- 
- 
Field SummaryFields Modifier and Type Field Description static StringSHARDSPLIT_CHECKDISKSPACE_ENABLED
 - 
Constructor SummaryConstructors Constructor Description SplitShardCmd(CollectionCommandContext ccc)
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcall(org.apache.solr.common.cloud.ClusterState state, org.apache.solr.common.cloud.ZkNodeProps message, org.apache.solr.common.util.NamedList<Object> results)static voidcheckDiskSpace(String collection, String shard, org.apache.solr.common.cloud.Replica parentShardLeader, SolrIndexSplitter.SplitMethod method, org.apache.solr.client.solrj.cloud.SolrCloudManager cloudManager)static StringfillRanges(org.apache.solr.client.solrj.cloud.SolrCloudManager cloudManager, org.apache.solr.common.cloud.ZkNodeProps message, org.apache.solr.common.cloud.DocCollection collection, org.apache.solr.common.cloud.Slice parentSlice, List<org.apache.solr.common.cloud.DocRouter.Range> subRanges, List<String> subSlices, List<String> subShardNames, boolean firstReplicaNrt)static org.apache.solr.common.cloud.SlicegetParentSlice(org.apache.solr.common.cloud.ClusterState clusterState, String collectionName, AtomicReference<String> slice, String splitKey)static booleanlockForSplit(org.apache.solr.client.solrj.cloud.SolrCloudManager cloudManager, String collection, String shard)booleansplit(org.apache.solr.common.cloud.ClusterState clusterState, org.apache.solr.common.cloud.ZkNodeProps message, org.apache.solr.common.util.NamedList<Object> results)Shard splits start here and make additional requests to the host of the parent shard.static voidunlockForSplit(org.apache.solr.client.solrj.cloud.SolrCloudManager cloudManager, String collection, String shard)
 
- 
- 
- 
Field Detail- 
SHARDSPLIT_CHECKDISKSPACE_ENABLEDpublic static final String SHARDSPLIT_CHECKDISKSPACE_ENABLED - See Also:
- Constant Field Values
 
 
- 
 - 
Constructor Detail- 
SplitShardCmdpublic SplitShardCmd(CollectionCommandContext ccc) 
 
- 
 - 
Method Detail- 
callpublic void call(org.apache.solr.common.cloud.ClusterState state, org.apache.solr.common.cloud.ZkNodeProps message, org.apache.solr.common.util.NamedList<Object> results) throws Exception- Specified by:
- callin interface- CollApiCmds.CollectionApiCommand
- Throws:
- Exception
 
 - 
splitpublic boolean split(org.apache.solr.common.cloud.ClusterState clusterState, org.apache.solr.common.cloud.ZkNodeProps message, org.apache.solr.common.util.NamedList<Object> results) throws ExceptionShard splits start here and make additional requests to the host of the parent shard. The sequence of requests is as follows:- 1. Verify that there is enough disk space to create sub-shards.
- 2. If splitByPrefix is true, make request to get prefix ranges.
- 3. If this split was attempted previously and there are lingering sub-shards, delete them.
- 4. Create sub-shards in CONSTRUCTION state.
- 5. Add an initial replica to each sub-shard.
- 6. Request that parent shard wait for children to become ACTIVE.
- 7. Execute split: either LINK or REWRITE.
- 8. Apply buffered updates to the sub-shards so they are up-to-date with parent.
- 9. Determine node placement for additional replicas (but do not create yet).
- 10. If replicationFactor is more than 1, set shard state for sub-shards to RECOVERY; else mark ACTIVE.
- 11. Create additional replicas of sub-shards.
 
 There is a shard split doc (dev-docs/shard-split/shard-split.adoc) on how shard split works; illustrated with diagrams. - Throws:
- Exception
 
 - 
checkDiskSpacepublic static void checkDiskSpace(String collection, String shard, org.apache.solr.common.cloud.Replica parentShardLeader, SolrIndexSplitter.SplitMethod method, org.apache.solr.client.solrj.cloud.SolrCloudManager cloudManager) throws org.apache.solr.common.SolrException, IOException - Throws:
- org.apache.solr.common.SolrException
- IOException
 
 - 
getParentSlicepublic static org.apache.solr.common.cloud.Slice getParentSlice(org.apache.solr.common.cloud.ClusterState clusterState, String collectionName, AtomicReference<String> slice, String splitKey)
 - 
fillRangespublic static String fillRanges(org.apache.solr.client.solrj.cloud.SolrCloudManager cloudManager, org.apache.solr.common.cloud.ZkNodeProps message, org.apache.solr.common.cloud.DocCollection collection, org.apache.solr.common.cloud.Slice parentSlice, List<org.apache.solr.common.cloud.DocRouter.Range> subRanges, List<String> subSlices, List<String> subShardNames, boolean firstReplicaNrt) 
 - 
lockForSplitpublic static boolean lockForSplit(org.apache.solr.client.solrj.cloud.SolrCloudManager cloudManager, String collection, String shard) throws Exception- Throws:
- Exception
 
 
- 
 
-