poorbarcode commented on PR #21704:
URL: https://github.com/apache/pulsar/pull/21704#issuecomment-1878315926

   Sorry, to clear the steps of the issue, I left a comment: 
   
   ---
   
   ### Background & Summary
   1. `checkCompaction` will delete the topic if the attribute 
`replicationClusters` does not match the current cluster( in other words, the 
attribute `replicationClusters` does not contain `broker.conf.cluster_name` )
   2. `topic level policy modification` and `namespace level policy 
modification` will trigger a task `checkCompaction`.
   3. When a topic is loading, it is initialized by the following steps:
     a. Registered a listener to accept the `topic level policy modification` 
event
     b. Initialize the attribute `replicationClusters`
   
   After `section 3-a`, the task `checkCompaction` may be triggered by a 
topic-level policy modification`(see `section 3`), but at this time the 
`replicationClusters` has not been initialized. It causes the `section 2` to 
delete the topic.
   
   ---
   
   ### The conditions to reproduce the issue:
   - You enabled replication on the namespace level and did not enable 
replication on the topic level.
   - The flowing events happen at the same time
     - Modify topic-level policies, such as `pulsar-admin topics 
set-dispatch-rate`
     - The target topic is loading now.
   
   ---
   
   ### Detail steps of the issue
   | time | task: `topic loading` | task: `modifying topic policies` |
   | --- | --- | --- |
   | 1 | Registered the topic to accept new changes of Topic Policies; the 
attribute `replicationClusters` is empty now | 
   | 2 | | Modify topic policies |
   | 3 | | Trigger a task `checkReplication`, and then it will try to delete 
the topic due to `replicationClusters` being empty |
   | 4 | Initialize the attribute `replicationClusters` from Namespace level 
Replication settings | 
   
   --- 
   
   ### Workaround-1
   Before you upgrade to the new version(which contains this fix), disable the 
feature `topicLevelPoliciesEnabled`, but it also makes all topic-level policies 
invalidate you set before.
   
   ### Workaround-2
   Before you upgrade to the new version(which contains this fix), do not 
modify any topic-level policies.
   


-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to