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