LuciferYang commented on code in PR #14416:
URL: https://github.com/apache/gravitino/pull/14416#discussion_r4561495055
##########
catalogs/catalog-fileset/src/main/java/org/apache/gravitino/catalog/fileset/FilesetCatalogOperations.java:
##########
@@ -1516,9 +1517,11 @@ FileSystem getFileSystem(Path path, Map<String, String>
config) throws IOExcepti
.getOrDefault(
config,
FilesetCatalogPropertiesMetadata.FILESYSTEM_CONNECTION_TIMEOUT_SECONDS);
+ // Read the user here: a pool thread keeps the Subject of the request that
started it.
+ String user = PrincipalUtils.getCurrentUserName();
Review Comment:
Done. The cache loader now passes `cacheKey.currentUser` to a new
`getFileSystem(path, config, user)` overload; the two-argument `getFileSystem`
keeps its own read, and in main code only `formalizePath` calls it.
`testGetFileSystemUsesRequestUserOnPoolThread` now runs both through the cache
and directly.
##########
catalogs/catalog-fileset/src/test/java/org/apache/gravitino/catalog/fileset/TestFilesetCatalogOperations.java:
##########
@@ -2655,6 +2657,95 @@ public void
testTestConnectionRejectsDefaultCatalogLocationThatIsAFile() throws
}
}
+ @Test
+ public void testGetFileSystemUsesRequestUserOnPoolThread() throws Exception {
Review Comment:
Added a comment on `startPoolThreadsAs`: the tests rely on a thread started
inside `Subject.doAs` keeping that `Subject`, which holds up to JDK 22. Later
JDKs make `Subject.getSubject` throw, so these tests need revisiting when
`PrincipalUtils` moves off it.
--
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]