Skip to content

[FLINK-33045] Make it possible to disable auto-registering schema in Schema Registry - #26662

Open
MartijnVisser wants to merge 4 commits into
apache:masterfrom
MartijnVisser:FLINK-33045_support-auto-register-schema
Open

[FLINK-33045] Make it possible to disable auto-registering schema in Schema Registry#26662
MartijnVisser wants to merge 4 commits into
apache:masterfrom
MartijnVisser:FLINK-33045_support-auto-register-schema

Conversation

@MartijnVisser

Copy link
Copy Markdown
Contributor

What is the purpose of the change

This PR is based on #25410 and aims to complete the necessary tasks. It introduces auto.register.schemas as a table option. Compared to the linked PR, it includes unit tests, a new IT case and updated documentation

Brief change log

  • Introduces new table option auto.register.schemas
  • Adds unit tests
  • Adds a new AvroConfluentITCase
  • Removes previous (currently disabled) bash-based tests
  • It also bumps certain dependencies

Verifying this change

This change added tests and can be verified as follows:

  • Run AvroConfluentITCase that writes and reads from/to Kafka using avro-confluent, with the table option set to true (default) to show that Flink can register the schema and false where it relies on schema registration outside of Flink

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

  • Dependencies (does it add or upgrade a dependency): yes
  • The public API, i.e., is any changed class annotated with @Public(Evolving): no
  • The serializers: no
  • The runtime per-record code paths (performance sensitive): no
  • Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn, ZooKeeper: no
  • The S3 file system connector: no

Documentation

  • Does this pull request introduce a new feature? yes
  • If yes, how is the feature documented? docs / JavaDocs

@flinkbot

flinkbot commented Jun 10, 2025

Copy link
Copy Markdown
Collaborator

CI report:

Bot commands The @flinkbot bot supports the following commands:
  • @flinkbot run azure re-run the last Azure build

@MartijnVisser

Copy link
Copy Markdown
Contributor Author

@flinkbot run azure

1 similar comment
@MartijnVisser

Copy link
Copy Markdown
Contributor Author

@flinkbot run azure

@MartijnVisser
MartijnVisser force-pushed the FLINK-33045_support-auto-register-schema branch from 94811df to ba6bd2e Compare June 11, 2025 06:52
Comment thread docs/content.zh/docs/connectors/table/formats/avro-confluent.md Outdated
Comment thread docs/content/docs/connectors/table/formats/avro-confluent.md Outdated
Comment thread flink-python/pom.xml Outdated
@MartijnVisser
MartijnVisser force-pushed the FLINK-33045_support-auto-register-schema branch 2 times, most recently from 7304dde to 0b8f50b Compare June 12, 2025 07:39

@fapaul fapaul left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for working on this feature. It's a great quality of life improvement.

Comment thread flink-end-to-end-tests/flink-confluent-schema-registry/pom.xml Outdated
Comment thread flink-end-to-end-tests/flink-sql-client-test/pom.xml Outdated
@github-actions github-actions Bot added community-reviewed PR has been reviewed by the community. and removed community-reviewed PR has been reviewed by the community. labels Jun 30, 2025
@github-actions github-actions Bot added community-reviewed PR has been reviewed by the community. and removed community-reviewed PR has been reviewed by the community. labels Jul 9, 2025
@github-actions github-actions Bot added community-reviewed PR has been reviewed by the community. and removed community-reviewed PR has been reviewed by the community. labels Jul 17, 2025
@raphaelauv

raphaelauv commented Aug 18, 2025

Copy link
Copy Markdown

// Commonly used options maintained by Flink for convenience
// --------------------------------------------------------------------------------------------

public static final ConfigOption<Boolean> AUTO_REGISTER_SCHEMAS =

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

can't we rely on the schema-registry ser/deser that already support these options like (
AUTO_REGISTER_SCHEMAS , USE_SCHEMA_ID , NORMALIZE_SCHEMAS , AVRO_REMOVE_JAVA_PROPS_CONFIG ) than adding it here ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

No. Flink doesn't use Confluent's KafkaAvroSerializer, ConfluentSchemaRegistryCoder talks to the SchemaRegistryClient directly and writes the magic byte and id itself. The registry configs only ever reached the client, so serializer options like auto.register.schemas were silently ignored. This PR implements that one under the same key Confluent uses, so it also works when passed via registryConfigs in the DataStream API. use.schema.id and normalize.schemas would need the same treatment, that's a follow-up.

@MartijnVisser

Copy link
Copy Markdown
Contributor Author

@raphaelauv Yes, that's the same problem. registryConfigs only configures the client, it doesn't affect how Flink writes records. With this PR auto.register.schemas in that map is honored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community-reviewed PR has been reviewed by the community.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants