YARN-11111. Recovery failure when node-label configure-type transit from delegated-centralized to centralized (#4200)

This commit is contained in:
Junfan Zhang 2022-04-22 10:37:28 +08:00 committed by GitHub
parent 56cfd60617
commit b35b744670
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -27,6 +27,8 @@
.AddToClusterNodeLabelsRequestPBImpl; .AddToClusterNodeLabelsRequestPBImpl;
import org.apache.hadoop.yarn.server.api.protocolrecords.impl.pb import org.apache.hadoop.yarn.server.api.protocolrecords.impl.pb
.ReplaceLabelsOnNodeRequestPBImpl; .ReplaceLabelsOnNodeRequestPBImpl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
@ -40,6 +42,8 @@
*/ */
public class NodeLabelMirrorOp public class NodeLabelMirrorOp
extends FSNodeStoreLogOp<CommonNodeLabelsManager> { extends FSNodeStoreLogOp<CommonNodeLabelsManager> {
private static final Logger LOG = LoggerFactory.getLogger(
NodeLabelMirrorOp.class);
public NodeLabelMirrorOp() { public NodeLabelMirrorOp() {
super(); super();
@ -66,15 +70,20 @@ public void recover(InputStream is, CommonNodeLabelsManager mgr)
.parseDelimitedFrom(is)).getNodeLabels(); .parseDelimitedFrom(is)).getNodeLabels();
mgr.addToCluserNodeLabels(labels); mgr.addToCluserNodeLabels(labels);
if (mgr.isCentralizedConfiguration()) { try {
// Only load node to labels mapping while using centralized if (mgr.isCentralizedConfiguration() && is.available() != 0) {
// configuration // Only load node to labels mapping while using centralized
Map<NodeId, Set<String>> nodeToLabels = // configuration
new ReplaceLabelsOnNodeRequestPBImpl( Map<NodeId, Set<String>> nodeToLabels =
YarnServerResourceManagerServiceProtos new ReplaceLabelsOnNodeRequestPBImpl(
.ReplaceLabelsOnNodeRequestProto YarnServerResourceManagerServiceProtos
.parseDelimitedFrom(is)).getNodeToLabels(); .ReplaceLabelsOnNodeRequestProto
mgr.replaceLabelsOnNode(nodeToLabels); .parseDelimitedFrom(is)).getNodeToLabels();
mgr.replaceLabelsOnNode(nodeToLabels);
}
} catch (Exception e) {
LOG.error("Errors on loading node to labels mapping while using "
+ "centralized configuration", e);
} }
} }