Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[#eng-3619] don't rebalance shards when there's only a single node in…

… the cluster
  • Loading branch information...
commit 87060a5f7015388a001e5a8a6252cdde7d3c3da5 1 parent 29d2291
@dakrone dakrone authored
View
5 pom.xml
@@ -6,7 +6,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.sonian</groupId>
<artifactId>elasticsearch-equilibrium</artifactId>
- <version>0.20.1</version>
+ <version>0.20.2-SNAPSHOT</version>
<packaging>jar</packaging>
<description>Shard allocation plugin for ElasticSearch</description>
<inceptionYear>2011</inceptionYear>
@@ -46,8 +46,7 @@
</parent>
<properties>
- <elasticsearch.version>0.20.2</elasticsearch.version>
- <allocation.version>3.3.3</allocation.version>
+ <elasticsearch.version>0.20.5</elasticsearch.version>
</properties>
<repositories>
View
6 src/main/java/com/sonian/elasticsearch/equilibrium/DiskShardsAllocator.java
@@ -188,6 +188,12 @@ public boolean rebalance(RoutingAllocation allocation) {
RoutingNode[] sortedNodesLeastToHigh = sortedNodesByShardCountLeastToHigh(allocation);
int lowIndex = 0;
int highIndex = sortedNodesLeastToHigh.length - 1;
+
+ // If only a single node is present, don't bother trying to rebalance.
+ if (sortedNodesLeastToHigh.length <= 1) {
+ return false;
+ }
+
boolean relocationPerformed;
do {
relocationPerformed = false;
Please sign in to comment.
Something went wrong with that request. Please try again.