YARN-4649. Add additional logging to some NM state store operations. Contributed by Sidharta Seethana
(cherry picked from commit 1cd55e0c17
)
This commit is contained in:
parent
9591363ad8
commit
bbda446889
|
@ -57,6 +57,9 @@ Release 2.9.0 - UNRELEASED
|
||||||
|
|
||||||
YARN-4647. Make RegisterNodeManagerRequestPBImpl thread-safe. (kasha)
|
YARN-4647. Make RegisterNodeManagerRequestPBImpl thread-safe. (kasha)
|
||||||
|
|
||||||
|
YARN-4649. Add additional logging to some NM state store operations.
|
||||||
|
(Sidharta Seethana via vvasudev)
|
||||||
|
|
||||||
OPTIMIZATIONS
|
OPTIMIZATIONS
|
||||||
|
|
||||||
BUG FIXES
|
BUG FIXES
|
||||||
|
|
|
@ -286,18 +286,32 @@ public class ContainerManagerImpl extends CompositeService implements
|
||||||
RecoveredApplicationsState appsState = stateStore.loadApplicationsState();
|
RecoveredApplicationsState appsState = stateStore.loadApplicationsState();
|
||||||
for (ContainerManagerApplicationProto proto :
|
for (ContainerManagerApplicationProto proto :
|
||||||
appsState.getApplications()) {
|
appsState.getApplications()) {
|
||||||
|
if (LOG.isDebugEnabled()) {
|
||||||
|
LOG.debug("Recovering application with state: " + proto.toString());
|
||||||
|
}
|
||||||
recoverApplication(proto);
|
recoverApplication(proto);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (RecoveredContainerState rcs : stateStore.loadContainersState()) {
|
for (RecoveredContainerState rcs : stateStore.loadContainersState()) {
|
||||||
|
if (LOG.isDebugEnabled()) {
|
||||||
|
LOG.debug("Recovering container with state: " + rcs);
|
||||||
|
}
|
||||||
|
|
||||||
recoverContainer(rcs);
|
recoverContainer(rcs);
|
||||||
}
|
}
|
||||||
|
|
||||||
String diagnostic = "Application marked finished during recovery";
|
String diagnostic = "Application marked finished during recovery";
|
||||||
for (ApplicationId appId : appsState.getFinishedApplications()) {
|
for (ApplicationId appId : appsState.getFinishedApplications()) {
|
||||||
|
|
||||||
|
if (LOG.isDebugEnabled()) {
|
||||||
|
LOG.debug("Application marked finished during recovery: " + appId);
|
||||||
|
}
|
||||||
|
|
||||||
dispatcher.getEventHandler().handle(
|
dispatcher.getEventHandler().handle(
|
||||||
new ApplicationFinishEvent(appId, diagnostic));
|
new ApplicationFinishEvent(appId, diagnostic));
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
LOG.info("Not a recoverable state store. Nothing to recover.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -248,6 +248,11 @@ public class NMLeveldbStateStoreService extends NMStateStoreService {
|
||||||
@Override
|
@Override
|
||||||
public void storeContainer(ContainerId containerId,
|
public void storeContainer(ContainerId containerId,
|
||||||
StartContainerRequest startRequest) throws IOException {
|
StartContainerRequest startRequest) throws IOException {
|
||||||
|
if (LOG.isDebugEnabled()) {
|
||||||
|
LOG.debug("storeContainer: containerId= " + containerId
|
||||||
|
+ ", startRequest= " + startRequest);
|
||||||
|
}
|
||||||
|
|
||||||
String key = CONTAINERS_KEY_PREFIX + containerId.toString()
|
String key = CONTAINERS_KEY_PREFIX + containerId.toString()
|
||||||
+ CONTAINER_REQUEST_KEY_SUFFIX;
|
+ CONTAINER_REQUEST_KEY_SUFFIX;
|
||||||
try {
|
try {
|
||||||
|
@ -261,6 +266,11 @@ public class NMLeveldbStateStoreService extends NMStateStoreService {
|
||||||
@Override
|
@Override
|
||||||
public void storeContainerDiagnostics(ContainerId containerId,
|
public void storeContainerDiagnostics(ContainerId containerId,
|
||||||
StringBuilder diagnostics) throws IOException {
|
StringBuilder diagnostics) throws IOException {
|
||||||
|
if (LOG.isDebugEnabled()) {
|
||||||
|
LOG.debug("storeContainerDiagnostics: containerId=" + containerId
|
||||||
|
+ ", diagnostics=" + diagnostics);
|
||||||
|
}
|
||||||
|
|
||||||
String key = CONTAINERS_KEY_PREFIX + containerId.toString()
|
String key = CONTAINERS_KEY_PREFIX + containerId.toString()
|
||||||
+ CONTAINER_DIAGS_KEY_SUFFIX;
|
+ CONTAINER_DIAGS_KEY_SUFFIX;
|
||||||
try {
|
try {
|
||||||
|
@ -273,6 +283,10 @@ public class NMLeveldbStateStoreService extends NMStateStoreService {
|
||||||
@Override
|
@Override
|
||||||
public void storeContainerLaunched(ContainerId containerId)
|
public void storeContainerLaunched(ContainerId containerId)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
|
if (LOG.isDebugEnabled()) {
|
||||||
|
LOG.debug("storeContainerLaunched: containerId=" + containerId);
|
||||||
|
}
|
||||||
|
|
||||||
String key = CONTAINERS_KEY_PREFIX + containerId.toString()
|
String key = CONTAINERS_KEY_PREFIX + containerId.toString()
|
||||||
+ CONTAINER_LAUNCHED_KEY_SUFFIX;
|
+ CONTAINER_LAUNCHED_KEY_SUFFIX;
|
||||||
try {
|
try {
|
||||||
|
@ -285,6 +299,11 @@ public class NMLeveldbStateStoreService extends NMStateStoreService {
|
||||||
@Override
|
@Override
|
||||||
public void storeContainerResourceChanged(ContainerId containerId,
|
public void storeContainerResourceChanged(ContainerId containerId,
|
||||||
Resource capability) throws IOException {
|
Resource capability) throws IOException {
|
||||||
|
if (LOG.isDebugEnabled()) {
|
||||||
|
LOG.debug("storeContainerResourceChanged: containerId=" + containerId
|
||||||
|
+ ", capability=" + capability);
|
||||||
|
}
|
||||||
|
|
||||||
String key = CONTAINERS_KEY_PREFIX + containerId.toString()
|
String key = CONTAINERS_KEY_PREFIX + containerId.toString()
|
||||||
+ CONTAINER_RESOURCE_CHANGED_KEY_SUFFIX;
|
+ CONTAINER_RESOURCE_CHANGED_KEY_SUFFIX;
|
||||||
try {
|
try {
|
||||||
|
@ -299,6 +318,10 @@ public class NMLeveldbStateStoreService extends NMStateStoreService {
|
||||||
@Override
|
@Override
|
||||||
public void storeContainerKilled(ContainerId containerId)
|
public void storeContainerKilled(ContainerId containerId)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
|
if (LOG.isDebugEnabled()) {
|
||||||
|
LOG.debug("storeContainerKilled: containerId=" + containerId);
|
||||||
|
}
|
||||||
|
|
||||||
String key = CONTAINERS_KEY_PREFIX + containerId.toString()
|
String key = CONTAINERS_KEY_PREFIX + containerId.toString()
|
||||||
+ CONTAINER_KILLED_KEY_SUFFIX;
|
+ CONTAINER_KILLED_KEY_SUFFIX;
|
||||||
try {
|
try {
|
||||||
|
@ -311,6 +334,10 @@ public class NMLeveldbStateStoreService extends NMStateStoreService {
|
||||||
@Override
|
@Override
|
||||||
public void storeContainerCompleted(ContainerId containerId,
|
public void storeContainerCompleted(ContainerId containerId,
|
||||||
int exitCode) throws IOException {
|
int exitCode) throws IOException {
|
||||||
|
if (LOG.isDebugEnabled()) {
|
||||||
|
LOG.debug("storeContainerCompleted: containerId=" + containerId);
|
||||||
|
}
|
||||||
|
|
||||||
String key = CONTAINERS_KEY_PREFIX + containerId.toString()
|
String key = CONTAINERS_KEY_PREFIX + containerId.toString()
|
||||||
+ CONTAINER_EXIT_CODE_KEY_SUFFIX;
|
+ CONTAINER_EXIT_CODE_KEY_SUFFIX;
|
||||||
try {
|
try {
|
||||||
|
@ -323,6 +350,10 @@ public class NMLeveldbStateStoreService extends NMStateStoreService {
|
||||||
@Override
|
@Override
|
||||||
public void removeContainer(ContainerId containerId)
|
public void removeContainer(ContainerId containerId)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
|
if (LOG.isDebugEnabled()) {
|
||||||
|
LOG.debug("removeContainer: containerId=" + containerId);
|
||||||
|
}
|
||||||
|
|
||||||
String keyPrefix = CONTAINERS_KEY_PREFIX + containerId.toString();
|
String keyPrefix = CONTAINERS_KEY_PREFIX + containerId.toString();
|
||||||
try {
|
try {
|
||||||
WriteBatch batch = db.createWriteBatch();
|
WriteBatch batch = db.createWriteBatch();
|
||||||
|
@ -389,6 +420,11 @@ public class NMLeveldbStateStoreService extends NMStateStoreService {
|
||||||
@Override
|
@Override
|
||||||
public void storeApplication(ApplicationId appId,
|
public void storeApplication(ApplicationId appId,
|
||||||
ContainerManagerApplicationProto p) throws IOException {
|
ContainerManagerApplicationProto p) throws IOException {
|
||||||
|
if (LOG.isDebugEnabled()) {
|
||||||
|
LOG.debug("storeApplication: appId=" + appId
|
||||||
|
+ ", proto=" + p);
|
||||||
|
}
|
||||||
|
|
||||||
String key = APPLICATIONS_KEY_PREFIX + appId;
|
String key = APPLICATIONS_KEY_PREFIX + appId;
|
||||||
try {
|
try {
|
||||||
db.put(bytes(key), p.toByteArray());
|
db.put(bytes(key), p.toByteArray());
|
||||||
|
@ -400,6 +436,10 @@ public class NMLeveldbStateStoreService extends NMStateStoreService {
|
||||||
@Override
|
@Override
|
||||||
public void storeFinishedApplication(ApplicationId appId)
|
public void storeFinishedApplication(ApplicationId appId)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
|
if (LOG.isDebugEnabled()) {
|
||||||
|
LOG.debug("storeFinishedApplication.appId: " + appId);
|
||||||
|
}
|
||||||
|
|
||||||
String key = FINISHED_APPS_KEY_PREFIX + appId;
|
String key = FINISHED_APPS_KEY_PREFIX + appId;
|
||||||
try {
|
try {
|
||||||
db.put(bytes(key), new byte[0]);
|
db.put(bytes(key), new byte[0]);
|
||||||
|
@ -411,6 +451,10 @@ public class NMLeveldbStateStoreService extends NMStateStoreService {
|
||||||
@Override
|
@Override
|
||||||
public void removeApplication(ApplicationId appId)
|
public void removeApplication(ApplicationId appId)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
|
if (LOG.isDebugEnabled()) {
|
||||||
|
LOG.debug("removeApplication: appId=" + appId);
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
WriteBatch batch = db.createWriteBatch();
|
WriteBatch batch = db.createWriteBatch();
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -100,6 +100,17 @@ public abstract class NMStateStoreService extends AbstractService {
|
||||||
public Resource getCapability() {
|
public Resource getCapability() {
|
||||||
return capability;
|
return capability;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return new StringBuffer("Status: ").append(getStatus())
|
||||||
|
.append(", Exit code: ").append(exitCode)
|
||||||
|
.append(", Killed: ").append(getKilled())
|
||||||
|
.append(", Diagnostics: ").append(getDiagnostics())
|
||||||
|
.append(", Capability: ").append(getCapability())
|
||||||
|
.append(", StartRequest: ").append(getStartRequest())
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class LocalResourceTrackerState {
|
public static class LocalResourceTrackerState {
|
||||||
|
|
Loading…
Reference in New Issue