You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by "jojochuang (via GitHub)" <gi...@apache.org> on 2025/05/09 00:03:04 UTC

[PR] HDDS-13000. [Snapshot] listSnapshotDiffJobs throws NPE. [ozone]

jojochuang opened a new pull request, #8418:
URL: https://github.com/apache/ozone/pull/8418

   ## What changes were proposed in this pull request?
   HDDS-13000. [Snapshot] listSnapshotDiffJobs throws NPE.
   
   Please describe your PR in detail:
   * Check for nullity in SnapshotDiffJob.toProtoBuf()
   
   ## What is the link to the Apache JIRA
   
   https://issues.apache.org/jira/browse/HDDS-13000
   
   ## How was this patch tested?
   
   No regression test because the bug doesn't fail the client. More like a cosmetic issue.


-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-13000. [Snapshot] listSnapshotDiffJobs throws NPE. [ozone]

Posted by "peterxcli (via GitHub)" <gi...@apache.org>.
peterxcli commented on code in PR #8418:
URL: https://github.com/apache/ozone/pull/8418#discussion_r2080819974


##########
hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/helpers/SnapshotDiffJob.java:
##########
@@ -269,9 +269,11 @@ public SnapshotDiffJobProto toProtoBuf() {
         .setForceFullDiff(forceFullDiff)
         .setDisableNativeDiff(disableNativeDiff)
         .setTotalDiffEntries(totalDiffEntries)
-        .setSubStatus(subStatus.toProtoBuf())
-        .setKeysProcessedPct(keysProcessedPct)
-        .build();
+        .setKeysProcessedPct(keysProcessedPct);
+    if (subStatus != null) {
+      builder.setSubStatus(subStatus.toProtoBuf());
+    }
+    return builder.build();

Review Comment:
   nit
   ```suggestion
           .setKeysProcessedPct(keysProcessedPct)
           .setSubStatus(subStatus != null ? subStatus.toProtoBuf() : null);
       return builder.build();
   ```



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-13000. [Snapshot] listSnapshotDiffJobs throws NPE. [ozone]

Posted by "peterxcli (via GitHub)" <gi...@apache.org>.
peterxcli commented on code in PR #8418:
URL: https://github.com/apache/ozone/pull/8418#discussion_r2080819974


##########
hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/helpers/SnapshotDiffJob.java:
##########
@@ -269,9 +269,11 @@ public SnapshotDiffJobProto toProtoBuf() {
         .setForceFullDiff(forceFullDiff)
         .setDisableNativeDiff(disableNativeDiff)
         .setTotalDiffEntries(totalDiffEntries)
-        .setSubStatus(subStatus.toProtoBuf())
-        .setKeysProcessedPct(keysProcessedPct)
-        .build();
+        .setKeysProcessedPct(keysProcessedPct);
+    if (subStatus != null) {
+      builder.setSubStatus(subStatus.toProtoBuf());
+    }
+    return builder.build();

Review Comment:
   nit
   ```suggestion
           .setKeysProcessedPct(keysProcessedPct)
           .setSubStatus(subStatus != null ? subStatus.toProtoBuf() : null);
           .build();
   ```



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-13000. [Snapshot] listSnapshotDiffJobs throws NPE. [ozone]

Posted by "ivandika3 (via GitHub)" <gi...@apache.org>.
ivandika3 commented on code in PR #8418:
URL: https://github.com/apache/ozone/pull/8418#discussion_r2080868374


##########
hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/helpers/SnapshotDiffJob.java:
##########
@@ -258,7 +258,7 @@ public int hashCode() {
   }
 
   public SnapshotDiffJobProto toProtoBuf() {
-    return SnapshotDiffJobProto.newBuilder()
+    SnapshotDiffJobProto.Builder builder = SnapshotDiffJobProto.newBuilder()
         .setCreationTime(creationTime)
         .setJobId(jobId)
         .setStatus(status.toProtobuf())

Review Comment:
   Should we also check for `status` as well?



##########
hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/helpers/SnapshotDiffJob.java:
##########
@@ -269,9 +269,11 @@ public SnapshotDiffJobProto toProtoBuf() {
         .setForceFullDiff(forceFullDiff)
         .setDisableNativeDiff(disableNativeDiff)
         .setTotalDiffEntries(totalDiffEntries)
-        .setSubStatus(subStatus.toProtoBuf())
-        .setKeysProcessedPct(keysProcessedPct)
-        .build();
+        .setKeysProcessedPct(keysProcessedPct);
+    if (subStatus != null) {
+      builder.setSubStatus(subStatus.toProtoBuf());
+    }

Review Comment:
   If `subStatus` can be null, maybe we also need use `diffJobProto.hasSubStatus` before in `SnapshotDiffJob#getFromProtoBuf`.



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-13000. [Snapshot] listSnapshotDiffJobs throws NPE. [ozone]

Posted by "jojochuang (via GitHub)" <gi...@apache.org>.
jojochuang commented on PR #8418:
URL: https://github.com/apache/ozone/pull/8418#issuecomment-2877451220

   Merged. Thanks @adoroszlai @ivandika3 @peterxcli !


-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-13000. [Snapshot] listSnapshotDiffJobs throws NPE. [ozone]

Posted by "jojochuang (via GitHub)" <gi...@apache.org>.
jojochuang commented on code in PR #8418:
URL: https://github.com/apache/ozone/pull/8418#discussion_r2080839003


##########
hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/helpers/SnapshotDiffJob.java:
##########
@@ -269,9 +269,11 @@ public SnapshotDiffJobProto toProtoBuf() {
         .setForceFullDiff(forceFullDiff)
         .setDisableNativeDiff(disableNativeDiff)
         .setTotalDiffEntries(totalDiffEntries)
-        .setSubStatus(subStatus.toProtoBuf())
-        .setKeysProcessedPct(keysProcessedPct)
-        .build();
+        .setKeysProcessedPct(keysProcessedPct);
+    if (subStatus != null) {
+      builder.setSubStatus(subStatus.toProtoBuf());
+    }
+    return builder.build();

Review Comment:
   Actually this doesn't work. Protobuf setters don't accept null.



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-13000. [Snapshot] listSnapshotDiffJobs throws NPE. [ozone]

Posted by "jojochuang (via GitHub)" <gi...@apache.org>.
jojochuang merged PR #8418:
URL: https://github.com/apache/ozone/pull/8418


-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org