Skip to content

Commit

Permalink
Implemented PR suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
dlmarion committed Jan 15, 2025
1 parent db30a4f commit a358031
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -280,12 +280,10 @@ public synchronized void stop(ServerType server, String hostname) throws IOExcep
try {
cluster.stopProcessWithTimeout(managerProcess, 30, TimeUnit.SECONDS);
try {
new ZooZap().zap(cluster.getServerContext().getSiteConfiguration(),
new String[] {"-manager"});
} catch (Exception e) {
new ZooZap().zap(cluster.getServerContext().getSiteConfiguration(), "-manager");
} catch (RuntimeException e) {
log.error("Error zapping Manager zookeeper lock", e);
}

} catch (ExecutionException | TimeoutException e) {
log.warn("Manager did not fully stop after 30 seconds", e);
} catch (InterruptedException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.function.Supplier;
import java.util.stream.Stream;

Expand Down Expand Up @@ -835,9 +836,9 @@ public synchronized void stop() throws IOException, InterruptedException {
// is restarted, then the processes will start right away
// and not wait for the old locks to be cleaned up.
try {
new ZooZap().zap(getServerContext().getSiteConfiguration(), new String[] {"-manager",
"-compaction-coordinators", "-tservers", "-compactors", "-sservers"});
} catch (Exception e) {
new ZooZap().zap(getServerContext().getSiteConfiguration(), "-manager",
"-compaction-coordinators", "-tservers", "-compactors", "-sservers");
} catch (RuntimeException e) {
log.error("Error zapping zookeeper locks", e);
}
control.stop(ServerType.ZOOKEEPER, null);
Expand All @@ -858,11 +859,12 @@ public synchronized void stop() throws IOException, InterruptedException {
if (startCalled) {
final ServerContext ctx = getServerContext();
final String zRoot = getServerContext().getZooKeeperRoot();
ctx.getZooCache().clear((path) -> path.startsWith(zRoot + Constants.ZMANAGER_LOCK));
ctx.getZooCache().clear((path) -> path.startsWith(zRoot + Constants.ZGC_LOCK));
ctx.getZooCache().clear((path) -> path.startsWith(zRoot + Constants.ZCOMPACTORS));
ctx.getZooCache().clear((path) -> path.startsWith(zRoot + Constants.ZSSERVERS));
ctx.getZooCache().clear((path) -> path.startsWith(zRoot + Constants.ZTSERVERS));
Predicate<String> pred = path -> false;
for (String lockPath : Set.of(Constants.ZMANAGER_LOCK, Constants.ZGC_LOCK,
Constants.ZCOMPACTORS, Constants.ZSSERVERS, Constants.ZTSERVERS)) {
pred = pred.or(path -> path.startsWith(zRoot + lockPath));
}
ctx.getZooCache().clear(pred);
}

// ACCUMULO-2985 stop the ExecutorService after we finished using it to stop accumulo procs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public void execute(String[] args) throws Exception {
}
}

public void zap(SiteConfiguration siteConf, String[] args) {
public void zap(SiteConfiguration siteConf, String... args) {
Opts opts = new Opts();
opts.parseArgs(keyword(), args);

Expand Down

0 comments on commit a358031

Please sign in to comment.