Skip to content

Commit 7b75de0

Browse files
committed
YARN-1056. Remove dual use of string 'resourcemanager' in yarn.resourcemanager.connect.{max.wait.secs|retry_interval.secs}. Contributed by Karthik Kambatla.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1514135 13f79535-47bb-0310-9956-ffa450edef68
1 parent 8507186 commit 7b75de0

File tree

5 files changed

+56
-47
lines changed

5 files changed

+56
-47
lines changed

hadoop-yarn-project/CHANGES.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -875,6 +875,10 @@ Release 2.1.0-beta - 2013-08-06
875875

876876
YARN-1043. Push all metrics consistently. (Jian He via acmurthy)
877877

878+
YARN-1056. Remove dual use of string 'resourcemanager' in
879+
yarn.resourcemanager.connect.{max.wait.secs|retry_interval.secs}
880+
(Karthik Kambatla via acmurthy)
881+
878882
Release 2.0.5-alpha - 06/06/2013
879883

880884
INCOMPATIBLE CHANGES

hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/conf/YarnConfiguration.java

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ public class YarnConfiguration extends Configuration {
259259

260260
/** URI for FileSystemRMStateStore */
261261
public static final String FS_RM_STATE_STORE_URI =
262-
RM_PREFIX + "fs.rm-state-store.uri";
262+
RM_PREFIX + "fs.state-store.uri";
263263

264264
/** The maximum number of completed applications RM keeps. */
265265
public static final String RM_MAX_COMPLETED_APPLICATIONS =
@@ -655,19 +655,17 @@ public class YarnConfiguration extends Configuration {
655655
public static final long DEFAULT_NM_PROCESS_KILL_WAIT_MS =
656656
2000;
657657

658-
/** Max time to wait to establish a connection to RM
659-
*/
660-
public static final String RESOURCEMANAGER_CONNECT_MAX_WAIT_SECS =
661-
RM_PREFIX + "resourcemanager.connect.max.wait.secs";
662-
public static final int DEFAULT_RESOURCEMANAGER_CONNECT_MAX_WAIT_SECS =
663-
15*60;
664-
665-
/** Time interval between each attempt to connect to RM
666-
*/
667-
public static final String RESOURCEMANAGER_CONNECT_RETRY_INTERVAL_SECS =
668-
RM_PREFIX + "resourcemanager.connect.retry_interval.secs";
669-
public static final long DEFAULT_RESOURCEMANAGER_CONNECT_RETRY_INTERVAL_SECS
670-
= 30;
658+
/** Max time to wait to establish a connection to RM */
659+
public static final String RESOURCEMANAGER_CONNECT_MAX_WAIT_MS =
660+
RM_PREFIX + "connect.max-wait.ms";
661+
public static final int DEFAULT_RESOURCEMANAGER_CONNECT_MAX_WAIT_MS =
662+
15 * 60 * 1000;
663+
664+
/** Time interval between each attempt to connect to RM */
665+
public static final String RESOURCEMANAGER_CONNECT_RETRY_INTERVAL_MS =
666+
RM_PREFIX + "connect.retry-interval.ms";
667+
public static final long DEFAULT_RESOURCEMANAGER_CONNECT_RETRY_INTERVAL_MS
668+
= 30 * 1000;
671669

672670
/**
673671
* CLASSPATH for YARN applications. A comma-separated list of CLASSPATH

hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/client/RMProxy.java

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,10 @@
3535
import org.apache.hadoop.io.retry.RetryPolicies;
3636
import org.apache.hadoop.io.retry.RetryPolicy;
3737
import org.apache.hadoop.io.retry.RetryProxy;
38-
import org.apache.hadoop.security.SecurityUtil;
3938
import org.apache.hadoop.security.UserGroupInformation;
40-
import org.apache.hadoop.security.token.Token;
41-
import org.apache.hadoop.security.token.TokenIdentifier;
4239
import org.apache.hadoop.yarn.conf.YarnConfiguration;
4340
import org.apache.hadoop.yarn.exceptions.YarnRuntimeException;
4441
import org.apache.hadoop.yarn.ipc.YarnRPC;
45-
import org.apache.hadoop.yarn.security.AMRMTokenIdentifier;
4642

4743
import com.google.common.annotations.VisibleForTesting;
4844

@@ -79,38 +75,36 @@ public T run() {
7975
public static RetryPolicy createRetryPolicy(Configuration conf) {
8076
long rmConnectWaitMS =
8177
conf.getInt(
82-
YarnConfiguration.RESOURCEMANAGER_CONNECT_MAX_WAIT_SECS,
83-
YarnConfiguration.DEFAULT_RESOURCEMANAGER_CONNECT_MAX_WAIT_SECS)
84-
* 1000;
78+
YarnConfiguration.RESOURCEMANAGER_CONNECT_MAX_WAIT_MS,
79+
YarnConfiguration.DEFAULT_RESOURCEMANAGER_CONNECT_MAX_WAIT_MS);
8580
long rmConnectionRetryIntervalMS =
8681
conf.getLong(
87-
YarnConfiguration.RESOURCEMANAGER_CONNECT_RETRY_INTERVAL_SECS,
82+
YarnConfiguration.RESOURCEMANAGER_CONNECT_RETRY_INTERVAL_MS,
8883
YarnConfiguration
89-
.DEFAULT_RESOURCEMANAGER_CONNECT_RETRY_INTERVAL_SECS)
90-
* 1000;
84+
.DEFAULT_RESOURCEMANAGER_CONNECT_RETRY_INTERVAL_MS);
9185

9286
if (rmConnectionRetryIntervalMS < 0) {
9387
throw new YarnRuntimeException("Invalid Configuration. " +
94-
YarnConfiguration.RESOURCEMANAGER_CONNECT_RETRY_INTERVAL_SECS +
88+
YarnConfiguration.RESOURCEMANAGER_CONNECT_RETRY_INTERVAL_MS +
9589
" should not be negative.");
9690
}
9791

98-
boolean waitForEver = (rmConnectWaitMS == -1000);
92+
boolean waitForEver = (rmConnectWaitMS == -1);
9993

10094
if (waitForEver) {
10195
return RetryPolicies.RETRY_FOREVER;
10296
} else {
10397
if (rmConnectWaitMS < 0) {
10498
throw new YarnRuntimeException("Invalid Configuration. "
105-
+ YarnConfiguration.RESOURCEMANAGER_CONNECT_MAX_WAIT_SECS
99+
+ YarnConfiguration.RESOURCEMANAGER_CONNECT_MAX_WAIT_MS
106100
+ " can be -1, but can not be other negative numbers");
107101
}
108102

109103
// try connect once
110104
if (rmConnectWaitMS < rmConnectionRetryIntervalMS) {
111-
LOG.warn(YarnConfiguration.RESOURCEMANAGER_CONNECT_MAX_WAIT_SECS
105+
LOG.warn(YarnConfiguration.RESOURCEMANAGER_CONNECT_MAX_WAIT_MS
112106
+ " is smaller than "
113-
+ YarnConfiguration.RESOURCEMANAGER_CONNECT_RETRY_INTERVAL_SECS
107+
+ YarnConfiguration.RESOURCEMANAGER_CONNECT_RETRY_INTERVAL_MS
114108
+ ". Only try connect once.");
115109
rmConnectWaitMS = 0;
116110
}

hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/resources/yarn-default.xml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,20 @@
140140
<value>1000</value>
141141
</property>
142142

143+
<property>
144+
<description>Maximum time to wait to establish connection to
145+
ResourceManager.</description>
146+
<name>yarn.resourcemanager.connect.max-wait.ms</name>
147+
<value>900000</value>
148+
</property>
149+
150+
<property>
151+
<description>How often to try connecting to the
152+
ResourceManager.</description>
153+
<name>yarn.resourcemanager.connect.retry-interval.ms</name>
154+
<value>30000</value>
155+
</property>
156+
143157
<property>
144158
<description>The maximum number of application attempts. It's a global
145159
setting for all application masters. Each application master can specify
@@ -249,7 +263,7 @@
249263
RM state will be stored. This must be supplied when using
250264
org.apache.hadoop.yarn.server.resourcemanager.recovery.FileSystemRMStateStore
251265
as the value for yarn.resourcemanager.store.class</description>
252-
<name>yarn.resourcemanager.fs.rm-state-store.uri</name>
266+
<name>yarn.resourcemanager.fs.state-store.uri</name>
253267
<value>${hadoop.tmp.dir}/yarn/system/rmstore</value>
254268
<!--value>hdfs://localhost:9000/rmstore</value-->
255269
</property>

hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/TestNodeStatusUpdater.java

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -957,15 +957,14 @@ protected NodeStatusUpdater createUpdater(Context context,
957957
@Test (timeout = 150000)
958958
public void testNMConnectionToRM() throws Exception {
959959
final long delta = 50000;
960-
final long connectionWaitSecs = 5;
961-
final long connectionRetryIntervalSecs = 1;
960+
final long connectionWaitMs = 5000;
961+
final long connectionRetryIntervalMs = 1000;
962962
//Waiting for rmStartIntervalMS, RM will be started
963963
final long rmStartIntervalMS = 2*1000;
964-
conf.setLong(YarnConfiguration.RESOURCEMANAGER_CONNECT_MAX_WAIT_SECS,
965-
connectionWaitSecs);
966-
conf.setLong(YarnConfiguration
967-
.RESOURCEMANAGER_CONNECT_RETRY_INTERVAL_SECS,
968-
connectionRetryIntervalSecs);
964+
conf.setLong(YarnConfiguration.RESOURCEMANAGER_CONNECT_MAX_WAIT_MS,
965+
connectionWaitMs);
966+
conf.setLong(YarnConfiguration.RESOURCEMANAGER_CONNECT_RETRY_INTERVAL_MS,
967+
connectionRetryIntervalMs);
969968

970969
//Test NM try to connect to RM Several times, but finally fail
971970
NodeManagerWithCustomNodeStatusUpdater nmWithUpdater;
@@ -987,15 +986,15 @@ protected NodeStatusUpdater createUpdater(Context context,
987986
} catch(Exception e) {
988987
long t = System.currentTimeMillis();
989988
long duration = t - waitStartTime;
990-
boolean waitTimeValid = (duration >= connectionWaitSecs * 1000)
991-
&& (duration < (connectionWaitSecs * 1000 + delta));
989+
boolean waitTimeValid = (duration >= connectionWaitMs)
990+
&& (duration < (connectionWaitMs + delta));
992991
if(!waitTimeValid) {
993992
//either the exception was too early, or it had a different cause.
994993
//reject with the inner stack trace
995994
throw new Exception("NM should have tried re-connecting to RM during " +
996-
"period of at least " + connectionWaitSecs + " seconds, but " +
997-
"stopped retrying within " + (connectionWaitSecs + delta/1000) +
998-
" seconds: " + e, e);
995+
"period of at least " + connectionWaitMs + " ms, but " +
996+
"stopped retrying within " + (connectionWaitMs + delta) +
997+
" ms: " + e, e);
999998
}
1000999
}
10011000

@@ -1149,14 +1148,14 @@ protected NMContext createNMContext(
11491148
@Test(timeout = 200000)
11501149
public void testNodeStatusUpdaterRetryAndNMShutdown()
11511150
throws Exception {
1152-
final long connectionWaitSecs = 1;
1153-
final long connectionRetryIntervalSecs = 1;
1151+
final long connectionWaitSecs = 1000;
1152+
final long connectionRetryIntervalMs = 1000;
11541153
YarnConfiguration conf = createNMConfig();
1155-
conf.setLong(YarnConfiguration.RESOURCEMANAGER_CONNECT_MAX_WAIT_SECS,
1154+
conf.setLong(YarnConfiguration.RESOURCEMANAGER_CONNECT_MAX_WAIT_MS,
11561155
connectionWaitSecs);
11571156
conf.setLong(YarnConfiguration
1158-
.RESOURCEMANAGER_CONNECT_RETRY_INTERVAL_SECS,
1159-
connectionRetryIntervalSecs);
1157+
.RESOURCEMANAGER_CONNECT_RETRY_INTERVAL_MS,
1158+
connectionRetryIntervalMs);
11601159
conf.setLong(YarnConfiguration.NM_SLEEP_DELAY_BEFORE_SIGKILL_MS, 5000);
11611160
CyclicBarrier syncBarrier = new CyclicBarrier(2);
11621161
nm = new MyNodeManager2(syncBarrier, conf);

0 commit comments

Comments
 (0)