Schemas
Schema Registry schemas, their compatibility settings, and their versions are browsed and managed from the Schemas page in Cloudera Surveyor for Apache Kafka.
Schemas page
The Schemas page lists all schemas in the selected Schema Registry instance. View the type, compatibility, validation level, and evolution setting of each schema. Filter and sort schemas by name, compatibility, validation level, evolution, type, or group. Add new schemas as needed.
The table displays the following schema attributes:
Name – The unique name of the schema in the Schema Registry instance. Click to open the Schema Details page.
Compatibility – The compatibility rule that new schema versions must satisfy, such as
Backward,Forward,Both, orNone.Validation Level – The set of existing versions that a new version is checked against, either
AllorLatest.Evolution – The indication of whether new versions can be added to the schema after the first version.
Type – The format of the schema, either
AvroorJSON.Schema Group – The user-defined group the schema belongs to.
Click Add Schema to create a new schema. Click any schema row to open the Entity Details drawer for quick access to the schema text of the latest version. Click the schema name to go to the Schema Details page.
Schema Details page
The Schema Details page provides information about an individual schema and its versions. At the top of the page, a summary displays the metadata of the schema, such as its type and compatibility.
The page is organized into the following sections:
Schema Text – The schema editor, which displays the schema text and description of the selected version. Use the editor to view a version, or to create a new version by editing the displayed text, typing or pasting new text, or loading text from a file using
Add File. Add the new version with
Add Version, or revert your edits with
Discard Changes.
Versions – A table of all versions of the schema, where you can compare versions and change the state of a version. By default, the latest version is selected and displayed in the Schema Text section. Click any row to display that version instead. The table displays the following attributes:
Version – The version number of the schema. Each schema numbers its own versions, starting at 1.
ID – The unique ID of the version across all schemas in Schema Registry. Clients can use the ID to reference this exact version.
Created – The time when the version was added.
State – The state of the version, which determines whether the version is included in compatibility checks.
Enabledversions are included.DisabledandArchivedversions are excluded, but only a disabled version can be enabled again.Archivedis a terminal state.Description – The description of the version. Hover over a truncated description to view the full text.
Adding schemas
Add new schemas with their first version to Schema Registry in Cloudera Surveyor using the Add Schema option on the Schemas page.
A schema in Schema Registry consists of metadata and schema text. The metadata, such as the name, type, and compatibility, applies to the schema as a whole. The schema text is stored in versions, where each version holds a different revision of the schema text.
In Cloudera Surveyor, adding a schema is done in two steps. First, you create the schema metadata in the Add Schema modal, which you open using the option. Second, you add schema text on the Schema Details page, which opens after the metadata is created, to create the first version of the schema.
You must have the necessary permissions to add schemas in Schema Registry. In Apache Ranger, the required permissions are Read and Create on the Schema Registry Service or Schema Group resource.
Enabled state. The version appears in the Versions table of the Schema Details page.Adding schema versions
Evolve existing schemas by adding new versions in Cloudera Surveyor using the Add Version option in the
Schema Text section of the Schema Details pages.
As your data changes, you evolve a schema by adding new versions, each holding a revised
schema text. In Cloudera Surveyor, you add versions in the section. You can edit the schema text of an existing version, type or paste new
schema text into the editor, or upload it from a .json, .avsc,
or .txt file.
When you add a version, Schema Registry checks it against the enabled versions of the schema according to the schema's Compatibility and Validation Level settings. Schema Registry rejects a version that does not pass the check. If the schema text is identical to an existing version, Schema Registry does not create a new version.
You must have the necessary permissions to add schema versions in Schema Registry. In Apache Ranger, the required permissions are Read and Create on the Schema Registry Service or Schema Group resource.
The schema must have evolution enabled.
Enabled state and appears at the top of the Versions table. If the schema text is identical to an existing version, no version is added. A No Version Added notification is displayed, and the matching existing version is selected in the table.Comparing schema versions
Compare the schema text of two schema versions in Cloudera Surveyor using the Compare Versions option
in the Versions section of the Schema Details pages.
Comparing two versions of a schema shows exactly what changed in the schema text between them. In Cloudera Surveyor, you compare versions using the option, which opens the Compare Schema Versions modal. The modal displays the differences between the schema text of a base version and a target version, together with the description of each version.
You compare versions, for example, when a consumer fails after a schema is updated. Compare the version the consumer was built against with the latest version to find which fields changed.
You must have the necessary permissions to read schemas in Schema Registry. In Apache Ranger, the required permission is Read on the Schema Registry Service or Schema Group resource.
The schema must have at least two versions.
Changing the state of a schema version
Enable, disable, or archive schema versions in Cloudera Surveyor using the actions menu of the Versions table on the Schema Details pages.
The state of a schema version determines whether Schema Registry includes the version in compatibility checks when a new version is added. In Cloudera Surveyor, you change the state using the actions menu of a version row on the table.
A schema version can have the following states:
Enabled – The version is included in compatibility checks. Versions are enabled when you add them. You can disable or archive an enabled version.
Disabled – The version is excluded from compatibility checks. Disable a version when it causes new versions to be rejected, for example, a version that was added by mistake. You can enable a disabled version again if it is compatible with the currently enabled versions. You can also archive a disabled version.
Archived – The version is permanently excluded from compatibility checks. Archive a version when you never want it to be part of compatibility checks again. You cannot enable or disable an archived version.
You must have the necessary permissions to change the state of schema versions in Schema Registry. In Apache Ranger, the required permissions are Read and Update on the Schema Registry Service or Schema Group resource.
