-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[Doc] Add content for topic-level schema compatibility check strategy #13832
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -809,23 +809,124 @@ To use your custom schema storage implementation, perform the following steps. | |
|
|
||
| ## Set schema compatibility check strategy | ||
|
|
||
| You can set [schema compatibility check strategy](schema-evolution-compatibility.md#schema-compatibility-check-strategy) at namespace or broker level. | ||
| You can set [schema compatibility check strategy](schema-evolution-compatibility.md#schema-compatibility-check-strategy) at the topic, namespace or broker level. | ||
|
|
||
| - If you set schema compatibility check strategy at both namespace or broker level, it uses the strategy set for the namespace level. | ||
| The schema compatibility check strategy set at different levels has priority: topic level > namespace level > broker level. | ||
|
|
||
| - If you do not set schema compatibility check strategy at both namespace or broker level, it uses the `FULL` strategy. | ||
| - If you set the strategy at both topic and namespace level, it uses the topic-level strategy. | ||
|
|
||
| - If you set schema compatibility check strategy at broker level rather than namespace level, it uses the strategy set for the broker level. | ||
| - If you set the strategy at both namespace and broker level, it uses the namespace-level strategy. | ||
|
|
||
| - If you set schema compatibility check strategy at namespace level rather than broker level, it uses the strategy set for the namespace level. | ||
| - If you do not set the strategy at any level, it uses the `FULL` strategy. For all available values, see [here](schema-evolution-compatibility.md#schema-compatibility-check-strategy). | ||
|
|
||
| ### Namespace | ||
|
|
||
| ### Topic level | ||
|
|
||
| To set a schema compatibility check strategy at the topic level, use one of the following methods. | ||
|
|
||
| <!--DOCUSAURUS_CODE_TABS--> | ||
|
|
||
| <!--Admin CLI--> | ||
|
|
||
| Use the [`pulsar-admin topics set-schema-compatibility-strategy`](https://pulsar.apache.org/tools/pulsar-admin/) command. | ||
|
|
||
| ```shell | ||
| pulsar-admin topics set-schema-compatibility-strategy <strategy> <topicName> | ||
| ``` | ||
| <!--REST API--> | ||
|
|
||
| Send a `PUT` request to this endpoint: {@inject: endpoint|PUT|/admin/v2/topics/:tenant/:namespace/:topic|operation/schemaCompatibilityStrategy?version=[[pulsar:version_number]]} | ||
|
|
||
| <!--Java Admin API--> | ||
|
|
||
| ```java | ||
| void setSchemaCompatibilityStrategy(String topic, SchemaCompatibilityStrategy strategy) | ||
| ``` | ||
|
|
||
| Here is an example of setting a schema compatibility check strategy at the topic level. | ||
|
|
||
| ```java | ||
| PulsarAdmin admin = …; | ||
|
|
||
| admin.topicPolicies().setSchemaCompatibilityStrategy("my-tenant/my-ns/my-topic", SchemaCompatibilityStrategy.ALWAYS_INCOMPATIBLE); | ||
| ``` | ||
|
|
||
| <!--END_DOCUSAURUS_CODE_TABS--> | ||
| <br /> | ||
| To get the topic-level schema compatibility check strategy, use one of the following methods. | ||
|
|
||
| <!--DOCUSAURUS_CODE_TABS--> | ||
|
|
||
| <!--Admin CLI--> | ||
|
|
||
| Use the [`pulsar-admin topics get-schema-compatibility-strategy`](https://pulsar.apache.org/tools/pulsar-admin/) command. | ||
|
|
||
| ```shell | ||
| pulsar-admin topics get-schema-compatibility-strategy <topicName> | ||
| ``` | ||
| <!--REST API--> | ||
|
|
||
| Send a `GET` request to this endpoint: {@inject: endpoint|GET|/admin/v2/topics/:tenant/:namespace/:topic|operation/schemaCompatibilityStrategy?version=[[pulsar:version_number]]} | ||
|
|
||
| <!--Java Admin API--> | ||
|
|
||
| ```java | ||
| SchemaCompatibilityStrategy getSchemaCompatibilityStrategy(String topic, boolean applied) | ||
| ``` | ||
|
|
||
| Here is an example of getting the topic-level schema compatibility check strategy. | ||
|
|
||
| ```java | ||
| PulsarAdmin admin = …; | ||
|
|
||
| // get the current applied schema compatibility strategy | ||
| admin.topicPolicies().getSchemaCompatibilityStrategy("my-tenant/my-ns/my-topic", true); | ||
|
|
||
| // only get the schema compatibility strategy from topic policies | ||
| admin.topicPolicies().getSchemaCompatibilityStrategy("my-tenant/my-ns/my-topic", false); | ||
| ``` | ||
|
|
||
| <!--END_DOCUSAURUS_CODE_TABS--> | ||
| <br /> | ||
| To remove the topic-level schema compatibility check strategy, use one of the following methods. | ||
|
|
||
| <!--DOCUSAURUS_CODE_TABS--> | ||
|
|
||
| <!--Admin CLI--> | ||
|
|
||
| Use the [`pulsar-admin topics remove-schema-compatibility-strategy`](https://pulsar.apache.org/tools/pulsar-admin/) command. | ||
|
|
||
| ```shell | ||
| pulsar-admin topics remove-schema-compatibility-strategy <topicName> | ||
| ``` | ||
| <!--REST API--> | ||
|
|
||
| Send a `DELETE` request to this endpoint: {@inject: endpoint|DELETE|/admin/v2/topics/:tenant/:namespace/:topic|operation/schemaCompatibilityStrategy?version=[[pulsar:version_number]]} | ||
|
|
||
| <!--Java Admin API--> | ||
|
|
||
| ```java | ||
| void removeSchemaCompatibilityStrategy(String topic) | ||
| ``` | ||
|
|
||
| Here is an example of removing the topic-level schema compatibility check strategy. | ||
|
|
||
| ```java | ||
| PulsarAdmin admin = …; | ||
|
|
||
| admin.removeSchemaCompatibilityStrategy("my-tenant/my-ns/my-topic"); | ||
| ``` | ||
|
|
||
| <!--END_DOCUSAURUS_CODE_TABS--> | ||
|
|
||
|
|
||
| ### Namespace level | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should keep the
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Do you mean by using the same tab name, like Admin CLI?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Corrected. PTAL. Thanks. |
||
|
|
||
| You can set schema compatibility check strategy at namespace level using one of the following methods. | ||
|
|
||
| <!--DOCUSAURUS_CODE_TABS--> | ||
|
|
||
| <!--pulsar-admin--> | ||
| <!--Admin CLI--> | ||
|
|
||
| Use the [`pulsar-admin namespaces set-schema-compatibility-strategy`](https://pulsar.apache.org/tools/pulsar-admin/) command. | ||
|
|
||
|
|
@@ -836,7 +937,7 @@ pulsar-admin namespaces set-schema-compatibility-strategy options | |
|
|
||
| Send a `PUT` request to this endpoint: {@inject: endpoint|PUT|/admin/v2/namespaces/:tenant/:namespace|operation/schemaCompatibilityStrategy?version=[[pulsar:version_number]]} | ||
|
|
||
| <!--Java--> | ||
| <!--Java Admin CLI--> | ||
|
|
||
| Use the [`setSchemaCompatibilityStrategy`](https://pulsar.apache.org/api/admin/)method. | ||
|
|
||
|
|
@@ -846,7 +947,7 @@ admin.namespaces().setSchemaCompatibilityStrategy("test", SchemaCompatibilityStr | |
|
|
||
| <!--END_DOCUSAURUS_CODE_TABS--> | ||
|
|
||
| ### Broker | ||
| ### Broker level | ||
|
|
||
| You can set schema compatibility check strategy at broker level by setting `schemaCompatibilityStrategy` in [`broker.conf`](https://github.com/apache/pulsar/blob/f24b4890c278f72a67fe30e7bf22dc36d71aac6a/conf/broker.conf#L1240) or [`standalone.conf`](https://github.com/apache/pulsar/blob/master/conf/standalone.conf) file. | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add a description that available values for schema compatibility strategy?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. I will add a link as the reference for available values. Thank you.