-
Notifications
You must be signed in to change notification settings - Fork 308
Protobuf4j migration #6926
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
carlesarnal
wants to merge
22
commits into
Apicurio:main
Choose a base branch
from
carlesarnal:protobuf4j-migration
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Protobuf4j migration #6926
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
de37ec2 to
1556c89
Compare
456d253 to
b666338
Compare
This was referenced Dec 4, 2025
Member
Author
|
This work is finalized besides the migration path. The failing test is the test that's checking that both the old serializer and the new one result in the same contentId being used. |
6c2ff4a to
45bd3f3
Compare
…ew ones generate the same contentId
Introduce compilation context pooling and centralize well-known type detection to reduce code duplication and improve performance through resource reuse. Key changes: - Add ProtobufCompilationContext with pooled filesystem and WASM instances - Create ProtobufWellKnownTypes utility to centralize type detection logic - Add toNormalizedProtoText() and hasOriginalProtoText() to ProtobufSchema - Implement rewriteReferences() in ProtobufDereferencer for import rewriting - Add pre-parsed schema support to ProtobufCompatibilityChecker - Simplify validateSyntaxOnly() to use pooled compilation context - Add extractProtocError() for enhanced error messages This reduces code duplication from 6+ locations to 1 utility class and enables WASM instance reuse across compilations. Note: The pooling implementation has known issues for long-running servers that are documented in docs/protobuf4j-improvements-plan.md and will be addressed in follow-up work (shutdown hooks, idle eviction, configurable pooling mode for server vs serdes use cases).
45bd3f3 to
b064079
Compare
b064079 to
af03fe7
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR migrates Apicurio Registry's protobuf implementation from Square's Wire-Schema library to protobuf4j, a library that runs the official
protoccompiler via WebAssembly (WASM) on the JVM.Key Benefits:
Root Cause / Motivation
Wire-Schema presented several challenges:
Changes
Core Migration:
ProtobufSchemaLoader,ProtobufSchemaUtils, andFileDescriptorUtilsto use protobuf4j APIsProtobuf.normalizeSchemaToText()for consistent outputProtobuf.validateSyntax()without dependency resolutionNew Utilities:
ProtobufWellKnownTypes: Centralized well-known type detection (google/protobuf/, google/type/, etc.)ProtobufCompilationContext: Filesystem pooling and WASM instance caching for improved performanceProtobufSchemaUtils: New utility class replacing Wire-specific helpersSerdes Updates:
Deleted Files:
DynamicSchema.java(427 lines)EnumDefinition.java(69 lines)MessageDefinition.java(206 lines)ProtobufMessage.java(147 lines)Testing Infrastructure:
ProtobufBackwardCompatibilityIT- shades old wire-schema serializer (v3.1.2) to verify interoperabilityProtobufSerdesPerformanceIT- compares new vs old vs Confluent serializer performanceProtobufParsingBenchmarkfor compilation performance profilingTest Plan
ProtobufBackwardCompatibilityIT: Verifies messages serialized with old wire-schema serializer can be deserialized by new protobuf4j serializer and vice versaProtobufSerdesPerformanceIT: Confirms no performance regression in serialization/deserialization hot pathsContentCanonicalizerTest: Verifies canonical form consistencyfix native image buildcommit)Migration Considerations
For Existing Users:
Breaking Changes:
ProtoFileElement,MessageElement, etc.)FileDescriptor-based APIs