WJL3333 opened a new pull request #9598: URL: https://github.com/apache/pulsar/pull/9598
Fixes #9595 ### Motivation make `LocalPolicies` immutable to avoid concurrent modify inconsistent. `NamespaceService.updateNamespaceBundles` is not thread safe. when split the same namespace concurrently, both 2 thread can get the same `LocalPolicies` instance from pulsar.getLocalZkCacheService().policiesCache() and `updateNamespaceBundles` change the LocalPolicies.bundles without concurrent protect. which can cause the param `NamespaceBundles` is inconsistent with the serialized data. ### Modifications make `LocalPolicies` immutable. each time modify field need object copy to avoid change the same instance concurrently. ### Verifying this change - [ ] Make sure that the change passes the CI checks. This change is already covered by existing tests, such as *V1_AdminApiTest.testNamespaceSplitBundleConcurrent*. ### Does this pull request potentially affect one of the following parts: no ### Documentation no ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected]
