Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -74,6 +75,8 @@ public static void setupMiniCluster() throws Exception {
config.setZooKeeperPort(0);
HashMap<String,String> 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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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());
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<String,String> siteConf = cfg.getSiteConfig();
cfg.setSiteConfig(siteConf);
}
Expand Down
Loading