Class Builders.CollectionBuilder

  • Enclosing class:
    Builders

    public static class Builders.CollectionBuilder
    extends Object
    • Constructor Detail

      • CollectionBuilder

        public CollectionBuilder​(String collectionName)
    • Method Detail

      • getCollectionMetricsBuilder

        public org.apache.solr.cluster.placement.impl.CollectionMetricsBuilder getCollectionMetricsBuilder()
      • getShardBuilders

        public List<Builders.ShardBuilder> getShardBuilders()
        Returns:
        The internal shards data structure to allow test code to modify the replica distribution to nodes.
      • customCollectionSetup

        public Builders.CollectionBuilder customCollectionSetup​(List<List<String>> shardsReplicas,
                                                                List<Builders.NodeBuilder> liveNodes)
        Initializes the collection to a specific shard and replica distribution passed in shardsReplicas.
        Parameters:
        shardsReplicas - A list of shard descriptions, describing the replicas of that shard. Replica description include the replica type and the node on which the replica should be placed. Everything is text to make it easy to design specific collections. For example the following value:
        
         List.of(
           List.of("NRT 0", "TLOG 0", "NRT 3"), // shard 1
           List.of("NRT 1", "NRT 3", "TLOG 2")); // shard 2
        
         
        Creates a placement that would distribute replicas to nodes (there must be at least 4 nodes) in the following way:
        
         +--------------+----+----+----+----+
         |         Node |  0 |  1 |  2 |  3 |
         +----------------------------------+
         |   Shard 1:   |    |    |    |    |
         |         NRT  |  X |    |    |  X |
         |         TLOG |  X |    |    |    |
         +----------------------------------+
         |   Shard 2:   |    |    |    |    |
         |         NRT  |    |  X |    |  X |
         |         TLOG |    |    |  X |    |
         +--------------+----+----+----+----+
        
         
      • initializeShardsReplicas

        public Builders.CollectionBuilder initializeShardsReplicas​(int countShards,
                                                                   int countNrtReplicas,
                                                                   int countTlogReplicas,
                                                                   int countPullReplicas,
                                                                   List<Builders.NodeBuilder> nodes)
        Initializes shard and replica builders for the collection based on passed parameters. Replicas are assigned round-robin to the nodes. The shard leader is the first NRT replica of each shard (or first TLOG is no NRT). Shard and replica configuration can be modified afterwards, the returned builder hierarchy is a convenient starting point.
        Parameters:
        countShards - number of shards to create
        countNrtReplicas - number of NRT replicas per shard
        countTlogReplicas - number of TLOG replicas per shard
        countPullReplicas - number of PULL replicas per shard
        nodes - list of nodes to place replicas on.
      • initializeShardsReplicas

        public Builders.CollectionBuilder initializeShardsReplicas​(int countShards,
                                                                   int countNrtReplicas,
                                                                   int countTlogReplicas,
                                                                   int countPullReplicas,
                                                                   List<Builders.NodeBuilder> nodes,
                                                                   List<Integer> initialSizeGBPerShard)
        Initializes shard and replica builders for the collection based on passed parameters. Replicas are assigned round-robin to the nodes. The shard leader is the first NRT replica of each shard (or first TLOG is no NRT). Shard and replica configuration can be modified afterwards, the returned builder hierarchy is a convenient starting point.
        Parameters:
        countShards - number of shards to create
        countNrtReplicas - number of NRT replicas per shard
        countTlogReplicas - number of TLOG replicas per shard
        countPullReplicas - number of PULL replicas per shard
        nodes - list of nodes to place replicas on.
        initialSizeGBPerShard - initial replica size (in GB) per shard
      • build

        public org.apache.solr.cluster.SolrCollection build()