YARN-3930. FileSystemNodeLabelsStore should make sure edit log file closed when exception is thrown. (Dian Fu via wangda)
(cherry picked from commit fa2b63ed16
)
This commit is contained in:
parent
391d2d88f2
commit
7b2540770e
|
@ -589,6 +589,9 @@ Release 2.8.0 - UNRELEASED
|
||||||
YARN-3805. Update the documentation of Disk Checker based on YARN-90.
|
YARN-3805. Update the documentation of Disk Checker based on YARN-90.
|
||||||
(Masatake Iwasaki via ozawa)
|
(Masatake Iwasaki via ozawa)
|
||||||
|
|
||||||
|
YARN-3930. FileSystemNodeLabelsStore should make sure edit log file closed when
|
||||||
|
exception is thrown. (Dian Fu via wangda)
|
||||||
|
|
||||||
Release 2.7.2 - UNRELEASED
|
Release 2.7.2 - UNRELEASED
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
|
|
@ -127,31 +127,40 @@ public class FileSystemNodeLabelsStore extends NodeLabelsStore {
|
||||||
@Override
|
@Override
|
||||||
public void updateNodeToLabelsMappings(
|
public void updateNodeToLabelsMappings(
|
||||||
Map<NodeId, Set<String>> nodeToLabels) throws IOException {
|
Map<NodeId, Set<String>> nodeToLabels) throws IOException {
|
||||||
ensureAppendEditlogFile();
|
try {
|
||||||
editlogOs.writeInt(SerializedLogType.NODE_TO_LABELS.ordinal());
|
ensureAppendEditlogFile();
|
||||||
((ReplaceLabelsOnNodeRequestPBImpl) ReplaceLabelsOnNodeRequest
|
editlogOs.writeInt(SerializedLogType.NODE_TO_LABELS.ordinal());
|
||||||
.newInstance(nodeToLabels)).getProto().writeDelimitedTo(editlogOs);
|
((ReplaceLabelsOnNodeRequestPBImpl) ReplaceLabelsOnNodeRequest
|
||||||
ensureCloseEditlogFile();
|
.newInstance(nodeToLabels)).getProto().writeDelimitedTo(editlogOs);
|
||||||
|
} finally {
|
||||||
|
ensureCloseEditlogFile();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void storeNewClusterNodeLabels(List<NodeLabel> labels)
|
public void storeNewClusterNodeLabels(List<NodeLabel> labels)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
ensureAppendEditlogFile();
|
try {
|
||||||
editlogOs.writeInt(SerializedLogType.ADD_LABELS.ordinal());
|
ensureAppendEditlogFile();
|
||||||
((AddToClusterNodeLabelsRequestPBImpl) AddToClusterNodeLabelsRequest
|
editlogOs.writeInt(SerializedLogType.ADD_LABELS.ordinal());
|
||||||
.newInstance(labels)).getProto().writeDelimitedTo(editlogOs);
|
((AddToClusterNodeLabelsRequestPBImpl) AddToClusterNodeLabelsRequest
|
||||||
ensureCloseEditlogFile();
|
.newInstance(labels)).getProto().writeDelimitedTo(editlogOs);
|
||||||
|
} finally {
|
||||||
|
ensureCloseEditlogFile();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeClusterNodeLabels(Collection<String> labels)
|
public void removeClusterNodeLabels(Collection<String> labels)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
ensureAppendEditlogFile();
|
try {
|
||||||
editlogOs.writeInt(SerializedLogType.REMOVE_LABELS.ordinal());
|
ensureAppendEditlogFile();
|
||||||
((RemoveFromClusterNodeLabelsRequestPBImpl) RemoveFromClusterNodeLabelsRequest.newInstance(Sets
|
editlogOs.writeInt(SerializedLogType.REMOVE_LABELS.ordinal());
|
||||||
.newHashSet(labels.iterator()))).getProto().writeDelimitedTo(editlogOs);
|
((RemoveFromClusterNodeLabelsRequestPBImpl) RemoveFromClusterNodeLabelsRequest.newInstance(Sets
|
||||||
ensureCloseEditlogFile();
|
.newHashSet(labels.iterator()))).getProto().writeDelimitedTo(editlogOs);
|
||||||
|
} finally {
|
||||||
|
ensureCloseEditlogFile();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
|
Loading…
Reference in New Issue