-
Notifications
You must be signed in to change notification settings - Fork 306
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
17
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
2406cd1 to
de37ec2
Compare
…ew ones generate the same contentId
de37ec2 to
1556c89
Compare
f172d9c to
8538e53
Compare
8538e53 to
e0f9243
Compare
9db0078 to
456d253
Compare
456d253 to
b666338
Compare
This was referenced Dec 4, 2025
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.
Migrate Protobuf Schema Utilities and Serdes from Wire-Schema to Protobuf4j
Summary
This PR migrates Apicurio Registry protobuf implementation from
wire-schematoprotobuf4j(WASM-based pure JVM implementation), removing the wire-related dependencies while maintaining full backward compatibility with existing schemas and clients.Changes
1. Protobuf Schema Utilities Migration
FileDescriptorToProtoConverterto convert FileDescriptor → protobuf text format// Proto schema formatted by Wire, do not edit.Key classes:
ProtobufSchemaUtils.java- Migrated to protobuf4j APIsFileDescriptorToProtoConverter.java- New converter (currently mimics wire-schema format)2. Serdes Migration
Modified:
serdes/protobuf-serdes/FileDescriptor.toProto()instead of wire-schema APIs3. Build Configuration
Modified:
pom.xml- Updated protobuf4j version, added old-serializer profileintegration-tests/pom.xml- Added old-serializer shaded dependencyutils/protobuf-schema-utilities/pom.xml- Replaced wire-schema with protobuf4j4. Backward Compatibility Testing Infrastructure
New module:
integration-tests/protobuf-backward-compat/old-serializer/io.apicurio.registry.old.*namespaceNew test:
integration-tests/src/test/java/io/apicurio/tests/serdes/apicurio/ProtobufBackwardCompatibilityIT.javaTest validates that:
Current status: Failing due to the reasons I'll explain below.
Implementation Plan
The code here represents Phase 0: Prerequisites of a comprehensive migration plan. Full migration requires additional phases:
Phase 0: Prerequisites ✅ DONE (current code)
Phase 1: FileDescriptor Normalization (Next PR)
Phase 2: Database Migration (Subsequent PR)
Phase 3: Testing & Validation
Test Plan
Unit Tests
Integration Tests
ProtobufBackwardCompatibilityIT- Validates old and new serializers produce same content IDManual Testing
Rollout Strategy
Server-first upgrade is strongly recommended to avoid duplicate schemas during the transition.
Recommended Rollout (Server First) ✅
Deploy v3.1.3+ server
Old clients (v3.1.2) continue working
New clients (v3.1.3+) work seamlessly
Gradually upgrade clients
Why Client-First Upgrade Doesn't Work ❌
Do NOT upgrade clients before the server. If you do:
Alternative: Simultaneous Upgrade ✅
If coordinated deployment is possible:
Backward Compatibility
Any valid protobuf syntax (wire-schema, protobuf4j, hand-written) normalizes to the same FileDescriptor, which produces the same protobuf4j canonical text and hash.
Client Compatibility Matrix
Migration Guide for Users
Prerequisites
Migration Steps
Take database backup (recommended)
Deploy v3.1.3+ server
Monitor migration logs
Upgrade clients gradually
Troubleshooting
Migration takes too long
Duplicate schemas after migration
Dependencies
Removed:
com.squareup.wire:wire-schema(from server and serdes)com.squareup.wire:wire-compiler(from server and serdes)com.squareup.okio:okio(transitive, from server and serdes)Added:
com.github.protobuf4j:protobuf4j(WASM-based protobuf compiler)Testing only (not in production):
Performance Impact
Migration Performance
Runtime Performance
Checklist
Next Steps
Notes for Reviewers
Key changes to review:
utils/protobuf-schema-utilities/FileDescriptorToProtoConverter.java(temporary)Expected test results:
ProtobufBackwardCompatibilityITshould PASS (validates format mimicking works)