JingsongLi commented on code in PR #9652:
URL: https://github.com/apache/paimon/pull/9652#discussion_r3975882036
##########
paimon-common/src/main/java/org/apache/paimon/fs/hadoop/HadoopFileIO.java:
##########
@@ -435,8 +444,20 @@ public boolean tryAtomicOverwriteViaRename(Path dst,
String content) throws IOEx
writer.flush();
}
- renameMethod.invoke(
- fs, hadoopTemp, hadoopDst, new Options.Rename[]
{Options.Rename.OVERWRITE});
+ Options.Rename[] renameOptions = new Options.Rename[]
{Options.Rename.OVERWRITE};
+ if (fs instanceof HadoopSecuredFileSystem) {
+ // the call has to stay inside the wrapper's doAs, or the
rename runs as
+ // whoever the current thread is rather than the login user
+ ((HadoopSecuredFileSystem) fs)
+ .callAsLoginUser(
+ () -> {
+ renameMethod.invoke(
+ renameTarget, hadoopTemp,
hadoopDst, renameOptions);
Review Comment:
[P2] Convert reflective failures to IOException inside the doAs action. When
the delegate's rename throws IOException, Method.invoke wraps it in
InvocationTargetException. UGI.doAs converts that to
UndeclaredThrowableException, and runSecuredWithIOException throws
RuntimeException, bypassing the catch below and HintFileUtils.commitHint's
IOException retry loop. I reproduced this with the repository's Hadoop 2.8.5
dependency: the unsecured path throws IOException, while the secured head
throws RuntimeException with that exception chain. Catch and translate
reflective exceptions inside this lambda, and add a regression test through
tryAtomicOverwriteViaRename with an injected delegate rename failure; the
direct callAsLoginUser IOException test does not exercise Method.invoke.
--
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]