Uploaded image for project: 'Chukwa'
  1. Chukwa
  2. CHUKWA-163

source code should not use DATACONF envrionment variable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 0.1.2
    • Fix Version/s: 0.1.2
    • Component/s: User Interface
    • Labels:
      None

      Description

      DataConfig.java and DatabaseConfig.java should not use DATACONFIG environment variable. It should use CHUKWA_CONF_DIR.

      Index: src/java/org/apache/hadoop/chukwa/inputtools/mdl/DataConfig.java
      ===================================================================
      — src/java/org/apache/hadoop/chukwa/inputtools/mdl/DataConfig.java (revision 766193)
      +++ src/java/org/apache/hadoop/chukwa/inputtools/mdl/DataConfig.java (working copy)
      @@ -26,10 +26,11 @@
      import java.util.Iterator;
      import java.util.HashMap;
      import java.util.Map;
      +import java.io.File;

      public class DataConfig {
      private static Configuration config;

      • final static String DATACONFIG = "mdl.xml";
        + final static String MDL_XML = "mdl.xml";
        private Log log = LogFactory.getLog(DataConfig.class);

      public DataConfig(String path)

      { @@ -39,9 +40,11 @@ }

      public DataConfig() {

      • String dataConfig = System.getenv("DATACONFIG");
        + String dataConfig = System.getenv("CHUKWA_CONF_DIR");
        if (dataConfig == null) { - dataConfig = DATACONFIG; + dataConfig = MDL_XML; + }

        else

        { + dataConfig += File.separator + MDL_XML; }

        log.debug("DATACONFIG=" + dataConfig);
        if (config == null) {

      Index: src/java/org/apache/hadoop/chukwa/database/DatabaseConfig.java
      ===================================================================
      — src/java/org/apache/hadoop/chukwa/database/DatabaseConfig.java (revision 766193)
      +++ src/java/org/apache/hadoop/chukwa/database/DatabaseConfig.java (working copy)
      @@ -22,6 +22,7 @@
      import org.apache.hadoop.conf.Configuration;
      import org.apache.hadoop.fs.Path;
      import java.util.*;
      +import java.io.File;

      public class DatabaseConfig {
      private Configuration config = null;
      @@ -32,6 +33,7 @@
      public final static long MONTH = 30 * 24 * 60 * 60 * 1000L;
      public final static long WEEK = 7 * 24 * 60 * 60 * 1000L;
      public final static long DAY = 24 * 60 * 60 * 1000L;
      + public final static String MDL_XML = "mdl.xml";

      public DatabaseConfig(String path)

      { Path fileResource = new Path(path); @@ -40,7 +42,13 @@ }

      public DatabaseConfig() {

      • Path fileResource = new Path(System.getenv("DATACONFIG"));
        + String dataConfig = System.getenv("CHUKWA_CONF_DIR");
        + if (dataConfig == null) { + dataConfig = MDL_XML; + }

        else

        { + dataConfig += File.separator + MDL_XML; + }

        + Path fileResource = new Path(dataConfig);
        config = new Configuration();
        config.addResource(fileResource);
        }

        Activity

        Hide
        terencekwan Terence Kwan added a comment -

        Index: src/java/org/apache/hadoop/chukwa/inputtools/mdl/DataConfig.java
        ===================================================================
        — src/java/org/apache/hadoop/chukwa/inputtools/mdl/DataConfig.java (revision 766193)
        +++ src/java/org/apache/hadoop/chukwa/inputtools/mdl/DataConfig.java (working copy)
        @@ -26,10 +26,11 @@
        import java.util.Iterator;
        import java.util.HashMap;
        import java.util.Map;
        +import java.io.File;

        public class DataConfig {
        private static Configuration config;

        • final static String DATACONFIG = "mdl.xml";
          + final static String MDL_XML = "mdl.xml";
          private Log log = LogFactory.getLog(DataConfig.class);

        public DataConfig(String path)

        { @@ -39,9 +40,11 @@ }

        public DataConfig() {

        • String dataConfig = System.getenv("DATACONFIG");
          + String dataConfig = System.getenv("CHUKWA_CONF_DIR");
          if (dataConfig == null) { - dataConfig = DATACONFIG; + dataConfig = MDL_XML; + }

          else

          { + dataConfig += File.separator + MDL_XML; }

          log.debug("DATACONFIG=" + dataConfig);
          if (config == null) {
          Index: src/java/org/apache/hadoop/chukwa/database/DatabaseConfig.java
          ===================================================================

            • src/java/org/apache/hadoop/chukwa/database/DatabaseConfig.java (revision 766193)
              +++ src/java/org/apache/hadoop/chukwa/database/DatabaseConfig.java (working copy)
              @@ -22,6 +22,7 @@
              import org.apache.hadoop.conf.Configuration;
              import org.apache.hadoop.fs.Path;
              import java.util.*;
              +import java.io.File;

        public class DatabaseConfig {
        private Configuration config = null;
        @@ -32,6 +33,7 @@
        public final static long MONTH = 30 * 24 * 60 * 60 * 1000L;
        public final static long WEEK = 7 * 24 * 60 * 60 * 1000L;
        public final static long DAY = 24 * 60 * 60 * 1000L;
        + public final static String MDL_XML = "mdl.xml";

        public DatabaseConfig(String path)

        { Path fileResource = new Path(path); @@ -40,7 +42,13 @@ }

        public DatabaseConfig() {

        • Path fileResource = new Path(System.getenv("DATACONFIG"));
          + String dataConfig = System.getenv("CHUKWA_CONF_DIR");
          + if (dataConfig == null) { + dataConfig = MDL_XML; + }

          else

          { + dataConfig += File.separator + MDL_XML; + }

          + Path fileResource = new Path(dataConfig);
          config = new Configuration();
          config.addResource(fileResource);
          }

        Show
        terencekwan Terence Kwan added a comment - Index: src/java/org/apache/hadoop/chukwa/inputtools/mdl/DataConfig.java =================================================================== — src/java/org/apache/hadoop/chukwa/inputtools/mdl/DataConfig.java (revision 766193) +++ src/java/org/apache/hadoop/chukwa/inputtools/mdl/DataConfig.java (working copy) @@ -26,10 +26,11 @@ import java.util.Iterator; import java.util.HashMap; import java.util.Map; +import java.io.File; public class DataConfig { private static Configuration config; final static String DATACONFIG = "mdl.xml"; + final static String MDL_XML = "mdl.xml"; private Log log = LogFactory.getLog(DataConfig.class); public DataConfig(String path) { @@ -39,9 +40,11 @@ } public DataConfig() { String dataConfig = System.getenv("DATACONFIG"); + String dataConfig = System.getenv("CHUKWA_CONF_DIR"); if (dataConfig == null) { - dataConfig = DATACONFIG; + dataConfig = MDL_XML; + } else { + dataConfig += File.separator + MDL_XML; } log.debug("DATACONFIG=" + dataConfig); if (config == null) { Index: src/java/org/apache/hadoop/chukwa/database/DatabaseConfig.java =================================================================== src/java/org/apache/hadoop/chukwa/database/DatabaseConfig.java (revision 766193) +++ src/java/org/apache/hadoop/chukwa/database/DatabaseConfig.java (working copy) @@ -22,6 +22,7 @@ import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.Path; import java.util.*; +import java.io.File; public class DatabaseConfig { private Configuration config = null; @@ -32,6 +33,7 @@ public final static long MONTH = 30 * 24 * 60 * 60 * 1000L; public final static long WEEK = 7 * 24 * 60 * 60 * 1000L; public final static long DAY = 24 * 60 * 60 * 1000L; + public final static String MDL_XML = "mdl.xml"; public DatabaseConfig(String path) { Path fileResource = new Path(path); @@ -40,7 +42,13 @@ } public DatabaseConfig() { Path fileResource = new Path(System.getenv("DATACONFIG")); + String dataConfig = System.getenv("CHUKWA_CONF_DIR"); + if (dataConfig == null) { + dataConfig = MDL_XML; + } else { + dataConfig += File.separator + MDL_XML; + } + Path fileResource = new Path(dataConfig); config = new Configuration(); config.addResource(fileResource); }
        Hide
        eyang Eric Yang added a comment -

        +1 Looks good.

        Show
        eyang Eric Yang added a comment - +1 Looks good.
        Hide
        eyang Eric Yang added a comment -

        I just committed this. Thanks Terence.

        Show
        eyang Eric Yang added a comment - I just committed this. Thanks Terence.
        Hide
        hudson Hudson added a comment -
        Show
        hudson Hudson added a comment - Integrated in Chukwa-trunk #8 (See http://hudson.zones.apache.org/hudson/job/Chukwa-trunk/8/ )

          People

          • Assignee:
            terencekwan Terence Kwan
            Reporter:
            terencekwan Terence Kwan
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development