codelipenghui commented on a change in pull request #14283:
URL: https://github.com/apache/pulsar/pull/14283#discussion_r806437028
##########
File path:
pulsar-metadata/src/main/java/org/apache/pulsar/metadata/cache/impl/MetadataCacheImpl.java
##########
@@ -261,12 +268,17 @@ public void invalidate(String path) {
}
@Override
- public void refresh(String path) {
+ public CompletableFuture<Void> refresh(String path) {
// Refresh object of path if only it is cached before.
- if (objCache.getIfPresent(path) != null) {
- objCache.synchronous().invalidate(path);
- objCache.synchronous().refresh(path);
- }
+ CompletableFuture<Void> promise = new CompletableFuture<>();
+ scheduler.executeOrdered(path, () -> {
Review comment:
From the logs, we can see the thread name is `metadata-store-2437-1` or
`main` the caller thread. The above lines are calling sync methods and the
thread will be blocked until the refresh done, I have tested this case with
@Demogorgon314 yesterday, just to simulate the metadata get operation future
complete with 10 seconds delay, the `metadata-store-2437-1` or `main` will be
blocked 10 seconds.
```java
if (objCache.getIfPresent(path) != null) {
objCache.synchronous().invalidate(path);
objCache.synchronous().refresh(path);
}
```
--
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]