[Issue 5562][docs]Modify schema compatibility check doc - #5757
Conversation
|
@jennifer88huang @Anonymitaet PTAL! |
|
@congbobo184 I'll review later. |
|
run cpp tests |
|
|
||
| <td> | ||
|
|
||
| The schema compatibility check strategy in order to Upgrade to 2.5.0 or above for compatibility with pulsar version below 2.5.0. |
There was a problem hiding this comment.
| The schema compatibility check strategy in order to Upgrade to 2.5.0 or above for compatibility with pulsar version below 2.5.0. | |
| * If you upgrade a lower version to Pulsar 2.5.0, then it uses the `UNDEFINED` strategy, at this time, it actually uses the compatibility strategy of the topic. | |
| * If you use Pulsar 2.5.0 and a higher version, then it uses the `UNDEFINED` strategy, at this time, it actually uses the `FULL` compatibility strategy. |
|
|
||
| <td> | ||
|
|
||
| NONE |
There was a problem hiding this comment.
| NONE | |
| It depends |
|
|
||
| NONE | ||
|
|
||
| </td> |
There was a problem hiding this comment.
| </td> | |
| It depends |
|
|
||
| <td> | ||
|
|
||
| NONE |
There was a problem hiding this comment.
| NONE | |
| It depends |
|
|
||
| <th> | ||
|
|
||
| Note |
There was a problem hiding this comment.
| Note | |
| Description |
|
|
||
| <td> | ||
|
|
||
| The schema compatibility check strategy in order to Upgrade to 2.5.0 or above for compatibility with pulsar version below 2.5.0. |
There was a problem hiding this comment.
| The schema compatibility check strategy in order to Upgrade to 2.5.0 or above for compatibility with pulsar version below 2.5.0. | |
| * If you upgrade a lower version to Pulsar 2.5.0, then it uses the `UNDEFINED` strategy, at this time, it actually uses the compatibility strategy of the topic. | |
| * If you use Pulsar 2.5.0 and a higher version, then it uses the `UNDEFINED` strategy, at this time, it actually uses the `FULL` compatibility strategy. |
|
|
||
| </table> | ||
|
|
||
| ## Schema verification for producers |
There was a problem hiding this comment.
I've moved this part before order of upgrading clients, please delete lines 857-1017.
| </tr> | ||
|
|
||
| </table> | ||
|
|
There was a problem hiding this comment.
Add schema verification here. I've re-written some sentences as well.
| ## Schema verification | |
| When a producer or a consumer tries to connect to a topic, a broker performs some checks to verify a schema. | |
| ### Producer | |
| When a producer tries to connect to a topic (suppose ignore the schema auto creation), a broker does the following checks: | |
| * Check if the schema carried by the producer exists in the schema registry or not. | |
| * If the schema is already registered, then the producer is connected to a broker and produce messages with that schema. | |
| * If the schema is not registered, then Pulsar verifies if the schema is allowed to be registered based on the configured compatibility check strategy. | |
| ### Consumer | |
| When a consumer tries to connect to a topic, a broker checks if a carried schema is compatible with a registered schema based on the configured schema compatibility check strategy. | |
| <table style="table"> | |
| <tr> | |
| <th> | |
| Compatibility check strategy | |
| </th> | |
| <th> | |
| Check logic | |
| </th> | |
| </tr> | |
| <tr> | |
| <td> | |
| `ALWAYS_COMPATIBLE` | |
| </td> | |
| <td> | |
| All pass | |
| </td> | |
| </tr> | |
| <tr> | |
| <td> | |
| `ALWAYS_INCOMPATIBLE` | |
| </td> | |
| <td> | |
| No pass | |
| </td> | |
| </tr> | |
| <tr> | |
| <td> | |
| `BACKWARD` | |
| </td> | |
| <td> | |
| Can read the last schema | |
| </td> | |
| </tr> | |
| <tr> | |
| <td> | |
| `BACKWARD_TRANSITIVE` | |
| </td> | |
| <td> | |
| Can read all schemas | |
| </td> | |
| </tr> | |
| <tr> | |
| <td> | |
| `FORWARD` | |
| </td> | |
| <td> | |
| Can read the last schema | |
| </td> | |
| </tr> | |
| <tr> | |
| <td> | |
| `FORWARD_TRANSITIVE` | |
| </td> | |
| <td> | |
| Can read the last schema | |
| </td> | |
| </tr> | |
| <tr> | |
| <td> | |
| `FULL` | |
| </td> | |
| <td> | |
| Can read the last schema | |
| </td> | |
| </tr> | |
| <tr> | |
| <td> | |
| `FULL_TRANSITIVE` | |
| </td> | |
| <td> | |
| Can read all schemas | |
| </td> | |
| </tr> | |
| </table> |
I think this two command should not be provided to users. |
|
@congbobo184 if those two commands are deprecated, you can add |
|
This seems like a good way. |
| * If it is a new schema and it passes the compatibility check, the broker registers a new schema automatically for the topic. | ||
|
|
||
| * If the schema does not pass the compatibility check, the broker does not register a schema. | ||
| * If the schema is registered, producer is connected. |
There was a problem hiding this comment.
| * If the schema is registered, producer is connected. | |
| * If the schema is registered, a producer is connected to a broker. |
| * If the schema does not pass the compatibility check, the broker does not register a schema. | ||
| * If the schema is registered, producer is connected. | ||
|
|
||
| * If the schema isn't registered |
There was a problem hiding this comment.
| * If the schema isn't registered | |
| * If the schema is not registered: |
|
|
||
| * If the schema isn't registered | ||
|
|
||
| * If`isAllowAutoUpdateSchema` = false, producer is rejected. |
There was a problem hiding this comment.
| * If`isAllowAutoUpdateSchema` = false, producer is rejected. | |
| * If `isAllowAutoUpdateSchema` sets to **false**, the producer is rejected to connect to a broker. |
|
|
||
| * If`isAllowAutoUpdateSchema` = false, producer is rejected. | ||
|
|
||
| * If `isAllowAutoUpdateSchema` = true |
There was a problem hiding this comment.
| * If `isAllowAutoUpdateSchema` = true | |
| * If `isAllowAutoUpdateSchema` sets to **true**: |
|
|
||
| * If `isAllowAutoUpdateSchema` = true | ||
|
|
||
| * If schema pass the compatibility check then the broker registers a new schema automatically for the topic and producer is connected. |
There was a problem hiding this comment.
| * If schema pass the compatibility check then the broker registers a new schema automatically for the topic and producer is connected. | |
| * If schema pass the compatibility check then the broker registers a new schema automatically for the topic and producer is connected. |
| * If schema pass the compatibility check then the broker registers a new schema automatically for the topic and producer is connected. | |
| * If the schema passes the compatibility check, then the broker registers a new schema automatically for the topic and the producer is connected. |
| * If the **schema does not pass the compatibility check**, the consumer is rejected and disconnected. | ||
|
|
||
|  | ||
| * If schema pass the compatibility check, the consumer is connected. |
There was a problem hiding this comment.
| * If schema pass the compatibility check, the consumer is connected. | |
| * If the schema passes the compatibility check, then the consumer is connected to the broker. |
|  | ||
| * If schema pass the compatibility check, the consumer is connected. | ||
|
|
||
| * If schema does not pass the compatibility, the consumer is rejected. |
There was a problem hiding this comment.
| * If schema does not pass the compatibility, the consumer is rejected. | |
| * If the schema does not pass the compatibility check, then the consumer is rejected to connect to the broker. |
|
|
||
| ```bash | ||
| bin/pulsar-admin namespaces set-schema-autoupdate-strategy --disabled tenant/namespace | ||
| bin/pulsar-admin namespaces set-is-allow-auto-update-schema --disabled tenant/namespace |
There was a problem hiding this comment.
Do we consider adding enable AutoUpdate before this part?
From line 82:
| bin/pulsar-admin namespaces set-is-allow-auto-update-schema --disabled tenant/namespace | |
| * [Enable AutoUpdate](#enable-autoupdate) | |
| * [Disable AutoUpdate](#disable-autoupdate) | |
| * [Adjust compatibility](#adjust-compatibility) | |
| #### Enable AutoUpdate | |
| To enable `AutoUpdate` on a namespace, you can use the `pulsar-admin` command. | |
| ```bash | |
| bin/pulsar-admin namespaces set-is-allow-auto-update-schema --enable tenant/namespace |
| 5. If no, the broker judge whether this namespace can automatically create schema. | ||
| isAllowAutoUpdateSchema can be modified by Admin-Api and REST-API |
There was a problem hiding this comment.
| 5. If no, the broker judge whether this namespace can automatically create schema. | |
| isAllowAutoUpdateSchema can be modified by Admin-Api and REST-API | |
| 5. If no, the broker verifies whether a schema can be automatically created in this namespace: | |
| * If `isAllowAutoUpdateSchema` sets to **true**, then a schema can be created, and the broker validates the schema based on the schema compatibility check strategy defined for the topic. | |
| * If `isAllowAutoUpdateSchema` sets to **false**, then a schema can not be created, and the consumer is rejected to connect to the broker. | |
| **Tip**: | |
| `isAllowAutoUpdateSchema` can be set via **Pulsar admin API** or **REST API.** | |
| For how to set `isAllowAutoUpdateSchema` via Pulsar admin API, see [Manage AutoUpdate Strategy](schema-manage.md/#manage-autoupdate-strategy). |
| isAllowAutoUpdateSchema can be modified by Admin-Api and REST-API | ||
|
|
||
| 5. If no, the broker validates the schema based on the schema compatibility check strategy defined for the topic. | ||
| 6. If yes, the broker validates the schema based on the schema compatibility check strategy defined for the topic. |
There was a problem hiding this comment.
yes, we can delete the line 546 👍 :)
| 5. If no, the broker validates the schema based on the schema compatibility check strategy defined for the topic. | ||
|
|
||
| 6. If the schema is compatible, the broker stores it and returns the schema version to the consumer. | ||
| 3. If the schema is compatible, the consumer will be connected. |
There was a problem hiding this comment.
| 3. If the schema is compatible, the consumer will be connected. | |
| 3. If the schema is compatible, the consumer is connected to the broker. |
| 3. If the schema is compatible, the consumer will be connected. | ||
|
|
||
| 7. If the schema is incompatible, the consumer will be disconnected. | ||
| 4. If the schema is incompatible, the consumer will be disconnected. |
There was a problem hiding this comment.
| 4. If the schema is incompatible, the consumer will be disconnected. | |
| 4. If the schema is incompatible, the consumer is disconnected to the broker. |
|
@congbobo184 as we discussed before, we finalize contents first and then re-draw the workflow, so pls do not add images now. |
|
@sijie where does the flag add? pulsar-client-tools or broker reject this request? if it is in pular-client-tools, how to add it? |
|
Thanks, i will look carefully and add hidden flag to hide them. :) |
| ## Schema compatibility check strategy | ||
|
|
||
| Pulsar has 8 schema compatibility check strategies, which are summarized in the following table. | ||
| Pulsar has 9 schema compatibility check strategies, which are summarized in the following table. |
There was a problem hiding this comment.
| Pulsar has 9 schema compatibility check strategies, which are summarized in the following table. | |
| Pulsar has 8 schema compatibility check strategies, which are summarized in the following table. |
| * [Enable AutoUpdate](#enable-autoupdate) | ||
|
|
||
| * [Disable AutoUpdate](#disable-autoupdate) |
There was a problem hiding this comment.
As we discussed just now, please correct the commands for enable and disable
|
|
||
| `isAllowAutoUpdateSchema` can be set via **Pulsar admin API** or **REST API.** | ||
|
|
||
| For how to set `isAllowAutoUpdateSchema` via Pulsar admin API, see [Manage AutoUpdate Strategy](schema-manage.md/#manage-autoupdate-strategy). |
|
run cpp tests |
|
run Integration Tests |
|
@congbobo184 @Anonymitaet When you fix an issue, please add the issue number and component in the title, for example, "[Issue 5562][docs] xxx", and add "Fixes #xxxx" in the description. |
maybe we can add this to the contributor guide and encourage committers and contributors following the same practice. |

Fixes #5562
In order to add the doc for #5227 , to solve the issue #5562
Motivation
modify the doc.