- Notifications
You must be signed in to change notification settings - Fork9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
HDFS-17749. [ARR] Fix wrong results due to the wrong usage of asyncComplete in getListing.#7466
Conversation
hadoop-yetus commentedMar 5, 2025
💔-1 overall
This message was automatically generated. |
hadoop-yetus commentedMar 5, 2025
💔-1 overall
This message was automatically generated. |
91c09e5
to43833f5
Comparehadoop-yetus commentedMar 11, 2025
🎊+1 overall
This message was automatically generated. |
@Hexiaoqiao@KeeProMise Sir, PTAL at this pr when you have free time , thanks a lot. |
@@ -355,7 +355,6 @@ public boolean mkdirs(String src, FsPermission masked, boolean createParent) | |||
return rpcClient.invokeAll(locations, method); | |||
} | |||
asyncComplete(false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Hi,@hfutatzhanghb I just took a look at this method, and I think it should work fine without the modifications you suggested. First, set the completeFuture in the thread pool variable to false. Next, if locations.size() > 1, the completeFuture after execution will replace the thread variable. If locations.size() <= 1, then since the initial value of completeFuture is set to false, the subsequent asynchronous call code will be executed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Hi,@KeeProMise , thanks for your reviewing. Have reverted mkdirs and other rpcs not affected by asyncComplete method to reduce code duplication. Thanks again.
asyncComplete(null);// Handler threadasyncApply(() -> {getFileInfo();// issue a rpc request.asyncApply();// AsyncRepsonder thread.});// The handler thread variable will be set to the CompletableFuture object after the execution of asyncApply. look AsyncUtil#asyncApply(...) publicstatic <T,R>voidasyncApply(ApplyFunction<T,R>function) {CompletableFuture<T>completableFuture = (CompletableFuture<T>)CUR_COMPLETABLE_FUTURE.get();assertcompletableFuture !=null;CompletableFuture<R>result =function.apply(completableFuture);CUR_COMPLETABLE_FUTURE.set((CompletableFuture<Object>)result);// will reset CUR_COMPLETABLE_FUTURE use the CompletableFuture object after the execution } |
returnnull; | ||
returnfinalNamenodeListingExists; | ||
}); | ||
} else { | ||
asyncComplete(namenodeListingExists); | ||
} | ||
asyncComplete(namenodeListingExists); | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
this look good to me.
f2550b2
tof6dc774
Comparehadoop-yetus commentedMar 21, 2025
🎊+1 overall
This message was automatically generated. |
hadoop-yetus commentedMar 21, 2025
💔-1 overall
This message was automatically generated. |
hadoop-yetus commentedMar 21, 2025
💔-1 overall
This message was automatically generated. |
hadoop-yetus commentedMar 21, 2025
💔-1 overall
This message was automatically generated. |
hadoop-yetus commentedMar 21, 2025
🎊+1 overall
This message was automatically generated. |
// Get the end points. | ||
nnContext0 = cluster.getNamenode("ns0", null); | ||
nnContext1 = cluster.getNamenode("ns1", null); | ||
nnFs0 = nnContext0.getFileSystem(); | ||
nnFs1 = nnContext1.getFileSystem(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
hi@hfutatzhanghb Have these variables been used?
yes, they were used in super class ---- Replied Message ----| From | ***@***.***> || Date | 03/24/2025 22:41 || To | ***@***.***> || Cc | ***@***.***>***@***.***> || Subject | Re: [apache/hadoop] HDFS-17749. [ARR] Fix wrong results due to the wrong usage of asyncComplete in getListing. (PR#7466) |@KeeProMise commented on this pull request.In hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/router/async/TestRouterAsyncMountTable.java: + // Get the end points. + nnContext0 = cluster.getNamenode("ns0", null);+ nnContext1 = cluster.getNamenode("ns1", null);+ nnFs0 = nnContext0.getFileSystem();+ nnFs1 = nnContext1.getFileSystem();hi@hfutatzhanghb Have these variables been used?—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: ***@***.***> |
hadoop-yetus commentedMar 24, 2025
🎊+1 overall
This message was automatically generated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
LGTM!
Description of PR
May get wrong results due to the wrong usage of asyncComplete in getListing RPC.
The root cause is as below:
How was this patch tested?
Add unit tests TestRouterAsyncMountTable.java.
How to reproduce?
Use original codes to run TestRouterAsyncMountTable.java
Some of unit tests will not pass due to the inaccurate results.