YARN-1326. RM should log using RMStore at startup time. (Tsuyoshi Ozawa via kasha)

This commit is contained in:
Karthik Kambatla 2014-08-27 01:43:58 -07:00
parent 2d9b77d617
commit d16bfd1d0f
5 changed files with 21 additions and 6 deletions

View File

@ -154,6 +154,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

View File

@ -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);
} }
} }

View File

@ -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()).

View File

@ -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;
} }

View File

@ -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"),