You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by xk...@apache.org on 2021/09/24 16:49:01 UTC

[hadoop] branch branch-2.10 updated: HDFS-16233. Do not use exception handler to implement copy-on-write for EnumCounters. (#3468)

This is an automated email from the ASF dual-hosted git repository.

xkrogen pushed a commit to branch branch-2.10
in repository https://gitbox.apache.org/repos/asf/hadoop.git


The following commit(s) were added to refs/heads/branch-2.10 by this push:
     new 6d11f7a  HDFS-16233. Do not use exception handler to implement copy-on-write for EnumCounters. (#3468)
6d11f7a is described below

commit 6d11f7ae8c4b1d318f99344fdef17f0e7512f221
Author: Wei-Chiu Chuang <we...@apache.org>
AuthorDate: Fri Sep 24 23:35:23 2021 +0800

    HDFS-16233. Do not use exception handler to implement copy-on-write for EnumCounters. (#3468)
    
    (cherry picked from commit 87632bbacf064e9b07564ba66ed1fbb1d42290d1)
    (cherry picked from commit bb08de559a36fd56c7d4023c6dcac66da3fbacc5)
    (cherry picked from commit 978ec57445f4178b31a6bfc383c6be032692c288)
    (cherry picked from commit cd7c34f9b4005d27886f73e58bef88e706fcccf9)
---
 .../java/org/apache/hadoop/hdfs/server/namenode/QuotaCounts.java | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/QuotaCounts.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/QuotaCounts.java
index 04c7182..34b349c 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/QuotaCounts.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/QuotaCounts.java
@@ -23,7 +23,6 @@ import org.apache.hadoop.fs.StorageType;
 import org.apache.hadoop.hdfs.protocol.HdfsConstants;
 import org.apache.hadoop.hdfs.util.ConstEnumCounters;
 import org.apache.hadoop.hdfs.util.EnumCounters;
-import org.apache.hadoop.hdfs.util.ConstEnumCounters.ConstEnumException;
 
 
 /**
@@ -56,14 +55,10 @@ public class QuotaCounts {
    */
   static <T extends Enum<T>> EnumCounters<T> modify(EnumCounters<T> counter,
       ModifyAction<T> action) {
-    try {
-      action.accept(counter);
-    } catch (ConstEnumException cee) {
-      // We don't call clone here because ConstEnumCounters.clone() will return
-      // an object of class ConstEnumCounters. We want EnumCounters.
+    if (counter instanceof ConstEnumCounters) {
       counter = counter.deepCopyEnumCounter();
-      action.accept(counter);
     }
+    action.accept(counter);
     return counter;
   }
 

---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org