lhotari opened a new pull request, #20540:
URL: https://github.com/apache/pulsar/pull/20540

   ### Motivation
   
   In Pulsar, there's a unresolved issue around topic unloading and loading 
which could lead to "Attempting to add producer to a fenced topic" & "Topic is 
temporarily unavailable" errors.
   Very recently #20526 was reported against Pulsar 2.11.1. Other related 
issues are #5284, #14941 and multiple others.
   
   ### Modifications
   
   - stop continuing to load a topic if the topic future has already been 
completed
     - the completion of the future is used to signal that the topic is being 
unloaded or it has timed out
   - stop continue to load topics when Pulsar broker is shutting down
   - address possible race conditions when the topic future is completed.
     - check CompletableFuture.complete / .completeExceptionally method's 
boolean return value. 
       - if it's `false`, this mean that the topic was possibly unloaded 
concurrently and the newly loaded instance should be closed.
         -  close the topic if this is detected.
   - when unloading a namespace, wait for all topic closing futures to complete 
(although the current closing logic is asynchronous)
     - ignore possible errors at close time since that could lead to the 
namespace unloading logic to fail in unexpected ways.
   - add cleanup logic for topic loading throttling solution that gets used 
when the number of concurrent topic loads exceeds 
`maxConcurrentTopicLoadRequest` (default: `5000`). Stop continuing to process 
the `pendingTopicLoadingQueue` if Pulsar broker is closing. Skip loading topics 
which have a topic future that has been completed (signals topic unloading).
   - add a solution to cleanup topic cache without doing a namespace bundle 
lookup
     - at cleanup time, remove the topic from the cache where it was added to.
   
   ### Documentation
   
   <!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. -->
   
   - [ ] `doc` <!-- Your PR contains doc changes. -->
   - [ ] `doc-required` <!-- Your PR changes impact docs and you will update 
later -->
   - [x] `doc-not-needed` <!-- Your PR changes do not impact docs -->
   - [ ] `doc-complete` <!-- Docs have been already added -->
   
   ### Matching PR in forked repository
   
   PR in forked repository: <!-- ENTER URL HERE -->
   
   <!--
   After opening this PR, the build in apache/pulsar will fail and instructions 
will
   be provided for opening a PR in the PR author's forked repository.
   
   apache/pulsar pull requests should be first tested in your own fork since 
the 
   apache/pulsar CI based on GitHub Actions has constrained resources and quota.
   GitHub Actions provides separate quota for pull requests that are executed 
in 
   a forked repository.
   
   The tests will be run in the forked repository until all PR review comments 
have
   been handled, the tests pass and the PR is approved by a reviewer.
   -->
   


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