Skip to content

Passing Conf object to KryoDecorator#8452

Merged
reiabreu merged 1 commit intomasterfrom
kyro-schema
Mar 28, 2026
Merged

Passing Conf object to KryoDecorator#8452
reiabreu merged 1 commit intomasterfrom
kyro-schema

Conversation

@reiabreu
Copy link
Copy Markdown
Contributor

Important

Disclaimer: This PR and its description were generated using Gemini CLI, an AI-powered developer tool.

Problem Statement
Currently, the IKryoDecorator interface only provides access to the Kryo instance. This prevents users from registering custom serializers that require metadata or schemas stored in the topology configuration. Users were previously
forced to use brittle workarounds, such as reading configuration from the local filesystem at worker startup.

Proposed Changes
This PR updates the IKryoDecorator interface to provide access to the topology configuration map, allowing for more dynamic and configuration-driven serialization logic.

  1. Interface Evolution (IKryoDecorator.java):
    • Added a new default method: void decorate(Kryo k, Map<String, Object> conf).
    • Deprecated the legacy void decorate(Kryo k) method.
    • The new method calls the deprecated one by default to maintain source and binary compatibility for existing implementations.
  2. Serialization Logic Update (SerializationFactory.java):
    • Updated the getKryo factory method to pass the topology configuration (conf) when invoking decorators.
  3. Testing and Validation:
    • Added a new test case test_registers_decorator_with_conf to SerializationFactoryTest.java.
    • Verified that a custom decorator can successfully retrieve values from the configuration map to perform conditional registrations.

Backward Compatibility

  • Binary Compatibility: Existing compiled decorators will continue to work without modification as the new method is a Java default method.
  • Source Compatibility: Existing source code will compile without changes, although users will receive a deprecation warning if they continue to implement the single-parameter decorate method.

Verification Results

  • Ran mvn test -Dtest=SerializationFactoryTest -pl storm-client — SUCCESS
  • Verified that TestKryoDecorator.java (using the old signature) still functions as expected.
  • Verified that Javadoc meets project Checkstyle requirements.

@reiabreu reiabreu marked this pull request as draft March 28, 2026 12:28
@reiabreu reiabreu marked this pull request as ready for review March 28, 2026 13:23
@reiabreu
Copy link
Copy Markdown
Contributor Author

@sambenas Just be mindful that the file has to serializable in order for the Conf map to be uploaded.
Once merged, this will be out in the next release.
Thank you

@reiabreu reiabreu requested a review from rzo1 March 28, 2026 13:25
@reiabreu reiabreu merged commit 9fdacae into master Mar 28, 2026
10 checks passed
@reiabreu reiabreu added this to the 2.8.6 milestone Mar 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants