apache / pulsar

Apache Pulsar - distributed pub-sub messaging system
https://pulsar.apache.org/
Apache License 2.0
14.26k stars 3.59k forks source link

[improve][broker] Fix non-persistent system topic schema compatibility #23286

Open Demogorgon314 opened 2 months ago

Demogorgon314 commented 2 months ago

Motivation

When upgrading broker version from 3.0.x to 3.3.x with ExtensibleLoadManagerImpl enabled, it will have an Unable to read schema exception. And the broker will fail to start. This issue is caused by https://github.com/apache/pulsar/pull/22055 .

***************
*** 23,29 ****
      "default" : null
    }, {
      "name" : "bundleCount",
!     "type" : "int"
    }, {
      "name" : "cpu",
      "type" : [ "null", "org.apache.pulsar.policies.data.loadbalancer.ResourceUsage" ],
--- 23,29 ----
      "default" : null
    }, {
      "name" : "bundleCount",
!     "type" : "long"
    }, {
      "name" : "cpu",
      "type" : [ "null", "org.apache.pulsar.policies.data.loadbalancer.ResourceUsage" ],
***************
*** 59,65 ****
      "type" : "long"
    }, {
      "name" : "topics",
!     "type" : "int"
    }, {
      "name" : "updatedAt",
      "type" : "long"
--- 59,65 ----
      "type" : "long"
    }, {
      "name" : "topics",
!     "type" : "long"
    }, {
      "name" : "updatedAt",
      "type" : "long"

Modifications

Add a new class NonPersistentSystemTopic, and it will use for system non-persistent topic.

Documentation

codecov-commenter commented 2 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 74.54%. Comparing base (bbc6224) to head (dfcb47a). Report is 578 commits behind head on master.

Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/apache/pulsar/pull/23286/graphs/tree.svg?width=650&height=150&src=pr&token=acYqCpsK9J&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)](https://app.codecov.io/gh/apache/pulsar/pull/23286?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) ```diff @@ Coverage Diff @@ ## master #23286 +/- ## ============================================ + Coverage 73.57% 74.54% +0.97% - Complexity 32624 34305 +1681 ============================================ Files 1877 1928 +51 Lines 139502 145035 +5533 Branches 15299 15859 +560 ============================================ + Hits 102638 108122 +5484 + Misses 28908 28652 -256 - Partials 7956 8261 +305 ``` | [Flag](https://app.codecov.io/gh/apache/pulsar/pull/23286/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | | |---|---|---| | [inttests](https://app.codecov.io/gh/apache/pulsar/pull/23286/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `27.63% <100.00%> (+3.05%)` | :arrow_up: | | [systests](https://app.codecov.io/gh/apache/pulsar/pull/23286/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `24.65% <0.00%> (+0.33%)` | :arrow_up: | | [unittests](https://app.codecov.io/gh/apache/pulsar/pull/23286/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `73.92% <100.00%> (+1.07%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more. | [Files with missing lines](https://app.codecov.io/gh/apache/pulsar/pull/23286?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | | |---|---|---| | [...rg/apache/pulsar/broker/service/BrokerService.java](https://app.codecov.io/gh/apache/pulsar/pull/23286?src=pr&el=tree&filepath=pulsar-broker%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fpulsar%2Fbroker%2Fservice%2FBrokerService.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cHVsc2FyLWJyb2tlci9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcHVsc2FyL2Jyb2tlci9zZXJ2aWNlL0Jyb2tlclNlcnZpY2UuamF2YQ==) | `82.02% <100.00%> (+1.24%)` | :arrow_up: | | [...ervice/nonpersistent/NonPersistentSystemTopic.java](https://app.codecov.io/gh/apache/pulsar/pull/23286?src=pr&el=tree&filepath=pulsar-broker%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fpulsar%2Fbroker%2Fservice%2Fnonpersistent%2FNonPersistentSystemTopic.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cHVsc2FyLWJyb2tlci9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcHVsc2FyL2Jyb2tlci9zZXJ2aWNlL25vbnBlcnNpc3RlbnQvTm9uUGVyc2lzdGVudFN5c3RlbVRvcGljLmphdmE=) | `100.00% <100.00%> (ø)` | | ... and [558 files with indirect coverage changes](https://app.codecov.io/gh/apache/pulsar/pull/23286/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
Demogorgon314 commented 2 months ago

@codelipenghui Did you mean to set the SchemaCompatibilityStrategy to BACKWARD? The default strategy is FULL, so int -> long and long -> int are incompatible.