|
@@ -30,6 +30,7 @@ import org.apache.hadoop.conf.Configuration;
|
|
|
import org.apache.hadoop.ha.HAServiceProtocol;
|
|
|
import org.apache.hadoop.ha.HAServiceProtocol.HAServiceState;
|
|
|
import org.apache.hadoop.http.lib.StaticUserWebFilter;
|
|
|
+import org.apache.hadoop.metrics2.MetricsSystem;
|
|
|
import org.apache.hadoop.metrics2.lib.DefaultMetricsSystem;
|
|
|
import org.apache.hadoop.metrics2.source.JvmMetrics;
|
|
|
import org.apache.hadoop.security.AuthenticationFilterInitializer;
|
|
@@ -173,7 +174,7 @@ public class ResourceManager extends CompositeService implements Recoverable {
|
|
|
private WebApp webApp;
|
|
|
private AppReportFetcher fetcher = null;
|
|
|
protected ResourceTrackerService resourceTracker;
|
|
|
- private JvmPauseMonitor pauseMonitor;
|
|
|
+ private JvmMetrics jvmMetrics;
|
|
|
private boolean curatorEnabled = false;
|
|
|
private CuratorFramework curator;
|
|
|
private final String zkRootNodePassword =
|
|
@@ -286,7 +287,7 @@ public class ResourceManager extends CompositeService implements Recoverable {
|
|
|
|
|
|
rmContext.setYarnConfiguration(conf);
|
|
|
|
|
|
- createAndInitActiveServices();
|
|
|
+ createAndInitActiveServices(false);
|
|
|
|
|
|
webAppAddress = WebAppUtils.getWebAppBindURL(this.conf,
|
|
|
YarnConfiguration.RM_BIND_HOST,
|
|
@@ -491,6 +492,7 @@ public class ResourceManager extends CompositeService implements Recoverable {
|
|
|
private ContainerAllocationExpirer containerAllocationExpirer;
|
|
|
private ResourceManager rm;
|
|
|
private RMActiveServiceContext activeServiceContext;
|
|
|
+ private boolean fromActive = false;
|
|
|
|
|
|
RMActiveServices(ResourceManager rm) {
|
|
|
super("RMActiveServices");
|
|
@@ -598,11 +600,17 @@ public class ResourceManager extends CompositeService implements Recoverable {
|
|
|
addService(resourceTracker);
|
|
|
rmContext.setResourceTrackerService(resourceTracker);
|
|
|
|
|
|
- DefaultMetricsSystem.initialize("ResourceManager");
|
|
|
- JvmMetrics jm = JvmMetrics.initSingleton("ResourceManager", null);
|
|
|
- pauseMonitor = new JvmPauseMonitor();
|
|
|
+ MetricsSystem ms = DefaultMetricsSystem.initialize("ResourceManager");
|
|
|
+ if (fromActive) {
|
|
|
+ JvmMetrics.reattach(ms, jvmMetrics);
|
|
|
+ UserGroupInformation.reattachMetrics();
|
|
|
+ } else {
|
|
|
+ jvmMetrics = JvmMetrics.initSingleton("ResourceManager", null);
|
|
|
+ }
|
|
|
+
|
|
|
+ JvmPauseMonitor pauseMonitor = new JvmPauseMonitor();
|
|
|
addService(pauseMonitor);
|
|
|
- jm.setPauseMonitor(pauseMonitor);
|
|
|
+ jvmMetrics.setPauseMonitor(pauseMonitor);
|
|
|
|
|
|
// Initialize the Reservation system
|
|
|
if (conf.getBoolean(YarnConfiguration.RM_RESERVATION_SYSTEM_ENABLE,
|
|
@@ -982,9 +990,13 @@ public class ResourceManager extends CompositeService implements Recoverable {
|
|
|
/**
|
|
|
* Helper method to create and init {@link #activeServices}. This creates an
|
|
|
* instance of {@link RMActiveServices} and initializes it.
|
|
|
+ *
|
|
|
+ * @param fromActive Indicates if the call is from the active state transition
|
|
|
+ * or the RM initialization.
|
|
|
*/
|
|
|
- protected void createAndInitActiveServices() {
|
|
|
+ protected void createAndInitActiveServices(boolean fromActive) {
|
|
|
activeServices = new RMActiveServices(this);
|
|
|
+ activeServices.fromActive = fromActive;
|
|
|
activeServices.init(conf);
|
|
|
}
|
|
|
|
|
@@ -1015,7 +1027,7 @@ public class ResourceManager extends CompositeService implements Recoverable {
|
|
|
QueueMetrics.clearQueueMetrics();
|
|
|
if (initialize) {
|
|
|
resetDispatcher();
|
|
|
- createAndInitActiveServices();
|
|
|
+ createAndInitActiveServices(true);
|
|
|
}
|
|
|
}
|
|
|
|