Skip to content

[fix][schema] Fix Protobuf native descriptor deserialization - #26725

Open
Denovo1998 wants to merge 1 commit into
apache:masterfrom
Denovo1998:fix-protobuf-native-deserialization
Open

Denovo1998 wants to merge 1 commit into
apache:masterfrom
Denovo1998:fix-protobuf-native-deserialization

Conversation

@Denovo1998

@Denovo1998 Denovo1998 commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Motivation

ProtobufNativeSchemaUtils.deserialize() fails to resolve nested root messages in files without a package, recurses indefinitely on cyclic imports, and leaves Java feature extensions unrecognized in the reconstructed descriptor proto. This shared utility is used by the default schema checker, broker schema validation, and generic client readers.

This is the standalone shared-deserializer prerequisite extracted from #19566. It does not add the advanced compatibility checker or change its activation policy.

Modifications

  • Resolve nested roots with or without a package, retaining legacy root-name lookup for existing stored schemas.
  • Report missing root descriptors and missing or cyclic imports as SchemaSerializationException.
  • Register Java feature extensions when running with Protobuf v4, while retaining Protobuf v3 compatibility and supporting relocated Protobuf packages.
  • Add independent descriptor and generic-reader regressions, and include the utility tests in the Protobuf v3 CI group.

Verifying this change

  • Make sure that the change passes the CI checks.

Local validation, with test retries disabled:

  • Protobuf 4.35.1: 29 focused client and broker tests passed.
  • Protobuf 3.25.5: 49 focused client and Functions tests passed.
  • ./gradlew quickCheck passed.
  • The new nested-root, malformed-import, and Java-feature regressions fail against the unpatched master implementation.

Does this pull request potentially affect one of the following parts:

  • Dependencies (add or upgrade a dependency)
  • The public API
  • The schema
  • The default values of configurations
  • The threading model
  • The binary protocol
  • The REST endpoints
  • The admin CLI options
  • The metrics
  • Anything that affects deployment

Schema descriptor reconstruction changes for all native-schema callers. The stored schema format and message wire format are unchanged.

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.

1 participant