Package org.elasticsearch.cluster.routing.allocation.allocator

Examples of org.elasticsearch.cluster.routing.allocation.allocator.BalancedShardsAllocator


                assertNull("addListener was called twice while only one time was expected", listeners[0]);
                listeners[0] = listener;
            }

        };
        BalancedShardsAllocator allocator = new BalancedShardsAllocator(settings.build(), service);
        assertThat(allocator.getIndexBalance(), Matchers.equalTo(0.2f));
        assertThat(allocator.getShardBalance(), Matchers.equalTo(0.3f));
        assertThat(allocator.getPrimaryBalance(), Matchers.equalTo(0.5f));
        assertThat(allocator.getThreshold(), Matchers.equalTo(2.0f));

        settings = settingsBuilder();
        settings.put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE, ClusterRebalanceAllocationDecider.ClusterRebalanceType.ALWAYS.toString());
        listeners[0].onRefreshSettings(settings.build());
        assertThat(allocator.getIndexBalance(), Matchers.equalTo(0.2f));
        assertThat(allocator.getShardBalance(), Matchers.equalTo(0.3f));
        assertThat(allocator.getPrimaryBalance(), Matchers.equalTo(0.5f));
        assertThat(allocator.getThreshold(), Matchers.equalTo(2.0f));

        settings = settingsBuilder();
        settings.put(BalancedShardsAllocator.SETTING_INDEX_BALANCE_FACTOR, 0.5);
        settings.put(BalancedShardsAllocator.SETTING_SHARD_BALANCE_FACTOR, 0.1);
        settings.put(BalancedShardsAllocator.SETTING_PRIMARY_BALANCE_FACTOR, 0.4);
        settings.put(BalancedShardsAllocator.SETTING_THRESHOLD, 3.0);
        listeners[0].onRefreshSettings(settings.build());
        assertThat(allocator.getIndexBalance(), Matchers.equalTo(0.5f));
        assertThat(allocator.getShardBalance(), Matchers.equalTo(0.1f));
        assertThat(allocator.getPrimaryBalance(), Matchers.equalTo(0.4f));
        assertThat(allocator.getThreshold(), Matchers.equalTo(3.0f));
    }
View Full Code Here

TOP

Related Classes of org.elasticsearch.cluster.routing.allocation.allocator.BalancedShardsAllocator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.