Hongtao He created KYLIN-3709:
---------------------------------

             Summary: Pass the wrong parameter to addResource function, kylin 
can not load the configuration file hbase.hdfs.xml .
                 Key: KYLIN-3709
                 URL: https://issues.apache.org/jira/browse/KYLIN-3709
             Project: Kylin
          Issue Type: Bug
          Components: Job Engine
    Affects Versions: v2.5.2, v2.5.1
            Reporter: Hongtao He
            Assignee: Shaofeng SHI
         Attachments: 
method-1-Pass-the-wrong-parameter-to-addResource-function-kyl.patch, 
method-2-Pass-the-wrong-parameter-to-addResource-function-kyl.patch

When calling Configuration.addResource, 
[KYLIN-3648|https://jira.apache.org/jira/browse/KYLIN-3648] use a Path as the 
parameter instead of a string in Kylin's HBaseConnection.

 
{code:java}
String hdfsConfigFile = 
KylinConfig.getInstanceFromEnv().getHBaseClusterHDFSConfigFile();
if (hdfsConfigFile == null || hdfsConfigFile.isEmpty()) {
    return;
}
Configuration hdfsConf = new Configuration(false);
hdfsConf.addResource(new Path(hdfsConfigFile));
{code}
Use a Path as the parameter of Configuration.addResource is better. 
Unfortunately,  the parameter which passed to the addResource function is 
wrong. The addResource function only accepts absolute paths, but the parameter 
is just a filename. For example, the value of 

hdfsConfigFile is "hbase.hdfs.xml", so addResource function will not work . The 
end result is that kylin can not load the hbase configuration file 
hbase.hdfs.xml .

There are two ways to fix this bug, and I think method 1 is better.

Method-1.revert the code
{code:java}
String hdfsConfigFile = 
KylinConfig.getInstanceFromEnv().getHBaseClusterHDFSConfigFile();
if (hdfsConfigFile == null || hdfsConfigFile.isEmpty()) {
    return;
}
Configuration hdfsConf = new Configuration(false);
hdfsConf.addResource(hdfsConfigFile);{code}
Method-2.Get the absolute path of the configuration file
{code:java}
String hdfsConfigFile = 
KylinConfig.getInstanceFromEnv().getHBaseClusterHDFSConfigFile();
if (hdfsConfigFile == null || hdfsConfigFile.isEmpty()) {
    return;
}
Configuration hdfsConf = new Configuration(false);
String hbaseHdfsConfigPath = System.getProperty("user.dir") + "/../conf/" + 
hdfsConfigFile;
hdfsConf.addResource(new Path(hbaseHdfsConfigPath));
{code}
 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to