Skip to content

[improve][client] Support protobuf v4 schema compatibility#25261

Merged
lhotari merged 2 commits intoapache:masterfrom
codelipenghui:penghui/protobuf-v4-schema-functions-ci
Feb 26, 2026
Merged

[improve][client] Support protobuf v4 schema compatibility#25261
lhotari merged 2 commits intoapache:masterfrom
codelipenghui:penghui/protobuf-v4-schema-functions-ci

Conversation

@codelipenghui
Copy link
Contributor

@codelipenghui codelipenghui commented Feb 25, 2026

Motivation

Fixes #25202.

Pulsar protobuf schema APIs were bounded to GeneratedMessageV3, which breaks usage with protobuf v4 generated classes (for example Any).

Modifications

  • Widened protobuf schema-related generic bounds from GeneratedMessageV3 to Message in client API/binding and implementations.
  • Updated protobuf schema reader/writer/native classes and runtime validation checks to use Message.
  • Kept strict generated-message validation via descriptor/default-instance reflective paths.
  • Added API signature regression test to lock in Message upper bounds.
  • Added/updated protobuf schema tests for client and native paths.
  • Updated pulsar-functions protobuf class detection to work with protobuf v4 (Message-based detection).
  • Added protobuf-v4 required CI job for client + functions tests using v4 property overrides.

Documentation

  • doc
  • doc-required
  • doc-not-needed
  • doc-complete

@github-actions
Copy link

@codelipenghui Please add the following content to your PR description and select a checkbox:

- [ ] `doc` <!-- Your PR contains doc changes -->
- [ ] `doc-required` <!-- Your PR changes impact docs and you will update later -->
- [ ] `doc-not-needed` <!-- Your PR changes do not impact docs -->
- [ ] `doc-complete` <!-- Docs have been already added -->

@codelipenghui codelipenghui self-assigned this Feb 25, 2026
@github-actions github-actions bot added the doc-not-needed Your PR changes do not impact docs label Feb 25, 2026
@codelipenghui codelipenghui changed the title [improve][client][functions] Support protobuf v4 schema compatibility [improve][client] Support protobuf v4 schema compatibility Feb 25, 2026
@codelipenghui codelipenghui added this to the 4.2.0 milestone Feb 25, 2026
@codecov-commenter
Copy link

codecov-commenter commented Feb 26, 2026

Codecov Report

❌ Patch coverage is 55.55556% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 72.61%. Comparing base (82846e5) to head (d04cbd4).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
...ulsar/client/impl/schema/ProtobufNativeSchema.java 33.33% 1 Missing and 1 partial ⚠️
...ache/pulsar/client/impl/schema/ProtobufSchema.java 33.33% 1 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #25261      +/-   ##
============================================
- Coverage     72.73%   72.61%   -0.13%     
- Complexity    34047    34413     +366     
============================================
  Files          1959     1959              
  Lines        155418   155418              
  Branches      17731    17731              
============================================
- Hits         113050   112855     -195     
- Misses        33378    33562     +184     
- Partials       8990     9001      +11     
Flag Coverage Δ
inttests 25.56% <0.00%> (-0.60%) ⬇️
systests 22.38% <0.00%> (-0.08%) ⬇️
unittests 73.59% <55.55%> (-0.11%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...main/java/org/apache/pulsar/client/api/Schema.java 83.33% <ø> (+3.33%) ⬆️
...nt/internal/PulsarClientImplementationBinding.java 62.50% <ø> (ø)
...nt/impl/PulsarClientImplementationBindingImpl.java 81.81% <ø> (+1.51%) ⬆️
...lient/impl/schema/reader/ProtobufNativeReader.java 100.00% <ø> (ø)
...lsar/client/impl/schema/reader/ProtobufReader.java 57.14% <ø> (ø)
...lient/impl/schema/writer/ProtobufNativeWriter.java 100.00% <ø> (ø)
...lsar/client/impl/schema/writer/ProtobufWriter.java 100.00% <100.00%> (ø)
...ulsar/functions/instance/JavaInstanceRunnable.java 73.71% <100.00%> (+0.53%) ⬆️
...rg/apache/pulsar/functions/source/TopicSchema.java 70.88% <100.00%> (+2.53%) ⬆️
...ulsar/client/impl/schema/ProtobufNativeSchema.java 79.06% <33.33%> (ø)
... and 1 more

... and 106 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Member

@lhotari lhotari left a comment

Choose a reason for hiding this comment

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

LGTM. I revisited the CI build to use the standard way for unit tests.

@lhotari lhotari merged commit 6b87357 into apache:master Feb 26, 2026
104 of 106 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

doc-not-needed Your PR changes do not impact docs ready-to-test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support for protobuf gencode v4.x

3 participants