YARN-1326. RM should log using RMStore at startup time. (Tsuyoshi Ozawa via kasha)
(cherry picked from commit d16bfd1d0f
)
This commit is contained in:
parent
ba95033cc4
commit
9c43760e59
|
@ -134,6 +134,9 @@ Release 2.6.0 - UNRELEASED
|
||||||
YARN-2389. Added functionality for schedulers to kill all applications in a
|
YARN-2389. Added functionality for schedulers to kill all applications in a
|
||||||
queue. (Subramaniam Venkatraman Krishnan via jianhe)
|
queue. (Subramaniam Venkatraman Krishnan via jianhe)
|
||||||
|
|
||||||
|
YARN-1326. RM should log using RMStore at startup time.
|
||||||
|
(Tsuyoshi Ozawa via kasha)
|
||||||
|
|
||||||
OPTIMIZATIONS
|
OPTIMIZATIONS
|
||||||
|
|
||||||
BUG FIXES
|
BUG FIXES
|
||||||
|
|
|
@ -17,17 +17,20 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.hadoop.yarn.server.resourcemanager.recovery;
|
package org.apache.hadoop.yarn.server.resourcemanager.recovery;
|
||||||
|
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.logging.LogFactory;
|
||||||
import org.apache.hadoop.conf.Configuration;
|
import org.apache.hadoop.conf.Configuration;
|
||||||
import org.apache.hadoop.util.ReflectionUtils;
|
import org.apache.hadoop.util.ReflectionUtils;
|
||||||
import org.apache.hadoop.yarn.conf.YarnConfiguration;
|
import org.apache.hadoop.yarn.conf.YarnConfiguration;
|
||||||
|
|
||||||
public class RMStateStoreFactory {
|
public class RMStateStoreFactory {
|
||||||
|
private static final Log LOG = LogFactory.getLog(RMStateStoreFactory.class);
|
||||||
|
|
||||||
public static RMStateStore getStore(Configuration conf) {
|
public static RMStateStore getStore(Configuration conf) {
|
||||||
RMStateStore store = ReflectionUtils.newInstance(
|
Class<? extends RMStateStore> storeClass =
|
||||||
conf.getClass(YarnConfiguration.RM_STORE,
|
conf.getClass(YarnConfiguration.RM_STORE,
|
||||||
MemoryRMStateStore.class, RMStateStore.class),
|
MemoryRMStateStore.class, RMStateStore.class);
|
||||||
conf);
|
LOG.info("Using RMStateStore implementation - " + storeClass);
|
||||||
return store;
|
return ReflectionUtils.newInstance(storeClass, conf);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -44,6 +44,7 @@ public class AboutBlock extends HtmlBlock {
|
||||||
_("Cluster ID:", cinfo.getClusterId()).
|
_("Cluster ID:", cinfo.getClusterId()).
|
||||||
_("ResourceManager state:", cinfo.getState()).
|
_("ResourceManager state:", cinfo.getState()).
|
||||||
_("ResourceManager HA state:", cinfo.getHAState()).
|
_("ResourceManager HA state:", cinfo.getHAState()).
|
||||||
|
_("ResourceManager RMStateStore:", cinfo.getRMStateStore()).
|
||||||
_("ResourceManager started on:", Times.format(cinfo.getStartedOn())).
|
_("ResourceManager started on:", Times.format(cinfo.getStartedOn())).
|
||||||
_("ResourceManager version:", cinfo.getRMBuildVersion() +
|
_("ResourceManager version:", cinfo.getRMBuildVersion() +
|
||||||
" on " + cinfo.getRMVersionBuiltOn()).
|
" on " + cinfo.getRMVersionBuiltOn()).
|
||||||
|
|
|
@ -25,6 +25,7 @@ import org.apache.hadoop.ha.HAServiceProtocol;
|
||||||
import org.apache.hadoop.service.Service.STATE;
|
import org.apache.hadoop.service.Service.STATE;
|
||||||
import org.apache.hadoop.util.VersionInfo;
|
import org.apache.hadoop.util.VersionInfo;
|
||||||
import org.apache.hadoop.yarn.server.resourcemanager.ResourceManager;
|
import org.apache.hadoop.yarn.server.resourcemanager.ResourceManager;
|
||||||
|
import org.apache.hadoop.yarn.server.resourcemanager.recovery.RMStateStore;
|
||||||
import org.apache.hadoop.yarn.util.YarnVersionInfo;
|
import org.apache.hadoop.yarn.util.YarnVersionInfo;
|
||||||
|
|
||||||
@XmlRootElement
|
@XmlRootElement
|
||||||
|
@ -35,6 +36,7 @@ public class ClusterInfo {
|
||||||
protected long startedOn;
|
protected long startedOn;
|
||||||
protected STATE state;
|
protected STATE state;
|
||||||
protected HAServiceProtocol.HAServiceState haState;
|
protected HAServiceProtocol.HAServiceState haState;
|
||||||
|
protected String rmStateStoreName;
|
||||||
protected String resourceManagerVersion;
|
protected String resourceManagerVersion;
|
||||||
protected String resourceManagerBuildVersion;
|
protected String resourceManagerBuildVersion;
|
||||||
protected String resourceManagerVersionBuiltOn;
|
protected String resourceManagerVersionBuiltOn;
|
||||||
|
@ -51,6 +53,8 @@ public class ClusterInfo {
|
||||||
this.id = ts;
|
this.id = ts;
|
||||||
this.state = rm.getServiceState();
|
this.state = rm.getServiceState();
|
||||||
this.haState = rm.getRMContext().getHAServiceState();
|
this.haState = rm.getRMContext().getHAServiceState();
|
||||||
|
this.rmStateStoreName = rm.getRMContext().getStateStore().getClass()
|
||||||
|
.getName();
|
||||||
this.startedOn = ts;
|
this.startedOn = ts;
|
||||||
this.resourceManagerVersion = YarnVersionInfo.getVersion();
|
this.resourceManagerVersion = YarnVersionInfo.getVersion();
|
||||||
this.resourceManagerBuildVersion = YarnVersionInfo.getBuildVersion();
|
this.resourceManagerBuildVersion = YarnVersionInfo.getBuildVersion();
|
||||||
|
@ -68,6 +72,10 @@ public class ClusterInfo {
|
||||||
return this.haState.toString();
|
return this.haState.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getRMStateStore() {
|
||||||
|
return this.rmStateStoreName;
|
||||||
|
}
|
||||||
|
|
||||||
public String getRMVersion() {
|
public String getRMVersion() {
|
||||||
return this.resourceManagerVersion;
|
return this.resourceManagerVersion;
|
||||||
}
|
}
|
||||||
|
|
|
@ -284,7 +284,7 @@ public class TestRMWebServices extends JerseyTest {
|
||||||
Exception {
|
Exception {
|
||||||
assertEquals("incorrect number of elements", 1, json.length());
|
assertEquals("incorrect number of elements", 1, json.length());
|
||||||
JSONObject info = json.getJSONObject("clusterInfo");
|
JSONObject info = json.getJSONObject("clusterInfo");
|
||||||
assertEquals("incorrect number of elements", 10, info.length());
|
assertEquals("incorrect number of elements", 11, info.length());
|
||||||
verifyClusterGeneric(info.getLong("id"), info.getLong("startedOn"),
|
verifyClusterGeneric(info.getLong("id"), info.getLong("startedOn"),
|
||||||
info.getString("state"), info.getString("haState"),
|
info.getString("state"), info.getString("haState"),
|
||||||
info.getString("hadoopVersionBuiltOn"),
|
info.getString("hadoopVersionBuiltOn"),
|
||||||
|
|
Loading…
Reference in New Issue