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

   ### Motivation
   
   https://github.com/apache/pulsar/pull/23062 improved the behaviour of 
initialising the Transaction Buffer: Synchronise the reader creation, read loop 
and the following process on its result. Maintain only one reader for each 
namespace. The reader is now not closed unless there is no snapshot read 
request in 1 minute.
   
   However, 
[SimpleCache](https://github.com/apache/pulsar/pull/23062/changes#diff-874612f5aa0d34f1df3c8d48bd8d4a4b28dc826a12fd08c45e1a62e10f6b5182)
 is a global lock, and the lock force is too strong, causing all 
`pulsar-transaction-snapshot-recover` threads to get stuck in the creation of 
the first reader. When system resources are insufficient, the problem will be 
magnified infinitely
   
   <img width="1515" height="965" alt="Screenshot 2026-03-05 at 22 31 03" 
src="https://github.com/user-attachments/assets/58d90c68-f68d-49b8-9cb9-d10be152a071";
 />
   
   
   ### Modifications
   
   Create a SimpleCache object for each `pulsar-transaction-snapshot-recover` 
thread, and then lock contention will not occur.
   - The initialisation of Transaction Buffer Recovery for different namespaces 
will be assigned to fixed threads based on hashcode, which eliminates the 
problem of multi-threading competition
   - SimpleCache is a utility class. We did not remove the 'synchronized' 
keyword, but as long as the same object is used by only one thread, this 
mechanism will not have any performance impact
   
   ### 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: x
   


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