mchades commented on code in PR #14407:
URL: https://github.com/apache/gravitino/pull/14407#discussion_r4579069517
##########
catalogs/catalog-fileset/src/main/java/org/apache/gravitino/catalog/fileset/FilesetCatalogOperations.java:
##########
@@ -1473,7 +1487,7 @@ FileSystem getFileSystemWithCache(Path path, Map<String,
String> conf) {
String authority =
provider != null ? provider.getFullAuthority(path, conf) :
path.toUri().getAuthority();
return fileSystemCache.get(
- new FileSystemCacheKey(scheme, authority),
+ new FileSystemCacheKey(scheme, authority, loginSettings(path, conf)),
Review Comment:
The key can reuse login settings cached for an hour, but the loader passes
`conf` to the proxy, which rereads `config.resources`. In a test with a mocked
Kerberos login, changing the XML principal from `svc-v1` to `svc-v2` left
`svc-v1` in a new filesystem's cache key while its proxy passed `svc-v2` to
login. A lookup for `svc-v1` can then reuse that client. Could the key and the
new client use the same resolved configuration, with a regression test that
updates the XML before creating a second client?
##########
catalogs/hadoop-common/src/main/java/org/apache/gravitino/catalog/hadoop/fs/HDFSFileSystemProxy.java:
##########
@@ -195,15 +246,24 @@ private UserGroupInformation initKerberosUgi(
.checkIntervalSec(kerberosConfig.getCheckIntervalSec())
.krb5Conf(Constants.HADOOP_KRB5_CONF,
Constants.SECURITY_KRB5_ENV)
.build();
+ // One file for each proxy: another proxy for the same entity would
rewrite a shared file
+ // while this one still renews its ticket from it. close() deletes it;
File.deleteOnExit
+ // would keep the path of every proxy ever created until the JVM exits.
String keytabPath =
- String.format(GRAVITINO_KEYTAB_FORMAT,
properties.getOrDefault(GRAVITINO_ID_KEY, ""));
+ String.format(
+ GRAVITINO_KEYTAB_FORMAT,
+ properties.getOrDefault(GRAVITINO_ID_KEY, "") + "-" +
UUID.randomUUID());
+ File destination = new File(keytabPath);
+ // Recorded before the fetch, so that close() also deletes what a failed
fetch leaves behind.
+ this.keytabFile = destination;
File keytabFile =
- KerberosAuthUtils.saveKeytabFromUri(
+ KerberosAuthUtils.fetchKeytabFromUri(
Review Comment:
If `getProxy()` throws after login, the caller never receives a proxy to
close. I reproduced this with a `final` `FileSystem` implementation. CGLIB
rejected the class, and the temporary keytab symlink for a `file://` source
remained after a normal JVM exit. Could `getProxy()` close the underlying
filesystem and release the Kerberos client and keytab when wrapping fails? The
existing failure test covers `FileSystem.newInstance()` inside the constructor.
--
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]