HDDS-13199. Remove DatanodeDetails#getUuid and DatanodeID#getUuid methods#10405
HDDS-13199. Remove DatanodeDetails#getUuid and DatanodeID#getUuid methods#10405navinko wants to merge 8 commits into
Conversation
There was a problem hiding this comment.
+1 the change looks good.
@navinko , Could you also remove DatanodeID#getUuid?
+++ b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/protocol/DatanodeID.java
@@ -121,11 +121,4 @@ private static HddsProtos.UUID toProto(final UUID id) {
.setLeastSigBits(id.getLeastSignificantBits())
.build();
}
-
- // TODO: Remove this in follow-up Jira. (HDDS-12015)
- // Exposing this temporarily to help with refactoring.
- @Deprecated
- public UUID getUuid() {
- return uuid;
- }
}
Thanks @szetszwo |
|
Once i removed DatanodeID#getUuid? the local build and test cases passed but realised it broke robot test for balancer (ratis+EC) .Fixed it by updating DatanodeID#getID (which is used for json conversion) to DatanodeID#getUuid |
|
|
||
| // Mainly used for JSON conversion | ||
| public String getID() { | ||
| public String getUuid() { |
There was a problem hiding this comment.
@navinko , Thanks for the update! Let's rename it to getUuidStringForTesting() and move it right after toString().
@@ -70,6 +65,10 @@ public String toString() {
return uuidByteString.getString();
}
+ public String getUuidStringForTesting() {
+ return toString();
+ }
+
/**
* This will be removed once the proto structure is refactored
* to remove deprecated fields.There was a problem hiding this comment.
Thanks @szetszwo for the suggestions.
Addressed the review comments and used getUuidStringForTesting for tests only and updated HddsTestUtils.
Since earlier the balancer's robot test, jq was referring "datanodeDetails.id.uuid" and getUuid() was available in DatanodeID class so the test succeeded but with rename to getUuidStringForTesting caused uuid being null . I used datanodeDetails.uuidString instead of datanodeDetails.id.uuidStringForTesting to make robot test succeed.
CI Build : https://github.com/navinko/ozone/actions/runs/26844028091/job/79160804056
| Get Datanode Ozone Used Bytes Info | ||
| [arguments] ${uuid} | ||
| ${output} = Execute export DATANODES=$(ozone admin datanode list --json) && for datanode in $(echo "$\{DATANODES\}" | jq -r '.[].id'); do ozone admin datanode usageinfo --uuid=$\{datanode\} --json | jq '{(.[0].datanodeDetails.id.uuid) : .[0].ozoneUsed}'; done | jq -s add | ||
| ${output} = Execute export DATANODES=$(ozone admin datanode list --json) && for datanode in $(echo "$\{DATANODES\}" | jq -r '.[].id'); do ozone admin datanode usageinfo --uuid=$\{datanode\} --json | jq '{(.[0].datanodeDetails.uuidString) : .[0].ozoneUsed}'; done | jq -s add |
There was a problem hiding this comment.
@navinko , Have a question: Which code requires this change? We probably cannot change the json format. Otherwise, it becomes an incompatible change since the scripts using this command won't work anymore.
@adoroszlai , Could see if this is an incompatible change? How to make it compatible?
There was a problem hiding this comment.
Hi @szetszwo, Agreed we should not change the contract . DatanodeID exposes a field uuid and there was a getter for that which was being referred when robot test output jq '{(.[0].datanodeDetails.id.uuid getting evaluated , it look for getUuid() which we renamed to getUuidStringForTesting
f2c0076#diff-e17218a6afd5c74990ac51dca37ce4654df8d2f38ed3bb6c56b2ba608893894eR47-L48
There was a problem hiding this comment.
... , it look for getUuid() ...
This part is my confusion -- there is no getUuid() in DatanodeID before this change. The method we are renaming is getID(). So why it works before the change?
+++ b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/protocol/DatanodeID.java
@@ -44,11 +44,6 @@ private DatanodeID(final UUID uuid) {
this.uuidByteString = StringWithByteString.valueOf(uuid.toString());
}
- // Mainly used for JSON conversion
- public String getID() {
- return toString();
- }
-There was a problem hiding this comment.
Could you run the command and see how the json output get changed?
There was a problem hiding this comment.
... , it look for getUuid() ...
This part is my confusion -- there is no getUuid() in DatanodeID before this change. The method we are renaming is getID(). So why it works before the change?
+++ b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/protocol/DatanodeID.java @@ -44,11 +44,6 @@ private DatanodeID(final UUID uuid) { this.uuidByteString = StringWithByteString.valueOf(uuid.toString()); } - // Mainly used for JSON conversion - public String getID() { - return toString(); - } -
Hi @szetszwo , It is little confusing , i am trying to explain in sequence ,apologies if still doesn't make sense. when getID was only there and we removed deprecated getUuid() the robot was still failing!
The way we did is
1: we had removed deprecated getUuid()
- at this time getID() was there , and robot test failed.
- the json having DatanodeDeatils obj like
"datanodeDetails" : {
"level" : 3,
"cost" : 0,
"id" : {
"id" : "d4e1d299-0d01-440d-9111-75cc1500bb70",
"byteString" : {
"validUtf8" : true,
"empty" : false
}
}
- Since we removed deprecated getUuid() ,we din't find uuid part of datanodeDetails, to fix robot test we renamed exiting getID ->getUuid() , which makes robot test pass.
Below changeset -robot test was failed
these are the json outputs from latest changsets
Latest patch -<-------- renamed getUuid() to getUuidStringForTesting"
"datanodeDetails" : {
"level" : 3,
"cost" : 0,
"id" : {
"byteString" : {
"validUtf8" : true,
"empty" : false
},
"uuidStringForTesting" : "3e4bb53d-5030-4f84-8f15-4287f3ab576e".
}
- to fix we updated in robot test datanodeDetails.id.uuidStringForTesting
- in json o/p for ozone admin datanode usageinfo , uuidStringForTesting is part of datanodeDetails obj so for sure this is not only for testing .
- If we could not have renamed then o/p will be like below thats why robot test with datanodeDetails.id.uuid
worked.
"datanodeDetails" : {
"level" : 3,
"cost" : 0,
"id" : {
"byteString" : {
"validUtf8" : true,
"empty" : false
},
"uuid" : "3e4bb53d-5030-4f84-8f15-4287f3ab576e".
}
There was a problem hiding this comment.
@navinko , thanks a lot for the detailed analysis!
If we keep DatanodeID.getUuid(), could the robot test pass?
How about we change getUuid() to return String instead of UUID?
There was a problem hiding this comment.
Hi @szetszwo
If we keep DatanodeID.getUuid() it pass the robot test.
Since the DatanodeID#getUuid () which was returning UUID was deprecated one and is already removed , the DatanodeID.getUuid() we been using return String only .
CI build successsful : https://github.com/navinko/ozone/actions/runs/26967483156
In master looks like some env issue causing test failure .
Below is the datanodeDetails obj for 'ozone admin datanode usageinfo' o/p
json in our patch now vs master.
#After fixing unintentional merge on conflict resolution and used DatanodeID#getUuid() returning string
"datanodeDetails" : {
"level" : 3,
"cost" : 0,
"id" : {
"uuid" : "760f1a0c-cdc8-40af-a179-516714de969a",
"byteString" : {
"validUtf8" : true,
"empty" : false
}
}
#From current master branch
"datanodeDetails" : {
"level" : 3,
"cost" : 0,
"id" : {
"uuid" : "a643947e-407e-4e06-9b3a-dd6c779dab73",
"id" : "a643947e-407e-4e06-9b3a-dd6c779dab73",
"byteString" : {
"validUtf8" : true,
"empty" : false
}
}
What changes were proposed in this pull request?
Rebase 8576.patch with upstream latest
Please describe your PR in detail:
Remove DatanodeDetails#getUuid and DatanodeID#getUuid methods
This is continuation of left over on HDDS-13199
What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-13199
How was this patch tested?
Tested all existing unit test and integration test ran successfully.
Tests locally : Did not observe any failure.
`
bash-5.1$ ozone admin datanode list
Datanode: b8466a8b-d1fc-481e-8304-e7fe4d696bbc (/default-rack/172.18.0.9/ozone-datanode-2.ozone_default/2 pipelines)
Operational State: IN_SERVICE
Health State: HEALTHY
Total volume count: 1
Healthy volume count: 1
Related pipelines:
4b81bbb6-f2b0-4b0a-9656-49e59208d600/RATIS/ONE/RATIS/OPEN/Leader
0348f63f-1d2b-4007-85b1-36bfbbf1341e/RATIS/THREE/RATIS/OPEN/Follower
Datanode: fceb2cd0-de86-4581-9f65-6da8466e831d (/default-rack/172.18.0.3/ozone-datanode-1.ozone_default/2 pipelines)
Operational State: IN_SERVICE
Health State: HEALTHY
Total volume count: 1
Healthy volume count: 1
Related pipelines:
f79ecaf8-0025-487b-b849-190a0c0eb147/RATIS/ONE/RATIS/OPEN/Leader
0348f63f-1d2b-4007-85b1-36bfbbf1341e/RATIS/THREE/RATIS/OPEN/Leader
Datanode: 4ddd5199-bebf-4a78-b7fc-9ee9f7691820 (/default-rack/172.18.0.8/ozone-datanode-3.ozone_default/2 pipelines)
Operational State: IN_SERVICE
Health State: HEALTHY
Total volume count: 1
Healthy volume count: 1
Related pipelines:
7719e064-dec7-4ec9-a519-08fec2d228c5/RATIS/ONE/RATIS/OPEN/Leader
0348f63f-1d2b-4007-85b1-36bfbbf1341e/RATIS/THREE/RATIS/OPEN/Follower
bash-5.1$ ozone admin datanode usageinfo -m -c=3
Usage Information (3 Datanodes)
ID : b8466a8b-d1fc-481e-8304-e7fe4d696bbc
IP Address : 172.18.0.9
Hostname : ozone-datanode-2.ozone_default
Filesystem Capacity : 485473984512 B (452.13 GB)
Filesystem Used : 32625520640 B (30.38 GB)
Filesystem Used % : 6.72% (Filesystem Used/Filesystem Capacity)
Filesystem Available : 452848463872 B (421.75 GB)
Filesystem Available % : 93.28% (Filesystem Available/Filesystem Capacity)
Ozone Capacity : 485425437116 B (452.09 GB)
Ozone Used : 4382720 B (4.18 MB)
Ozone Used % : 0.00% (Ozone Used/Ozone Capacity)
Ozone Available : 452848463872 B (421.75 GB)
Ozone Available % : 93.29% (Ozone Available/Ozone capacity)
Pipeline(s) : 2
Container(s) : 0
Container Pre-allocated : 0 B (0 B)
Remaining Allocatable : 452848463872 B (421.75 GB)
Free Space To Spare : 104857600 B (100 MB)
Reserved : 48547396 B (46.30 MB)
ID : 4ddd5199-bebf-4a78-b7fc-9ee9f7691820
IP Address : 172.18.0.8
Hostname : ozone-datanode-3.ozone_default
Filesystem Capacity : 485473984512 B (452.13 GB)
Filesystem Used : 32625520640 B (30.38 GB)
Filesystem Used % : 6.72% (Filesystem Used/Filesystem Capacity)
Filesystem Available : 452848463872 B (421.75 GB)
Filesystem Available % : 93.28% (Filesystem Available/Filesystem Capacity)
Ozone Capacity : 485425437116 B (452.09 GB)
Ozone Used : 4382720 B (4.18 MB)
Ozone Used % : 0.00% (Ozone Used/Ozone Capacity)
Ozone Available : 452848463872 B (421.75 GB)
Ozone Available % : 93.29% (Ozone Available/Ozone capacity)
Pipeline(s) : 2
Container(s) : 0
Container Pre-allocated : 0 B (0 B)
Remaining Allocatable : 452848463872 B (421.75 GB)
Free Space To Spare : 104857600 B (100 MB)
Reserved : 48547396 B (46.30 MB)
ID : fceb2cd0-de86-4581-9f65-6da8466e831d
IP Address : 172.18.0.3
Hostname : ozone-datanode-1.ozone_default
Filesystem Capacity : 485473984512 B (452.13 GB)
Filesystem Used : 32123781120 B (29.92 GB)
Filesystem Used % : 6.62% (Filesystem Used/Filesystem Capacity)
Filesystem Available : 453350203392 B (422.22 GB)
Filesystem Available % : 93.38% (Filesystem Available/Filesystem Capacity)
Ozone Capacity : 485425437116 B (452.09 GB)
Ozone Used : 4382720 B (4.18 MB)
Ozone Used % : 0.00% (Ozone Used/Ozone Capacity)
Ozone Available : 453350203392 B (422.22 GB)
Ozone Available % : 93.39% (Ozone Available/Ozone capacity)
Pipeline(s) : 2
Container(s) : 0
Container Pre-allocated : 0 B (0 B)
Remaining Allocatable : 453350203392 B (422.22 GB)
Free Space To Spare : 104857600 B (100 MB)
Reserved : 48547396 B (46.30 MB)
CI build: https://github.com/navinko/ozone/actions/runs/26769887196