Repository: drill
Updated Branches:
refs/heads/master 357d0202c -> 5bd92f832
DRILL-3496: Augment logging in DrillConfig and classpath scanning.
Main: Added and augmented logging calls.
Code Hygiene:
- Added/revised doc. comments, code comments.
- Renamed some locals.
- Added "final".
- Wrapped lines.
Also fixed currentTimeMillis -> Stopwatch in Drillbit.
Conflicts:
common/src/main/java/org/apache/drill/common/config/DrillConfig.java
Project: http://git-wip-us.apache.org/repos/asf/drill/repo
Commit: http://git-wip-us.apache.org/repos/asf/drill/commit/d144bdcc
Tree: http://git-wip-us.apache.org/repos/asf/drill/tree/d144bdcc
Diff: http://git-wip-us.apache.org/repos/asf/drill/diff/d144bdcc
Branch: refs/heads/master
Commit: d144bdcc5580634bf3c0c1baea4694e587e42a49
Parents: a0b3771
Author: dbarclay <[email protected]>
Authored: Tue Jul 14 12:11:36 2015 -0700
Committer: Jason Altekruse <[email protected]>
Committed: Tue Aug 4 08:49:01 2015 -0700
----------------------------------------------------------------------
.../apache/drill/common/config/DrillConfig.java | 114 ++++++++++++++-----
.../common/logical/FormatPluginConfigBase.java | 15 ++-
.../common/logical/StoragePluginConfigBase.java | 17 ++-
.../logical/data/LogicalOperatorBase.java | 11 +-
.../physical/base/PhysicalOperatorUtil.java | 8 +-
.../org/apache/drill/exec/server/Drillbit.java | 14 ++-
.../drill/exec/store/StoragePluginRegistry.java | 3 +-
.../drill/exec/store/dfs/FormatCreator.java | 3 +-
8 files changed, 135 insertions(+), 50 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/drill/blob/d144bdcc/common/src/main/java/org/apache/drill/common/config/DrillConfig.java
----------------------------------------------------------------------
diff --git
a/common/src/main/java/org/apache/drill/common/config/DrillConfig.java
b/common/src/main/java/org/apache/drill/common/config/DrillConfig.java
index fe43b4a..e5f0278 100644
--- a/common/src/main/java/org/apache/drill/common/config/DrillConfig.java
+++ b/common/src/main/java/org/apache/drill/common/config/DrillConfig.java
@@ -34,6 +34,8 @@ import
org.apache.drill.common.logical.StoragePluginConfigBase;
import org.apache.drill.common.logical.data.LogicalOperatorBase;
import org.apache.drill.common.util.PathScanner;
import org.reflections.util.ClasspathHelper;
+import org.slf4j.Logger;
+import static org.slf4j.LoggerFactory.getLogger;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonParser.Feature;
@@ -44,26 +46,33 @@ import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.ImmutableList;
import com.typesafe.config.Config;
import com.typesafe.config.ConfigFactory;
+import com.typesafe.config.ConfigRenderOptions;
public final class DrillConfig extends NestedConfig{
-// private static final org.slf4j.Logger logger =
org.slf4j.LoggerFactory.getLogger(DrillConfig.class);
+ private static final Logger logger = getLogger(DrillConfig.class);
+
private final ObjectMapper mapper;
private final ImmutableList<String> startupArguments;
public static final boolean ON_OSX =
System.getProperty("os.name").contains("OS X");
- @SuppressWarnings("restriction") private static final long
MAX_DIRECT_MEMORY = sun.misc.VM.maxDirectMemory();
+ @SuppressWarnings("restriction")
+ private static final long MAX_DIRECT_MEMORY = sun.misc.VM.maxDirectMemory();
@SuppressWarnings("unchecked")
private volatile List<Queue<Object>> sinkQueues = new
CopyOnWriteArrayList<Queue<Object>>(new Queue[1]);
@VisibleForTesting
- public DrillConfig(Config config, boolean enableServer) {
+ public DrillConfig(Config config, boolean enableServerConfigs) {
super(config);
- logger.debug("Setting up config object.");
+ logger.debug("Setting up DrillConfig object.");
+ if (logger.isTraceEnabled()) {
+ logger.trace("Given Config object is:\n{}",
+ config.root().render(ConfigRenderOptions.defaults()));
+ }
mapper = new ObjectMapper();
- if (enableServer) {
+ if (enableServerConfigs) {
SimpleModule deserModule = new
SimpleModule("LogicalExpressionDeserializationModule")
.addDeserializer(LogicalExpression.class, new
LogicalExpression.De(this))
.addDeserializer(SchemaPath.class, new SchemaPath.De(this));
@@ -79,10 +88,9 @@ public final class DrillConfig extends NestedConfig{
mapper.registerSubtypes(FormatPluginConfigBase.getSubTypes(this));
}
-
RuntimeMXBean bean = ManagementFactory.getRuntimeMXBean();
this.startupArguments = ImmutableList.copyOf(bean.getInputArguments());
- logger.debug("Config object initialized.");
+ logger.debug("DrillConfig object initialized.");
};
public List<String> getStartupArguments() {
@@ -90,7 +98,8 @@ public final class DrillConfig extends NestedConfig{
}
/**
- * Create a DrillConfig object using the default config file name
+ * Creates a DrillConfig object using the default config file name
+ * and with server-specific configuration options disabled.
* @return The new DrillConfig object.
*/
public static DrillConfig create() {
@@ -98,7 +107,8 @@ public final class DrillConfig extends NestedConfig{
}
/**
- * Creates a {@link DrillConfig configuration} disabling server specific
configuration options.
+ * Creates a {@link DrillConfig configuration} using the default config file
+ * name and with server-specific configuration options disabled.
*
* @return {@link DrillConfig} instance
*/
@@ -115,19 +125,26 @@ public final class DrillConfig extends NestedConfig{
* <p>
* Configuration values are retrieved as follows:
* <ul>
- * <li>Check a single copy of "drill-override.conf". If multiple copies are
on the classpath, behavior is
- * indeterminate. If a non-null value for overrideFileName is provided,
this is utilized instead of drill-override.conf.</li>
- * <li>Check all copies of "drill-module.conf". Loading order is
indeterminate.</li>
- * <li>Check a single copy of "drill-default.conf". If multiple copies are
on the classpath, behavior is
- * indeterminate.</li>
+ * <li>Check a single copy of "drill-override.conf". If multiple copies are
+ * on the classpath, which copy is read is indeterminate.
+ * If a non-null value for overrideFileResourcePathname is provided, this
+ * is used instead of "{@code drill-override.conf}".</li>
+ * <li>Check all copies of "{@code drill-module.conf}". Loading order is
+ * indeterminate.</li>
+ * <li>Check a single copy of "{@code drill-default.conf}". If multiple
+ * copies are on the classpath, which copy is read is indeterminate.</li>
* </ul>
*
* </p>
- * @param overrideFileName The name of the file to use for override
purposes.
+ * @param overrideFileResourcePathname
+ * the classpath resource pathname of the file to use for
+ * configuration override purposes; {@code null} specifies to use
the
+ * default pathname ({@link CommonConstants.CONFIG_OVERRIDE})
+ * (<strong>not</strong> to not look for an override file at all)
* @return A merged Config object.
*/
- public static DrillConfig create(String overrideFileName) {
- return create(overrideFileName, true);
+ public static DrillConfig create(String overrideFileResourcePathname) {
+ return create(overrideFileResourcePathname, true);
}
/**
@@ -138,34 +155,77 @@ public final class DrillConfig extends NestedConfig{
return create(null, testConfigurations, true);
}
- public static DrillConfig create(String overrideFileName, boolean
enableServerConfigs) {
- return create(overrideFileName, null, enableServerConfigs);
+ /**
+ * ...
+ * @param overrideFileResourcePathname
+ * see {@link #create(String)}'s {@code
overrideFileResourcePathname}
+ */
+ public static DrillConfig create(String overrideFileResourcePathname,
boolean enableServerConfigs) {
+ return create(overrideFileResourcePathname, null, enableServerConfigs);
}
- private static DrillConfig create(String overrideFileName, Properties
overriderProps, boolean enableServerConfigs) {
- overrideFileName = overrideFileName == null ?
CommonConstants.CONFIG_OVERRIDE_RESOURCE_PATHNAME : overrideFileName;
-
- // first we load defaults.
+ /**
+ * ...
+ * @param overrideFileResourcePathname
+ * see {@link #create(String)}'s {@code
overrideFileResourcePathname}
+ * @param overriderProps
+ * optional property map for further overriding (after override file
+ * is assimilated
+ * @param enableServerConfigs
+ * whether to enable server-specific configuration options
+ * @return
+ */
+ private static DrillConfig create(String overrideFileResourcePathname,
+ final Properties overriderProps,
+ final boolean enableServerConfigs) {
+ overrideFileResourcePathname =
+ overrideFileResourcePathname == null
+ ? CommonConstants.CONFIG_OVERRIDE_RESOURCE_PATHNAME
+ : overrideFileResourcePathname;
+
+ // 1. Load defaults configuration file.
Config fallback = null;
final ClassLoader[] classLoaders = ClasspathHelper.classLoaders();
for (ClassLoader classLoader : classLoaders) {
- if
(classLoader.getResource(CommonConstants.CONFIG_DEFAULT_RESOURCE_PATHNAME) !=
null) {
- fallback = ConfigFactory.load(classLoader,
CommonConstants.CONFIG_DEFAULT_RESOURCE_PATHNAME);
+ final URL url =
+
classLoader.getResource(CommonConstants.CONFIG_DEFAULT_RESOURCE_PATHNAME);
+ if (null != url) {
+ logger.debug("Loading base config. file at {}.", url);
+ fallback =
+ ConfigFactory.load(classLoader,
+
CommonConstants.CONFIG_DEFAULT_RESOURCE_PATHNAME);
break;
}
}
+ // 2. Load per-module configuration files.
Collection<URL> urls = PathScanner.getConfigURLs();
logger.debug("Loading configs at the following URLs {}", urls);
for (URL url : urls) {
+ logger.debug("Loading module config. file at {}.", url);
fallback = ConfigFactory.parseURL(url).withFallback(fallback);
}
- Config effectiveConfig =
ConfigFactory.load(overrideFileName).withFallback(fallback);
+ // 3. Load any overrides configuration file and overrides from JVM
+ // system properties (e.g., {-Dname=value").
+
+ // (Per ConfigFactory.load(...)'s mention of using
Thread.getContextClassLoader():)
+ final URL overrideFileUrl =
+
Thread.currentThread().getContextClassLoader().getResource(overrideFileResourcePathname);
+ if (null != overrideFileUrl ) {
+ logger.debug("Loading override config. file at {}.", overrideFileUrl);
+ }
+ Config effectiveConfig =
+
ConfigFactory.load(overrideFileResourcePathname).withFallback(fallback);
+
+ // 4. Apply any overriding properties.
if (overriderProps != null) {
- effectiveConfig =
ConfigFactory.parseProperties(overriderProps).withFallback(effectiveConfig);
+ logger.debug("Loading override Properties parameter {}.",
overriderProps);
+ effectiveConfig =
+
ConfigFactory.parseProperties(overriderProps).withFallback(effectiveConfig);
}
+ // 5. Create DrillConfig object from Config object.
return new DrillConfig(effectiveConfig.resolve(), enableServerConfigs);
}
http://git-wip-us.apache.org/repos/asf/drill/blob/d144bdcc/common/src/main/java/org/apache/drill/common/logical/FormatPluginConfigBase.java
----------------------------------------------------------------------
diff --git
a/common/src/main/java/org/apache/drill/common/logical/FormatPluginConfigBase.java
b/common/src/main/java/org/apache/drill/common/logical/FormatPluginConfigBase.java
index e5cf80b..1cd5dce 100644
---
a/common/src/main/java/org/apache/drill/common/logical/FormatPluginConfigBase.java
+++
b/common/src/main/java/org/apache/drill/common/logical/FormatPluginConfigBase.java
@@ -26,17 +26,22 @@ import org.apache.drill.common.util.PathScanner;
public abstract class FormatPluginConfigBase implements FormatPluginConfig{
static final org.slf4j.Logger logger =
org.slf4j.LoggerFactory.getLogger(FormatPluginConfigBase.class);
+
/**
* Use reflection to scan for implementations of {@see FormatPlugin}.
*
* @param config - Drill configuration object, used to find the packages to
scan
* @return - list of classes that implement the interface.
*/
- public synchronized static Class<?>[] getSubTypes(DrillConfig config){
- List<String> packages =
config.getStringList(CommonConstants.STORAGE_PLUGIN_CONFIG_SCAN_PACKAGES);
- Class<?>[] sec =
PathScanner.scanForImplementationsArr(FormatPluginConfig.class, packages);
- logger.debug("Adding Format Plugin Configs including {}", (Object) sec );
- return sec;
+ public synchronized static Class<?>[] getSubTypes(DrillConfig config) {
+ List<String> packages =
+
config.getStringList(CommonConstants.STORAGE_PLUGIN_CONFIG_SCAN_PACKAGES);
+ Class<?>[] pluginClasses =
+ PathScanner.scanForImplementationsArr(FormatPluginConfig.class,
packages);
+ for ( Class<?> pluginClass : pluginClasses ) {
+ logger.debug("Adding format plugin configuration {}", (Object)
pluginClass );
+ }
+ return pluginClasses;
}
@Override
http://git-wip-us.apache.org/repos/asf/drill/blob/d144bdcc/common/src/main/java/org/apache/drill/common/logical/StoragePluginConfigBase.java
----------------------------------------------------------------------
diff --git
a/common/src/main/java/org/apache/drill/common/logical/StoragePluginConfigBase.java
b/common/src/main/java/org/apache/drill/common/logical/StoragePluginConfigBase.java
index c006f16..dd9b18a 100644
---
a/common/src/main/java/org/apache/drill/common/logical/StoragePluginConfigBase.java
+++
b/common/src/main/java/org/apache/drill/common/logical/StoragePluginConfigBase.java
@@ -23,14 +23,21 @@ import org.apache.drill.common.config.CommonConstants;
import org.apache.drill.common.config.DrillConfig;
import org.apache.drill.common.util.PathScanner;
+import org.slf4j.Logger;
+import static org.slf4j.LoggerFactory.getLogger;
+
public abstract class StoragePluginConfigBase extends StoragePluginConfig {
- static final org.slf4j.Logger logger =
org.slf4j.LoggerFactory.getLogger(StoragePluginConfigBase.class);
+ private static final Logger logger =
getLogger(StoragePluginConfigBase.class);
public synchronized static Class<?>[] getSubTypes(DrillConfig config){
- List<String> packages =
config.getStringList(CommonConstants.STORAGE_PLUGIN_CONFIG_SCAN_PACKAGES);
- Class<?>[] sec =
PathScanner.scanForImplementationsArr(StoragePluginConfig.class, packages);
- logger.debug("Adding Storage Engine Configs including {}", (Object) sec );
- return sec;
+ List<String> packages =
+
config.getStringList(CommonConstants.STORAGE_PLUGIN_CONFIG_SCAN_PACKAGES);
+ Class<?>[] pluginClasses =
+ PathScanner.scanForImplementationsArr(StoragePluginConfig.class,
packages);
+ for (Class<?> pluginClass : pluginClasses) {
+ logger.debug("Adding storage plugin configuration {}", (Object)
pluginClass );
+ }
+ return pluginClasses;
}
@Override
http://git-wip-us.apache.org/repos/asf/drill/blob/d144bdcc/common/src/main/java/org/apache/drill/common/logical/data/LogicalOperatorBase.java
----------------------------------------------------------------------
diff --git
a/common/src/main/java/org/apache/drill/common/logical/data/LogicalOperatorBase.java
b/common/src/main/java/org/apache/drill/common/logical/data/LogicalOperatorBase.java
index 6c534eb..647fcf6 100644
---
a/common/src/main/java/org/apache/drill/common/logical/data/LogicalOperatorBase.java
+++
b/common/src/main/java/org/apache/drill/common/logical/data/LogicalOperatorBase.java
@@ -85,8 +85,13 @@ public abstract class LogicalOperatorBase implements
LogicalOperator{
}
public synchronized static Class<?>[] getSubTypes(DrillConfig config) {
- Class<?>[] ops =
PathScanner.scanForImplementationsArr(LogicalOperator.class,
config.getStringList(CommonConstants.LOGICAL_OPERATOR_SCAN_PACKAGES));
- logger.debug("Adding Logical Operator sub types: {}", ((Object) ops) );
+ final List<String> packages =
+ config.getStringList(CommonConstants.LOGICAL_OPERATOR_SCAN_PACKAGES);
+ final Class<?>[] ops =
+ PathScanner.scanForImplementationsArr(LogicalOperator.class, packages);
+ for ( Class<?> op : ops ) {
+ logger.debug("Adding logical operator {}", (Object) op);
+ }
return ops;
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/drill/blob/d144bdcc/exec/java-exec/src/main/java/org/apache/drill/exec/physical/base/PhysicalOperatorUtil.java
----------------------------------------------------------------------
diff --git
a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/base/PhysicalOperatorUtil.java
b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/base/PhysicalOperatorUtil.java
index 487ce77..a70d3f8 100644
---
a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/base/PhysicalOperatorUtil.java
+++
b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/base/PhysicalOperatorUtil.java
@@ -32,8 +32,12 @@ public class PhysicalOperatorUtil {
private PhysicalOperatorUtil(){}
public synchronized static Class<?>[] getSubTypes(DrillConfig config){
- Class<?>[] ops =
PathScanner.scanForImplementationsArr(PhysicalOperator.class,
config.getStringList(CommonConstants.PHYSICAL_OPERATOR_SCAN_PACKAGES));
- logger.debug("Adding Physical Operator sub types: {}", ((Object) ops) );
+ Class<?>[] ops =
+ PathScanner.scanForImplementationsArr(PhysicalOperator.class,
+
config.getStringList(CommonConstants.PHYSICAL_OPERATOR_SCAN_PACKAGES));
+ for (Class<?> op : ops) {
+ logger.debug("Adding physical operator {}", (Object) op );
+ }
return ops;
}
http://git-wip-us.apache.org/repos/asf/drill/blob/d144bdcc/exec/java-exec/src/main/java/org/apache/drill/exec/server/Drillbit.java
----------------------------------------------------------------------
diff --git
a/exec/java-exec/src/main/java/org/apache/drill/exec/server/Drillbit.java
b/exec/java-exec/src/main/java/org/apache/drill/exec/server/Drillbit.java
index 0640dbb..3862cea 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/server/Drillbit.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/server/Drillbit.java
@@ -17,6 +17,7 @@
*/
package org.apache.drill.exec.server;
+import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import org.apache.drill.common.AutoCloseables;
@@ -49,6 +50,7 @@ import org.glassfish.jersey.servlet.ServletContainer;
import com.codahale.metrics.servlets.MetricsServlet;
import com.codahale.metrics.servlets.ThreadDumpServlet;
+import com.google.common.base.Stopwatch;
import com.google.common.io.Closeables;
/**
@@ -175,7 +177,7 @@ public class Drillbit implements AutoCloseable {
private RegistrationHandle registrationHandle;
public Drillbit(final DrillConfig config, final RemoteServiceSet serviceSet)
throws Exception {
- final long startTime = System.currentTimeMillis();
+ final Stopwatch w = new Stopwatch().start();
logger.debug("Construction started.");
final boolean allowPortHunting = serviceSet != null;
final boolean enableHttp = config.getBoolean(ExecConstants.HTTP_ENABLE);
@@ -197,7 +199,7 @@ public class Drillbit implements AutoCloseable {
coord = new ZKClusterCoordinator(config);
storeProvider = new PStoreRegistry(this.coord,
config).newPStoreProvider();
}
- logger.info("Construction completed ({} ms).", System.currentTimeMillis()
- startTime);
+ logger.info("Construction completed ({} ms).",
w.elapsed(TimeUnit.MILLISECONDS));
}
private void startJetty() throws Exception {
@@ -234,7 +236,7 @@ public class Drillbit implements AutoCloseable {
}
public void run() throws Exception {
- final long startTime = System.currentTimeMillis();
+ final Stopwatch w = new Stopwatch().start();
logger.debug("Startup begun.");
coord.start(10000);
storeProvider.start();
@@ -248,7 +250,7 @@ public class Drillbit implements AutoCloseable {
startJetty();
Runtime.getRuntime().addShutdownHook(new ShutdownThread(this, new
StackTrace()));
- logger.info("Startup completed ({} ms).", System.currentTimeMillis() -
startTime);
+ logger.info("Startup completed ({} ms).",
w.elapsed(TimeUnit.MILLISECONDS));
}
@Override
@@ -257,7 +259,7 @@ public class Drillbit implements AutoCloseable {
if (isClosed) {
return;
}
- final long startTime = System.currentTimeMillis();
+ final Stopwatch w = new Stopwatch().start();
logger.debug("Shutdown begun.");
// wait for anything that is running to complete
@@ -291,7 +293,7 @@ public class Drillbit implements AutoCloseable {
AutoCloseables.close(manager, logger);
Closeables.closeQuietly(context);
- logger.info("Shutdown completed ({} ms).", System.currentTimeMillis() -
startTime);
+ logger.info("Shutdown completed ({} ms).",
w.elapsed(TimeUnit.MILLISECONDS));
isClosed = true;
}
http://git-wip-us.apache.org/repos/asf/drill/blob/d144bdcc/exec/java-exec/src/main/java/org/apache/drill/exec/store/StoragePluginRegistry.java
----------------------------------------------------------------------
diff --git
a/exec/java-exec/src/main/java/org/apache/drill/exec/store/StoragePluginRegistry.java
b/exec/java-exec/src/main/java/org/apache/drill/exec/store/StoragePluginRegistry.java
index 9ca419d..49a8a6b 100644
---
a/exec/java-exec/src/main/java/org/apache/drill/exec/store/StoragePluginRegistry.java
+++
b/exec/java-exec/src/main/java/org/apache/drill/exec/store/StoragePluginRegistry.java
@@ -107,7 +107,8 @@ public class StoragePluginRegistry implements
Iterable<Map.Entry<String, Storage
@SuppressWarnings("unchecked")
public void init() throws DrillbitStartupException {
DrillConfig config = context.getConfig();
- Collection<Class<? extends StoragePlugin>> plugins =
PathScanner.scanForImplementations(StoragePlugin.class,
config.getStringList(ExecConstants.STORAGE_ENGINE_SCAN_PACKAGES));
+ Collection<Class<? extends StoragePlugin>> plugins =
+ PathScanner.scanForImplementations(StoragePlugin.class,
config.getStringList(ExecConstants.STORAGE_ENGINE_SCAN_PACKAGES));
logger.debug("Loading storage plugins {}", plugins);
for (Class<? extends StoragePlugin> plugin : plugins) {
int i = 0;
http://git-wip-us.apache.org/repos/asf/drill/blob/d144bdcc/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/FormatCreator.java
----------------------------------------------------------------------
diff --git
a/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/FormatCreator.java
b/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/FormatCreator.java
index d2a903b..729dc55 100644
---
a/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/FormatCreator.java
+++
b/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/FormatCreator.java
@@ -46,7 +46,8 @@ public class FormatCreator {
final DrillConfig config = context.getConfig();
Map<String, FormatPlugin> plugins = Maps.newHashMap();
- Collection<Class<? extends FormatPlugin>> pluginClasses =
PathScanner.scanForImplementations(FormatPlugin.class,
config.getStringList(ExecConstants.STORAGE_ENGINE_SCAN_PACKAGES));
+ Collection<Class<? extends FormatPlugin>> pluginClasses =
+ PathScanner.scanForImplementations(FormatPlugin.class,
config.getStringList(ExecConstants.STORAGE_ENGINE_SCAN_PACKAGES));
if (storageConfig.formats == null || storageConfig.formats.isEmpty()) {