mirror of https://github.com/apache/lucene.git
SOLR-13065: Harden TestSimExecutePlanAction
This commit is contained in:
parent
655e9ecf7c
commit
1d601ed646
|
@ -411,16 +411,16 @@ public class SimClusterStateProvider implements ClusterStateProvider {
|
||||||
lock.lockInterruptibly();
|
lock.lockInterruptibly();
|
||||||
try {
|
try {
|
||||||
setReplicaStates(nodeId, Replica.State.ACTIVE, collections);
|
setReplicaStates(nodeId, Replica.State.ACTIVE, collections);
|
||||||
|
if (!collections.isEmpty()) {
|
||||||
|
collectionsStatesRef.set(null);
|
||||||
|
simRunLeaderElection(collections, true);
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
} finally {
|
} finally {
|
||||||
lock.unlock();
|
lock.unlock();
|
||||||
}
|
}
|
||||||
if (!collections.isEmpty()) {
|
|
||||||
collectionsStatesRef.set(null);
|
|
||||||
simRunLeaderElection(collections, true);
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -657,7 +657,12 @@ public class SimClusterStateProvider implements ClusterStateProvider {
|
||||||
private void simRunLeaderElection(Collection<String> collections, boolean saveClusterState) throws Exception {
|
private void simRunLeaderElection(Collection<String> collections, boolean saveClusterState) throws Exception {
|
||||||
ensureNotClosed();
|
ensureNotClosed();
|
||||||
if (saveClusterState) {
|
if (saveClusterState) {
|
||||||
collectionsStatesRef.set(null);
|
lock.lockInterruptibly();
|
||||||
|
try {
|
||||||
|
collectionsStatesRef.set(null);
|
||||||
|
} finally {
|
||||||
|
lock.unlock();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ClusterState state = getClusterState();
|
ClusterState state = getClusterState();
|
||||||
state.forEachCollection(dc -> {
|
state.forEachCollection(dc -> {
|
||||||
|
@ -798,7 +803,12 @@ public class SimClusterStateProvider implements ClusterStateProvider {
|
||||||
CreateCollectionCmd.checkReplicaTypes(props);
|
CreateCollectionCmd.checkReplicaTypes(props);
|
||||||
|
|
||||||
// always force getting fresh state
|
// always force getting fresh state
|
||||||
collectionsStatesRef.set(null);
|
lock.lockInterruptibly();
|
||||||
|
try {
|
||||||
|
collectionsStatesRef.set(null);
|
||||||
|
} finally {
|
||||||
|
lock.unlock();
|
||||||
|
}
|
||||||
final ClusterState clusterState = getClusterState();
|
final ClusterState clusterState = getClusterState();
|
||||||
|
|
||||||
String withCollection = props.getStr(CollectionAdminParams.WITH_COLLECTION);
|
String withCollection = props.getStr(CollectionAdminParams.WITH_COLLECTION);
|
||||||
|
@ -928,7 +938,12 @@ public class SimClusterStateProvider implements ClusterStateProvider {
|
||||||
});
|
});
|
||||||
|
|
||||||
// force recreation of collection states
|
// force recreation of collection states
|
||||||
collectionsStatesRef.set(null);
|
lock.lockInterruptibly();
|
||||||
|
try {
|
||||||
|
collectionsStatesRef.set(null);
|
||||||
|
} finally {
|
||||||
|
lock.unlock();
|
||||||
|
}
|
||||||
//simRunLeaderElection(Collections.singleton(collectionName), true);
|
//simRunLeaderElection(Collections.singleton(collectionName), true);
|
||||||
if (waitForFinalState) {
|
if (waitForFinalState) {
|
||||||
boolean finished = finalStateLatch.await(cloudManager.getTimeSource().convertDelay(TimeUnit.SECONDS, 60, TimeUnit.MILLISECONDS),
|
boolean finished = finalStateLatch.await(cloudManager.getTimeSource().convertDelay(TimeUnit.SECONDS, 60, TimeUnit.MILLISECONDS),
|
||||||
|
|
|
@ -83,7 +83,6 @@ public class TestSimExecutePlanAction extends SimSolrCloudTestCase {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@LuceneTestCase.BadApple(bugUrl="https://issues.apache.org/jira/browse/SOLR-12028") // 28-June-2018
|
@LuceneTestCase.BadApple(bugUrl="https://issues.apache.org/jira/browse/SOLR-12028") // 28-June-2018
|
||||||
@AwaitsFix(bugUrl="https://issues.apache.org/jira/browse/SOLR-12028")
|
|
||||||
public void testExecute() throws Exception {
|
public void testExecute() throws Exception {
|
||||||
SolrClient solrClient = cluster.simGetSolrClient();
|
SolrClient solrClient = cluster.simGetSolrClient();
|
||||||
String collectionName = "testExecute";
|
String collectionName = "testExecute";
|
||||||
|
@ -159,7 +158,6 @@ public class TestSimExecutePlanAction extends SimSolrCloudTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@AwaitsFix(bugUrl="https://issues.apache.org/jira/browse/SOLR-12028") // this test can fail to elect a leader, seems to be common among sim tests
|
|
||||||
public void testIntegration() throws Exception {
|
public void testIntegration() throws Exception {
|
||||||
SolrClient solrClient = cluster.simGetSolrClient();
|
SolrClient solrClient = cluster.simGetSolrClient();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue