void-ptr974 commented on PR #25914:
URL: https://github.com/apache/pulsar/pull/25914#issuecomment-4598010606

   Thanks for the follow-up. I think adding the second check before 
`skipEntries` / `markDelete` is a good improvement. The original entry check 
only handles the case where the topic is already closing before backlog 
eviction starts. This PR also handles the more important race where backlog 
eviction has already started, and then the topic begins closing before the 
cursor is mutated.
   
   One thing I think we should decide is whether this PR is intended to be a 
best-effort mitigation or a strict guarantee.
   
   With the current code, there is still a small window:
   
   1. `shouldStopEvictionOnTopicClose()` returns false
   2. topic close/delete starts immediately after that
   3. eviction still continues to call `skipEntries` / `markDelete`
   
   So this change can reduce the race window a lot, but it cannot completely 
guarantee that cursor mutation never happens during topic close/delete.
   
   If best-effort mitigation is enough for this issue, I think the current 
direction is reasonable. If the goal is to strictly prevent cursor mutation 
during teardown, then we may need stronger coordination with the topic 
close/delete path, instead of only checking `isClosingOrDeleting()` before 
mutation.


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