keith-turner commented on a change in pull request #1912:
URL: https://github.com/apache/accumulo/pull/1912#discussion_r572260732
##########
File path:
server/base/src/main/java/org/apache/accumulo/server/log/WalStateManager.java
##########
@@ -44,7 +44,7 @@
* by tablet servers and the replication machinery.
*
* <p>
- * The Master needs to know the state of the WALs to mark tablets during
recovery. The GC needs to
+ * The Manager needs to know the state of the WALs to mark tablets during
recovery. The GC needs to
Review comment:
Given this class is called WalStateManager, use of Manager in the docs
may be a bit ambiguous. Thinking could do the following, but not sure its
needed.
```suggestion
* The Accumulo Manager needs to know the state of the WALs to mark tablets
during recovery. The GC needs to
```
##########
File path:
server/manager/src/main/java/org/apache/accumulo/manager/upgrade/RenameMasterDirInZK.java
##########
@@ -0,0 +1,69 @@
+/*
+ * 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
+ *
+ * http://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.manager.upgrade;
+
+import org.apache.accumulo.core.Constants;
+import org.apache.accumulo.core.conf.SiteConfiguration;
+import org.apache.accumulo.fate.zookeeper.ZooReaderWriter;
+import org.apache.accumulo.fate.zookeeper.ZooUtil;
+import org.apache.accumulo.server.ServerContext;
+import org.apache.zookeeper.KeeperException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * A utility to handle the renaming of "/masters" to "/managers" in Zookeeper
when upgrading from a
+ * 2.0 (or earlier) to 2.1 instance. This utility is invoked automatically by
+ * {@link org.apache.accumulo.manager.state.SetGoalState} (which normally runs
first as a part of
+ * accumulo startup scripts). However, if a user is not using the standard
scripts or wishes to
+ * perform the upgrade as a separate process, this utility can be invoked with:
+ *
+ * <pre>
+ * {@code
+ * bin/accumulo org.apache.accumulo.manager.upgrade.RenameMasterDirInZK
+ * }
+ * </pre>
+ */
+public class RenameMasterDirInZK {
+ private static final Logger LOG =
LoggerFactory.getLogger(RenameMasterDirInZK.class);
+
+ public static void main(String[] args) {
+ var ctx = new ServerContext(SiteConfiguration.auto());
+ if (!renameMasterDirInZK(ctx)) {
+ LOG.info("Managers directory already exists in ZooKeeper. Not attempting
rename.");
Review comment:
Will this always show up in the console when starting Accumulo? If so
maybe it could be debug.
##########
File path:
server/manager/src/main/java/org/apache/accumulo/manager/upgrade/RenameMasterDirInZK.java
##########
@@ -0,0 +1,69 @@
+/*
+ * 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
+ *
+ * http://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.manager.upgrade;
+
+import org.apache.accumulo.core.Constants;
+import org.apache.accumulo.core.conf.SiteConfiguration;
+import org.apache.accumulo.fate.zookeeper.ZooReaderWriter;
+import org.apache.accumulo.fate.zookeeper.ZooUtil;
+import org.apache.accumulo.server.ServerContext;
+import org.apache.zookeeper.KeeperException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * A utility to handle the renaming of "/masters" to "/managers" in Zookeeper
when upgrading from a
+ * 2.0 (or earlier) to 2.1 instance. This utility is invoked automatically by
+ * {@link org.apache.accumulo.manager.state.SetGoalState} (which normally runs
first as a part of
+ * accumulo startup scripts). However, if a user is not using the standard
scripts or wishes to
+ * perform the upgrade as a separate process, this utility can be invoked with:
+ *
+ * <pre>
+ * {@code
+ * bin/accumulo org.apache.accumulo.manager.upgrade.RenameMasterDirInZK
+ * }
+ * </pre>
+ */
+public class RenameMasterDirInZK {
+ private static final Logger LOG =
LoggerFactory.getLogger(RenameMasterDirInZK.class);
+
+ public static void main(String[] args) {
+ var ctx = new ServerContext(SiteConfiguration.auto());
+ if (!renameMasterDirInZK(ctx)) {
+ LOG.info("Managers directory already exists in ZooKeeper. Not attempting
rename.");
+ }
+ }
+
+ public static boolean renameMasterDirInZK(ServerContext ctx) {
+ final ZooReaderWriter zoo = ctx.getZooReaderWriter();
+ final String mastersZooDir = ctx.getZooKeeperRoot() + "/masters";
+ final String managersZooDir = ctx.getZooKeeperRoot() + Constants.ZMANAGERS;
+ try {
+ boolean managersDirMissing = !zoo.exists(managersZooDir);
+ if (managersDirMissing) {
+ LOG.info("Renaming ZooKeeper directory {} to {}.", mastersZooDir,
managersZooDir);
+ zoo.recursiveCopyPersistentOverwrite(mastersZooDir, managersZooDir);
+ zoo.recursiveDelete(mastersZooDir, ZooUtil.NodeMissingPolicy.SKIP);
Review comment:
Given how important this is, could be more verbose.
```suggestion
LOG.info("Copying ZooKeeper directory {} to {}.", mastersZooDir,
managersZooDir);
zoo.recursiveCopyPersistentOverwrite(mastersZooDir, managersZooDir);
LOG.info("Deleting ZooKeeper directory {}.", mastersZooDir);
zoo.recursiveDelete(mastersZooDir, ZooUtil.NodeMissingPolicy.SKIP);
```
----------------------------------------------------------------
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]