mchades commented on code in PR #8254:
URL: https://github.com/apache/gravitino/pull/8254#discussion_r2300091215


##########
clients/client-python/gravitino/filesystem/gvfs_base_operations.py:
##########
@@ -547,3 +549,32 @@ def _get_fileset_catalog(self, catalog_ident: 
NameIdentifier):
             return catalog
         finally:
             write_lock.release()
+
+    def _get_fileset(self, fileset_ident: NameIdentifier):
+        read_lock = self._fileset_cache_lock.gen_rlock()
+        try:
+            read_lock.acquire()
+            cache_value: Fileset = self._fileset_cache.get(fileset_ident)
+            if cache_value is not None:
+                return cache_value
+        finally:
+            read_lock.release()
+
+        write_lock = self._fileset_cache_lock.gen_wlock()
+        try:
+            write_lock.acquire()
+            cache_value: Fileset = self._fileset_cache.get(fileset_ident)
+            if cache_value is not None:
+                return cache_value
+
+            catalog_ident: NameIdentifier = NameIdentifier.of(
+                fileset_ident.namespace().level(0), 
fileset_ident.namespace().level(1)
+            )
+            catalog: FilesetCatalog = self._get_fileset_catalog(catalog_ident)
+            fileset = catalog.as_fileset_catalog().load_fileset(
+                NameIdentifier.of(fileset_ident.namespace().level(2), 
fileset_ident.name())
+            )
+            self._fileset_cache[fileset_ident] = fileset
+            return fileset
+        finally:
+            write_lock.release()

Review Comment:
   added



##########
clients/filesystem-hadoop3/src/main/java/org/apache/gravitino/filesystem/hadoop/FilesetCatalogCache.java:
##########
@@ -80,6 +107,14 @@ private Cache<NameIdentifier, FilesetCatalog> 
newCatalogCache(
         .build();
   }
 
+  private Cache<NameIdentifier, Fileset> newFilesetCache(
+      ScheduledThreadPoolExecutor filesetCleanScheduler) {
+    return Caffeine.newBuilder()
+        .maximumSize(100)
+        
.scheduler(Scheduler.forScheduledExecutorService(filesetCleanScheduler))

Review Comment:
   fixed



-- 
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]

Reply via email to