YARN-2182. Updated ContainerId#toString() to append RM Epoch number. Contributed by Tsuyoshi OZAWA
(cherry-picked from commit e2d0ff364a
)
This commit is contained in:
parent
38df629367
commit
5c63482aaa
|
@ -137,6 +137,9 @@ Release 2.6.0 - UNRELEASED
|
|||
YARN-1326. RM should log using RMStore at startup time.
|
||||
(Tsuyoshi Ozawa via kasha)
|
||||
|
||||
YARN-2182. Updated ContainerId#toString() to append RM Epoch number.
|
||||
(Tsuyoshi OZAWA via jianhe)
|
||||
|
||||
OPTIMIZATIONS
|
||||
|
||||
BUG FIXES
|
||||
|
|
|
@ -83,7 +83,7 @@ public abstract class ContainerId implements Comparable<ContainerId>{
|
|||
|
||||
|
||||
// TODO: fail the app submission if attempts are more than 10 or something
|
||||
private static final ThreadLocal<NumberFormat> appAttemptIdFormat =
|
||||
private static final ThreadLocal<NumberFormat> appAttemptIdAndEpochFormat =
|
||||
new ThreadLocal<NumberFormat>() {
|
||||
@Override
|
||||
public NumberFormat initialValue() {
|
||||
|
@ -153,9 +153,13 @@ public abstract class ContainerId implements Comparable<ContainerId>{
|
|||
sb.append(ApplicationId.appIdFormat.get().format(appId.getId()))
|
||||
.append("_");
|
||||
sb.append(
|
||||
appAttemptIdFormat.get().format(
|
||||
appAttemptIdAndEpochFormat.get().format(
|
||||
getApplicationAttemptId().getAttemptId())).append("_");
|
||||
sb.append(containerIdFormat.get().format(getId()));
|
||||
sb.append(containerIdFormat.get().format(0x3fffff & getId()));
|
||||
int epoch = getId() >> 22;
|
||||
if (epoch > 0) {
|
||||
sb.append("_").append(appAttemptIdAndEpochFormat.get().format(epoch));
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
|
|
|
@ -54,7 +54,9 @@ public class TestContainerId {
|
|||
long ts = System.currentTimeMillis();
|
||||
ContainerId c6 = newContainerId(36473, 4365472, ts, 25645811);
|
||||
Assert.assertEquals("container_10_0001_01_000001", c1.toString());
|
||||
Assert.assertEquals("container_" + ts + "_36473_4365472_25645811",
|
||||
Assert.assertEquals(479987, 0x003fffff & c6.getId());
|
||||
Assert.assertEquals(6, c6.getId() >> 22);
|
||||
Assert.assertEquals("container_" + ts + "_36473_4365472_479987_06",
|
||||
c6.toString());
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue