This is an automated email from the ASF dual-hosted git repository.
mchades pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/gravitino.git
The following commit(s) were added to refs/heads/main by this push:
new bdd9c76485 [#13850] fix(gvfs): Use the metadata cache when merging
fileset properties (#13851)
bdd9c76485 is described below
commit bdd9c764856a25fcceaf60ff4e64e6ecf6ae8f60
Author: YangJie <[email protected]>
AuthorDate: Fri Nov 13 06:19:53 2026 -0500
[#13850] fix(gvfs): Use the metadata cache when merging fileset properties
(#13851)
### What changes were proposed in this pull request?
With the fileset metadata cache enabled, the Java and Python GVFS
clients now take the catalog, schema and fileset from the cache when
they merge the filesystem properties, instead of loading all three from
the server on every operation.
- Java: `BaseGVFSOperations.getAllProperties` goes through
`FilesetMetadataCache`. The catalog cache now stores the `Catalog`, and
`getFilesetCatalog` derives the fileset view from it. The schema loader
reuses the cached catalog. The loader still rejects non-fileset
catalogs, so they are not cached.
- Python: `_merge_fileset_properties` goes through
`_get_fileset_catalog`, `_get_fileset_schema` and `_get_fileset`, and
skips `******` placeholders as the Java client does, so a removed
override still in the cached fileset cannot overwrite the catalog
secret.
Secrets and static catalog credentials are not cached and are still
fetched on every call. With the cache disabled, the loads are unchanged.
### Why are the changes needed?
#12572 made both clients load the catalog, schema and fileset directly
from the client while merging properties. Before that change they came
from the cache-aware accessors, so since #12572, enabling
`fs.gravitino.filesetMetadataCache.cache.enable` (Java) or
`enable_fileset_metadata_cache` (Python) no longer removes these three
requests from each operation. #12572 is not in a release yet.
Fix: #13850
### Does this PR introduce _any_ user-facing change?
No. With the cache enabled, catalog, schema and fileset properties used
for the filesystem configuration are cached like the rest of the fileset
metadata, as they were before #12572.
### How was this patch tested?
-
`TestBaseGVFSOperationsSecrets.testMetadataCacheAvoidsRepeatedMetadataLoads`
(Java) and `test_metadata_cache_avoids_repeated_metadata_loads`
(Python): with the cache enabled, a second property merge loads nothing
again while secrets are fetched twice.
- `TestFilesetMetadataCache.testNonFilesetCatalogIsNotCached`: a
non-fileset catalog is loaded again on the next call instead of being
cached.
- `test_removed_fileset_secret_falls_back_to_catalog_secret_with_cache`
(Python): after a fileset override is removed, `S3StorageHandler` gets
the catalog key and secret.
---
.../gravitino/filesystem/gvfs_base_operations.py | 39 +++++++--
.../tests/unittests/test_gvfs_merge_secrets.py | 97 ++++++++++++++++++++++
.../filesystem/hadoop/BaseGVFSOperations.java | 27 +++++-
.../filesystem/hadoop/FilesetMetadataCache.java | 40 +++++----
.../hadoop/TestBaseGVFSOperationsSecrets.java | 58 +++++++++++++
.../hadoop/TestFilesetMetadataCache.java | 25 ++++++
docs/how-to-use-gvfs.md | 4 +-
7 files changed, 263 insertions(+), 27 deletions(-)
diff --git a/clients/client-python/gravitino/filesystem/gvfs_base_operations.py
b/clients/client-python/gravitino/filesystem/gvfs_base_operations.py
index 86b02227aa..7cb66627da 100644
--- a/clients/client-python/gravitino/filesystem/gvfs_base_operations.py
+++ b/clients/client-python/gravitino/filesystem/gvfs_base_operations.py
@@ -62,6 +62,9 @@ PROTOCOL_NAME = "gvfs"
TIME_WITHOUT_EXPIRATION = sys.maxsize
+# The server returns this placeholder for hidden and secret-bound property
values.
+_MASKED_PROPERTY_VALUE = "******"
+
# Maps Gravitino credentialInfo / catalog property keys to Python GVFS option
names.
_CREDENTIAL_INFO_TO_GVFS_KEYS = {
"s3-access-key-id": GVFSConfig.GVFS_FILESYSTEM_S3_ACCESS_KEY,
@@ -525,19 +528,34 @@ class BaseGVFSOperations(ABC):
:param actual_location: The actual storage location
: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_gravitino_client().load_catalog(catalog_name)
- schema = catalog.as_schemas().load_schema(schema_name)
- fileset = catalog.as_fileset_catalog().load_fileset(
- NameIdentifier.of(schema_name, fileset_ident.name())
- )
- fileset_props = dict(catalog.properties() or {})
+ if self._enable_fileset_metadata_cache:
+ # Go through the metadata cache so that an operation does not
reload the
+ # catalog, schema and fileset. Secrets are not cached and are still
+ # fetched on every call.
+ catalog = self._get_fileset_catalog(
+ NameIdentifier.of(metalake_name, catalog_name)
+ )
+ schema = self._get_fileset_schema(
+ NameIdentifier.of(metalake_name, catalog_name, schema_name)
+ )
+ fileset = self._get_fileset(fileset_ident)
+ else:
+ catalog = self._get_gravitino_client().load_catalog(catalog_name)
+ schema = catalog.as_schemas().load_schema(schema_name)
+ fileset = catalog.as_fileset_catalog().load_fileset(
+ NameIdentifier.of(schema_name, fileset_ident.name())
+ )
+ # Masked placeholders are skipped, as the Java client does: a cached
entry can still
+ # hold one for a secret removed since, which would overwrite a value
merged before it.
+ fileset_props = self._omit_masked_properties(catalog.properties())
fileset_props.update(catalog.get_secrets())
self._merge_static_catalog_credentials(fileset_props, catalog)
- fileset_props.update(schema.properties() or {})
+ fileset_props.update(self._omit_masked_properties(schema.properties()))
fileset_props.update(schema.get_secrets())
- fileset_props.update(fileset.properties() or {})
+
fileset_props.update(self._omit_masked_properties(fileset.properties()))
fileset_props.update(fileset.get_secrets())
if self._options:
fileset_props.update(self._options)
@@ -547,6 +565,11 @@ class BaseGVFSOperations(ABC):
fileset_props.update(user_defined_configs)
return fileset_props
+ @staticmethod
+ def _omit_masked_properties(properties) -> Dict[str, str]:
+ props = properties or {}
+ return {k: v for k, v in props.items() if v != _MASKED_PROPERTY_VALUE}
+
def _merge_static_catalog_credentials(
self, fileset_props: Dict[str, str], catalog
) -> None:
diff --git a/clients/client-python/tests/unittests/test_gvfs_merge_secrets.py
b/clients/client-python/tests/unittests/test_gvfs_merge_secrets.py
index b2b2d90fa4..5d5d3fcb07 100644
--- a/clients/client-python/tests/unittests/test_gvfs_merge_secrets.py
+++ b/clients/client-python/tests/unittests/test_gvfs_merge_secrets.py
@@ -23,7 +23,9 @@ from gravitino.exceptions.base import (
NotFoundException,
RESTException,
)
+from gravitino.filesystem.gvfs_config import GVFSConfig
from gravitino.filesystem.gvfs_default_operations import DefaultGVFSOperations
+from gravitino.filesystem.gvfs_storage_handler import S3StorageHandler
from gravitino.name_identifier import NameIdentifier
@@ -85,6 +87,101 @@ class TestGVFSMergeSecrets(unittest.TestCase):
self.assertEqual(merged["f-vis"], "3")
self.assertEqual(merged["f-secret"], "fs")
+ def test_metadata_cache_avoids_repeated_metadata_loads(self):
+ operations = DefaultGVFSOperations(
+ server_uri="http://localhost:8090",
+ metalake_name="ml",
+ options={GVFSConfig.GVFS_FILESYSTEM_ENABLE_FILESET_METADATA_CACHE:
True},
+ )
+
+ catalog = MagicMock()
+ schema = MagicMock()
+ fileset = MagicMock()
+ catalog.properties.return_value = {"c-vis": "1"}
+ catalog.get_secrets.return_value = {"c-secret": "cs"}
+ catalog.as_schemas.return_value.load_schema.return_value = schema
+ schema.properties.return_value = {"s-vis": "2"}
+ schema.get_secrets.return_value = {"s-secret": "ss"}
+ catalog.as_fileset_catalog.return_value.load_fileset.return_value =
fileset
+ fileset.properties.return_value = {"f-vis": "3"}
+ fileset.get_secrets.return_value = {"f-secret": "fs"}
+
+ client = MagicMock()
+ client.load_catalog.return_value = catalog
+ fileset_ident = NameIdentifier.of("ml", "catalog", "schema", "fs")
+
+ with patch.object(operations, "_get_gravitino_client",
return_value=client):
+ with patch.object(operations, "_get_user_defined_configs",
return_value={}):
+ first = operations._merge_fileset_properties(
+ fileset_ident, "file:///tmp/data"
+ )
+ second = operations._merge_fileset_properties(
+ fileset_ident, "file:///tmp/data"
+ )
+
+ self.assertEqual(first["f-secret"], "fs")
+ self.assertEqual(first, second)
+ # The second merge must come from the metadata cache: no repeated
loads.
+ client.load_catalog.assert_called_once_with("catalog")
+
catalog.as_schemas.return_value.load_schema.assert_called_once_with("schema")
+
catalog.as_fileset_catalog.return_value.load_fileset.assert_called_once_with(
+ NameIdentifier.of("schema", "fs")
+ )
+ # Secrets are not cached and are fetched on every merge.
+ self.assertEqual(catalog.get_secrets.call_count, 2)
+ self.assertEqual(schema.get_secrets.call_count, 2)
+ self.assertEqual(fileset.get_secrets.call_count, 2)
+
+ def
test_removed_fileset_secret_falls_back_to_catalog_secret_with_cache(self):
+ operations = DefaultGVFSOperations(
+ server_uri="http://localhost:8090",
+ metalake_name="ml",
+ options={GVFSConfig.GVFS_FILESYSTEM_ENABLE_FILESET_METADATA_CACHE:
True},
+ )
+
+ catalog = MagicMock()
+ schema = MagicMock()
+ fileset = MagicMock()
+ catalog.properties.return_value = {
+ "s3_access_key_id": "******",
+ "s3_secret_access_key": "******",
+ }
+ catalog.get_secrets.return_value = {
+ "s3_access_key_id": "catalog-key-id",
+ "s3_secret_access_key": "catalog-secret",
+ }
+ catalog.support_credentials.return_value.get_credentials.return_value
= []
+ catalog.as_schemas.return_value.load_schema.return_value = schema
+ schema.properties.return_value = {}
+ schema.get_secrets.return_value = {}
+ catalog.as_fileset_catalog.return_value.load_fileset.return_value =
fileset
+ # The cached fileset keeps the masked override after it is removed on
the server.
+ fileset.properties.return_value = {"s3_secret_access_key": "******"}
+ fileset.get_secrets.return_value = {"s3_secret_access_key":
"fileset-secret"}
+
+ client = MagicMock()
+ client.load_catalog.return_value = catalog
+ fileset_ident = NameIdentifier.of("ml", "catalog", "schema", "fs")
+
+ with patch.object(operations, "_get_gravitino_client",
return_value=client):
+ with patch.object(operations, "_get_user_defined_configs",
return_value={}):
+ first = operations._merge_fileset_properties(
+ fileset_ident, "s3://bucket/data"
+ )
+ fileset.get_secrets.return_value = {}
+ second = operations._merge_fileset_properties(
+ fileset_ident, "s3://bucket/data"
+ )
+
+
catalog.as_fileset_catalog.return_value.load_fileset.assert_called_once()
+ self.assertEqual(first["s3_secret_access_key"], "fileset-secret")
+ handler = S3StorageHandler()
+ with patch.object(handler, "get_filesystem") as get_filesystem:
+ handler.get_filesystem_with_expiration([], second,
"s3://bucket/data")
+ get_filesystem.assert_called_once()
+ self.assertEqual(get_filesystem.call_args.kwargs["key"],
"catalog-key-id")
+ self.assertEqual(get_filesystem.call_args.kwargs["secret"],
"catalog-secret")
+
def test_secret_override(self):
operations = DefaultGVFSOperations(
server_uri="http://localhost:8090", metalake_name="ml", options={}
diff --git
a/clients/filesystem-hadoop3/src/main/java/org/apache/gravitino/filesystem/hadoop/BaseGVFSOperations.java
b/clients/filesystem-hadoop3/src/main/java/org/apache/gravitino/filesystem/hadoop/BaseGVFSOperations.java
index ee5cf96378..a4894f6ada 100644
---
a/clients/filesystem-hadoop3/src/main/java/org/apache/gravitino/filesystem/hadoop/BaseGVFSOperations.java
+++
b/clients/filesystem-hadoop3/src/main/java/org/apache/gravitino/filesystem/hadoop/BaseGVFSOperations.java
@@ -1014,10 +1014,31 @@ public abstract class BaseGVFSOperations implements
Closeable {
Map<String, String> getAllProperties(NameIdentifier filesetIdent) {
String catalogName = filesetIdent.namespace().level(1);
String schemaName = filesetIdent.namespace().level(2);
- Catalog catalog = getGravitinoClient().loadCatalog(catalogName);
- Schema schema = catalog.asSchemas().loadSchema(schemaName);
+ // Go through the metadata cache when it is enabled, so that an operation
does not reload the
+ // catalog, schema and fileset. Secrets are not cached and are still
fetched on every call.
+ NameIdentifier catalogIdent =
+ NameIdentifier.of(filesetIdent.namespace().level(0),
filesetIdent.namespace().level(1));
+ NameIdentifier schemaIdent =
+ NameIdentifier.of(
+ filesetIdent.namespace().level(0),
+ filesetIdent.namespace().level(1),
+ filesetIdent.namespace().level(2));
+ Catalog catalog =
+ getFilesetMetadataCache()
+ .map(cache -> cache.getCatalog(catalogIdent))
+ .orElseGet(() -> getGravitinoClient().loadCatalog(catalogName));
+ Schema schema =
+ getFilesetMetadataCache()
+ .map(cache -> cache.getSchema(schemaIdent))
+ .orElseGet(() -> catalog.asSchemas().loadSchema(schemaName));
Fileset fileset =
- catalog.asFilesetCatalog().loadFileset(NameIdentifier.of(schemaName,
filesetIdent.name()));
+ getFilesetMetadataCache()
+ .map(cache -> cache.getFileset(filesetIdent))
+ .orElseGet(
+ () ->
+ catalog
+ .asFilesetCatalog()
+ .loadFileset(NameIdentifier.of(schemaName,
filesetIdent.name())));
Map<String, String> all = new HashMap<>();
putPropsAndSecrets(all, catalog.properties(), catalog.supportsSecrets());
diff --git
a/clients/filesystem-hadoop3/src/main/java/org/apache/gravitino/filesystem/hadoop/FilesetMetadataCache.java
b/clients/filesystem-hadoop3/src/main/java/org/apache/gravitino/filesystem/hadoop/FilesetMetadataCache.java
index 7c84994fd6..048b622bdd 100644
---
a/clients/filesystem-hadoop3/src/main/java/org/apache/gravitino/filesystem/hadoop/FilesetMetadataCache.java
+++
b/clients/filesystem-hadoop3/src/main/java/org/apache/gravitino/filesystem/hadoop/FilesetMetadataCache.java
@@ -39,7 +39,7 @@ import org.apache.gravitino.file.FilesetCatalog;
public class FilesetMetadataCache implements Closeable {
private final GravitinoClient client;
- private final Cache<NameIdentifier, FilesetCatalog> catalogCache;
+ private final Cache<NameIdentifier, Catalog> catalogCache;
private final Cache<NameIdentifier, Fileset> filesetCache;
private final Cache<NameIdentifier, Schema> schemaCache;
@@ -56,19 +56,35 @@ public class FilesetMetadataCache implements Closeable {
}
/**
- * Gets the fileset catalog by the given catalog identifier.
+ * Gets the fileset catalog by the given catalog identifier as a {@link
Catalog}.
*
* @param catalogIdent the catalog identifier.
- * @return the fileset catalog.
+ * @return the catalog.
*/
- public FilesetCatalog getFilesetCatalog(NameIdentifier catalogIdent) {
- FilesetCatalog filesetCatalog =
+ public Catalog getCatalog(NameIdentifier catalogIdent) {
+ Catalog catalog =
catalogCache.get(
- catalogIdent, ident ->
client.loadCatalog(catalogIdent.name()).asFilesetCatalog());
+ catalogIdent,
+ ident -> {
+ Catalog loaded = client.loadCatalog(ident.name());
+ // Throw inside the loader so that a non-fileset catalog is not
cached.
+ loaded.asFilesetCatalog();
+ return loaded;
+ });
Preconditions.checkArgument(
- filesetCatalog != null, String.format("Loaded fileset catalog: %s is
null.", catalogIdent));
- return filesetCatalog;
+ catalog != null, String.format("Loaded catalog: %s is null.",
catalogIdent));
+ return catalog;
+ }
+
+ /**
+ * Gets the fileset catalog by the given catalog identifier.
+ *
+ * @param catalogIdent the catalog identifier.
+ * @return the fileset catalog.
+ */
+ public FilesetCatalog getFilesetCatalog(NameIdentifier catalogIdent) {
+ return getCatalog(catalogIdent).asFilesetCatalog();
}
/**
@@ -98,14 +114,10 @@ public class FilesetMetadataCache implements Closeable {
NameIdentifier catalogIdent =
NameIdentifier.of(schemaIdent.namespace().level(0),
schemaIdent.namespace().level(1));
return schemaCache.get(
- schemaIdent,
- ident -> {
- Catalog c = client.loadCatalog(catalogIdent.name());
- return c.asSchemas().loadSchema(schemaIdent.name());
- });
+ schemaIdent, ident ->
getCatalog(catalogIdent).asSchemas().loadSchema(schemaIdent.name()));
}
- private Cache<NameIdentifier, FilesetCatalog> newCatalogCache() {
+ private Cache<NameIdentifier, Catalog> newCatalogCache() {
// In most scenarios, it will not read so many catalog filesets at the
same time, so we can just
// set a default value for this cache.
return Caffeine.newBuilder()
diff --git
a/clients/filesystem-hadoop3/src/test/java/org/apache/gravitino/filesystem/hadoop/TestBaseGVFSOperationsSecrets.java
b/clients/filesystem-hadoop3/src/test/java/org/apache/gravitino/filesystem/hadoop/TestBaseGVFSOperationsSecrets.java
index c559db3642..715d7b133b 100644
---
a/clients/filesystem-hadoop3/src/test/java/org/apache/gravitino/filesystem/hadoop/TestBaseGVFSOperationsSecrets.java
+++
b/clients/filesystem-hadoop3/src/test/java/org/apache/gravitino/filesystem/hadoop/TestBaseGVFSOperationsSecrets.java
@@ -27,6 +27,7 @@ import static org.mockito.ArgumentMatchers.anyMap;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
@@ -380,6 +381,63 @@ public class TestBaseGVFSOperationsSecrets {
return catalog;
}
+ @Test
+ public void testMetadataCacheAvoidsRepeatedMetadataLoads() throws Exception {
+ Configuration conf = new Configuration();
+
conf.set(GravitinoVirtualFileSystemConfiguration.FS_GRAVITINO_CLIENT_METALAKE_KEY,
"ml");
+ conf.set(
+ GravitinoVirtualFileSystemConfiguration.FS_GRAVITINO_SERVER_URI_KEY,
+ "http://localhost:8090");
+ conf.setBoolean(
+
GravitinoVirtualFileSystemConfiguration.FS_GRAVITINO_FILESET_METADATA_CACHE_ENABLE,
true);
+
+ Catalog catalog = mock(Catalog.class);
+ Schema schema = mock(Schema.class);
+ Fileset fileset = mock(Fileset.class);
+ SupportsSchemas schemas = mock(SupportsSchemas.class);
+ FilesetCatalog filesetCatalog = mock(FilesetCatalog.class);
+ SupportsSecrets catalogSecrets = mock(SupportsSecrets.class);
+ SupportsSecrets schemaSecrets = mock(SupportsSecrets.class);
+ SupportsSecrets filesetSecrets = mock(SupportsSecrets.class);
+
+ when(catalog.properties()).thenReturn(Map.of("c-vis", "1"));
+ when(catalog.supportsSecrets()).thenReturn(catalogSecrets);
+ when(catalogSecrets.getSecrets()).thenReturn(Map.of("c-secret", "cs"));
+ when(catalog.asSchemas()).thenReturn(schemas);
+ when(schemas.loadSchema("schema")).thenReturn(schema);
+ when(schema.properties()).thenReturn(Map.of("s-vis", "2"));
+ when(schema.supportsSecrets()).thenReturn(schemaSecrets);
+ when(schemaSecrets.getSecrets()).thenReturn(Map.of("s-secret", "ss"));
+ when(catalog.asFilesetCatalog()).thenReturn(filesetCatalog);
+ when(filesetCatalog.loadFileset(NameIdentifier.of("schema",
"fs"))).thenReturn(fileset);
+ when(fileset.properties()).thenReturn(Map.of("f-vis", "3"));
+ when(fileset.supportsSecrets()).thenReturn(filesetSecrets);
+ when(filesetSecrets.getSecrets()).thenReturn(Map.of("f-secret", "fs"));
+
+ GravitinoClient client = mock(GravitinoClient.class);
+ when(client.loadCatalog("catalog")).thenReturn(catalog);
+
+ TestOps ops = new TestOps(conf, client);
+ try {
+ NameIdentifier filesetIdent = NameIdentifier.of("ml", "catalog",
"schema", "fs");
+ Map<String, String> first = ops.getAllProperties(filesetIdent);
+ Map<String, String> second = ops.getAllProperties(filesetIdent);
+
+ assertEquals("fs", first.get("f-secret"));
+ assertEquals(first, second);
+ // The second resolution must come from the metadata cache: no repeated
loads.
+ verify(client, times(1)).loadCatalog("catalog");
+ verify(schemas, times(1)).loadSchema("schema");
+ verify(filesetCatalog, times(1)).loadFileset(NameIdentifier.of("schema",
"fs"));
+ // Secrets are fetched on every call so credential rotation is honored.
+ verify(catalogSecrets, times(2)).getSecrets();
+ verify(schemaSecrets, times(2)).getSecrets();
+ verify(filesetSecrets, times(2)).getSecrets();
+ } finally {
+ ops.close();
+ }
+ }
+
private static class TestOps extends BaseGVFSOperations {
private final GravitinoClient client;
diff --git
a/clients/filesystem-hadoop3/src/test/java/org/apache/gravitino/filesystem/hadoop/TestFilesetMetadataCache.java
b/clients/filesystem-hadoop3/src/test/java/org/apache/gravitino/filesystem/hadoop/TestFilesetMetadataCache.java
index 3c04482fef..c60ea31168 100644
---
a/clients/filesystem-hadoop3/src/test/java/org/apache/gravitino/filesystem/hadoop/TestFilesetMetadataCache.java
+++
b/clients/filesystem-hadoop3/src/test/java/org/apache/gravitino/filesystem/hadoop/TestFilesetMetadataCache.java
@@ -18,12 +18,17 @@
*/
package org.apache.gravitino.filesystem.hadoop;
+import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
import java.io.IOException;
+import org.apache.gravitino.Catalog;
+import org.apache.gravitino.NameIdentifier;
import org.apache.gravitino.client.GravitinoClient;
import org.junit.jupiter.api.Test;
@@ -93,4 +98,24 @@ public class TestFilesetMetadataCache {
// If we got here without exceptions, the test passes
assertTrue(true, "Cache close completed successfully");
}
+
+ @Test
+ public void testNonFilesetCatalogIsNotCached() throws IOException {
+ GravitinoClient client = mock(GravitinoClient.class);
+ Catalog catalog = mock(Catalog.class);
+ when(catalog.asFilesetCatalog())
+ .thenThrow(
+ new UnsupportedOperationException("Catalog does not support
fileset operations"));
+ when(client.loadCatalog("catalog")).thenReturn(catalog);
+ NameIdentifier catalogIdent = NameIdentifier.of("ml", "catalog");
+
+ try (FilesetMetadataCache cache = new FilesetMetadataCache(client)) {
+ assertThrows(
+ UnsupportedOperationException.class, () ->
cache.getFilesetCatalog(catalogIdent));
+ assertThrows(
+ UnsupportedOperationException.class, () ->
cache.getFilesetCatalog(catalogIdent));
+ }
+ // The failed load is not cached, so the second call loads the catalog
again.
+ verify(client, times(2)).loadCatalog("catalog");
+ }
}
diff --git a/docs/how-to-use-gvfs.md b/docs/how-to-use-gvfs.md
index 988e1053c8..b5a279b489 100644
--- a/docs/how-to-use-gvfs.md
+++ b/docs/how-to-use-gvfs.md
@@ -72,7 +72,7 @@ the path mapping and convert automatically.
| `fs.gravitino.client.request.header.` | The configuration
key prefix for the Gravitino client request header. You can set the request
header for the Gravitino client.
| (none)
| No [...]
| `fs.gravitino.enableCredentialVending` | Whether to enable
credential vending for the Gravitino Virtual File System.
| `false`
| No [...]
| `fs.gravitino.client.` | The configuration
key prefix for the Gravitino client config.
| (none)
| No [...]
-| `fs.gravitino.filesetMetadataCache.enable` | Whether to cache the
fileset, fileset schema or fileset catalog metadata in the Gravitino Virtual
File System. Note that this cache causes a side effect: if you modify the
fileset or fileset catalog metadata, the client cannot see the latest changes.
| `false`
| No [...]
+| `fs.gravitino.filesetMetadataCache.enable` | Whether to cache the
fileset, fileset schema or fileset catalog metadata in the Gravitino Virtual
File System. Note that this cache causes a side effect: while an entry is
cached, the client does not see changes to the fileset, its schema or its
catalog, including their properties. Secrets are still fetched for every
operation.
[...]
| `fs.gravitino.autoCreateLocation` | The configuration
key for whether to enable auto-creation of fileset location when the
server-side filesystem ops are disabled and the location does not exist.
| `true`
| No [...]
| `fs.gravitino.kerberos.access.filesets` | Comma-separated
fileset paths, such as `gvfs://fileset/catalog/schema/fileset`, to collect
Hadoop delegation tokens for. Needed on Kerberized HDFS when a job reads
filesets stored outside `fs.defaultFS`. See [Via Apache
Spark](#via-apache-spark).
| (none)
| No [...]
| `fs.path.config.<name>` | Defines a logical
location entry. Set `fs.path.config.<name>` to the real base URI (for example,
`hdfs://cluster1/`). Any key that starts with the same prefix (such as
`fs.path.config.<name>.config.resource`) is treated as a location-scoped
property and will be forwarded to the underlying filesystem client. Note:
location names must not contain (`.`, `_`). | (none)
| No [...]
@@ -473,7 +473,7 @@ to recompile the native libraries like `libhdfs` and
others, and completely repl
| `client_request_header_` | The configuration key prefix for the
Gravitino client request header. You can set the request header for the
Gravitino client.
| (none)
| No [...]
| `enable_credential_vending` | Whether to enable credential vending for
the Gravitino Virtual File System.
|
`false` | No
[...]
| `gvfs_gravitino_client_` | The configuration key prefix for the
Gravitino client. You can set the config for the Gravitino client.
| (none) | No
[...]
-| `enable_fileset_metadata_cache` | Whether to cache the fileset or fileset
catalog metadata in the Gravitino Virtual File System. Note that this cache
causes a side effect: if you modify the fileset or fileset catalog metadata,
the client cannot see the latest changes.
| `false` |
No [...]
+| `enable_fileset_metadata_cache` | Whether to cache the fileset, fileset
schema or fileset catalog metadata in the Gravitino Virtual File System. Note
that this cache causes a side effect: while an entry is cached, the client does
not see changes to the fileset, its schema or its catalog, including their
properties. Secrets are still fetched for every operation.
| [...]
| `auto_create_location` | The configuration key for whether to
enable auto-creation of fileset location when the server-side filesystem ops
are disabled and the location does not exist.
| `true` |
No [...]
| `fs_path_config_<name>` | Defines a logical location entry. Set
`fs_path_config_<name>` to the real base URI (for example, `hdfs://cluster1/`).
Any key that starts with the same prefix (such as
`fs_path_config_<name>_config.resource`) is treated as a location-scoped
property and will be forwarded to the underlying filesystem client. Note:
location names must not contain (`.`, `_`). | (none)
| No [...]