drill-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From par...@apache.org
Subject [1/4] drill git commit: DRILL-5560: Create configuration file for distribution specific configuration This closes #848
Date Mon, 12 Jun 2017 01:27:39 GMT
Repository: drill
Updated Branches:
  refs/heads/master 874bf6296 -> a7e298760


DRILL-5560: Create configuration file for distribution specific configuration
This closes #848


Project: http://git-wip-us.apache.org/repos/asf/drill/repo
Commit: http://git-wip-us.apache.org/repos/asf/drill/commit/adb79fb5
Tree: http://git-wip-us.apache.org/repos/asf/drill/tree/adb79fb5
Diff: http://git-wip-us.apache.org/repos/asf/drill/diff/adb79fb5

Branch: refs/heads/master
Commit: adb79fb58e7ee699424d8f24c6ed76080921b579
Parents: 874bf62
Author: Padma Penumarthy <ppenumar97@yahoo.com>
Authored: Tue May 30 10:17:48 2017 -0700
Committer: Parth Chandra <parthc@apache.org>
Committed: Sun Jun 11 17:15:27 2017 -0700

----------------------------------------------------------------------
 .../drill/common/config/CommonConstants.java     |  3 +++
 .../apache/drill/common/config/DrillConfig.java  | 19 ++++++++++++++-----
 distribution/src/resources/drill-config.sh       |  3 ++-
 3 files changed, 19 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/drill/blob/adb79fb5/common/src/main/java/org/apache/drill/common/config/CommonConstants.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/drill/common/config/CommonConstants.java b/common/src/main/java/org/apache/drill/common/config/CommonConstants.java
index d3d2b72..eab48d0 100644
--- a/common/src/main/java/org/apache/drill/common/config/CommonConstants.java
+++ b/common/src/main/java/org/apache/drill/common/config/CommonConstants.java
@@ -25,6 +25,9 @@ public interface CommonConstants {
   /** Module configuration files name.  (Classpath resource pathname.) */
   String DRILL_JAR_MARKER_FILE_RESOURCE_PATHNAME = "drill-module.conf";
 
+  /** Distribution Specific Override configuration file name.  (Classpath resource pathname.)
*/
+  String CONFIG_DISTRIBUTION_RESOURCE_PATHNAME = "drill-distrib.conf";
+
   /** Override configuration file name.  (Classpath resource pathname.) */
   String CONFIG_OVERRIDE_RESOURCE_PATHNAME = "drill-override.conf";
 

http://git-wip-us.apache.org/repos/asf/drill/blob/adb79fb5/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 6828718..0d3ce9a 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
@@ -116,11 +116,9 @@ public class DrillConfig extends NestedConfig {
 
 
   /**
-   * <p>
    * DrillConfig loads up Drill configuration information. It does this utilizing a combination
of classpath scanning
    * and Configuration fallbacks provided by the TypeSafe configuration library. The order
of precedence is as
    * follows:
-   * </p>
    * <p>
    * Configuration values are retrieved as follows:
    * <ul>
@@ -128,6 +126,8 @@ public class DrillConfig extends NestedConfig {
    *     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 a single copy of "drill-distrib.conf". If multiple copies are
+   *     on the classpath, which copy is read is indeterminate. </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
@@ -216,12 +216,21 @@ public class DrillConfig extends NestedConfig {
     }
     logString.append("\n");
 
-    // 3. Load any specified overrides configuration file along with any
+    final ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
+
+    // 3. Load distribution specific configuration file.
+    final URL distribConfigFileUrl = classLoader.getResource(CommonConstants.CONFIG_DISTRIBUTION_RESOURCE_PATHNAME);
+    if (null != distribConfigFileUrl ) {
+      logString.append("Distribution Specific Configuration File: ").append(distribConfigFileUrl).append("\n");
+    }
+    fallback =
+      ConfigFactory.load(CommonConstants.CONFIG_DISTRIBUTION_RESOURCE_PATHNAME).withFallback(fallback);
+
+    // 4. Load any specified overrides configuration file along with any
     //    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);
+    final URL overrideFileUrl = classLoader.getResource(overrideFileResourcePathname);
     if (null != overrideFileUrl ) {
       logString.append("Override File: ").append(overrideFileUrl).append("\n");
     }

http://git-wip-us.apache.org/repos/asf/drill/blob/adb79fb5/distribution/src/resources/drill-config.sh
----------------------------------------------------------------------
diff --git a/distribution/src/resources/drill-config.sh b/distribution/src/resources/drill-config.sh
index 1946275..32306ee 100644
--- a/distribution/src/resources/drill-config.sh
+++ b/distribution/src/resources/drill-config.sh
@@ -260,7 +260,8 @@ fi
 # Add $DRILL_HOME/conf if the user has provided their own
 # site configuration directory.
 # Ensures we pick up the default logback.xml, etc. if the
-# user does not provide their own.
+# user does not provide their own, and that we pick up the
+# drill-distrib.conf file, if provided by the distro.
 # Also, set a variable to remember that the config dir
 # is non-default, which is needed later.
 


Mime
View raw message