You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by cs...@apache.org on 2022/12/19 22:04:52 UTC
[accumulo] branch main updated: Add back in manager PropertyRenamer to ConfigPropertyUpgraderIT to fix test (#3135)
This is an automated email from the ASF dual-hosted git repository.
cshannon 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 f7a62bf46b Add back in manager PropertyRenamer to ConfigPropertyUpgraderIT to fix test (#3135)
f7a62bf46b is described below
commit f7a62bf46bff438c1f77c62d6261f33fa9c0beb3
Author: Christopher L. Shannon <ch...@gmail.com>
AuthorDate: Mon Dec 19 17:04:45 2022 -0500
Add back in manager PropertyRenamer to ConfigPropertyUpgraderIT to fix test (#3135)
---
.../accumulo/core/conf/DeprecatedPropertyUtil.java | 7 +++++
.../accumulo/test/conf/util/LegacyPropData.java | 4 ---
.../test/upgrade/ConfigPropertyUpgraderIT.java | 34 ++++++++++++++++++----
3 files changed, 35 insertions(+), 10 deletions(-)
diff --git a/core/src/main/java/org/apache/accumulo/core/conf/DeprecatedPropertyUtil.java b/core/src/main/java/org/apache/accumulo/core/conf/DeprecatedPropertyUtil.java
index 18c587206d..8cea352fb9 100644
--- a/core/src/main/java/org/apache/accumulo/core/conf/DeprecatedPropertyUtil.java
+++ b/core/src/main/java/org/apache/accumulo/core/conf/DeprecatedPropertyUtil.java
@@ -87,4 +87,11 @@ public class DeprecatedPropertyUtil {
return replacement;
}
+ /**
+ * @return The list of property renamers
+ */
+ public static List<PropertyRenamer> getPropertyRenamers() {
+ return renamers;
+ }
+
}
diff --git a/test/src/main/java/org/apache/accumulo/test/conf/util/LegacyPropData.java b/test/src/main/java/org/apache/accumulo/test/conf/util/LegacyPropData.java
index e00035a7df..59be787cd0 100644
--- a/test/src/main/java/org/apache/accumulo/test/conf/util/LegacyPropData.java
+++ b/test/src/main/java/org/apache/accumulo/test/conf/util/LegacyPropData.java
@@ -64,11 +64,7 @@ public class LegacyPropData {
names.add(new PropNode(zkRoot + Constants.ZUSERS, null));
names.add(new PropNode(zkRoot + "/wals", null));
names.add(new PropNode(zkRoot + "/bulk_failed_copyq/locks", null));
- names.add(new PropNode(zkRoot + "/config/master.bulk.retries", "4"));
- names.add(new PropNode(zkRoot + "/config/master.bulk.timeout", "10m"));
names.add(new PropNode(zkRoot + "/config/table.bloom.enabled", "true"));
- names.add(new PropNode(zkRoot + "/config/master.bulk.rename.threadpool.size", "10"));
- names.add(new PropNode(zkRoot + "/config/master.bulk.threadpool.size", "4"));
names.add(new PropNode(zkRoot + "/dead/tservers", null));
names.add(new PropNode(zkRoot + "/gc/lock", null));
names.add(new PropNode(zkRoot + "/gc/lock/zlock-0000000000", null));
diff --git a/test/src/main/java/org/apache/accumulo/test/upgrade/ConfigPropertyUpgraderIT.java b/test/src/main/java/org/apache/accumulo/test/upgrade/ConfigPropertyUpgraderIT.java
index 51f17f1c49..fd14764cd6 100644
--- a/test/src/main/java/org/apache/accumulo/test/upgrade/ConfigPropertyUpgraderIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/upgrade/ConfigPropertyUpgraderIT.java
@@ -30,6 +30,7 @@ import java.util.Map;
import java.util.UUID;
import org.apache.accumulo.core.Constants;
+import org.apache.accumulo.core.conf.DeprecatedPropertyUtil;
import org.apache.accumulo.core.data.InstanceId;
import org.apache.accumulo.core.fate.zookeeper.ZooReaderWriter;
import org.apache.accumulo.core.fate.zookeeper.ZooUtil;
@@ -62,6 +63,14 @@ public class ConfigPropertyUpgraderIT {
private static ZooKeeper zooKeeper;
private static ZooReaderWriter zrw;
+ private static final String TEST_DEPRECATED_PREFIX = "upgrader.test.deprecated.";
+ private static final String TEST_UPGRADED_PREFIX = "upgrader.test.upgraded.";
+
+ // Create legacy renamer for this test
+ private static final DeprecatedPropertyUtil.PropertyRenamer TEST_PROP_RENAMER =
+ DeprecatedPropertyUtil.PropertyRenamer.renamePrefix(TEST_DEPRECATED_PREFIX,
+ TEST_UPGRADED_PREFIX);
+
private InstanceId instanceId = null;
@TempDir
@@ -69,6 +78,7 @@ public class ConfigPropertyUpgraderIT {
@BeforeAll
public static void setupZk() {
+ DeprecatedPropertyUtil.getPropertyRenamers().add(TEST_PROP_RENAMER);
// using default zookeeper port - we don't have a full configuration
testZk = new ZooKeeperTestingServer(tempDir);
@@ -81,6 +91,8 @@ public class ConfigPropertyUpgraderIT {
@AfterAll
public static void shutdownZK() throws Exception {
+ DeprecatedPropertyUtil.getPropertyRenamers().remove(TEST_PROP_RENAMER);
+
testZk.close();
}
@@ -97,7 +109,18 @@ public class ConfigPropertyUpgraderIT {
.anyTimes();
expect(context.getInstanceID()).andReturn(instanceId).anyTimes();
+ // Add dummy legacy properties for testing
+ String zkRoot = ZooUtil.getRoot(instanceId);
List<LegacyPropData.PropNode> nodes = LegacyPropData.getData(instanceId);
+ nodes.add(new LegacyPropData.PropNode(
+ zkRoot + Constants.ZCONFIG + "/" + TEST_DEPRECATED_PREFIX + "prop1", "4"));
+ nodes.add(new LegacyPropData.PropNode(
+ zkRoot + Constants.ZCONFIG + "/" + TEST_DEPRECATED_PREFIX + "prop2", "10m"));
+ nodes.add(new LegacyPropData.PropNode(
+ zkRoot + Constants.ZCONFIG + "/" + TEST_DEPRECATED_PREFIX + "prop3", "10"));
+ nodes.add(new LegacyPropData.PropNode(
+ zkRoot + Constants.ZCONFIG + "/" + TEST_DEPRECATED_PREFIX + "prop4", "4"));
+
for (LegacyPropData.PropNode node : nodes) {
zrw.putPersistentData(node.getPath(), node.getData(), ZooUtil.NodeExistsPolicy.SKIP);
}
@@ -139,13 +162,12 @@ public class ConfigPropertyUpgraderIT {
}
Map<String,String> props = vProps.asMap();
-
- // also validates that rname from deprecated master to manager occured.
assertEquals(5, props.size());
- assertEquals("4", props.get("manager.bulk.retries"));
- assertEquals("10m", props.get("manager.bulk.timeout"));
- assertEquals("10", props.get("manager.bulk.rename.threadpool.size"));
- assertEquals("4", props.get("manager.bulk.threadpool.size"));
+ // also validates that rename occurred from deprecated to upgraded names
+ assertEquals("4", props.get(TEST_UPGRADED_PREFIX + "prop1"));
+ assertEquals("10m", props.get(TEST_UPGRADED_PREFIX + "prop2"));
+ assertEquals("10", props.get(TEST_UPGRADED_PREFIX + "prop3"));
+ assertEquals("4", props.get(TEST_UPGRADED_PREFIX + "prop4"));
assertEquals("true", props.get("table.bloom.enabled"));