hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jia...@apache.org
Subject [11/44] hadoop git commit: YARN-3930. FileSystemNodeLabelsStore should make sure edit log file closed when exception is thrown. (Dian Fu via wangda)
Date Tue, 21 Jul 2015 23:13:55 GMT
YARN-3930. FileSystemNodeLabelsStore should make sure edit log file closed when exception is
thrown. (Dian Fu via wangda)


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/fa2b63ed
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/fa2b63ed
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/fa2b63ed

Branch: refs/heads/YARN-1197
Commit: fa2b63ed162410ba05eadf211a1da068351b293a
Parents: d96bbe1
Author: Wangda Tan <wangda@apache.org>
Authored: Thu Jul 16 16:06:20 2015 -0700
Committer: Wangda Tan <wangda@apache.org>
Committed: Thu Jul 16 16:06:20 2015 -0700

----------------------------------------------------------------------
 hadoop-yarn-project/CHANGES.txt                 |  3 ++
 .../nodelabels/FileSystemNodeLabelsStore.java   | 39 ++++++++++++--------
 2 files changed, 27 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/fa2b63ed/hadoop-yarn-project/CHANGES.txt
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt
index a098a64..cd0d132 100644
--- a/hadoop-yarn-project/CHANGES.txt
+++ b/hadoop-yarn-project/CHANGES.txt
@@ -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

http://git-wip-us.apache.org/repos/asf/hadoop/blob/fa2b63ed/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/nodelabels/FileSystemNodeLabelsStore.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/nodelabels/FileSystemNodeLabelsStore.java
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/nodelabels/FileSystemNodeLabelsStore.java
index f26e204..abf07e8 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/nodelabels/FileSystemNodeLabelsStore.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/nodelabels/FileSystemNodeLabelsStore.java
@@ -127,31 +127,40 @@ public class FileSystemNodeLabelsStore extends NodeLabelsStore {
   @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)


Mime
View raw message