HoustonPutman commented on code in PR #5357:
URL: https://github.com/apache/solr/pull/5357#discussion_r4604853109
##########
solr/solr-ref-guide/modules/upgrade-notes/pages/major-changes-in-solr-11.adoc:
##########
@@ -25,6 +25,19 @@ This page highlights the most important changes including
new features and chang
Before starting an upgrade to this version of Solr, please be sure to review
all information about changes from the version you are currently on up to this
one, to include the minor version number changes as well.
For example, if you are currently using Solr 10.1, you should review changes
made in all subsequent 10.x releases in addition to the 11.0-specific changes
on this page.
+=== Rolling Upgrades
+
+If the Overseer is disabled (cluster property `overseerEnabled` or
`SOLR_CLOUD_OVERSEER_ENABLED` set to `false`), Collection and ConfigSet API
locks now use a different ZooKeeper node format.
+10.x and 11 nodes don't see each other's locks, so while both versions are
running, two conflicting commands on the same collection or configset can run
at the same time without an error.
Review Comment:
This makes it sounds like the Collection and ConfigSet API locks use
different ZK node format than each other. Make it more clear that its the
versions that have different implementations
```suggestion
If the Overseer is disabled (cluster property `overseerEnabled` or
`SOLR_CLOUD_OVERSEER_ENABLED` set to `false`), Collection and ConfigSet API
locks now use a different ZooKeeper node format than they did in Solr 10 and
previous versions.
10.x and 11 nodes don't see each other's locks, so while both versions are
running, two conflicting commands on the same collection or configset can run
at the same time without an error.
```
##########
solr/core/src/java/org/apache/solr/cloud/ZkDistributedLockFactory.java:
##########
@@ -38,26 +36,18 @@ abstract class ZkDistributedLockFactory {
protected DistributedLock doCreateLock(
boolean isWriteLock, String lockPath, String lockIdToMirror) {
- try {
- for (int attempt = 1; ; attempt++) {
- try {
- return isWriteLock
- ? new ZkDistributedLock.Write(zkClient, lockPath, lockIdToMirror)
- : new ZkDistributedLock.Read(zkClient, lockPath, lockIdToMirror);
- } catch (KeeperException.NoNodeException e) {
- if (attempt == MAX_CREATE_ATTEMPTS) {
- throw e;
- }
- // Lock dirs are containers, so ZK drops them when empty. Recreate
and try again.
- makeLockPath(lockPath);
- }
+ if (StrUtils.isBlank(lockIdToMirror)) {
+ // Empty payload: otherwise Curator stores the local IP address in every
lock node
+ InterProcessReadWriteLock readWriteLock =
+ new InterProcessReadWriteLock(zkClient.getCuratorFramework(),
lockPath, new byte[0]);
Review Comment:
Maybe it doesn't hurt to put the solr node name there, just for future
reference...
##########
solr/core/src/java/org/apache/solr/cloud/ZkDistributedLockFactory.java:
##########
@@ -38,26 +36,18 @@ abstract class ZkDistributedLockFactory {
protected DistributedLock doCreateLock(
boolean isWriteLock, String lockPath, String lockIdToMirror) {
- try {
- for (int attempt = 1; ; attempt++) {
- try {
- return isWriteLock
- ? new ZkDistributedLock.Write(zkClient, lockPath, lockIdToMirror)
- : new ZkDistributedLock.Read(zkClient, lockPath, lockIdToMirror);
- } catch (KeeperException.NoNodeException e) {
- if (attempt == MAX_CREATE_ATTEMPTS) {
- throw e;
- }
- // Lock dirs are containers, so ZK drops them when empty. Recreate
and try again.
- makeLockPath(lockPath);
- }
+ if (StrUtils.isBlank(lockIdToMirror)) {
+ // Empty payload: otherwise Curator stores the local IP address in every
lock node
+ InterProcessReadWriteLock readWriteLock =
+ new InterProcessReadWriteLock(zkClient.getCuratorFramework(),
lockPath, new byte[0]);
+ if (isWriteLock) {
+ InterProcessReadWriteLock.WriteLock writeLock =
readWriteLock.writeLock();
+ return new ZkDistributedLock.Owned(writeLock, lockPath,
writeLock::getLockPath);
}
- } catch (KeeperException e) {
- throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, e);
- } catch (InterruptedException e) {
- Thread.currentThread().interrupt();
- throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, e);
+ InterProcessReadWriteLock.ReadLock readLock = readWriteLock.readLock();
+ return new ZkDistributedLock.Owned(readLock, lockPath,
readLock::getLockPath);
}
+ return new ZkDistributedLock.Mirrored(zkClient, lockPath, isWriteLock,
lockIdToMirror);
Review Comment:
can we add some else {} blocks here to make it a little easier to read.
--
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]