janhoy commented on code in PR #5371:
URL: https://github.com/apache/solr/pull/5371#discussion_r4655718369


##########
solr/core/src/java/org/apache/solr/pkg/PackageStore.java:
##########
@@ -336,11 +340,20 @@ void deleteVersion(String packageName, String version) {
                 }
                 versions.remove(idxToRemove);
                 packages.znodeVersion = stat.getVersion() + 1;
+                finalState[0] = packages;
                 return Utils.toJSON(packages);
               });
     } catch (KeeperException | InterruptedException e) {
+      finalState[0] = null;
       handleZkErr(e);
     }
+
+    if (finalState[0] == null) {
+      return null;
+    }
+    pkgs = finalState[0];
+    packageLoader.refreshPackageConf();

Review Comment:
   Agreed, and `addVersion` had the same race. Both now install the new state 
only if it isn't older than the current one.



##########
solr/core/src/java/org/apache/solr/pkg/ClusterPackage.java:
##########
@@ -109,7 +109,10 @@ public SolrJerseyResponse deletePackageVersion(String 
packageName, String versio
     final var response = new SolrJerseyResponse();
     PackageStore packageStore = 
coreContainer.getPackageLoader().getPackageStore();
 
-    packageStore.deleteVersion(packageName, version);
+    Integer newVersion = packageStore.deleteVersion(packageName, version);
+    if (newVersion != null) {
+      notifyAllNodesToSync(newVersion);

Review Comment:
   Added: the test now runs on two nodes and checks the delete is visible right 
away on the node that didn't handle it.



-- 
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.

To unsubscribe, e-mail: [email protected]

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