brucearctor opened a new issue, #13890:
URL: https://github.com/apache/gravitino/issues/13890
### Version
main branch
### Describe what's wrong
When GVFS fileset metadata caching is enabled
(`fs.gravitino.filesetMetadataCache.cache.enable=true` in Java or
`enable_fileset_metadata_cache=True` in Python), `BaseGVFSOperations` still
bypasses the metadata cache during property and secret resolution and contains
two additional bugs in its schema and catalog caching paths:
1. **Java `BaseGVFSOperations.getAllProperties` bypasses
`FilesetMetadataCache` and reloads `Fileset` redundantly:**
- Introduced in `#12572` / `#13538`,
`BaseGVFSOperations.getAllProperties(NameIdentifier)` calls
`getGravitinoClient().loadCatalog(...)`, `catalog.asSchemas().loadSchema(...)`,
and `catalog.asFilesetCatalog().loadFileset(...)` directly instead of routing
through `getCatalog`, `getSchema`, and `getFileset`.
- Furthermore, `getActualFileSystemByLocationName` already resolves
`Fileset fileset = getFileset(filesetIdent)` before calling
`getAllProperties(filesetIdent)`, causing a duplicate `loadFileset` RPC when
metadata caching is disabled.
2. **Python `BaseGVFSOperations._merge_fileset_properties` bypasses
`_catalog_cache`, `_schema_cache`, and `_fileset_cache`:**
- Similarly, `_merge_fileset_properties` calls
`self._get_gravitino_client().load_catalog(...)`,
`catalog.as_schemas().load_schema(...)`, and
`catalog.as_fileset_catalog().load_fileset(...)` directly instead of routing
through `self._get_fileset_catalog`, `self._get_fileset_schema`, and
`self._get_fileset` (or reusing the `Fileset` already loaded in
`_get_actual_filesystem_by_location_name`).
3. **Java `BaseGVFSOperations.getSchema` accesses `filesetMetadataCache`
directly without lazy initialization (`NullPointerException`) and uses uncached
`getGravitinoClient().loadCatalog(...)`:**
- After `#8777` made `gravitinoClient` and `filesetMetadataCache` lazily
initialized via `getGravitinoClient()` and `getFilesetMetadataCache()`,
`BaseGVFSOperations.getSchema(NameIdentifier)` was left accessing the
`filesetMetadataCache` field directly (which is `null` until
`getFilesetMetadataCache()` is called) and calling
`getGravitinoClient().loadCatalog(...)` instead of `getCatalog(...)` when
caching is disabled.
- Similarly, `FilesetMetadataCache.getSchema(NameIdentifier)` calls
`client.loadCatalog(...)` directly instead of reusing `catalogCache`.
4. **Documentation typo in `docs/how-to-use-gvfs.md`:**
- Line 75 documents the Java property as
`fs.gravitino.filesetMetadataCache.enable`, whereas
`GravitinoVirtualFileSystemConfiguration.FS_GRAVITINO_FILESET_METADATA_CACHE_ENABLE`
is `"fs.gravitino.filesetMetadataCache.cache.enable"`.
### Error message and/or stacktrace
1. Calling `BaseGVFSOperations.getSchema(schemaIdent)` with
`fs.gravitino.filesetMetadataCache.cache.enable=true` before
`getFilesetMetadataCache()` has been initialized throws:
```text
java.lang.NullPointerException: Cannot invoke
"org.apache.gravitino.filesystem.hadoop.FilesetMetadataCache.getSchema(org.apache.gravitino.NameIdentifier)"
because "this.filesetMetadataCache" is null
at
org.apache.gravitino.filesystem.hadoop.BaseGVFSOperations.getSchema(BaseGVFSOperations.java:702)
```
2. With `fs.gravitino.filesetMetadataCache.cache.enable=true` (or
`enable_fileset_metadata_cache=True` in Python), `getAllProperties` /
`_merge_fileset_properties` still issues uncached `loadCatalog`, `loadSchema`,
and `loadFileset` RPCs to the Gravitino server on every filesystem cache miss.
### How to reproduce
1. Configure Hadoop GVFS with
`fs.gravitino.filesetMetadataCache.cache.enable=true` (or Python GVFS with
`enable_fileset_metadata_cache=True`).
2. Trigger `getAllProperties` / `_merge_fileset_properties` (or resolve a
fileset filesystem via `getActualFileSystemByLocationName` /
`_get_actual_filesystem_by_location_name`) multiple times.
3. Observe that `GravitinoClient.loadCatalog`, `SupportsSchemas.loadSchema`,
and `FilesetCatalog.loadFileset` are invoked on every call instead of being
served from the metadata cache.
### Additional context
Related PRs:
- `#7572` / `#8530`: Introduced `FilesetMetadataCache` and Python GVFS
metadata caching (`_catalog_cache`, `_schema_cache`, `_fileset_cache`).
- `#8777`: Introduced lazy initialization for `gravitinoClient` and
`filesetMetadataCache`.
- `#12572` / `#13538`: Added `getAllProperties` /
`_merge_fileset_properties` for merging catalog, schema, and fileset properties
and secrets.
--
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]