hadoop-hdfs-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Colin Patrick McCabe (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HDFS-5781) Use a map to record the mapping between FSEditLogOpCode and the corresponding byte value
Date Wed, 22 Jan 2014 03:36:20 GMT

    [ https://issues.apache.org/jira/browse/HDFS-5781?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13878211#comment-13878211

Colin Patrick McCabe commented on HDFS-5781:

+  private static final FSEditLogOpCodes[] VALUES = new FSEditLogOpCodes[256];
+  static {
+    for (FSEditLogOpCodes code : FSEditLogOpCodes.values()) {
+      int codeValue = code.getOpCode() & 0xff;
+      VALUES[codeValue] = code;
+    }
+  }

Sorry to nitpick, but it might be better to do a first pass through values() to determine
how big the array should be.  That way we wouldn't have to use 256 all the time.

+1 once this is addressed.

> Use a map to record the mapping between FSEditLogOpCode and the corresponding byte value
> ----------------------------------------------------------------------------------------
>                 Key: HDFS-5781
>                 URL: https://issues.apache.org/jira/browse/HDFS-5781
>             Project: Hadoop HDFS
>          Issue Type: Improvement
>          Components: namenode
>    Affects Versions: 2.4.0
>            Reporter: Jing Zhao
>            Assignee: Jing Zhao
>         Attachments: HDFS-5781.000.patch, HDFS-5781.001.patch
> HDFS-5674 uses Enum.values and enum.ordinal to identify an editlog op for a given byte
value. While improving the efficiency, it may cause issue. E.g., when several new editlog
ops are added to trunk around the same time (for several different new features), it is hard
to backport the editlog ops with larger byte values to branch-2 before those with smaller
values, since there will be gaps in the byte values of the enum. 
> This jira plans to still use a map to record the mapping between editlog ops and their
byte values. 

This message was sent by Atlassian JIRA

View raw message