smengcl commented on code in PR #11370:
URL: https://github.com/apache/ozone/pull/11370#discussion_r4318558605
##########
hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/protocol/DatanodeDetails.java:
##########
@@ -698,6 +698,8 @@ public String toDebugString() {
", certSerialId: " + certSerialId +
", persistedOpState: " + persistedOpState +
", persistedOpStateExpiryEpochSec: " + persistedOpStateExpiryEpochSec +
+ ", version: " + version +
+ ", currentVersion: " + currentVersion +
Review Comment:
I just noticed this fails `TestDatanodeIdYaml#testWriteRead` in CI
[integration (container)
split](https://github.com/apache/ozone/actions/runs/39239919965/job/118025879793).
The test round trips a `DatanodeDetails` through the `datanode.id` YAML and
compares `toDebugString()`, but `currentVersion` is intentionally not persisted
there (`DatanodeIdYaml.DatanodeDetailsYaml#setCurrentVersion` is a no op), so
the node read back has `DEFAULT_VERSION (0)` instead of
`STREAM_PUTBLOCK_WITHOUT_RAFT (101)`.
Suggested test update:
```diff
---
a/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/helpers/TestDatanodeIdYaml.java
+++
b/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/helpers/TestDatanodeIdYaml.java
@@ -24,6 +24,7 @@
import java.io.File;
import java.io.IOException;
import java.util.UUID;
+import org.apache.hadoop.hdds.HDDSVersion;
import org.apache.hadoop.hdds.HddsConfigKeys;
import org.apache.hadoop.hdds.conf.OzoneConfiguration;
import org.apache.hadoop.hdds.protocol.DatanodeDetails;
@@ -50,6 +51,9 @@ void testWriteRead(@TempDir File dir) throws IOException {
DatanodeDetails read = DatanodeIdYaml.readDatanodeIdFile(file);
assertEquals(original, read);
+ // currentVersion is not persisted in datanode.id
+ assertEquals(HDDSVersion.DEFAULT_VERSION, read.getCurrentVersion());
+ read.setCurrentVersion(original.getCurrentVersion());
assertEquals(original.toDebugString(), read.toDebugString());
}
```
--
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]