You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ge...@apache.org on 2018/12/14 17:22:23 UTC
[3/3] lucene-solr:master: SOLR-13065: Harden TestSimExecutePlanAction
SOLR-13065: Harden TestSimExecutePlanAction
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/1d601ed6
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/1d601ed6
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/1d601ed6
Branch: refs/heads/master
Commit: 1d601ed6460c9041faabeec7f5491ef21a052a00
Parents: 655e9ec
Author: Jason Gerlowski <ge...@apache.org>
Authored: Fri Dec 14 11:09:43 2018 -0500
Committer: Jason Gerlowski <ge...@apache.org>
Committed: Fri Dec 14 12:22:09 2018 -0500
----------------------------------------------------------------------
.../sim/SimClusterStateProvider.java | 35 ++++++++++++++------
.../sim/TestSimExecutePlanAction.java | 2 --
2 files changed, 25 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/1d601ed6/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/SimClusterStateProvider.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/SimClusterStateProvider.java b/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/SimClusterStateProvider.java
index c411b21..fd6c955 100644
--- a/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/SimClusterStateProvider.java
+++ b/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/SimClusterStateProvider.java
@@ -411,16 +411,16 @@ public class SimClusterStateProvider implements ClusterStateProvider {
lock.lockInterruptibly();
try {
setReplicaStates(nodeId, Replica.State.ACTIVE, collections);
+ if (!collections.isEmpty()) {
+ collectionsStatesRef.set(null);
+ simRunLeaderElection(collections, true);
+ return true;
+ } else {
+ return false;
+ }
} finally {
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 {
ensureNotClosed();
if (saveClusterState) {
- collectionsStatesRef.set(null);
+ lock.lockInterruptibly();
+ try {
+ collectionsStatesRef.set(null);
+ } finally {
+ lock.unlock();
+ }
}
ClusterState state = getClusterState();
state.forEachCollection(dc -> {
@@ -798,7 +803,12 @@ public class SimClusterStateProvider implements ClusterStateProvider {
CreateCollectionCmd.checkReplicaTypes(props);
// always force getting fresh state
- collectionsStatesRef.set(null);
+ lock.lockInterruptibly();
+ try {
+ collectionsStatesRef.set(null);
+ } finally {
+ lock.unlock();
+ }
final ClusterState clusterState = getClusterState();
String withCollection = props.getStr(CollectionAdminParams.WITH_COLLECTION);
@@ -928,7 +938,12 @@ public class SimClusterStateProvider implements ClusterStateProvider {
});
// force recreation of collection states
- collectionsStatesRef.set(null);
+ lock.lockInterruptibly();
+ try {
+ collectionsStatesRef.set(null);
+ } finally {
+ lock.unlock();
+ }
//simRunLeaderElection(Collections.singleton(collectionName), true);
if (waitForFinalState) {
boolean finished = finalStateLatch.await(cloudManager.getTimeSource().convertDelay(TimeUnit.SECONDS, 60, TimeUnit.MILLISECONDS),
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/1d601ed6/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/TestSimExecutePlanAction.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/TestSimExecutePlanAction.java b/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/TestSimExecutePlanAction.java
index 1d36f14..8f95288 100644
--- a/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/TestSimExecutePlanAction.java
+++ b/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/TestSimExecutePlanAction.java
@@ -83,7 +83,6 @@ public class TestSimExecutePlanAction extends SimSolrCloudTestCase {
@Test
@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 {
SolrClient solrClient = cluster.simGetSolrClient();
String collectionName = "testExecute";
@@ -159,7 +158,6 @@ public class TestSimExecutePlanAction extends SimSolrCloudTestCase {
}
@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 {
SolrClient solrClient = cluster.simGetSolrClient();