Shut down Karapace on invalid schema records
By default, Karapace Schema Registry skips invalid records in the _schemas topic
and continues running.
Enable strict mode to shut down Karapace when it detects invalid schema records.
Why enable strict mode
Skipping invalid records can hide problems and leave the registry inconsistent. Enable strict mode when data consistency is more important than keeping Schema Registry available after it encounters invalid records.
Enable strict mode
- Console
- CLI
- API
- Log in to the Aiven Console, select your project, and choose your Aiven for Apache Kafka® service.
- On the Overview page, click Service settings from the sidebar.
- Scroll to Advanced configuration and click Configure.
- Click Add configuration options.
- Find
schema_registry_config.schema_reader_strict_modeand set it to Enabled. - Click Save configuration.
Enable strict mode with the Aiven CLI:
avn service update SERVICE_NAME \
-c schema_registry_config.schema_reader_strict_mode=true
Parameters:
SERVICE_NAME: Name of your Aiven for Apache Kafka® service.schema_registry_config.schema_reader_strict_mode=true: Shuts down Karapace when invalid schema records are detected.
Enable strict mode with the Aiven API:
curl --request PUT \
--url https://api.aiven.io/v1/project/PROJECT_NAME/service/SERVICE_NAME \
--header 'Authorization: Bearer TOKEN' \
--header 'content-type: application/json' \
--data '{
"user_config": {
"schema_registry_config": {
"schema_reader_strict_mode": true
}
}
}'
Parameters:
PROJECT_NAME: Name of your project in Aiven.SERVICE_NAME: Name of your Aiven for Apache Kafka® service.TOKEN: Your API authentication token.schema_reader_strict_mode: Whentrue, Karapace shuts down if it detects invalid schema records.
What to do if Karapace shuts down
If strict mode stops Karapace because of invalid records in _schemas:
- Disable strict mode so Schema Registry can start again and skip invalid records.
Use the same Console, CLI, or API steps as in Enable strict mode,
and set the option to Disabled or
false. - Create a support ticket or email Aiven support so the invalid records can be investigated and fixed.
Related pages