YARN-11111. Recovery failure when node-label configure-type transit from delegated-centralized to centralized (#4200)
This commit is contained in:
parent
56cfd60617
commit
b35b744670
@ -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,15 +70,20 @@ public void recover(InputStream is, CommonNodeLabelsManager mgr)
|
||||
.parseDelimitedFrom(is)).getNodeLabels();
|
||||
mgr.addToCluserNodeLabels(labels);
|
||||
|
||||
if (mgr.isCentralizedConfiguration()) {
|
||||
// Only load node to labels mapping while using centralized
|
||||
// configuration
|
||||
Map<NodeId, Set<String>> nodeToLabels =
|
||||
new ReplaceLabelsOnNodeRequestPBImpl(
|
||||
YarnServerResourceManagerServiceProtos
|
||||
.ReplaceLabelsOnNodeRequestProto
|
||||
.parseDelimitedFrom(is)).getNodeToLabels();
|
||||
mgr.replaceLabelsOnNode(nodeToLabels);
|
||||
try {
|
||||
if (mgr.isCentralizedConfiguration() && is.available() != 0) {
|
||||
// Only load node to labels mapping while using centralized
|
||||
// configuration
|
||||
Map<NodeId, Set<String>> nodeToLabels =
|
||||
new ReplaceLabelsOnNodeRequestPBImpl(
|
||||
YarnServerResourceManagerServiceProtos
|
||||
.ReplaceLabelsOnNodeRequestProto
|
||||
.parseDelimitedFrom(is)).getNodeToLabels();
|
||||
mgr.replaceLabelsOnNode(nodeToLabels);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LOG.error("Errors on loading node to labels mapping while using "
|
||||
+ "centralized configuration", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user