ArafatKhan2198 commented on code in PR #6492:
URL: https://github.com/apache/ozone/pull/6492#discussion_r1583212190
##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/codec/NSSummaryCodec.java:
##########
@@ -110,13 +113,17 @@ public NSSummary fromPersistedFormat(byte[] rawData)
throws IOException {
int strLen = in.readInt();
if (strLen == 0) {
+ long parentId = in.readLong(); // Deserialize parentId
+ res.setParentId(parentId);
return res;
}
byte[] buffer = new byte[strLen];
int bytesRead = in.read(buffer);
assert (bytesRead == strLen);
String dirName = stringCodec.fromPersistedFormat(buffer);
res.setDirName(dirName);
+ long parentId = in.readLong();
Review Comment:
Thanks for the comment @sumitagrawl
To ensure simplicity in addressing the backward compatibility of `NSSummary`
objects during **deserialization**, we've implemented a straightforward
solution. When **deserializing** old data, if the parentId field is not present
or is set to zero, we assign it a value of **`-1`**. This indicates that the
parentId was not originally set, effectively differentiating old data from new
without needing complex versioning systems. This approach is neatly integrated
into our deserialization method, keeping the process clean and efficient.
--
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]