lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a.@apache.org
Subject [lucene-solr] branch master updated: SOLR-13763: Ignore freedisk changes in a live simulator created from snapshot.
Date Wed, 18 Sep 2019 21:22:33 GMT
This is an automated email from the ASF dual-hosted git repository.

ab pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git


The following commit(s) were added to refs/heads/master by this push:
     new 9e449ad  SOLR-13763: Ignore freedisk changes in a live simulator created from snapshot.
9e449ad is described below

commit 9e449ad0bcc8c95bc4a4164362c4f652a92f3910
Author: Andrzej Bialecki <ab@apache.org>
AuthorDate: Wed Sep 18 23:21:24 2019 +0200

    SOLR-13763: Ignore freedisk changes in a live simulator created from snapshot.
---
 .../cloud/autoscaling/sim/TestSnapshotCloudManager.java   | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/TestSnapshotCloudManager.java
b/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/TestSnapshotCloudManager.java
index 7627c13..b1bd7f4 100644
--- a/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/TestSnapshotCloudManager.java
+++ b/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/TestSnapshotCloudManager.java
@@ -29,6 +29,7 @@ import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
+import java.util.TreeMap;
 import java.util.function.Function;
 import java.util.function.Predicate;
 import java.util.regex.Pattern;
@@ -152,7 +153,7 @@ public class TestSnapshotCloudManager extends SolrCloudTestCase {
     SnapshotCloudManager snapshotCloudManager1 = SnapshotCloudManager.readSnapshot(tmpDir);
     try (SimCloudManager simCloudManager = SimCloudManager.createCluster(snapshotCloudManager1,
null, TimeSource.get("simTime:50"))) {
       SimSolrCloudTestCase.assertClusterStateEquals(snapshotCloudManager.getClusterStateProvider().getClusterState(),
simCloudManager.getClusterStateProvider().getClusterState());
-      assertNodeStateProvider(snapshotCloudManager, simCloudManager);
+      assertNodeStateProvider(snapshotCloudManager, simCloudManager, "freedisk");
       assertDistribStateManager(snapshotCloudManager.getDistribStateManager(), simCloudManager.getDistribStateManager());
       ClusterState state = simCloudManager.getClusterStateProvider().getClusterState();
       Replica r = state.getCollection(CollectionAdminParams.SYSTEM_COLL).getReplicas().get(0);
@@ -174,14 +175,20 @@ public class TestSnapshotCloudManager extends SolrCloudTestCase {
     }
   }
 
-  private static void assertNodeStateProvider(SolrCloudManager oneMgr, SolrCloudManager twoMgr)
throws Exception {
+  private static void assertNodeStateProvider(SolrCloudManager oneMgr, SolrCloudManager twoMgr,
String... ignorableNodeValues) throws Exception {
     NodeStateProvider one = oneMgr.getNodeStateProvider();
     NodeStateProvider two = twoMgr.getNodeStateProvider();
     for (String node : oneMgr.getClusterStateProvider().getLiveNodes()) {
       Map<String, Object> oneVals = one.getNodeValues(node, SimUtils.COMMON_NODE_TAGS);
       Map<String, Object> twoVals = two.getNodeValues(node, SimUtils.COMMON_NODE_TAGS);
-      oneVals = Utils.getDeepCopy(oneVals, 10, false, true);
-      twoVals = Utils.getDeepCopy(twoVals, 10, false, true);
+      oneVals = new TreeMap<>(Utils.getDeepCopy(oneVals, 10, false, true));
+      twoVals = new TreeMap<>(Utils.getDeepCopy(twoVals, 10, false, true));
+      if (ignorableNodeValues != null) {
+        for (String key : ignorableNodeValues) {
+          oneVals.remove(key);
+          twoVals.remove(key);
+        }
+      }
       assertEquals(Utils.toJSONString(oneVals), Utils.toJSONString(twoVals));
       Map<String, Map<String, List<ReplicaInfo>>> oneInfos = one.getReplicaInfo(node,
SimUtils.COMMON_REPLICA_TAGS);
       Map<String, Map<String, List<ReplicaInfo>>> twoInfos = two.getReplicaInfo(node,
SimUtils.COMMON_REPLICA_TAGS);


Mime
View raw message