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