From 315be452d706f423fa92029a2745eb37751d2639 Mon Sep 17 00:00:00 2001 From: Keith Turner Date: Thu, 27 Jun 2024 17:31:03 -0400 Subject: [PATCH 1/3] removes unused zookeeper nodes in upgrade --- .../main/java/org/apache/accumulo/core/Constants.java | 3 --- .../accumulo/manager/upgrade/Upgrader11to12.java | 11 ++++++++++- .../accumulo/manager/upgrade/Upgrader11to12Test.java | 7 +++++++ 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/core/src/main/java/org/apache/accumulo/core/Constants.java b/core/src/main/java/org/apache/accumulo/core/Constants.java index dd5b7d2f7a5..f8fec90d1df 100644 --- a/core/src/main/java/org/apache/accumulo/core/Constants.java +++ b/core/src/main/java/org/apache/accumulo/core/Constants.java @@ -63,7 +63,6 @@ public class Constants { public static final String ZMONITOR_HTTP_ADDR = ZMONITOR + "/http_addr"; // used by < 2.1 table and namespace configurations - public static final String ZCONF_LEGACY = "/conf"; public static final String ZCONFIG = "/config"; public static final String ZTSERVERS = "/tservers"; @@ -78,8 +77,6 @@ public class Constants { public static final String ZDEAD = "/dead"; public static final String ZDEADTSERVERS = ZDEAD + "/tservers"; - public static final String ZTRACERS = "/tracers"; - public static final String ZPROBLEMS = "/problems"; public static final String BULK_ARBITRATOR_TYPE = "bulkTx"; diff --git a/server/manager/src/main/java/org/apache/accumulo/manager/upgrade/Upgrader11to12.java b/server/manager/src/main/java/org/apache/accumulo/manager/upgrade/Upgrader11to12.java index 0c5e0865498..32327d933ec 100644 --- a/server/manager/src/main/java/org/apache/accumulo/manager/upgrade/Upgrader11to12.java +++ b/server/manager/src/main/java/org/apache/accumulo/manager/upgrade/Upgrader11to12.java @@ -69,13 +69,22 @@ public class Upgrader11to12 implements Upgrader { static final Set UPGRADE_FAMILIES = Set.of(DataFileColumnFamily.NAME, CHOPPED, ExternalCompactionColumnFamily.NAME); + public static final String ZTRACERS = "/tracers"; + public static final String ZCONF_LEGACY = "/conf"; + @Override public void upgradeZookeeper(@NonNull ServerContext context) { log.debug("Upgrade ZooKeeper: upgrading to data version {}", METADATA_FILE_JSON_ENCODING); - var rootBase = ZooUtil.getRoot(context.getInstanceID()) + ZROOT_TABLET; + var zooRoot = ZooUtil.getRoot(context.getInstanceID()); + var rootBase = zooRoot + ZROOT_TABLET; try { var zrw = context.getZooReaderWriter(); + + // clean up nodes no longer in use + zrw.recursiveDelete(zooRoot + ZTRACERS, ZooUtil.NodeMissingPolicy.SKIP); + zrw.recursiveDelete(zooRoot + ZCONF_LEGACY, ZooUtil.NodeMissingPolicy.SKIP); + Stat stat = new Stat(); byte[] rootData = zrw.getData(rootBase, stat); diff --git a/server/manager/src/test/java/org/apache/accumulo/manager/upgrade/Upgrader11to12Test.java b/server/manager/src/test/java/org/apache/accumulo/manager/upgrade/Upgrader11to12Test.java index 14d19de4655..bde5dbce2aa 100644 --- a/server/manager/src/test/java/org/apache/accumulo/manager/upgrade/Upgrader11to12Test.java +++ b/server/manager/src/test/java/org/apache/accumulo/manager/upgrade/Upgrader11to12Test.java @@ -50,6 +50,7 @@ import org.apache.accumulo.core.data.Mutation; import org.apache.accumulo.core.data.Value; import org.apache.accumulo.core.fate.zookeeper.ZooReaderWriter; +import org.apache.accumulo.core.fate.zookeeper.ZooUtil; import org.apache.accumulo.core.metadata.StoredTabletFile; import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection.ChoppedColumnFamily; import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection.DataFileColumnFamily; @@ -366,6 +367,12 @@ public void upgradeZooKeeperTest() throws Exception { expect(zrw.overwritePersistentData(eq("/accumulo/" + iid.canonical() + "/root_tablet"), capture(byteCapture), eq(123))).andReturn(true).once(); + zrw.recursiveDelete("/accumulo/" + iid.canonical() + "/tracers", + ZooUtil.NodeMissingPolicy.SKIP); + expectLastCall().once(); + zrw.recursiveDelete("/accumulo/" + iid.canonical() + "/conf", ZooUtil.NodeMissingPolicy.SKIP); + expectLastCall().once(); + replay(context, zrw); upgrader.upgradeZookeeper(context); From 388d5db83ca7d5b8f166da9ff01bc8e72496d283 Mon Sep 17 00:00:00 2001 From: Keith Turner Date: Thu, 27 Jun 2024 17:34:54 -0400 Subject: [PATCH 2/3] remove comment --- core/src/main/java/org/apache/accumulo/core/Constants.java | 1 - 1 file changed, 1 deletion(-) diff --git a/core/src/main/java/org/apache/accumulo/core/Constants.java b/core/src/main/java/org/apache/accumulo/core/Constants.java index f8fec90d1df..411af753cfe 100644 --- a/core/src/main/java/org/apache/accumulo/core/Constants.java +++ b/core/src/main/java/org/apache/accumulo/core/Constants.java @@ -62,7 +62,6 @@ public class Constants { public static final String ZMONITOR_LOCK = ZMONITOR + "/lock"; public static final String ZMONITOR_HTTP_ADDR = ZMONITOR + "/http_addr"; - // used by < 2.1 table and namespace configurations public static final String ZCONFIG = "/config"; public static final String ZTSERVERS = "/tservers"; From 8076aa876c61201d703720cecc453f3f12a475c9 Mon Sep 17 00:00:00 2001 From: Keith Turner Date: Fri, 12 Jul 2024 16:01:20 -0400 Subject: [PATCH 3/3] remove uneeded code --- .../org/apache/accumulo/manager/upgrade/Upgrader11to12.java | 2 -- .../org/apache/accumulo/manager/upgrade/Upgrader11to12Test.java | 2 -- 2 files changed, 4 deletions(-) diff --git a/server/manager/src/main/java/org/apache/accumulo/manager/upgrade/Upgrader11to12.java b/server/manager/src/main/java/org/apache/accumulo/manager/upgrade/Upgrader11to12.java index 32327d933ec..ffeaf9a015f 100644 --- a/server/manager/src/main/java/org/apache/accumulo/manager/upgrade/Upgrader11to12.java +++ b/server/manager/src/main/java/org/apache/accumulo/manager/upgrade/Upgrader11to12.java @@ -70,7 +70,6 @@ public class Upgrader11to12 implements Upgrader { Set.of(DataFileColumnFamily.NAME, CHOPPED, ExternalCompactionColumnFamily.NAME); public static final String ZTRACERS = "/tracers"; - public static final String ZCONF_LEGACY = "/conf"; @Override public void upgradeZookeeper(@NonNull ServerContext context) { @@ -83,7 +82,6 @@ public void upgradeZookeeper(@NonNull ServerContext context) { // clean up nodes no longer in use zrw.recursiveDelete(zooRoot + ZTRACERS, ZooUtil.NodeMissingPolicy.SKIP); - zrw.recursiveDelete(zooRoot + ZCONF_LEGACY, ZooUtil.NodeMissingPolicy.SKIP); Stat stat = new Stat(); byte[] rootData = zrw.getData(rootBase, stat); diff --git a/server/manager/src/test/java/org/apache/accumulo/manager/upgrade/Upgrader11to12Test.java b/server/manager/src/test/java/org/apache/accumulo/manager/upgrade/Upgrader11to12Test.java index bde5dbce2aa..d176a4c56c8 100644 --- a/server/manager/src/test/java/org/apache/accumulo/manager/upgrade/Upgrader11to12Test.java +++ b/server/manager/src/test/java/org/apache/accumulo/manager/upgrade/Upgrader11to12Test.java @@ -370,8 +370,6 @@ public void upgradeZooKeeperTest() throws Exception { zrw.recursiveDelete("/accumulo/" + iid.canonical() + "/tracers", ZooUtil.NodeMissingPolicy.SKIP); expectLastCall().once(); - zrw.recursiveDelete("/accumulo/" + iid.canonical() + "/conf", ZooUtil.NodeMissingPolicy.SKIP); - expectLastCall().once(); replay(context, zrw);