Github user xunzhang commented on a diff in the pull request:

    https://github.com/apache/incubator-hawq/pull/828#discussion_r72934303
  
    --- Diff: src/test/feature/lib/hdfs_config.cpp ---
    @@ -0,0 +1,284 @@
    +#include <fstream>
    +#include <string>
    +#include <vector>
    +#include <unordered_set>
    +
    +#include "hdfs_config.h"
    +#include "command.h"
    +#include "psql.h"
    +#include "xml_parser.h"
    +#include "string_util.h"
    +
    +using std::string;
    +
    +namespace hawq {
    +namespace test {
    +
    +string HdfsConfig::getHdfsUser() {
    +  string cmd = "ps aux|grep hdfs.server|grep -v grep";
    +  Command c(cmd);
    +  string result = c.run().getResultOutput();
    +  auto lines = hawq::test::split(result, '\n');
    +  if (lines.size() >= 1) {
    +    return hawq::test::trim(hawq::test::split(lines[lines.size()-1], ' 
')[0]);
    +  } 
    +  return "hdfs";
    +}
    +
    +bool HdfsConfig::LoadFromHawqConfigFile() {
    +  const char *env = getenv("GPHOME");
    +  string confPath = env ? env : "";
    +  if (!confPath.empty()) {
    +    confPath.append("/etc/hdfs-client.xml");
    +  } else {
    +    return false;
    +  }
    +
    +  hawqxmlconf.reset(new XmlConfig(confPath));
    +  hawqxmlconf->parse();
    +  return true;
    +}
    +
    +bool HdfsConfig::LoadFromHdfsConfigFile() {
    +  string confPath=getHadoopHome();
    +  if (confPath == "")
    +    return false;
    +  confPath.append("/etc/hadoop/hdfs-site.xml");
    +  hdfsxmlconf.reset(new XmlConfig(confPath));
    +  hdfsxmlconf->parse();
    +  return true;
    +}
    +
    +bool HdfsConfig::isHA() {
    --- End diff --
    
    [REVIEW-LINK-1] I think the implementation of these functions are 
problematic. Say if user modified these configuration files without restart 
HAWQ, the result could be confused. A better way is to get these kinds of 
status from running HAWQ, is that possible?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to