This is an automated email from the ASF dual-hosted git repository. ctubbsii 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 9777a7e789 Remove TODOs and rename PerTableVolumeChooser (#2734) 9777a7e789 is described below commit 9777a7e789c3668f1d9619a2a7538495f95b7cfc Author: Luke Foster <84727868+foste...@users.noreply.github.com> AuthorDate: Wed May 25 23:00:23 2022 -0400 Remove TODOs and rename PerTableVolumeChooser (#2734) * Remove TODOs and rename PerTableVolumeChooser * Rename corresponding test and clean up spotbugs suppressions Co-authored-by: Christopher Tubbs <ctubb...@apache.org> --- .../fs/{PerTableVolumeChooser.java => DelegatingChooser.java} | 10 ++++------ ...TableVolumeChooserTest.java => DelegatingChooserTest.java} | 6 +++--- .../org/apache/accumulo/server/fs/PerTableVolumeChooser.java | 11 +++-------- .../main/java/org/apache/accumulo/test/VolumeChooserIT.java | 6 +++--- 4 files changed, 13 insertions(+), 20 deletions(-) diff --git a/core/src/main/java/org/apache/accumulo/core/spi/fs/PerTableVolumeChooser.java b/core/src/main/java/org/apache/accumulo/core/spi/fs/DelegatingChooser.java similarity index 94% rename from core/src/main/java/org/apache/accumulo/core/spi/fs/PerTableVolumeChooser.java rename to core/src/main/java/org/apache/accumulo/core/spi/fs/DelegatingChooser.java index 39ae0e52fb..0f99c73030 100644 --- a/core/src/main/java/org/apache/accumulo/core/spi/fs/PerTableVolumeChooser.java +++ b/core/src/main/java/org/apache/accumulo/core/spi/fs/DelegatingChooser.java @@ -30,16 +30,14 @@ import org.slf4j.LoggerFactory; /** * A {@link VolumeChooser} that delegates to another volume chooser based on other properties: * table.custom.volume.chooser for tables, and general.custom.volume.chooser.scoped for scopes. - * general.custom.volume.chooser.{scope} can override the system wide setting for - * general.custom.volume.chooser.scoped. At the this this was written, the only known scope was + * general.custom.volume.chooser.{scope} can override the system-wide setting for + * general.custom.volume.chooser.scoped. At the time this was written, the only known scope was * "logger". * * @since 2.1.0 */ -public class PerTableVolumeChooser implements VolumeChooser { - // TODO rename this class to DelegatingChooser? It delegates for more than just per-table scope - private static final Logger log = LoggerFactory.getLogger(PerTableVolumeChooser.class); - // TODO Add hint of expected size to construction, see ACCUMULO-3410 +public class DelegatingChooser implements VolumeChooser { + private static final Logger log = LoggerFactory.getLogger(DelegatingChooser.class); /* Track VolumeChooser instances so they can keep state. */ private final ConcurrentHashMap<TableId,VolumeChooser> tableSpecificChooserCache = new ConcurrentHashMap<>(); diff --git a/core/src/test/java/org/apache/accumulo/core/spi/fs/PerTableVolumeChooserTest.java b/core/src/test/java/org/apache/accumulo/core/spi/fs/DelegatingChooserTest.java similarity index 98% rename from core/src/test/java/org/apache/accumulo/core/spi/fs/PerTableVolumeChooserTest.java rename to core/src/test/java/org/apache/accumulo/core/spi/fs/DelegatingChooserTest.java index 955bb01b01..eaad25c3bf 100644 --- a/core/src/test/java/org/apache/accumulo/core/spi/fs/PerTableVolumeChooserTest.java +++ b/core/src/test/java/org/apache/accumulo/core/spi/fs/DelegatingChooserTest.java @@ -37,7 +37,7 @@ import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -public class PerTableVolumeChooserTest { +public class DelegatingChooserTest { private static final String TABLE_CUSTOM_SUFFIX = "volume.chooser"; @@ -47,7 +47,7 @@ public class PerTableVolumeChooserTest { private ServiceEnvironment serviceEnv; private Configuration tableConf; - private PerTableVolumeChooser chooser; + private DelegatingChooser chooser; private Configuration systemConf; public static class MockChooser1 extends RandomVolumeChooser {} @@ -58,7 +58,7 @@ public class PerTableVolumeChooserTest { public void before() { serviceEnv = createStrictMock(ServiceEnvironment.class); - chooser = new PerTableVolumeChooser(); + chooser = new DelegatingChooser(); tableConf = createStrictMock(Configuration.class); systemConf = createStrictMock(Configuration.class); diff --git a/server/base/src/main/java/org/apache/accumulo/server/fs/PerTableVolumeChooser.java b/server/base/src/main/java/org/apache/accumulo/server/fs/PerTableVolumeChooser.java index 7b1008465e..888b1d774e 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/fs/PerTableVolumeChooser.java +++ b/server/base/src/main/java/org/apache/accumulo/server/fs/PerTableVolumeChooser.java @@ -18,19 +18,14 @@ */ package org.apache.accumulo.server.fs; +import org.apache.accumulo.core.spi.fs.DelegatingChooser; import org.slf4j.LoggerFactory; -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; - @Deprecated(since = "2.1.0") -@SuppressFBWarnings(value = "NM_SAME_SIMPLE_NAME_AS_SUPERCLASS", - justification = "Same name used for compatibility during deprecation cycle") -public class PerTableVolumeChooser extends org.apache.accumulo.core.spi.fs.PerTableVolumeChooser - implements VolumeChooser { +public class PerTableVolumeChooser extends DelegatingChooser implements VolumeChooser { public PerTableVolumeChooser() { LoggerFactory.getLogger(PerTableVolumeChooser.class).warn( "The class {} is deprecated. Please configure {} instead.", - PerTableVolumeChooser.class.getName(), - org.apache.accumulo.core.spi.fs.PerTableVolumeChooser.class.getName()); + PerTableVolumeChooser.class.getName(), DelegatingChooser.class.getName()); } } diff --git a/test/src/main/java/org/apache/accumulo/test/VolumeChooserIT.java b/test/src/main/java/org/apache/accumulo/test/VolumeChooserIT.java index ce50dc9c75..40fd255864 100644 --- a/test/src/main/java/org/apache/accumulo/test/VolumeChooserIT.java +++ b/test/src/main/java/org/apache/accumulo/test/VolumeChooserIT.java @@ -50,7 +50,7 @@ import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection; import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection.DataFileColumnFamily; import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection.LogColumnFamily; import org.apache.accumulo.core.security.Authorizations; -import org.apache.accumulo.core.spi.fs.PerTableVolumeChooser; +import org.apache.accumulo.core.spi.fs.DelegatingChooser; import org.apache.accumulo.core.spi.fs.PreferredVolumeChooser; import org.apache.accumulo.core.spi.fs.RandomVolumeChooser; import org.apache.accumulo.core.spi.fs.VolumeChooserEnvironment.Scope; @@ -100,10 +100,10 @@ public class VolumeChooserIT extends ConfigurableMacBase { namespace1 = "ns_" + getUniqueNames(2)[0]; namespace2 = "ns_" + getUniqueNames(2)[1]; - // Set the general volume chooser to the PerTableVolumeChooser so that different choosers can be + // Set the general volume chooser to the DelegatingChooser so that different choosers can be // specified Map<String,String> siteConfig = new HashMap<>(); - siteConfig.put(Property.GENERAL_VOLUME_CHOOSER.getKey(), PerTableVolumeChooser.class.getName()); + siteConfig.put(Property.GENERAL_VOLUME_CHOOSER.getKey(), DelegatingChooser.class.getName()); // if a table doesn't have a volume chooser, use the preferred volume chooser siteConfig.put(PERTABLE_CHOOSER_PROP, PreferredVolumeChooser.class.getName());