Repository navigation
[fix][admin] Restore Pulsar 4.x compatible serialVersionUID for PackageMetadata - #26784
Merged
Merged
Conversation
…geMetadata In Pulsar 4.x, PackagesManagementImpl (org.apache.pulsar.packages.management.core.impl.PackagesManagementImpl) stores package metadata using Java serialization of PackageMetadata. apache#25570 switches the default format to JSON, but the legacy Java serialization format must still be deserializable so that package metadata written by Pulsar 4.x remains readable after an upgrade. apache#25414 added serialVersionUID = 1L to PackageMetadata, which had no explicit value in Pulsar 4.x. Package metadata stored by Pulsar 4.x then fails to deserialize after upgrading with "local class incompatible". Use the default serialVersionUID computed from the Pulsar 4.0.13 and 4.2.4 release jars instead, and do the same for the Serializable NamespaceBundleStats data class. Assisted-by: Claude Code (claude-opus-5-5)
lhotari
requested review from
Technoboy-,
dao-jun,
david-streamlio,
merlimat and
nodece
September 30, 2026 18:36
merlimat
approved these changes
Sep 30, 2026
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
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.
Motivation
In Pulsar 4.x,
PackagesManagementImpl(org.apache.pulsar.packages.management.core.impl.PackagesManagementImpl) stores package metadata using Java serialization ofPackageMetadata. #25570 switched the default format to JSON, but the legacy Java serialization format must still be deserializable so that package metadata written by Pulsar 4.x remains readable after an upgrade.#25414 added
serialVersionUID = 1LtoPackageMetadata, which had no explicitserialVersionUIDin Pulsar 4.x. Reading package metadata stored by Pulsar 4.x then fails after upgrading:Modifications
PackageMetadata.serialVersionUIDto-3557006947394568058L, the defaultserialVersionUIDcomputed withObjectStreamClass.lookupfrom the Pulsar 4.0.13 and 4.2.4 release jars (both give the same value). The class structure hasn't changed since then. A comment explains that the value must not be changed.Serializabledata classNamespaceBundleStats(7307982611138203289L, same in 4.0.13 and 4.2.4), which [improve][build] Fix compile warnings in production code #25414 also changed to1L.serialVersionUIDadditions in [improve][build] Fix compile warnings in production code #25414 are left as they are: they are on exception classes and runtime objects, which aren't stored as serialized data.Verifying this change
This change added tests and can be verified as follows:
PackageMetadataSerdeTest.testLegacyBytesWrittenByPulsar42AreReadable, which deserializes aPackageMetadatapayload written by the Pulsar 4.2.4 release. It fails with the "local class incompatible" error above whenserialVersionUIDis1L, and passes with this change.Does this pull request potentially affect one of the following parts:
If the box was checked, please highlight the changes