315157973 commented on pull request #9900: URL: https://github.com/apache/pulsar/pull/9900#issuecomment-798827502
> > `OrderedExecutor` is used to ensure that all modification operations under each namespace are in a single thread. Different namespaces can be operated in parallel due to different objects. > > This might not be a sufficient solution for ensuring thread safety. Considering read operations is equally important. How does the solution ensure that read operations are thread safe? I have added a snapshot, I don’t know if there is any omission Visibility: A snapshot is generated for each modification. After the modification is completed, the entire snapshot is written to the cache, and the value of caffeine is immediately visible to all threads Atomicity: Since we only modify the snapshot, finally writing entire snapshot to the cache is atomic Orderliness: Because it is single-threaded, it is orderly ---------------------------------------------------------------- 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]
