jerryshao commented on code in PR #14416:
URL: https://github.com/apache/gravitino/pull/14416#discussion_r4560628821
##########
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:
The new tests rely on pool threads inheriting the `Subject` of the thread
that started them (that is why the expected value is `"bob on alice"`). That
holds on JDK 17, which this project builds with, and the test would fail loudly
rather than pass silently if the inheritance went away. It may be worth a short
comment on `startPoolThreadsAs` saying so, to make the dependency explicit for
whoever upgrades the JDK.
##########
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:
Nit: `getFileSystemWithCache` already builds `FileSystemCacheKey`, which
reads the current user in its constructor, and then `getFileSystem` reads it
again here. Both happen on the same request thread, so the values match today,
but it would be more robust to have a single source of truth, for example by
letting the cache loader pass `cacheKey.currentUser` down (with `getFileSystem`
keeping this read for the other callers). That way the user the file system is
cached under and the user it acts for cannot diverge if someone changes one of
the two reads later.
--
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]