Skip to content

HDDS-10481. Use proto 3 in SCMRatisProtocol.proto#9695

Merged
szetszwo merged 10 commits intoapache:masterfrom
Russole:HDDS-10481
Feb 4, 2026
Merged

HDDS-10481. Use proto 3 in SCMRatisProtocol.proto#9695
szetszwo merged 10 commits intoapache:masterfrom
Russole:HDDS-10481

Conversation

@Russole
Copy link
Contributor

@Russole Russole commented Feb 1, 2026

What changes were proposed in this pull request?

  • Add REQUEST_TYPE_UNSPECIFIED = 0 to align with proto3 enum default value semantics.
  • Migrate SCMRatisProtocol.proto from proto2 to proto3 by replacing required fields with optional.
  • Reserve field numbers and names to prevent accidental reuse in future schema changes.
  • Add required-equivalent presence checks during deserialization, since proto3 no longer validates required fields when deserialization.
  • Add unit tests to verify deserialization fails when required fields are missing

What is the link to the Apache JIRA

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

How was this patch tested?

@Russole Russole changed the title HDDS-10481. HDDS-10481. Use proto 3 in SCMRatisProtocol.proto Feb 1, 2026
@adoroszlai adoroszlai requested a review from szetszwo February 1, 2026 06:47
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!

I suggest to move the old proto to test and rename the outer classname to something like Proto2SCMRatisProtocolForTesting. Then, we can create objects, serialize them using Proto2SCMRatisProtocolForTesting (proto2) and deserialize them using SCMRatisProtocol (proto3) for testing compatibility.

@Russole
Copy link
Contributor Author

Russole commented Feb 2, 2026

Thanks @szetszwo for the review. I’ve updated the patch based on the feedback by adding proto2–proto3 compatibility tests and moving the legacy proto to test scope.

@Russole Russole requested a review from szetszwo February 2, 2026 22:45
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 the update! The change looks good. Just have a comment about the file name of the test proto.

*/
syntax = "proto2";
option java_package = "org.apache.hadoop.hdds.protocol.proto.testing";
option java_outer_classname = "Proto2SCMRatisProtocolForTesting";
Copy link
Contributor

Choose a reason for hiding this comment

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

Please also change the file name to Proto2SCMRatisProtocolForTesting.proto.

@Russole Russole requested a review from szetszwo February 4, 2026 11:27
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.

+1 the change looks good.

@szetszwo szetszwo merged commit 2cdec7b into apache:master Feb 4, 2026
44 checks passed
@szetszwo
Copy link
Contributor

szetszwo commented Feb 4, 2026

@Russole , thanks a again for working on this! After merging this PR, filed two related JIRAs HDDS-14561 HDDS-14562; see if you are interested in also working on them.

@Russole
Copy link
Contributor Author

Russole commented Feb 4, 2026

@szetszwo Appreciate the review and for merging this.
I’m happy to pick up both HDDS-14561 and HDDS-14562.

@Russole Russole deleted the HDDS-10481 branch February 5, 2026 15:35
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