diff --git a/core/src/main/java/org/apache/accumulo/core/classloader/ClassLoaderUtil.java b/core/src/main/java/org/apache/accumulo/core/classloader/ClassLoaderUtil.java index e04b772c37c..4190bd578f5 100644 --- a/core/src/main/java/org/apache/accumulo/core/classloader/ClassLoaderUtil.java +++ b/core/src/main/java/org/apache/accumulo/core/classloader/ClassLoaderUtil.java @@ -44,9 +44,9 @@ public static synchronized void initContextFactory(AccumuloConfiguration conf) { String factoryName = conf.get(Property.GENERAL_CONTEXT_CLASSLOADER_FACTORY); if (factoryName == null || factoryName.isEmpty()) { // load the default implementation - LOG.info("Using default {}, which is subject to change in a future release", - ContextClassLoaderFactory.class.getName()); - FACTORY = new URLContextClassLoaderFactory(); + LOG.info("{} not set, using System ClassLoader for all contexts", + Property.GENERAL_CONTEXT_CLASSLOADER_FACTORY.getKey()); + FACTORY = context -> ClassLoader.getSystemClassLoader(); } else { // load user's selected implementation and provide it with the service environment try { diff --git a/core/src/main/java/org/apache/accumulo/core/classloader/URLContextClassLoaderFactory.java b/core/src/main/java/org/apache/accumulo/core/util/test/URLContextClassLoaderFactory.java similarity index 91% rename from core/src/main/java/org/apache/accumulo/core/classloader/URLContextClassLoaderFactory.java rename to core/src/main/java/org/apache/accumulo/core/util/test/URLContextClassLoaderFactory.java index 32681e6e5d0..097d76201f4 100644 --- a/core/src/main/java/org/apache/accumulo/core/classloader/URLContextClassLoaderFactory.java +++ b/core/src/main/java/org/apache/accumulo/core/util/test/URLContextClassLoaderFactory.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.accumulo.core.classloader; +package org.apache.accumulo.core.util.test; import java.io.UncheckedIOException; import java.net.MalformedURLException; @@ -34,8 +34,8 @@ import com.github.benmanes.caffeine.cache.Cache; /** - * The default implementation of ContextClassLoaderFactory. This classloader returns a - * URLClassLoader based on the given context value which is a CSV list of URLs. For example, + * A test implementation of ContextClassLoaderFactory. This classloader returns a URLClassLoader + * based on the given context value which is a CSV list of URLs. For example, * file://path/one/jar1.jar,file://path/two/jar2.jar */ public class URLContextClassLoaderFactory implements ContextClassLoaderFactory { diff --git a/core/src/test/java/org/apache/accumulo/core/classloader/ContextClassLoaderFactoryTest.java b/core/src/test/java/org/apache/accumulo/core/classloader/URLContextClassLoaderFactoryTest.java similarity index 95% rename from core/src/test/java/org/apache/accumulo/core/classloader/ContextClassLoaderFactoryTest.java rename to core/src/test/java/org/apache/accumulo/core/classloader/URLContextClassLoaderFactoryTest.java index 440d6ca72b4..5789f5854a3 100644 --- a/core/src/test/java/org/apache/accumulo/core/classloader/ContextClassLoaderFactoryTest.java +++ b/core/src/test/java/org/apache/accumulo/core/classloader/URLContextClassLoaderFactoryTest.java @@ -30,6 +30,7 @@ import org.apache.accumulo.core.conf.ConfigurationCopy; import org.apache.accumulo.core.conf.Property; import org.apache.accumulo.core.spi.common.ContextClassLoaderFactory.ContextClassLoaderException; +import org.apache.accumulo.core.util.test.URLContextClassLoaderFactory; import org.apache.commons.io.FileUtils; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -38,7 +39,7 @@ import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; @SuppressFBWarnings(value = "PATH_TRAVERSAL_IN", justification = "paths not set by user input") -public class ContextClassLoaderFactoryTest extends WithTestNames { +public class URLContextClassLoaderFactoryTest extends WithTestNames { @TempDir private static Path tempFolder; diff --git a/minicluster/src/test/java/org/apache/accumulo/minicluster/MiniAccumuloClusterClasspathTest.java b/minicluster/src/test/java/org/apache/accumulo/minicluster/MiniAccumuloClusterClasspathTest.java index d12a266cf73..4992976cad0 100644 --- a/minicluster/src/test/java/org/apache/accumulo/minicluster/MiniAccumuloClusterClasspathTest.java +++ b/minicluster/src/test/java/org/apache/accumulo/minicluster/MiniAccumuloClusterClasspathTest.java @@ -40,6 +40,7 @@ import org.apache.accumulo.core.data.Mutation; import org.apache.accumulo.core.data.Value; import org.apache.accumulo.core.security.Authorizations; +import org.apache.accumulo.core.util.test.URLContextClassLoaderFactory; import org.apache.commons.io.FileUtils; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; @@ -74,6 +75,8 @@ public static void setupMiniCluster() throws Exception { config.setZooKeeperPort(0); HashMap site = new HashMap<>(); site.put(Property.TSERV_WAL_MAX_SIZE.getKey(), "1G"); + site.put(Property.GENERAL_CONTEXT_CLASSLOADER_FACTORY.getKey(), + URLContextClassLoaderFactory.class.getName()); config.setSiteConfig(site); accumulo = new MiniAccumuloCluster(config); accumulo.start(); diff --git a/server/manager/src/main/java/org/apache/accumulo/manager/BalanceManager.java b/server/manager/src/main/java/org/apache/accumulo/manager/BalanceManager.java index 9baae8d74dd..7a62a68361b 100644 --- a/server/manager/src/main/java/org/apache/accumulo/manager/BalanceManager.java +++ b/server/manager/src/main/java/org/apache/accumulo/manager/BalanceManager.java @@ -350,6 +350,7 @@ void waitForBalance() { while (unassigned > 0) { log.debug("displayUnassigned():{}", unassigned); UtilWaitThread.sleep(50); + waitForBalance(EnumSet.allOf(Ample.DataLevel.class)); unassigned = getManager().displayUnassigned(); } } diff --git a/test/src/main/java/org/apache/accumulo/test/compaction/ClassLoaderContextCompactionIT.java b/test/src/main/java/org/apache/accumulo/test/compaction/ClassLoaderContextCompactionIT.java index 2162b4eb7af..18dfa5fbe3c 100644 --- a/test/src/main/java/org/apache/accumulo/test/compaction/ClassLoaderContextCompactionIT.java +++ b/test/src/main/java/org/apache/accumulo/test/compaction/ClassLoaderContextCompactionIT.java @@ -57,6 +57,7 @@ import org.apache.accumulo.core.metrics.MetricsUtil; import org.apache.accumulo.core.spi.metrics.LoggingMeterRegistryFactory; import org.apache.accumulo.core.util.compaction.ExternalCompactionUtil; +import org.apache.accumulo.core.util.test.URLContextClassLoaderFactory; import org.apache.accumulo.core.util.threads.Threads; import org.apache.accumulo.minicluster.ServerType; import org.apache.accumulo.miniclusterImpl.MiniAccumuloClusterImpl; @@ -101,6 +102,8 @@ public void configureMiniCluster(MiniAccumuloConfigImpl cfg, Configuration coreS cfg.setProperty(Property.COMPACTOR_FAILURE_BACKOFF_INTERVAL, "5s"); cfg.setProperty(Property.COMPACTOR_FAILURE_BACKOFF_RESET, "10m"); cfg.setProperty(Property.COMPACTOR_FAILURE_TERMINATION_THRESHOLD, "3"); + cfg.setProperty(Property.GENERAL_CONTEXT_CLASSLOADER_FACTORY, + URLContextClassLoaderFactory.class.getName()); cfg.getClusterServerConfiguration().setNumDefaultCompactors(2); cfg.getClusterServerConfiguration().addCompactorResourceGroup(GROUP1, 1); // Tell the server processes to use a StatsDMeterRegistry and the simple logging registry diff --git a/test/src/main/java/org/apache/accumulo/test/functional/HalfClosedTabletIT.java b/test/src/main/java/org/apache/accumulo/test/functional/HalfClosedTabletIT.java index 015dd489c39..9b3f7d7484e 100644 --- a/test/src/main/java/org/apache/accumulo/test/functional/HalfClosedTabletIT.java +++ b/test/src/main/java/org/apache/accumulo/test/functional/HalfClosedTabletIT.java @@ -40,6 +40,7 @@ import org.apache.accumulo.core.iterators.IteratorUtil.IteratorScope; import org.apache.accumulo.core.metadata.schema.TabletMetadata.ColumnType; import org.apache.accumulo.core.metadata.schema.TabletsMetadata; +import org.apache.accumulo.core.util.test.URLContextClassLoaderFactory; import org.apache.accumulo.miniclusterImpl.MiniAccumuloConfigImpl; import org.apache.accumulo.server.ServerContext; import org.apache.accumulo.server.conf.store.TablePropKey; @@ -71,6 +72,8 @@ public static class HalfClosedTabletITConfiguration implements MiniClusterConfig @Override public void configureMiniCluster(MiniAccumuloConfigImpl cfg, Configuration coreSite) { cfg.getClusterServerConfiguration().setNumDefaultTabletServers(1); + cfg.setProperty(Property.GENERAL_CONTEXT_CLASSLOADER_FACTORY, + URLContextClassLoaderFactory.class.getName()); } } diff --git a/test/src/main/java/org/apache/accumulo/test/functional/ScannerContextIT.java b/test/src/main/java/org/apache/accumulo/test/functional/ScannerContextIT.java index 7c7ea5d8490..83bc5121f5b 100644 --- a/test/src/main/java/org/apache/accumulo/test/functional/ScannerContextIT.java +++ b/test/src/main/java/org/apache/accumulo/test/functional/ScannerContextIT.java @@ -43,8 +43,11 @@ import org.apache.accumulo.core.data.Range; import org.apache.accumulo.core.data.Value; import org.apache.accumulo.core.security.Authorizations; +import org.apache.accumulo.core.util.test.URLContextClassLoaderFactory; import org.apache.accumulo.miniclusterImpl.MiniAccumuloClusterImpl; +import org.apache.accumulo.miniclusterImpl.MiniAccumuloConfigImpl; import org.apache.accumulo.test.harness.AccumuloClusterHarness; +import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; import org.junit.jupiter.api.BeforeEach; @@ -64,6 +67,12 @@ protected Duration defaultTimeout() { return Duration.ofMinutes(2); } + @Override + public void configureMiniCluster(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) { + cfg.setProperty(Property.GENERAL_CONTEXT_CLASSLOADER_FACTORY, + URLContextClassLoaderFactory.class.getName()); + } + @BeforeEach public void checkCluster() throws Exception { assumeTrue(getClusterType() == ClusterType.MINI); diff --git a/test/src/main/java/org/apache/accumulo/test/shell/ShellServerIT.java b/test/src/main/java/org/apache/accumulo/test/shell/ShellServerIT.java index 4283c8d837d..6fbb243b934 100644 --- a/test/src/main/java/org/apache/accumulo/test/shell/ShellServerIT.java +++ b/test/src/main/java/org/apache/accumulo/test/shell/ShellServerIT.java @@ -91,6 +91,7 @@ import org.apache.accumulo.core.spi.crypto.NoCryptoServiceFactory; import org.apache.accumulo.core.util.format.Formatter; import org.apache.accumulo.core.util.format.FormatterConfig; +import org.apache.accumulo.core.util.test.URLContextClassLoaderFactory; import org.apache.accumulo.minicluster.ServerType; import org.apache.accumulo.miniclusterImpl.MiniAccumuloConfigImpl; import org.apache.accumulo.test.ImportExportIT; @@ -131,7 +132,8 @@ private static class ShellServerITConfigCallback implements MiniClusterConfigura public void configureMiniCluster(MiniAccumuloConfigImpl cfg, Configuration coreSite) { // Only one tserver to avoid race conditions on ZK propagation (auths and configuration) cfg.getClusterServerConfiguration().setNumDefaultTabletServers(1); - // Set the min span to 0 so we will definitely get all the traces back. See ACCUMULO-4365 + cfg.setProperty(Property.GENERAL_CONTEXT_CLASSLOADER_FACTORY, + URLContextClassLoaderFactory.class.getName()); Map siteConf = cfg.getSiteConfig(); cfg.setSiteConfig(siteConf); }