You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by no...@apache.org on 2017/07/31 14:17:32 UTC
lucene-solr:branch_7x: SOLR-11157: wrong branch , reverting
Repository: lucene-solr
Updated Branches:
refs/heads/branch_7x d81c56377 -> 9744e6842
SOLR-11157: wrong branch , reverting
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/9744e684
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/9744e684
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/9744e684
Branch: refs/heads/branch_7x
Commit: 9744e684249ed9144f00be43eea25795c0fcf708
Parents: d81c563
Author: Noble Paul <no...@apache.org>
Authored: Mon Jul 31 23:47:22 2017 +0930
Committer: Noble Paul <no...@apache.org>
Committed: Mon Jul 31 23:47:22 2017 +0930
----------------------------------------------------------------------
solr/CHANGES.txt | 2 --
.../cloud/autoscaling/AutoScalingHandler.java | 4 ----
.../autoscaling/AutoScalingHandlerTest.java | 21 ----------------
.../apache/solr/common/cloud/ClusterState.java | 25 ++++----------------
4 files changed, 5 insertions(+), 47 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9744e684/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index c7c3243..2232b55 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -103,8 +103,6 @@ Other Changes
* SOLR-11131: Document 'assert' as a command option in bin/solr, and bin/solr.cmd scripts.
(Jason Gerlowski via Anshum Gupta)
-* SOLR-11157: remove-policy must fail if a policy to be deleted is used by a collection (noble)
-
================== 7.0.0 ==================
Versions of Major Components
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9744e684/solr/core/src/java/org/apache/solr/cloud/autoscaling/AutoScalingHandler.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/cloud/autoscaling/AutoScalingHandler.java b/solr/core/src/java/org/apache/solr/cloud/autoscaling/AutoScalingHandler.java
index b9bed3d..356ce37 100644
--- a/solr/core/src/java/org/apache/solr/cloud/autoscaling/AutoScalingHandler.java
+++ b/solr/core/src/java/org/apache/solr/cloud/autoscaling/AutoScalingHandler.java
@@ -193,10 +193,6 @@ public class AutoScalingHandler extends RequestHandlerBase implements Permission
if (policies == null || !policies.containsKey(policyName)) {
throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, "No policy exists with name: " + policyName);
}
- container.getZkController().getZkStateReader().getClusterState().forEachCollection(coll -> {
- if (policyName.equals(coll.getPolicyName())) throw new SolrException(SolrException.ErrorCode.BAD_REQUEST,
- StrUtils.formatString("policy : {0} is being used by collection {1}", policyName, coll.getName()));
- });
zkSetPolicies(container.getZkController().getZkStateReader(), policyName, null);
rsp.getValues().add("result", "success");
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9744e684/solr/core/src/test/org/apache/solr/cloud/autoscaling/AutoScalingHandlerTest.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/cloud/autoscaling/AutoScalingHandlerTest.java b/solr/core/src/test/org/apache/solr/cloud/autoscaling/AutoScalingHandlerTest.java
index 6ac35dd..197801a 100644
--- a/solr/core/src/test/org/apache/solr/cloud/autoscaling/AutoScalingHandlerTest.java
+++ b/solr/core/src/test/org/apache/solr/cloud/autoscaling/AutoScalingHandlerTest.java
@@ -287,27 +287,6 @@ public class AutoScalingHandlerTest extends SolrCloudTestCase {
}
}
- @Test
- public void testDeleteUsedPolicy() throws Exception {
- CloudSolrClient solrClient = cluster.getSolrClient();
- // add multiple policies
- String setPolicyCommand = "{'set-policy': {" +
- " 'nodelete':[" +
- " {'nodeRole':'overseer', 'replica':0}]}}";
- solrClient.request(createAutoScalingRequest(SolrRequest.METHOD.POST, setPolicyCommand));
- CollectionAdminRequest.createCollection("COLL1", "conf", 1, 1)
- .setPolicy("nodelete")
- .process(cluster.getSolrClient());
- String removePolicyCommand = "{remove-policy : nodelete}";
- createAutoScalingRequest(SolrRequest.METHOD.POST, removePolicyCommand);
- try {
- solrClient.request(createAutoScalingRequest(SolrRequest.METHOD.POST, removePolicyCommand));
- fail("should have failed");
- } catch (Exception e) {
- assertTrue(e.getMessage().contains("is being used by collection"));
- }
- solrClient.request(CollectionAdminRequest.deleteCollection("COLL1"));
- }
public static SolrRequest createAutoScalingRequest(SolrRequest.METHOD m, String message) {
return createAutoScalingRequest(m, null, message);
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9744e684/solr/solrj/src/java/org/apache/solr/common/cloud/ClusterState.java
----------------------------------------------------------------------
diff --git a/solr/solrj/src/java/org/apache/solr/common/cloud/ClusterState.java b/solr/solrj/src/java/org/apache/solr/common/cloud/ClusterState.java
index 119b038..772ef75 100644
--- a/solr/solrj/src/java/org/apache/solr/common/cloud/ClusterState.java
+++ b/solr/solrj/src/java/org/apache/solr/common/cloud/ClusterState.java
@@ -25,12 +25,10 @@ import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger;
-import java.util.function.Consumer;
import org.apache.solr.common.SolrException;
import org.apache.solr.common.SolrException.ErrorCode;
import org.apache.solr.common.util.Utils;
-import org.apache.zookeeper.KeeperException;
import org.apache.zookeeper.Watcher;
import org.noggit.JSONWriter;
@@ -40,7 +38,7 @@ import org.noggit.JSONWriter;
* @lucene.experimental
*/
public class ClusterState implements JSONWriter.Writable {
-
+
private final Integer znodeVersion;
private final Map<String, CollectionRef> collectionStates, immutableCollectionStates;
@@ -291,9 +289,9 @@ public class ClusterState implements JSONWriter.Writable {
}
return null;
}
-
+
/**
- * Check if node is alive.
+ * Check if node is alive.
*/
public boolean liveNodesContain(String name) {
return liveNodes.contains(name);
@@ -312,7 +310,7 @@ public class ClusterState implements JSONWriter.Writable {
}
/**
* Create ClusterState from json string that is typically stored in zookeeper.
- *
+ *
* @param version zk version of the clusterstate.json file (bytes)
* @param bytes clusterstate.json as a byte array
* @param liveNodes list of live nodes
@@ -396,7 +394,7 @@ public class ClusterState implements JSONWriter.Writable {
/**
* The version of clusterstate.json in ZooKeeper.
- *
+ *
* @return null if ClusterState was created for publication, not consumption
* @deprecated true cluster state spans many ZK nodes, stop depending on the version number of the shared node!
*/
@@ -446,20 +444,7 @@ public class ClusterState implements JSONWriter.Writable {
public Map<String, CollectionRef> getCollectionStates() {
return immutableCollectionStates;
}
- public void forEachCollection(Consumer<DocCollection> consumer) {
- collectionStates.forEach((s, collectionRef) -> {
- try {
- consumer.accept(collectionRef.get());
- } catch (SolrException e) {
- if (e.getCause() instanceof KeeperException.NoNodeException) {
- //don't do anything. This collection does not exist
- } else{
- throw e;
- }
- }
- });
- }
public static class CollectionRef {
protected final AtomicInteger gets = new AtomicInteger();
private final DocCollection coll;