Implement caching of iceberg metadata on coordinator#22739
Implement caching of iceberg metadata on coordinator#22739raunaqmorarka merged 3 commits intotrinodb:masterfrom
Conversation
04890a1 to
c910b2d
Compare
f01974c to
3e7ebd4
Compare
lib/trino-filesystem-manager/src/main/java/io/trino/filesystem/manager/FileSystemConfig.java
Outdated
Show resolved
Hide resolved
jkylling
left a comment
There was a problem hiding this comment.
This will also cache data files if the coordinator does execution?
lib/trino-filesystem-manager/src/main/java/io/trino/filesystem/manager/FileSystemModule.java
Outdated
Show resolved
Hide resolved
...rino-iceberg/src/test/java/io/trino/plugin/iceberg/TestIcebergMemoryCacheFileOperations.java
Outdated
Show resolved
Hide resolved
lib/trino-filesystem/src/main/java/io/trino/filesystem/memory/MemoryFileSystemCache.java
Outdated
Show resolved
Hide resolved
lib/trino-filesystem/src/main/java/io/trino/filesystem/memory/MemoryFileSystemCache.java
Outdated
Show resolved
Hide resolved
...rino-iceberg/src/test/java/io/trino/plugin/iceberg/TestIcebergMemoryCacheFileOperations.java
Outdated
Show resolved
Hide resolved
3e7ebd4 to
ff07326
Compare
ff07326 to
9beb3e8
Compare
9beb3e8 to
445043b
Compare
There was a problem hiding this comment.
nit: Default configuration for cache is not stable if Runtime.getRutime().maxMemory() < 2000 MB?
lib/trino-filesystem/src/main/java/io/trino/filesystem/memory/MemoryFileSystemCache.java
Outdated
Show resolved
Hide resolved
445043b to
d8dcbfa
Compare
lib/trino-filesystem/src/main/java/io/trino/filesystem/memory/MemoryFileSystemCacheConfig.java
Outdated
Show resolved
Hide resolved
lib/trino-filesystem/src/main/java/io/trino/filesystem/memory/MemoryFileSystemCacheConfig.java
Outdated
Show resolved
Hide resolved
lib/trino-filesystem/src/main/java/io/trino/filesystem/tracing/TracingInputFile.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
How frequently cacheLength is called?
Seems like length could be important to cache. @jkylling could alluxio provide an implementation of this method?
There was a problem hiding this comment.
In the context of iceberg metadata files, we need it only because SNAPSHOT file lengths are not known in advance and iceberg library uses file length to open it's avro reader.
Having it in the cache helps for subsequent queries.
There was a problem hiding this comment.
From what I can tell the CacheManager interface we use from Alluxio does not have a way to get the file length.
lib/trino-filesystem/src/main/java/io/trino/filesystem/memory/MemoryFileSystemCacheModule.java
Outdated
Show resolved
Hide resolved
lib/trino-filesystem-manager/src/main/java/io/trino/filesystem/manager/FileSystemModule.java
Outdated
Show resolved
Hide resolved
lib/trino-filesystem-manager/src/main/java/io/trino/filesystem/manager/FileSystemModule.java
Outdated
Show resolved
Hide resolved
lib/trino-filesystem-manager/src/main/java/io/trino/filesystem/manager/FileSystemModule.java
Outdated
Show resolved
Hide resolved
lib/trino-filesystem-manager/src/main/java/io/trino/filesystem/manager/FileSystemModule.java
Outdated
Show resolved
Hide resolved
lib/trino-filesystem/src/main/java/io/trino/filesystem/cache/CacheFileSystem.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Maybe the javadoc should be changed noting that location could be a directory now. What's the semantics then?
There was a problem hiding this comment.
There is no "semantics", it's a hint to the cache, it can do whatever with it.
There was a problem hiding this comment.
I think the expectation is that it should evict cached data for all files in location, right?
There was a problem hiding this comment.
it's not a strict requirement, but ideally files under directory should be deleted.
this was needed only because certain tests manipulate files and directories directly, it's not a problem for real workloads where direct manipulation is not allowed.
lib/trino-filesystem/src/main/java/io/trino/filesystem/cache/CacheInputFile.java
Outdated
Show resolved
Hide resolved
lib/trino-filesystem/src/main/java/io/trino/filesystem/cache/CacheInputFile.java
Outdated
Show resolved
Hide resolved
lib/trino-filesystem/src/main/java/io/trino/filesystem/memory/MemoryFileSystemCache.java
Outdated
Show resolved
Hide resolved
lib/trino-filesystem/src/main/java/io/trino/filesystem/memory/MemoryFileSystemCache.java
Outdated
Show resolved
Hide resolved
lib/trino-filesystem/src/main/java/io/trino/filesystem/memory/MemoryFileSystemCache.java
Outdated
Show resolved
Hide resolved
lib/trino-filesystem/src/main/java/io/trino/filesystem/memory/MemoryFileSystemCache.java
Outdated
Show resolved
Hide resolved
lib/trino-filesystem/src/main/java/io/trino/filesystem/memory/MemoryFileSystemCache.java
Outdated
Show resolved
Hide resolved
lib/trino-filesystem/src/main/java/io/trino/filesystem/memory/MemoryFileSystemCache.java
Outdated
Show resolved
Hide resolved
lib/trino-filesystem/src/main/java/io/trino/filesystem/memory/MemoryFileSystemCacheConfig.java
Outdated
Show resolved
Hide resolved
lib/trino-filesystem/src/main/java/io/trino/filesystem/memory/MemoryFileSystemCacheConfig.java
Outdated
Show resolved
Hide resolved
964eefc to
3712402
Compare
|
analysis time is not reported as planning time, so the gains are probably even better |
Every implementation of TrinoInputFile caches lastModified. Therefore, calls to lastModified() should not be traced repeatedly.
3712402 to
891fe76
Compare
lib/trino-filesystem/src/main/java/io/trino/filesystem/tracing/Tracing.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
It seems better to put these in trino-filesystem-manager module as that is where they are used.
There was a problem hiding this comment.
This would require making MemoryInputStream and MemoryInput public and bring some dependencies into trino-filesystem-manager pom.xml
Doable but the current way seems simpler.
Let me know if you would still like to move these classes to trino-filesystem-manager module.
891fe76 to
56bc045
Compare
lib/trino-filesystem/src/main/java/io/trino/filesystem/cache/CacheInputFile.java
Outdated
Show resolved
Hide resolved
lib/trino-filesystem/src/main/java/io/trino/filesystem/cache/CacheInputFile.java
Outdated
Show resolved
Hide resolved
lib/trino-filesystem/src/main/java/io/trino/filesystem/memory/MemoryFileSystemCache.java
Outdated
Show resolved
Hide resolved
lib/trino-filesystem/src/main/java/io/trino/filesystem/memory/MemoryFileSystemCache.java
Outdated
Show resolved
Hide resolved
lib/trino-filesystem/src/main/java/io/trino/filesystem/memory/MemoryFileSystemCache.java
Outdated
Show resolved
Hide resolved
plugin/trino-iceberg/src/main/java/io/trino/plugin/iceberg/IcebergConfig.java
Outdated
Show resolved
Hide resolved
plugin/trino-iceberg/src/main/java/io/trino/plugin/iceberg/IcebergConfig.java
Outdated
Show resolved
Hide resolved
lib/trino-filesystem/src/test/java/io/trino/filesystem/memory/TestMemoryFileSystemCache.java
Outdated
Show resolved
Hide resolved
56bc045 to
595c427
Compare
This is intended to reduce filesystem accesses for metadata operations in iceberg without having to explicitly configure filesystem caching on local disks
595c427 to
52291c6
Compare


Description
This is intended to reduce filesystem accesses for metadata operations in iceberg without having to explicitly configure filesystem caching on local disks
Additional context and related issues
Pre-requisite to landing #22584 as that potentially increases filesystem accesses for planning queries with different columns projected from same table through multiple scans
Release notes
( ) This is not user-visible or is docs only, and no release notes are required.
( ) Release notes are required. Please propose a release note for me.
(x) Release notes are required, with the following suggested text: