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



##########
File path: 
solr/core/src/java/org/apache/solr/cluster/placement/plugins/AffinityPlacementFactory.java
##########
@@ -238,11 +258,93 @@ public PlacementPlan computePlacement(Cluster cluster, 
PlacementRequest request,
         // failure. Current code does fail if placement is impossible 
(constraint is at most one replica of a shard on any node).
         for (Replica.ReplicaType replicaType : Replica.ReplicaType.values()) {
           makePlacementDecisions(solrCollection, shardName, availabilityZones, 
replicaType, request.getCountReplicasToCreate(replicaType),
-              attrValues, replicaTypeToNodes, nodesWithReplicas, coresOnNodes, 
placementPlanFactory, replicaPlacements);
+              attrValues, replicaTypeToNodes, nodesWithReplicas, coresOnNodes, 
placementContext.getPlacementPlanFactory(), replicaPlacements);
         }
       }
 
-      return placementPlanFactory.createPlacementPlan(request, 
replicaPlacements);
+      return 
placementContext.getPlacementPlanFactory().createPlacementPlan(request, 
replicaPlacements);
+    }
+
+    @Override
+    public void verifyAllowedModification(ModificationRequest 
modificationRequest, PlacementContext placementContext) throws 
PlacementModificationException, InterruptedException {
+      if (modificationRequest instanceof DeleteShardsRequest) {
+        throw new UnsupportedOperationException("not implemented yet");
+      } else if (modificationRequest instanceof DeleteCollectionRequest) {
+        verifyDeleteCollection((DeleteCollectionRequest) modificationRequest, 
placementContext);
+      } else if (modificationRequest instanceof DeleteReplicasRequest) {
+        verifyDeleteReplicas((DeleteReplicasRequest) modificationRequest, 
placementContext);
+      } else {
+        throw new UnsupportedOperationException("unsupported request type " + 
modificationRequest.getClass().getName());
+      }
+    }
+
+    private void verifyDeleteCollection(DeleteCollectionRequest 
deleteCollectionRequest, PlacementContext placementContext) throws 
PlacementModificationException, InterruptedException {

Review comment:
       I agree. Or change the configuration of the collection (I assume 
`withCollection` can be removed).




----------------------------------------------------------------
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:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org

Reply via email to