xiaoyuyao commented on a change in pull request #1182: URL: https://github.com/apache/hadoop-ozone/pull/1182#discussion_r454009691
########## File path: hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/security/OzoneTokenIdentifier.java ########## @@ -77,6 +80,122 @@ public Text getKind() { return KIND_NAME; } + /** Instead of relying on proto serialization, this + * provides explicit serialization for OzoneTokenIdentifier. + * @return byte[] + */ + public byte[] toUniqueSerializedKey() { + ByteBuffer result = Review comment: Thanks @prashantpogde for working on this. The patch LGTM overall. Have a few questions: Have you consider leverage the readFields from parent class to handle the basic non-protoc serialization which seems to be much simpler. ``` public byte[] toUniqueSerializedKey() throws IOException { DataOutputBuffer buf = new DataOutputBuffer(); super.write(buf); WritableUtils.writeEnum(buf, getTokenType()); // Set s3 specific fields. if (getTokenType().equals(S3AUTHINFO)) { WritableUtils.writeString(buf, getAwsAccessId()); WritableUtils.writeString(buf, getSignature()); WritableUtils.writeString(buf, getStrToSign()); } else { WritableUtils.writeString(buf, getOmCertSerialId()); } return buf.getData(); } ``` ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: ozone-issues-unsubscr...@hadoop.apache.org For additional commands, e-mail: ozone-issues-h...@hadoop.apache.org