This is an automated email from the ASF dual-hosted git repository.
dlmarion pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/accumulo.git
The following commit(s) were added to refs/heads/main by this push:
new af62a8e21d Removed admin locks cmd, instructions on new cmds (#5934)
af62a8e21d is described below
commit af62a8e21da79070195f96b5d278b89b537eb048
Author: Dave Marion <[email protected]>
AuthorDate: Tue Sep 30 08:23:13 2025 -0400
Removed admin locks cmd, instructions on new cmds (#5934)
Removed the Admin 'locks' command and provided the user
with instructions on which commands to use to remove the
server locks.
Closes #5889
---
.../org/apache/accumulo/server/util/Admin.java | 41 +++++++----
.../accumulo/server/util/TabletServerLocks.java | 84 ----------------------
2 files changed, 27 insertions(+), 98 deletions(-)
diff --git
a/server/base/src/main/java/org/apache/accumulo/server/util/Admin.java
b/server/base/src/main/java/org/apache/accumulo/server/util/Admin.java
index c1b6667366..c3dd6474f5 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/util/Admin.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/util/Admin.java
@@ -113,6 +113,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.beust.jcommander.JCommander;
+import com.beust.jcommander.MissingCommandException;
import com.beust.jcommander.Parameter;
import com.beust.jcommander.Parameters;
import com.google.auto.service.AutoService;
@@ -129,6 +130,9 @@ public class Admin implements KeywordExecutable {
private static final Logger log = LoggerFactory.getLogger(Admin.class);
private final CountDownLatch lockAcquiredLatch = new CountDownLatch(1);
+ @Deprecated(since = "4.0.0")
+ private static final String LOCKS_COMMAND = "locks";
+
private static class SubCommandOpts {
@Parameter(names = {"-h", "-?", "--help", "-help"}, help = true)
public boolean help = false;
@@ -305,13 +309,6 @@ public class Admin implements KeywordExecutable {
commandDescription = "Changes the unique secret given to the instance
that all servers must know.")
static class ChangeSecretCommand {}
- @Parameters(commandNames = "locks",
- commandDescription = "List or delete Tablet Server locks. Default with
no arguments is to list the locks.")
- static class TabletServerLocksCommand extends SubCommandOpts {
- @Parameter(names = "-delete", description = "specify a tablet server lock
to delete")
- String delete = null;
- }
-
@Parameters(commandNames = "deleteZooInstance",
commandDescription = "Deletes specific instance name or id from
zookeeper or cleans up all old instances.")
static class DeleteZooInstanceCommand extends SubCommandOpts {
@@ -462,9 +459,6 @@ public class Admin implements KeywordExecutable {
ListInstancesCommand listInstancesOpts = new ListInstancesCommand();
cl.addCommand(listInstancesOpts);
- TabletServerLocksCommand tServerLocksOpts = new TabletServerLocksCommand();
- cl.addCommand(tServerLocksOpts);
-
PingCommand pingCommand = new PingCommand();
cl.addCommand(pingCommand);
@@ -487,7 +481,29 @@ public class Admin implements KeywordExecutable {
VolumesCommand volumesCommand = new VolumesCommand();
cl.addCommand(volumesCommand);
- cl.parse(args);
+ try {
+ cl.parse(args);
+ } catch (MissingCommandException e) {
+ // Process removed commands to provide alternate approach
+ boolean foundRemovedCommand = false;
+ for (String arg : args) {
+ switch (arg) {
+ case LOCKS_COMMAND:
+ foundRemovedCommand = true;
+ System.out.println("'locks' command has been removed. Use
'serviceStatus' command"
+ + " to list processes and 'stop -f' command to remove their
locks.");
+ break;
+ default:
+ break;
+ }
+ }
+ if (foundRemovedCommand) {
+ return;
+ } else {
+ cl.usage();
+ return;
+ }
+ }
if (cl.getParsedCommand() == null) {
cl.usage();
@@ -536,9 +552,6 @@ public class Admin implements KeywordExecutable {
deleteZooInstOpts.auth);
} else if (cl.getParsedCommand().equals("restoreZoo")) {
RestoreZookeeper.execute(conf, restoreZooOpts.file,
restoreZooOpts.overwrite);
- } else if (cl.getParsedCommand().equals("locks")) {
- TabletServerLocks.execute(context, args.length > 2 ? args[2] : null,
- tServerLocksOpts.delete);
} else if (cl.getParsedCommand().equals("fate")) {
executeFateOpsCommand(context, fateOpsCommand);
} else if (cl.getParsedCommand().equals("serviceStatus")) {
diff --git
a/server/base/src/main/java/org/apache/accumulo/server/util/TabletServerLocks.java
b/server/base/src/main/java/org/apache/accumulo/server/util/TabletServerLocks.java
deleted file mode 100644
index 545be6f88a..0000000000
---
a/server/base/src/main/java/org/apache/accumulo/server/util/TabletServerLocks.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.accumulo.server.util;
-
-import java.util.Optional;
-import java.util.Set;
-
-import org.apache.accumulo.core.fate.zookeeper.ZooReaderWriter;
-import org.apache.accumulo.core.lock.ServiceLock;
-import org.apache.accumulo.core.lock.ServiceLockData;
-import org.apache.accumulo.core.lock.ServiceLockData.ThriftService;
-import org.apache.accumulo.core.lock.ServiceLockPaths.AddressSelector;
-import org.apache.accumulo.core.lock.ServiceLockPaths.ResourceGroupPredicate;
-import org.apache.accumulo.core.lock.ServiceLockPaths.ServiceLockPath;
-import org.apache.accumulo.core.zookeeper.ZooCache;
-import org.apache.accumulo.server.ServerContext;
-
-import com.google.common.base.Preconditions;
-import com.google.common.net.HostAndPort;
-
-public class TabletServerLocks {
-
- public static void execute(final ServerContext context, final String lock,
final String delete)
- throws Exception {
-
- ZooCache cache = context.getZooCache();
- ZooReaderWriter zoo = context.getZooSession().asReaderWriter();
-
- if (delete == null) {
- Set<ServiceLockPath> tabletServers = context.getServerPaths()
- .getTabletServer(ResourceGroupPredicate.ANY, AddressSelector.all(),
false);
- if (tabletServers.isEmpty()) {
- System.err.println("No tservers found in ZK");
- }
-
- for (ServiceLockPath tabletServer : tabletServers) {
- Optional<ServiceLockData> lockData = ServiceLock.getLockData(cache,
tabletServer, null);
- final String holder;
- if (lockData.isPresent()) {
- holder =
lockData.orElseThrow().getAddressString(ThriftService.TSERV);
- } else {
- holder = "<none>";
- }
-
- System.out.printf("%32s %16s%n", tabletServer.getServer(), holder);
- }
- } else {
- if (lock == null) {
- printUsage();
- } else {
- var hostAndPort = HostAndPort.fromString(lock);
- Set<ServiceLockPath> paths = context.getServerPaths()
- .getTabletServer(ResourceGroupPredicate.ANY,
AddressSelector.exact(hostAndPort), true);
- Preconditions.checkArgument(paths.size() == 1,
- lock + " does not match a single ZooKeeper TabletServer lock.
matches=" + paths);
- ServiceLockPath path = paths.iterator().next();
- ServiceLock.deleteLock(zoo, path);
- System.out.printf("Deleted %s", path.toString());
- }
-
- }
- }
-
- private static void printUsage() {
- System.out.println("Usage : accumulo admin locks -delete <tserver lock>");
- }
-
-}