murblanc commented on a change in pull request #2373:
URL: https://github.com/apache/lucene-solr/pull/2373#discussion_r576411785
##########
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:
We could document to the user that in order to support safe deletes, the
secondary collection must reference the primary one. Then up to the user to
decide if the two collections are updated or not...
At least this leaves a scalable option available.
The other "cleaner" solution is to make collection references a first class
citizen managed correctly (so we can maintain mapping and reverse mapping), but
then the scope increases greatly and changes quite a few things in how
collection are manages (and `withCollection` would then be just one specific
usage of this collection reference mechanism, but maybe the only one...).
No perfect solution here, but once we get to very large numbers of
collections (with collection lists not stored in node memory) the iteration
will be prohibitively expensive (that's why I didn't want having such an
iterator in the first place BTW).
----------------------------------------------------------------
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]