Class SplitShardCmd

    • Method Detail

      • split

        public 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 Exception
        Shard 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
      • checkDiskSpace

        public 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
      • getParentSlice

        public static org.apache.solr.common.cloud.Slice getParentSlice​(org.apache.solr.common.cloud.ClusterState clusterState,
                                                                        String collectionName,
                                                                        AtomicReference<String> slice,
                                                                        String splitKey)
      • fillRanges

        public 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)
      • lockForSplit

        public static boolean lockForSplit​(org.apache.solr.client.solrj.cloud.SolrCloudManager cloudManager,
                                           String collection,
                                           String shard)
                                    throws Exception
        Throws:
        Exception
      • unlockForSplit

        public static void unlockForSplit​(org.apache.solr.client.solrj.cloud.SolrCloudManager cloudManager,
                                          String collection,
                                          String shard)
                                   throws Exception
        Throws:
        Exception