Fix compilation on Java 8 + tests that rely on ordering
Note, we still have tests failing because of mvel compilation bugs, see more here: http://jira.codehaus.org/browse/MVEL-299 closes #4510
This commit is contained in:
parent
9d8ab56c9b
commit
bb4d3f55c0
|
@ -4510,7 +4510,7 @@ public class ConcurrentHashMapV8<K,V> extends AbstractMap<K,V>
|
||||||
(containsAll(c) && c.containsAll(this))));
|
(containsAll(c) && c.containsAll(this))));
|
||||||
}
|
}
|
||||||
|
|
||||||
public ConcurrentHashMapSpliterator<K> spliterator() {
|
public ConcurrentHashMapSpliterator<K> spliteratorJSR166() {
|
||||||
Node<K,V>[] t;
|
Node<K,V>[] t;
|
||||||
ConcurrentHashMapV8<K,V> m = map;
|
ConcurrentHashMapV8<K,V> m = map;
|
||||||
long n = m.sumCount();
|
long n = m.sumCount();
|
||||||
|
@ -4568,7 +4568,7 @@ public class ConcurrentHashMapV8<K,V> extends AbstractMap<K,V>
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ConcurrentHashMapSpliterator<V> spliterator() {
|
public ConcurrentHashMapSpliterator<V> spliteratorJSR166() {
|
||||||
Node<K,V>[] t;
|
Node<K,V>[] t;
|
||||||
ConcurrentHashMapV8<K,V> m = map;
|
ConcurrentHashMapV8<K,V> m = map;
|
||||||
long n = m.sumCount();
|
long n = m.sumCount();
|
||||||
|
@ -4656,7 +4656,7 @@ public class ConcurrentHashMapV8<K,V> extends AbstractMap<K,V>
|
||||||
(containsAll(c) && c.containsAll(this))));
|
(containsAll(c) && c.containsAll(this))));
|
||||||
}
|
}
|
||||||
|
|
||||||
public ConcurrentHashMapSpliterator<Map.Entry<K,V>> spliterator() {
|
public ConcurrentHashMapSpliterator<Map.Entry<K,V>> spliteratorJSR166() {
|
||||||
Node<K,V>[] t;
|
Node<K,V>[] t;
|
||||||
ConcurrentHashMapV8<K,V> m = map;
|
ConcurrentHashMapV8<K,V> m = map;
|
||||||
long n = m.sumCount();
|
long n = m.sumCount();
|
||||||
|
|
|
@ -507,6 +507,18 @@ public class IndexShardRoutingTable implements Iterable<ShardRouting> {
|
||||||
return this.replicas;
|
return this.replicas;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<ShardRouting> replicaShardsWithState(ShardRoutingState... states) {
|
||||||
|
List<ShardRouting> shards = newArrayList();
|
||||||
|
for (ShardRouting shardEntry : replicas) {
|
||||||
|
for (ShardRoutingState state : states) {
|
||||||
|
if (shardEntry.state() == state) {
|
||||||
|
shards.add(shardEntry);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return shards;
|
||||||
|
}
|
||||||
|
|
||||||
public List<ShardRouting> shardsWithState(ShardRoutingState... states) {
|
public List<ShardRouting> shardsWithState(ShardRoutingState... states) {
|
||||||
List<ShardRouting> shards = newArrayList();
|
List<ShardRouting> shards = newArrayList();
|
||||||
for (ShardRouting shardEntry : this) {
|
for (ShardRouting shardEntry : this) {
|
||||||
|
|
|
@ -34,6 +34,7 @@ import org.junit.Test;
|
||||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.*;
|
import static org.elasticsearch.cluster.routing.ShardRoutingState.*;
|
||||||
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
|
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
|
||||||
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
||||||
|
import static org.hamcrest.Matchers.anyOf;
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
|
|
||||||
public class ClusterRebalanceRoutingTests extends ElasticsearchAllocationTestCase {
|
public class ClusterRebalanceRoutingTests extends ElasticsearchAllocationTestCase {
|
||||||
|
@ -434,7 +435,7 @@ public class ClusterRebalanceRoutingTests extends ElasticsearchAllocationTestCas
|
||||||
routingNodes = clusterState.routingNodes();
|
routingNodes = clusterState.routingNodes();
|
||||||
|
|
||||||
assertThat(routingNodes.node("node3").size(), equalTo(1));
|
assertThat(routingNodes.node("node3").size(), equalTo(1));
|
||||||
assertThat(routingNodes.node("node3").get(0).shardId().index().name(), equalTo("test1"));
|
assertThat(routingNodes.node("node3").get(0).shardId().index().name(), anyOf(equalTo("test1"), equalTo("test2")));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -111,10 +111,10 @@ public class UpdateNumberOfReplicasTests extends ElasticsearchAllocationTestCase
|
||||||
assertThat(routingTable.index("test").shard(0).primaryShard().state(), equalTo(STARTED));
|
assertThat(routingTable.index("test").shard(0).primaryShard().state(), equalTo(STARTED));
|
||||||
assertThat(routingTable.index("test").shard(0).primaryShard().currentNodeId(), equalTo(nodeHoldingPrimary));
|
assertThat(routingTable.index("test").shard(0).primaryShard().currentNodeId(), equalTo(nodeHoldingPrimary));
|
||||||
assertThat(routingTable.index("test").shard(0).replicaShards().size(), equalTo(2));
|
assertThat(routingTable.index("test").shard(0).replicaShards().size(), equalTo(2));
|
||||||
assertThat(routingTable.index("test").shard(0).replicaShards().get(0).state(), equalTo(STARTED));
|
assertThat(routingTable.index("test").shard(0).replicaShardsWithState(STARTED).size(), equalTo(1));
|
||||||
assertThat(routingTable.index("test").shard(0).replicaShards().get(0).currentNodeId(), equalTo(nodeHoldingReplica));
|
assertThat(routingTable.index("test").shard(0).replicaShardsWithState(STARTED).get(0).currentNodeId(), equalTo(nodeHoldingReplica));
|
||||||
assertThat(routingTable.index("test").shard(0).replicaShards().get(1).state(), equalTo(INITIALIZING));
|
assertThat(routingTable.index("test").shard(0).replicaShardsWithState(INITIALIZING).size(), equalTo(1));
|
||||||
assertThat(routingTable.index("test").shard(0).replicaShards().get(1).currentNodeId(), equalTo("node3"));
|
assertThat(routingTable.index("test").shard(0).replicaShardsWithState(INITIALIZING).get(0).currentNodeId(), equalTo("node3"));
|
||||||
|
|
||||||
routingNodes = clusterState.routingNodes();
|
routingNodes = clusterState.routingNodes();
|
||||||
prevRoutingTable = routingTable;
|
prevRoutingTable = routingTable;
|
||||||
|
@ -127,10 +127,9 @@ public class UpdateNumberOfReplicasTests extends ElasticsearchAllocationTestCase
|
||||||
assertThat(routingTable.index("test").shard(0).primaryShard().state(), equalTo(STARTED));
|
assertThat(routingTable.index("test").shard(0).primaryShard().state(), equalTo(STARTED));
|
||||||
assertThat(routingTable.index("test").shard(0).primaryShard().currentNodeId(), equalTo(nodeHoldingPrimary));
|
assertThat(routingTable.index("test").shard(0).primaryShard().currentNodeId(), equalTo(nodeHoldingPrimary));
|
||||||
assertThat(routingTable.index("test").shard(0).replicaShards().size(), equalTo(2));
|
assertThat(routingTable.index("test").shard(0).replicaShards().size(), equalTo(2));
|
||||||
assertThat(routingTable.index("test").shard(0).replicaShards().get(0).state(), equalTo(STARTED));
|
assertThat(routingTable.index("test").shard(0).replicaShardsWithState(STARTED).size(), equalTo(2));
|
||||||
assertThat(routingTable.index("test").shard(0).replicaShards().get(0).currentNodeId(), equalTo(nodeHoldingReplica));
|
assertThat(routingTable.index("test").shard(0).replicaShardsWithState(STARTED).get(0).currentNodeId(), anyOf(equalTo(nodeHoldingReplica), equalTo("node3")));
|
||||||
assertThat(routingTable.index("test").shard(0).replicaShards().get(1).state(), equalTo(STARTED));
|
assertThat(routingTable.index("test").shard(0).replicaShardsWithState(STARTED).get(1).currentNodeId(), anyOf(equalTo(nodeHoldingReplica), equalTo("node3")));
|
||||||
assertThat(routingTable.index("test").shard(0).replicaShards().get(1).currentNodeId(), equalTo("node3"));
|
|
||||||
|
|
||||||
logger.info("now remove a replica");
|
logger.info("now remove a replica");
|
||||||
routingNodes = clusterState.routingNodes();
|
routingNodes = clusterState.routingNodes();
|
||||||
|
|
Loading…
Reference in New Issue