mchades commented on code in PR #13891:
URL: https://github.com/apache/gravitino/pull/13891#discussion_r4595906748
##########
clients/filesystem-hadoop3/src/main/java/org/apache/gravitino/filesystem/hadoop/BaseGVFSOperations.java:
##########
@@ -1023,32 +1079,49 @@ Map<String, String> getAllProperties(NameIdentifier
filesetIdent) {
filesetIdent.namespace().level(0),
filesetIdent.namespace().level(1),
filesetIdent.namespace().level(2));
- Catalog catalog =
- getFilesetMetadataCache()
- .map(cache -> cache.getCatalog(catalogIdent))
- .orElseGet(() -> getGravitinoClient().loadCatalog(catalogName));
+ Catalog catalog = getCatalog(catalogIdent);
Schema schema =
- getFilesetMetadataCache()
- .map(cache -> cache.getSchema(schemaIdent))
- .orElseGet(() -> catalog.asSchemas().loadSchema(schemaName));
- Fileset fileset =
- getFilesetMetadataCache()
- .map(cache -> cache.getFileset(filesetIdent))
- .orElseGet(
- () ->
- catalog
- .asFilesetCatalog()
- .loadFileset(NameIdentifier.of(schemaName,
filesetIdent.name())));
+ enableFilesetMetadataCache
+ ? getSchema(schemaIdent)
+ : catalog.asSchemas().loadSchema(schemaIdent.name());
+
+ SupportsSecrets filesetSecrets = null;
+ boolean needClientBackedFileset = fileset == null;
+ if (fileset != null) {
+ try {
+ filesetSecrets = fileset.supportsSecrets();
+ } catch (UnsupportedOperationException e) {
+ // A custom getFileset hook may return a metadata-only Fileset (such
as FilesetDTO); fall
+ // back to the client-backed fileset so properties and secrets still
load.
+ needClientBackedFileset = true;
+ }
+ }
+ Fileset resolvedFileset =
+ needClientBackedFileset ? loadClientBackedFileset(filesetIdent,
catalog) : fileset;
Review Comment:
A `getFileset()` override can return a different fileset whose
`supportsSecrets()` works. I ran `open()` with different property values on the
hook and client filesets. The hook selected the same location on both
revisions, but the backend received the client value on the base and the hook
value here, with metadata caching both on and off. Please reuse the preloaded
fileset for configuration only when it came from the normal client lookup.
##########
clients/filesystem-hadoop3/src/main/java/org/apache/gravitino/filesystem/hadoop/BaseGVFSOperations.java:
##########
@@ -609,11 +616,15 @@ private void createFilesetLocationIfNeed(
// If the server-side filesystem ops are disabled, the fileset directory
may not exist. In such
// case the operations like create, open, list files under this directory
will fail. So we
// need to check the existence of the fileset directory beforehand.
- boolean fsOpsDisabled =
- ((Catalog) getFilesetCatalog(catalogIdent))
- .properties()
- .getOrDefault("disable-filesystem-ops", "false")
- .equalsIgnoreCase("true");
+ boolean fsOpsDisabled = false;
+ Catalog catalog = getCatalog(catalogIdent);
Review Comment:
When the catalog from `getFilesetCatalog()` has
`disable-filesystem-ops=true` and the client catalog has it set to `false`,
this reads the wrong flag. With the default `autoCreateLocation=true`, I
verified that `listStatus()` creates the missing fileset directory and returns
an empty list on the base. Here it throws `FileNotFoundException`. Please keep
the null guard and honor the flag on the catalog selected by the hook.
##########
clients/client-python/gravitino/filesystem/gvfs_base_operations.py:
##########
@@ -526,37 +530,39 @@ def _merge_fileset_properties(
:param fileset_ident: The fileset identifier
:param actual_location: The actual storage location
+ :param fileset: The pre-loaded fileset if already available
:return: Merged properties dictionary
"""
metalake_name = fileset_ident.namespace().level(0)
catalog_name = fileset_ident.namespace().level(1)
schema_name = fileset_ident.namespace().level(2)
+ catalog = self._get_fileset_catalog(
Review Comment:
With metadata caching off, the property merge used to load its catalog,
schema and fileset through the Gravitino client. With an `operations_class`
overriding `_get_fileset_catalog`, I verified that `gvfs.exists()` now passes
the hook's values for all three layers to the backend. Overriding only
`_get_fileset` also replaces the fileset properties if the returned object
implements `get_secrets()`. Please keep the original property sources in this
mode while reusing metadata from the default client lookup.
--
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]