This is an automated email from the ASF dual-hosted git repository.

dlmarion pushed a commit to branch 3.1
in repository https://gitbox.apache.org/repos/asf/accumulo.git

commit d6900d8e659c887e2f0a5dfb0f106cf0de300b6a
Merge: 579b512ec9 712e50ed49
Author: Dave Marion <dlmar...@apache.org>
AuthorDate: Wed Jan 29 13:06:59 2025 +0000

    Merge branch '2.1' into 3.1

 .../org/apache/accumulo/core/lock/ServiceLock.java | 28 ----------------------
 .../org/apache/accumulo/server/util/ZooZap.java    |  4 +++-
 2 files changed, 3 insertions(+), 29 deletions(-)

diff --cc core/src/main/java/org/apache/accumulo/core/lock/ServiceLock.java
index 25cbc98cb6,c6478baff3..e695ac9c00
--- a/core/src/main/java/org/apache/accumulo/core/lock/ServiceLock.java
+++ b/core/src/main/java/org/apache/accumulo/core/lock/ServiceLock.java
@@@ -16,9 -16,8 +16,8 @@@
   * specific language governing permissions and limitations
   * under the License.
   */
 -package org.apache.accumulo.core.fate.zookeeper;
 +package org.apache.accumulo.core.lock;
  
- import static java.nio.charset.StandardCharsets.UTF_8;
  import static java.util.Objects.requireNonNull;
  
  import java.util.ArrayList;
diff --cc server/base/src/main/java/org/apache/accumulo/server/util/ZooZap.java
index 0c2d6f18b6,54c596ea05..4d16127b37
--- a/server/base/src/main/java/org/apache/accumulo/server/util/ZooZap.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/util/ZooZap.java
@@@ -109,42 -111,40 +109,44 @@@ public class ZooZap implements KeywordE
        return;
      }
  
 -    String volDir = 
VolumeConfiguration.getVolumeUris(siteConf).iterator().next();
 -    Path instanceDir = new Path(volDir, "instance_id");
 -    InstanceId iid = VolumeManager.getInstanceIDFromHdfs(instanceDir, new 
Configuration());
 -    ZooReaderWriter zoo = new ZooReaderWriter(siteConf);
 +    try (var zk = new ZooSession(getClass().getSimpleName(), siteConf)) {
 +      // Login as the server on secure HDFS
 +      if (siteConf.getBoolean(Property.INSTANCE_RPC_SASL_ENABLED)) {
 +        SecurityUtil.serverLogin(siteConf);
 +      }
  
 -    if (opts.zapMaster) {
 -      log.warn("The -master option is deprecated. Please use -manager 
instead.");
 -    }
 -    if (opts.zapManager || opts.zapMaster) {
 -      String managerLockPath = Constants.ZROOT + "/" + iid + 
Constants.ZMANAGER_LOCK;
 +      String volDir = 
VolumeConfiguration.getVolumeUris(siteConf).iterator().next();
 +      Path instanceDir = new Path(volDir, "instance_id");
 +      InstanceId iid = VolumeManager.getInstanceIDFromHdfs(instanceDir, new 
Configuration());
 +      var zrw = zk.asReaderWriter();
 +
 +      if (opts.zapManager) {
 +        String managerLockPath = ZooUtil.getRoot(iid) + 
Constants.ZMANAGER_LOCK;
  
 -      try {
 -        zapDirectory(zoo, managerLockPath, opts);
 -      } catch (KeeperException | InterruptedException e) {
 -        e.printStackTrace();
 +        try {
 +          zapDirectory(zrw, managerLockPath, opts);
 +        } catch (KeeperException | InterruptedException e) {
 +          e.printStackTrace();
 +        }
        }
 -    }
  
 -    if (opts.zapTservers) {
 -      String tserversPath = Constants.ZROOT + "/" + iid + Constants.ZTSERVERS;
 -      try {
 -        List<String> children = zoo.getChildren(tserversPath);
 -        for (String child : children) {
 -          message("Deleting " + tserversPath + "/" + child + " from 
zookeeper", opts);
 -
 -          if (opts.zapManager || opts.zapMaster) {
 -            zoo.recursiveDelete(tserversPath + "/" + child, 
NodeMissingPolicy.SKIP);
 -          } else {
 -            var zLockPath = ServiceLock.path(tserversPath + "/" + child);
 -            if (!zoo.getChildren(zLockPath.toString()).isEmpty()) {
 -              try {
 -                ServiceLock.deleteLock(zoo, zLockPath);
 -              } catch (RuntimeException e) {
 -                message("Did not delete " + tserversPath + "/" + child, opts);
 +      if (opts.zapTservers) {
 +        String tserversPath = ZooUtil.getRoot(iid) + Constants.ZTSERVERS;
 +        try {
 +          List<String> children = zrw.getChildren(tserversPath);
 +          for (String child : children) {
 +            message("Deleting " + tserversPath + "/" + child + " from 
zookeeper", opts);
 +
 +            if (opts.zapManager) {
 +              zrw.recursiveDelete(tserversPath + "/" + child, 
NodeMissingPolicy.SKIP);
 +            } else {
 +              var zLockPath = ServiceLock.path(tserversPath + "/" + child);
 +              if (!zrw.getChildren(zLockPath.toString()).isEmpty()) {
-                 if (!ServiceLock.deleteLock(zrw, zLockPath, "tserver")) {
++                try {
++                  ServiceLock.deleteLock(zrw, zLockPath);
++                } catch (RuntimeException e) {
 +                  message("Did not delete " + tserversPath + "/" + child, 
opts);
 +                }
                }
              }
            }

Reply via email to