hadoop-hdfs-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tassapol Athiapinya (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HDFS-5887) Add suffix to generated protobuf class
Date Thu, 14 Aug 2014 04:45:12 GMT

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

Tassapol Athiapinya commented on HDFS-5887:
-------------------------------------------

Uploaded first patch HDFS-5887.000.patch. Most are *.java change to pick up new generated
class names. Here are partial changes that are directly related to *.proto.
{code}
diff --git hadoop-hdfs-project/hadoop-hdfs/src/main/proto/HAZKInfo.proto hadoop-hdfs-project/hadoop-hdfs/src/main/proto/HAZKInfo.proto
index aa8b6be..2702a79 100644
--- hadoop-hdfs-project/hadoop-hdfs/src/main/proto/HAZKInfo.proto
+++ hadoop-hdfs-project/hadoop-hdfs/src/main/proto/HAZKInfo.proto
@@ -26,7 +26,7 @@ option java_package = "org.apache.hadoop.hdfs.server.namenode.ha.proto";
 option java_outer_classname = "HAZKInfoProtos";
 package hadoop.hdfs;
 
-message ActiveNodeInfo {
+message ActiveNodeInfoProto {
   required string nameserviceId = 1;
   required string namenodeId = 2;
 
diff --git hadoop-hdfs-project/hadoop-hdfs/src/main/proto/datatransfer.proto hadoop-hdfs-project/hadoop-hdfs/src/main/proto/datatransfer.proto
index 6283b56..78e80f0 100644
--- hadoop-hdfs-project/hadoop-hdfs/src/main/proto/datatransfer.proto
+++ hadoop-hdfs-project/hadoop-hdfs/src/main/proto/datatransfer.proto
@@ -169,7 +169,7 @@ message ReleaseShortCircuitAccessRequestProto {
 }
 
 message ReleaseShortCircuitAccessResponseProto {
-  required Status status = 1;
+  required StatusProto status = 1;
   optional string error = 2;
 }
 
@@ -180,7 +180,7 @@ message ShortCircuitShmRequestProto {
 }
 
 message ShortCircuitShmResponseProto { 
-  required Status status = 1;
+  required StatusProto status = 1;
   optional string error = 2;
   optional ShortCircuitShmIdProto id = 3;
 }
@@ -194,7 +194,7 @@ message PacketHeaderProto {
   optional bool syncBlock = 5 [default = false];
 }
 
-enum Status {
+enum StatusProto {
   SUCCESS = 0;
   ERROR = 1;
   ERROR_CHECKSUM = 2;
@@ -212,7 +212,7 @@ enum Status {
 
 message PipelineAckProto {
   required sint64 seqno = 1;
-  repeated Status status = 2;
+  repeated StatusProto status = 2;
   optional uint64 downstreamAckTimeNanos = 3 [default = 0];
 }
 
@@ -232,7 +232,7 @@ message ReadOpChecksumInfoProto {
 }
 
 message BlockOpResponseProto {
-  required Status status = 1;
+  required StatusProto status = 1;
 
   optional string firstBadLink = 2;
   optional OpBlockChecksumResponseProto checksumResponse = 3;
@@ -257,11 +257,11 @@ message BlockOpResponseProto {
  * read request.
  */
 message ClientReadStatusProto {
-  required Status status = 1;
+  required StatusProto status = 1;
 }
 
 message DNTransferAckProto {
-  required Status status = 1;
+  required StatusProto status = 1;
 }
 
 message OpBlockChecksumResponseProto {
diff --git hadoop-hdfs-project/hadoop-hdfs/src/main/proto/fsimage.proto hadoop-hdfs-project/hadoop-hdfs/src/main/proto/fsimage.proto
index 1c8edfa..3dbe6c6 100644
--- hadoop-hdfs-project/hadoop-hdfs/src/main/proto/fsimage.proto
+++ hadoop-hdfs-project/hadoop-hdfs/src/main/proto/fsimage.proto
@@ -46,7 +46,7 @@ import "xattr.proto";
  *
  */
 
-message FileSummary {
+message FileSummaryProto {
   // The version of the above EBNF grammars.
   required uint32 ondiskVersion = 1;
   // layoutVersion describes which features are available in the
@@ -54,18 +54,18 @@ message FileSummary {
   required uint32 layoutVersion = 2;
   optional string codec         = 3;
   // index for each section
-  message Section {
+  message SectionProto {
     optional string name = 1;
     optional uint64 length = 2;
     optional uint64 offset = 3;
   }
-  repeated Section sections = 4;
+  repeated SectionProto sections = 4;
 }
 
 /**
  * Name: NS_INFO
  */
-message NameSystemSection {
+message NameSystemSectionProto {
   optional uint32 namespaceId = 1;
   optional uint64 genstampV1 = 2;
   optional uint64 genstampV2 = 3;
@@ -82,11 +82,11 @@ message NameSystemSection {
  *
  * Name: INODE
  */
-message INodeSection {
+message INodeSectionProto {
   /**
    * under-construction feature for INodeFile
    */
-  message FileUnderConstructionFeature {
+  message FileUnderConstructionFeatureProto {
     optional string clientName = 1;
     optional string clientMachine = 2;
   }
@@ -124,19 +124,19 @@ message INodeSection {
     repeated XAttrCompactProto xAttrs = 1;
   }
   
-  message INodeFile {
+  message INodeFileProto {
     optional uint32 replication = 1;
     optional uint64 modificationTime = 2;
     optional uint64 accessTime = 3;
     optional uint64 preferredBlockSize = 4;
     optional fixed64 permission = 5;
     repeated BlockProto blocks = 6;
-    optional FileUnderConstructionFeature fileUC = 7;
+    optional FileUnderConstructionFeatureProto fileUC = 7;
     optional AclFeatureProto acl = 8;
     optional XAttrFeatureProto xAttrs = 9;
   }
 
-  message INodeDirectory {
+  message INodeDirectoryProto {
     optional uint64 modificationTime = 1;
     // namespace quota
     optional uint64 nsQuota = 2;
@@ -147,26 +147,26 @@ message INodeSection {
     optional XAttrFeatureProto xAttrs = 6;
   }
 
-  message INodeSymlink {
+  message INodeSymlinkProto {
     optional fixed64 permission = 1;
     optional bytes target = 2;
     optional uint64 modificationTime = 3;
     optional uint64 accessTime = 4;
   }
 
-  message INode {
-    enum Type {
+  message INodeProto {
+    enum TypeProto {
       FILE = 1;
       DIRECTORY = 2;
       SYMLINK = 3;
     };
-    required Type type = 1;
+    required TypeProto type = 1;
     required uint64 id = 2;
     optional bytes name = 3;
 
-    optional INodeFile file = 4;
-    optional INodeDirectory directory = 5;
-    optional INodeSymlink symlink = 6;
+    optional INodeFileProto file = 4;
+    optional INodeDirectoryProto directory = 5;
+    optional INodeSymlinkProto symlink = 6;
   }
 
   optional uint64 lastInodeId = 1;
@@ -179,24 +179,24 @@ message INodeSection {
  * reconstructing the lease map.
  * NAME: FILES_UNDERCONSTRUCTION
  */
-message FilesUnderConstructionSection {
-  message FileUnderConstructionEntry {
+message FilesUnderConstructionSectionProto {
+  message FileUnderConstructionEntryProto {
     optional uint64 inodeId = 1;
     optional string fullPath = 2;
   }
-  // repeated FileUnderConstructionEntry...
+  // repeated FileUnderConstructionEntryProto...
 }
 
 /**
  * This section records the children of each directories
  * NAME: INODE_DIR
  */
-message INodeDirectorySection {
+message INodeDirectorySectionProto {
   /**
    * A single DirEntry needs to fit in the default PB max message size of
    * 64MB. Please be careful when adding more fields to a DirEntry!
    */
-  message DirEntry {
+  message DirEntryProto {
     optional uint64 parent = 1;
     // children that are not reference nodes
     repeated uint64 children = 2 [packed = true];
@@ -206,8 +206,8 @@ message INodeDirectorySection {
   // repeated DirEntry, ended at the boundary of the section.
 }
 
-message INodeReferenceSection {
-  message INodeReference {
+message INodeReferenceSectionProto {
+  message INodeReferenceProto {
     // id of the referred inode
     optional uint64 referredId = 1;
     // local name recorded in WithName
@@ -217,91 +217,91 @@ message INodeReferenceSection {
     // recorded in WithName
     optional uint32 lastSnapshotId = 4;
   }
-  // repeated INodeReference...
+  // repeated INodeReferenceProto...
 }
 
 /**
  * This section records the information about snapshot
  * NAME: SNAPSHOT
  */
-message SnapshotSection {
-  message Snapshot {
+message SnapshotSectionProto {
+  message SnapshotProto {
     optional uint32 snapshotId = 1;
     // Snapshot root
-    optional INodeSection.INode root = 2;
+    optional INodeSectionProto.INodeProto root = 2;
   }
 
   optional uint32 snapshotCounter = 1;
   repeated uint64 snapshottableDir = 2 [packed = true];
   // total number of snapshots
   optional uint32 numSnapshots = 3;
-  // repeated Snapshot...
+  // repeated SnapshotProto...
 }
 
 /**
  * This section records information about snapshot diffs
  * NAME: SNAPSHOT_DIFF
  */
-message SnapshotDiffSection {
-  message CreatedListEntry {
+message SnapshotDiffSectionProto {
+  message CreatedListEntryProto {
     optional bytes name = 1;
   }
 
-  message DirectoryDiff {
+  message DirectoryDiffProto {
     optional uint32 snapshotId = 1;
     optional uint32 childrenSize = 2;
     optional bool isSnapshotRoot = 3;
     optional bytes name = 4;
-    optional INodeSection.INodeDirectory snapshotCopy = 5;
+    optional INodeSectionProto.INodeDirectoryProto snapshotCopy = 5;
     optional uint32 createdListSize = 6;
     repeated uint64 deletedINode = 7 [packed = true]; // id of deleted inodes
     // id of reference nodes in the deleted list
     repeated uint32 deletedINodeRef = 8 [packed = true];
-    // repeated CreatedListEntry (size is specified by createdListSize)
+    // repeated CreatedListEntryProto (size is specified by createdListSize)
   }
 
-  message FileDiff {
+  message FileDiffProto {
     optional uint32 snapshotId = 1;
     optional uint64 fileSize = 2;
     optional bytes name = 3;
-    optional INodeSection.INodeFile snapshotCopy = 4;
+    optional INodeSectionProto.INodeFileProto snapshotCopy = 4;
   }
 
-  message DiffEntry {
-    enum Type {
+  message DiffEntryProto {
+    enum TypeProto {
       FILEDIFF = 1;
       DIRECTORYDIFF = 2;
     }
-    required Type type = 1;
+    required TypeProto type = 1;
     optional uint64 inodeId = 2;
     optional uint32 numOfDiff = 3;
 
-    // repeated DirectoryDiff or FileDiff
+    // repeated DirectoryDiffProto or FileDiffProto
   }
 
-  // repeated DiffEntry
+  // repeated DiffEntryProto
 }
 
 /**
  * This section maps string to id
  * NAME: STRING_TABLE
  */
-message StringTableSection {
-  message Entry {
+message StringTableSectionProto {
+  message EntryProto {
     optional uint32 id = 1;
     optional string str = 2;
   }
   optional uint32 numEntry = 1;
-  // repeated Entry
+  // repeated EntryProto
 }
 
-message SecretManagerSection {
-  message DelegationKey {
+message SecretManagerSectionProto {
+  message DelegationKeyProto {
     optional uint32 id         = 1;
     optional uint64 expiryDate = 2;
     optional bytes  key        = 3;
   }
-  message PersistToken {
+  message PersistTokenProto {
     optional uint32 version        = 1;
     optional string owner          = 2;
     optional string renewer        = 3;
@@ -316,11 +316,11 @@ message SecretManagerSection {
   optional uint32 tokenSequenceNumber = 2;
   optional uint32 numKeys = 3;
   optional uint32 numTokens = 4;
-  // repeated DelegationKey keys
-  // repeated PersistToken tokens
+  // repeated DelegationKeyProto keys
+  // repeated PersistTokenProto tokens
 }
 
-message CacheManagerSection {
+message CacheManagerSectionProto {
   required uint64 nextDirectiveId = 1;
   required uint32 numPools        = 2;
   required uint32 numDirectives   = 3;
diff --git hadoop-hdfs-project/hadoop-hdfs/src/main/proto/hdfs.proto hadoop-hdfs-project/hadoop-hdfs/src/main/proto/hdfs.proto
index 32c54b0..48154ac 100644
--- hadoop-hdfs-project/hadoop-hdfs/src/main/proto/hdfs.proto
+++ hadoop-hdfs-project/hadoop-hdfs/src/main/proto/hdfs.proto
@@ -218,12 +218,12 @@ message LocatedBlocksProto {
  * Optionally includes a file's block locations if requested by client on the rpc call.
  */
 message HdfsFileStatusProto {
-  enum FileType {
+  enum FileTypeProto {
     IS_DIR = 1;
     IS_FILE = 2;
     IS_SYMLINK = 3;
   }
-  required FileType fileType = 1;
+  required FileTypeProto fileType = 1;
   required bytes path = 2;          // local name of inode encoded java UTF8
   required uint64 length = 3;
   required FsPermissionProto permission = 4;
@@ -359,12 +359,12 @@ message CheckpointSignatureProto {
  * Command sent from one namenode to another namenode.
  */
 message NamenodeCommandProto {
-  enum Type {
+  enum TypeProto {
     NamenodeCommand = 0;      // Base command
     CheckPointCommand = 1;    // Check point command
   }
   required uint32 action = 1;
-  required Type type = 2;
+  required TypeProto type = 2;
   optional CheckpointCommandProto checkpointCmd = 3;
 }
 {code}

> Add suffix to generated protobuf class
> --------------------------------------
>
>                 Key: HDFS-5887
>                 URL: https://issues.apache.org/jira/browse/HDFS-5887
>             Project: Hadoop HDFS
>          Issue Type: Sub-task
>    Affects Versions: HDFS-5698 (FSImage in protobuf)
>            Reporter: Haohui Mai
>            Priority: Minor
>         Attachments: HDFS-5887.000.patch
>
>
> As suggested by [~tlipcon], the code is more readable if we give each class generated
by the protobuf the suffix "Proto".
> This jira proposes to rename the classes and to introduce no functionality changes.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Mime
View raw message