smengcl commented on code in PR #4264:
URL: https://github.com/apache/ozone/pull/4264#discussion_r1122505474
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/protocolPB/OzoneManagerRequestHandler.java:
##########
@@ -1219,11 +1219,26 @@ private GetS3VolumeContextResponse getS3VolumeContext()
private SnapshotDiffResponse snapshotDiff(
SnapshotDiffRequest snapshotDiffRequest) throws IOException {
- return SnapshotDiffResponse.newBuilder().setSnapshotDiffReport(
- impl.snapshotDiff(snapshotDiffRequest.getVolumeName(),
+ org.apache.hadoop.ozone.snapshot.SnapshotDiffResponse response =
+ impl.snapshotDiff(
+ snapshotDiffRequest.getVolumeName(),
snapshotDiffRequest.getBucketName(),
snapshotDiffRequest.getFromSnapshot(),
- snapshotDiffRequest.getToSnapshot()).toProtobuf()).build();
+ snapshotDiffRequest.getToSnapshot(),
+ snapshotDiffRequest.getToken(),
+ snapshotDiffRequest.getPageSize());
+
+ OzoneManagerProtocolProtos.SnapshotDiffReportProto snapshotDiffReportProto;
+ if (response.getSnapshotDiffReport() == null) {
+ snapshotDiffReportProto = null;
+ } else {
+ snapshotDiffReportProto = response.getSnapshotDiffReport().toProtobuf();
+ }
+
+ return SnapshotDiffResponse.newBuilder()
+ .setSnapshotDiffReport(snapshotDiffReportProto)
Review Comment:
Double check if setting `null` would cause protobuf-generated methods to
raise exception or not?
IIRC this [would not play well with
proto3](https://stackoverflow.com/a/42634681). Though I believe we are using
protoc 3 to compile proto2 syntax files.
Do we have a test case for this?
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/protocolPB/OzoneManagerRequestHandler.java:
##########
@@ -1219,11 +1219,26 @@ private GetS3VolumeContextResponse getS3VolumeContext()
private SnapshotDiffResponse snapshotDiff(
SnapshotDiffRequest snapshotDiffRequest) throws IOException {
- return SnapshotDiffResponse.newBuilder().setSnapshotDiffReport(
- impl.snapshotDiff(snapshotDiffRequest.getVolumeName(),
+ org.apache.hadoop.ozone.snapshot.SnapshotDiffResponse response =
+ impl.snapshotDiff(
+ snapshotDiffRequest.getVolumeName(),
snapshotDiffRequest.getBucketName(),
snapshotDiffRequest.getFromSnapshot(),
- snapshotDiffRequest.getToSnapshot()).toProtobuf()).build();
+ snapshotDiffRequest.getToSnapshot(),
+ snapshotDiffRequest.getToken(),
+ snapshotDiffRequest.getPageSize());
+
+ OzoneManagerProtocolProtos.SnapshotDiffReportProto snapshotDiffReportProto;
+ if (response.getSnapshotDiffReport() == null) {
+ snapshotDiffReportProto = null;
+ } else {
+ snapshotDiffReportProto = response.getSnapshotDiffReport().toProtobuf();
+ }
+
+ return SnapshotDiffResponse.newBuilder()
+ .setSnapshotDiffReport(snapshotDiffReportProto)
Review Comment:
Double check if setting `null` would cause protobuf-generated methods to
raise exception or not?
IIRC this [would not play well with
proto3](https://stackoverflow.com/a/42634681). Though I believe we are just
using protoc 3 to compile proto2 syntax files.
Do we have a test case for this?
--
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]