murblanc commented on a change in pull request #2373:
URL: https://github.com/apache/lucene-solr/pull/2373#discussion_r576340130



##########
File path: 
solr/core/src/java/org/apache/solr/cluster/placement/plugins/AffinityPlacementFactory.java
##########
@@ -280,25 +250,31 @@ public void verifyAllowedModification(ModificationRequest 
modificationRequest, P
 
     private void verifyDeleteCollection(DeleteCollectionRequest 
deleteCollectionRequest, PlacementContext placementContext) throws 
PlacementModificationException, InterruptedException {
       Cluster cluster = placementContext.getCluster();
-      Set<String> colocatedCollections = 
colocatedWith.getOrDefault(deleteCollectionRequest.getCollection().getName(), 
Set.of());
-      for (String primaryName : colocatedCollections) {
-        try {
-          if (cluster.getCollection(primaryName) != null) {
-            // still exists
-            throw new PlacementModificationException("colocated collection " + 
primaryName +
-                " of " + deleteCollectionRequest.getCollection().getName() + " 
still present");
-          }
-        } catch (IOException e) {
-          throw new PlacementModificationException("failed to retrieve 
colocated collection information", e);
+      Set<String> colocatedWith = new HashSet<>();
+      for (SolrCollection collection : cluster.collections()) {

Review comment:
       This loop is frightening... Looping over all collection will be 
expensive. Can't we instead update collection properties with the "reverse" of 
the `withCollection` relation?
   Or that means that for high scale SolrCloud clusters (WIP), `withCollection` 
is strongly discouraged.

##########
File path: 
solr/core/src/java/org/apache/solr/cluster/placement/impl/SimpleClusterAbstractionsImpl.java
##########
@@ -292,6 +303,17 @@ public boolean equals(Object obj) {
     public int hashCode() {
       return Objects.hash(shardName, collection, shardState);
     }
+
+    @Override
+    public String toString() {
+      return "ShardImpl{" +
+          "shardName='" + shardName + '\'' +

Review comment:
       Why quote the shard name and not the collection name?

##########
File path: 
solr/core/src/java/org/apache/solr/cluster/placement/impl/SimpleClusterAbstractionsImpl.java
##########
@@ -432,5 +454,17 @@ public boolean equals(Object obj) {
     public int hashCode() {
       return Objects.hash(replicaName, coreName, shard, replicaType, 
replicaState, node);
     }
+
+    @Override
+    public String toString() {
+      return "ReplicaImpl{" +
+          "replicaName='" + replicaName + '\'' +
+          ", coreName='" + coreName + '\'' +

Review comment:
       quoting strategy on returned string unclear




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to