Skip to content

Conversation

@Russole
Copy link
Contributor

@Russole Russole commented Feb 8, 2026

What changes were proposed in this pull request?

  • Updated SCM Ratis request/response serialization and deserialization
    to use Ratis shaded protobuf (ByteString / ByteBuffer) at the transport boundary.
  • Removed unnecessary intermediate byte[] conversions in the SCM Ratis message path.
  • Updated existing unit tests to match the revised serialization and deserialization
    implementation.

What is the link to the Apache JIRA

https://issues.apache.org/jira/browse/HDDS-14561

How was this patch tested?

Copy link
Contributor

@szetszwo szetszwo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Russole , thanks for working on this!

Let see if the current change can be compiled -- I think we need to change the protobuf compiler or use shading to make SCMRatisRequest/Response extending the protobuf inside Ratis.

@Russole
Copy link
Contributor Author

Russole commented Feb 9, 2026

Thanks @szetszwo!

The current change compiles and all CI checks pass:
https://github.com/Russole/ozone/actions/runs/21776638347

Agreed that SCMRatisRequestProto and SCMRatisResponseProto still extend
com.google.protobuf.*, as they are generated by the standard protobuf compiler.
This PR focuses on the SCM↔Ratis message boundary, updating the wrapping/parsing
to use Ratis shaded protobuf types and avoid extra byte[] conversions.

Let me know if you think it makes sense to open a follow-up JIRA for generating
the SCM Ratis protos with the shaded protobuf.

Comment on lines +117 to +118
UnsafeByteOperations.unsafeWrap(
requestProto.toByteString().asReadOnlyByteBuffer()));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Russole , I see how this change works now -- it does prevent copying to an array but still needs type conversion from com.google.protobuf.ByteString to org.apache.ratis.thirdparty.com.google.protobuf.ByteString.

Let's fix also the conversion in this JIRA; see ContainerCommandRequestProto as an example for how to do it.

@Russole
Copy link
Contributor Author

Russole commented Feb 10, 2026

Thanks for the clarification!

I’m working on this now. I see the issue with the remaining type conversion between
com.google.protobuf and the Ratis shaded protobuf, and I’m updating the implementation
to follow the same pattern as ContainerCommandRequestProto so that the SCM Ratis
request/response fully use the shaded protobuf types.

I’ll update the PR once this is addressed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants