murblanc commented on a change in pull request #1528:
URL: https://github.com/apache/lucene-solr/pull/1528#discussion_r429811700
##########
File path: solr/core/src/java/org/apache/solr/cloud/ZkController.java
##########
@@ -491,6 +494,41 @@ public boolean isClosed() {
assert ObjectReleaseTracker.track(this);
}
+ /**
+ * <p>Verifies if /clusterstate.json exists in Zookeepeer, and if it does
and is not empty, refuses to start and outputs
+ * a helpful message regarding collection migration.</p>
+ *
+ * <p>If /clusterstate.json exists and is empty, it is removed.</p>
+ */
+ private void checkNoOldClusterstate(final SolrZkClient zkClient) throws
InterruptedException {
+ try {
+ if (!zkClient.exists(ZkStateReader.UNSUPPORTED_CLUSTER_STATE, true)) {
+ return;
+ }
+
+ final byte[] data =
zkClient.getData(ZkStateReader.UNSUPPORTED_CLUSTER_STATE, null, null, true);
+
+ if (Arrays.equals("{}".getBytes(StandardCharsets.UTF_8), data)) {
+ // Empty json. This log will only occur once.
+ log.warn("{} no longer supported starting with Solr 9. Found empty
file on Zookeeper, deleting it.", ZkStateReader.UNSUPPORTED_CLUSTER_STATE);
+ zkClient.delete(ZkStateReader.UNSUPPORTED_CLUSTER_STATE, -1, true);
Review comment:
I don't think that's an issue: if /clusterstate.json is non empty, no
node running 9.0 will start.
If /clusterstate.json exists and is empty, the first starting node on 9.0
will delete it as it starts.
8.x nodes that might start afterwards (who knows) will I believe recreate
the file (that will be deleted again when a 9.0 node starts).
----------------------------------------------------------------
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]