Revert "YARN-7537 [Atsv2] load hbase configuration from filesystem rather than URL. Contributed by Rohith Sharma"
This reverts commit ec8f47e7fa
.
This commit is contained in:
parent
e7642a3e6f
commit
f3e33aeb80
|
@ -2463,7 +2463,7 @@
|
||||||
</property>
|
</property>
|
||||||
|
|
||||||
<property>
|
<property>
|
||||||
<description> Optional FS path to an hbase-site.xml configuration file to be
|
<description> Optional URL to an hbase-site.xml configuration file to be
|
||||||
used to connect to the timeline-service hbase cluster. If empty or not
|
used to connect to the timeline-service hbase cluster. If empty or not
|
||||||
specified, then the HBase configuration will be loaded from the classpath.
|
specified, then the HBase configuration will be loaded from the classpath.
|
||||||
When specified the values in the specified configuration file will override
|
When specified the values in the specified configuration file will override
|
||||||
|
|
|
@ -18,14 +18,13 @@
|
||||||
package org.apache.hadoop.yarn.server.timelineservice.storage.common;
|
package org.apache.hadoop.yarn.server.timelineservice.storage.common;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.net.MalformedURLException;
|
||||||
|
import java.net.URL;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.apache.hadoop.conf.Configuration;
|
import org.apache.hadoop.conf.Configuration;
|
||||||
import org.apache.hadoop.fs.FSDataInputStream;
|
|
||||||
import org.apache.hadoop.fs.FileSystem;
|
|
||||||
import org.apache.hadoop.fs.Path;
|
|
||||||
import org.apache.hadoop.hbase.Cell;
|
import org.apache.hadoop.hbase.Cell;
|
||||||
import org.apache.hadoop.hbase.CellUtil;
|
import org.apache.hadoop.hbase.CellUtil;
|
||||||
import org.apache.hadoop.hbase.HBaseConfiguration;
|
import org.apache.hadoop.hbase.HBaseConfiguration;
|
||||||
|
@ -270,43 +269,28 @@ public final class HBaseTimelineStorageUtils {
|
||||||
* @return a configuration with the HBase configuration from the classpath,
|
* @return a configuration with the HBase configuration from the classpath,
|
||||||
* optionally overwritten by the timeline service configuration URL if
|
* optionally overwritten by the timeline service configuration URL if
|
||||||
* specified.
|
* specified.
|
||||||
* @throws IOException if a timeline service HBase configuration path
|
* @throws MalformedURLException if a timeline service HBase configuration URL
|
||||||
* is specified but unable to read it.
|
* is specified but is a malformed URL.
|
||||||
*/
|
*/
|
||||||
public static Configuration getTimelineServiceHBaseConf(Configuration conf)
|
public static Configuration getTimelineServiceHBaseConf(Configuration conf)
|
||||||
throws IOException {
|
throws MalformedURLException {
|
||||||
if (conf == null) {
|
if (conf == null) {
|
||||||
throw new NullPointerException();
|
throw new NullPointerException();
|
||||||
}
|
}
|
||||||
|
|
||||||
Configuration hbaseConf;
|
Configuration hbaseConf;
|
||||||
String timelineServiceHBaseConfFilePath =
|
String timelineServiceHBaseConfFileURL =
|
||||||
conf.get(YarnConfiguration.TIMELINE_SERVICE_HBASE_CONFIGURATION_FILE);
|
conf.get(YarnConfiguration.TIMELINE_SERVICE_HBASE_CONFIGURATION_FILE);
|
||||||
if (timelineServiceHBaseConfFilePath != null
|
if (timelineServiceHBaseConfFileURL != null
|
||||||
&& timelineServiceHBaseConfFilePath.length() > 0) {
|
&& timelineServiceHBaseConfFileURL.length() > 0) {
|
||||||
LOG.info("Using hbase configuration at " +
|
LOG.info("Using hbase configuration at " +
|
||||||
timelineServiceHBaseConfFilePath);
|
timelineServiceHBaseConfFileURL);
|
||||||
// create a clone so that we don't mess with out input one
|
// create a clone so that we don't mess with out input one
|
||||||
hbaseConf = new Configuration(conf);
|
hbaseConf = new Configuration(conf);
|
||||||
Configuration plainHBaseConf = new Configuration(false);
|
Configuration plainHBaseConf = new Configuration(false);
|
||||||
FileSystem fs = null;
|
URL hbaseSiteXML = new URL(timelineServiceHBaseConfFileURL);
|
||||||
FSDataInputStream in = null;
|
plainHBaseConf.addResource(hbaseSiteXML);
|
||||||
try {
|
HBaseConfiguration.merge(hbaseConf, plainHBaseConf);
|
||||||
Path hbaseConfigPath = new Path(timelineServiceHBaseConfFilePath);
|
|
||||||
fs = FileSystem.newInstance(conf);
|
|
||||||
in = fs.open(hbaseConfigPath);
|
|
||||||
plainHBaseConf.addResource(in);
|
|
||||||
HBaseConfiguration.merge(hbaseConf, plainHBaseConf);
|
|
||||||
} catch (IOException e) {
|
|
||||||
throw e;
|
|
||||||
} finally {
|
|
||||||
if (in != null) {
|
|
||||||
in.close();
|
|
||||||
}
|
|
||||||
if (fs != null) {
|
|
||||||
fs.close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
// default to what is on the classpath
|
// default to what is on the classpath
|
||||||
hbaseConf = HBaseConfiguration.create(conf);
|
hbaseConf = HBaseConfiguration.create(conf);
|
||||||
|
|
Loading…
Reference in New Issue