This is an automated email from the ASF dual-hosted git repository. kturner pushed a commit to branch elasticity in repository https://gitbox.apache.org/repos/asf/accumulo.git
The following commit(s) were added to refs/heads/elasticity by this push: new 2f894ae50b fixes compactions planning with new prefix (#3990) 2f894ae50b is described below commit 2f894ae50bb71309da02f5d960b2cd407c08b201 Author: Keith Turner <ktur...@apache.org> AuthorDate: Tue Nov 28 13:31:40 2023 -0500 fixes compactions planning with new prefix (#3990) Compaction planning using the new conifuratrion prefix was not working when running in TableManagementIterator. This change fixes planning to work in this environment. --- .../util/compaction/CompactionServicesConfig.java | 27 +++++++++------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/core/src/main/java/org/apache/accumulo/core/util/compaction/CompactionServicesConfig.java b/core/src/main/java/org/apache/accumulo/core/util/compaction/CompactionServicesConfig.java index b4fcc8d32c..a4363b99c3 100644 --- a/core/src/main/java/org/apache/accumulo/core/util/compaction/CompactionServicesConfig.java +++ b/core/src/main/java/org/apache/accumulo/core/util/compaction/CompactionServicesConfig.java @@ -28,7 +28,6 @@ import org.apache.accumulo.core.client.PluginEnvironment; import org.apache.accumulo.core.conf.AccumuloConfiguration; import org.apache.accumulo.core.conf.ConfigurationTypeHelper; import org.apache.accumulo.core.conf.Property; -import org.apache.accumulo.core.spi.compaction.CompactionServiceId; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -51,21 +50,12 @@ public class CompactionServicesConfig { @SuppressWarnings("removal") private static final Property oldPrefix = Property.TSERV_COMPACTION_SERVICE_PREFIX; private static final Property newPrefix = Property.COMPACTION_SERVICE_PREFIX; - public static final CompactionServiceId DEFAULT_SERVICE = CompactionServiceId.of("default"); - - private static Map<String,Map<String,String>> - stripPropPrefix(PluginEnvironment.Configuration conf) { - @SuppressWarnings("removal") - String prefix = Property.TSERV_COMPACTION_SERVICE_PREFIX.getKey(); - var confMap = new HashMap<String,String>(); - conf.getWithPrefix(prefix).forEach((prop, val) -> { - var suffix = prop.substring(prefix.length()); - confMap.put(suffix, val); - }); - return Map.of(prefix, confMap); + + private interface ConfigIndirection { + Map<String,String> getAllPropertiesWithPrefixStripped(Property p); } - private static Map<String,Map<String,String>> getConfiguration(AccumuloConfiguration aconf) { + private static Map<String,Map<String,String>> getConfiguration(ConfigIndirection aconf) { Map<String,Map<String,String>> properties = new HashMap<>(); var newProps = aconf.getAllPropertiesWithPrefixStripped(newPrefix); @@ -95,11 +85,16 @@ public class CompactionServicesConfig { public CompactionServicesConfig(PluginEnvironment.Configuration conf) { // TODO will probably not need rate limit eventually and the 2nd param predicate can go away - this(stripPropPrefix(conf), property -> conf.isSet(property.getKey())); + this(getConfiguration(prefix -> { + var props = conf.getWithPrefix(prefix.getKey()); + Map<String,String> stripped = new HashMap<>(); + props.forEach((k, v) -> stripped.put(k.substring(prefix.getKey().length()), v)); + return stripped; + }), property -> conf.isSet(property.getKey())); } public CompactionServicesConfig(AccumuloConfiguration aconf) { - this(getConfiguration(aconf), aconf::isPropertySet); + this(getConfiguration(aconf::getAllPropertiesWithPrefixStripped), aconf::isPropertySet); } @SuppressWarnings("removal")