mirror of https://github.com/apache/druid.git
allow and load extensions with absolute paths in druid.extensions.loadList (#3747)
This commit is contained in:
parent
d1896a2d62
commit
06d0ef9c6c
|
@ -24,7 +24,7 @@ Many of Druid's external dependencies can be plugged in as modules. Extensions c
|
|||
|`druid.extensions.directory`|The root extension directory where user can put extensions related files. Druid will load extensions stored under this directory.|`extensions` (This is a relative path to Druid's working directory)|
|
||||
|`druid.extensions.hadoopDependenciesDir`|The root hadoop dependencies directory where user can put hadoop related dependencies files. Druid will load the dependencies based on the hadoop coordinate specified in the hadoop index task.|`hadoop-dependencies` (This is a relative path to Druid's working directory|
|
||||
|`druid.extensions.hadoopContainerDruidClasspath`|Hadoop Indexing launches hadoop jobs and this configuration provides way to explicitly set the user classpath for the hadoop job. By default this is computed automatically by druid based on the druid process classpath and set of extensions. However, sometimes you might want to be explicit to resolve dependency conflicts between druid and hadoop.|null|
|
||||
|`druid.extensions.loadList`|A JSON array of extensions to load from extension directories by Druid. If it is not specified, its value will be `null` and Druid will load all the extensions under `druid.extensions.directory`. If its value is empty list `[]`, then no extensions will be loaded at all.|null|
|
||||
|`druid.extensions.loadList`|A JSON array of extensions to load from extension directories by Druid. If it is not specified, its value will be `null` and Druid will load all the extensions under `druid.extensions.directory`. If its value is empty list `[]`, then no extensions will be loaded at all. It is also allowed to specify absolute path of other custom extensions not stored in the common extensions directory.|null|
|
||||
|`druid.extensions.searchCurrentClassloader`|This is a boolean flag that determines if Druid will search the main classloader for extensions. It defaults to true but can be turned off if you have reason to not automatically add all modules on the classpath.|true|
|
||||
|
||||
### Zookeeper
|
||||
|
|
|
@ -30,7 +30,6 @@ import com.google.inject.Injector;
|
|||
import com.google.inject.Key;
|
||||
import com.google.inject.Module;
|
||||
import com.google.inject.util.Modules;
|
||||
|
||||
import io.druid.curator.CuratorModule;
|
||||
import io.druid.curator.discovery.DiscoveryModule;
|
||||
import io.druid.guice.AWSModule;
|
||||
|
@ -206,7 +205,11 @@ public class Initialization
|
|||
int i = 0;
|
||||
extensionsToLoad = new File[toLoad.size()];
|
||||
for (final String extensionName : toLoad) {
|
||||
final File extensionDir = new File(rootExtensionsDir, extensionName);
|
||||
File extensionDir = new File(extensionName);
|
||||
if (!extensionDir.isAbsolute()) {
|
||||
extensionDir = new File(rootExtensionsDir, extensionName);
|
||||
}
|
||||
|
||||
if (!extensionDir.isDirectory()) {
|
||||
throw new ISE(
|
||||
String.format(
|
||||
|
|
|
@ -277,12 +277,15 @@ public class InitializationTest
|
|||
public void testGetExtensionFilesToLoad_with_load_list() throws IOException
|
||||
{
|
||||
final File extensionsDir = temporaryFolder.newFolder();
|
||||
|
||||
final File absolutePathExtension = temporaryFolder.newFolder();
|
||||
|
||||
final ExtensionsConfig config = new ExtensionsConfig()
|
||||
{
|
||||
@Override
|
||||
public List<String> getLoadList()
|
||||
{
|
||||
return Arrays.asList("mysql-metadata-storage", "druid-kafka-eight");
|
||||
return Arrays.asList("mysql-metadata-storage", "druid-kafka-eight", absolutePathExtension.getAbsolutePath());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -294,13 +297,13 @@ public class InitializationTest
|
|||
final File mysql_metadata_storage = new File(extensionsDir, "mysql-metadata-storage");
|
||||
final File druid_kafka_eight = new File(extensionsDir, "druid-kafka-eight");
|
||||
final File random_extension = new File(extensionsDir, "random-extensions");
|
||||
|
||||
mysql_metadata_storage.mkdir();
|
||||
druid_kafka_eight.mkdir();
|
||||
random_extension.mkdir();
|
||||
|
||||
final File[] expectedFileList = new File[]{druid_kafka_eight, mysql_metadata_storage};
|
||||
final File[] expectedFileList = new File[]{mysql_metadata_storage, druid_kafka_eight, absolutePathExtension};
|
||||
final File[] actualFileList = Initialization.getExtensionFilesToLoad(config);
|
||||
Arrays.sort(actualFileList);
|
||||
Assert.assertArrayEquals(expectedFileList, actualFileList);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue