ChenSammi commented on code in PR #7394:
URL: https://github.com/apache/ozone/pull/7394#discussion_r1837446484
##########
hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/security/OzoneTokenIdentifier.java:
##########
@@ -125,7 +136,13 @@ public OzoneTokenIdentifier fromUniqueSerializedKey(byte[]
rawData)
setStrToSign(WritableUtils.readString(in));
} else {
this.tokenType = Type.DELEGATION_TOKEN;
- setOmCertSerialId(WritableUtils.readString(in));
+ String value = WritableUtils.readString(in);
+ try {
+ UUID.fromString(value);
+ setSecretKeyId(value);
+ } catch (IllegalArgumentException e) {
+ setOmCertSerialId(value);
+ }
Review Comment:
Because this OzoneTokenIdentifier#toUniqueSerializedKey uses its own raw
format instead of OMTokenProto format, which I have no idea how. In a period
of time(7d, max delegation time lifetime) after OM is upgraded to use shared
secret key, the same index string would be cerial ID or secreKey ID. So this "
UUID.fromString(value);" used to detect whether it's secretKey, which is a
UUID, or a serial ID, which is a number.
Let me further check if we can refactor some existing code, to avoid this
UUID.fromString(value) being executed after upgrade 7days.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]