shibd commented on pull request #13725: URL: https://github.com/apache/pulsar/pull/13725#issuecomment-1012903078
> Sorry, I am not getting this yet. > > In the error part. > > https://github.com/apache/pulsar/blob/2a7515f9593a76b294bfe2835621a0ab8a904957/pulsar-metadata/src/test/java/org/apache/pulsar/metadata/LockManagerTest.java#L146-L148 > > We have the following key code line executed in the order: > > ``` > [0] [Main Thread] lock.updateValue("value-2").join(); > > [1. Main Thread] store.put(path, payload, ...) > > [2. metadata-store Thread] metadataCaches.forEach(c -> c.refresh(path)); > > [3. metadata-store Thread] objCache.synchronous().invalidate(path); > > [4. metadata-store Thread] objCache.synchronous().refresh(path); > > [5] cache.get("/my/path/1").join() > ``` > > Is this the right executing order that [3] happens before [5]? Why would [5] got value before [0] ? @Jason918 Your description is only the execution order of `thread 1`. If only `thread 1` is working, it is no problem. However, there is another thread in refresh during actual operation(`thread 2`), which is triggered by the notification of metadata. This is performed in the background. We don't know when to complete it https://github.com/apache/pulsar/blob/2a7515f9593a76b294bfe2835621a0ab8a904957/pulsar-metadata/src/main/java/org/apache/pulsar/metadata/impl/AbstractMetadataStore.java#L181-L197 I use `thread 1 `and `thread 2` to express two update flow. You can look at the above explanation. -- 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]
