-
Notifications
You must be signed in to change notification settings - Fork 450
Add env variables to configure manifest cache #2993
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
07e5008
2001cca
ee95c46
f411547
a87cc1c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -51,6 +51,7 @@ | |
| StringType, | ||
| StructType, | ||
| ) | ||
| from pyiceberg.utils.config import Config | ||
|
|
||
| UNASSIGNED_SEQ = -1 | ||
| DEFAULT_BLOCK_SIZE = 67108864 # 64 * 1024 * 1024 | ||
|
|
@@ -891,13 +892,16 @@ def __hash__(self) -> int: | |
| return hash(self.manifest_path) | ||
|
|
||
|
|
||
| # Global cache for ManifestFile objects, keyed by manifest_path. | ||
| # This deduplicates ManifestFile objects across manifest lists, which commonly | ||
| # share manifests after append operations. | ||
| _manifest_cache: LRUCache[str, ManifestFile] = LRUCache(maxsize=128) | ||
kris-gaudel marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| # Lock for thread-safe cache access | ||
kris-gaudel marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| _DEFAULT_MANIFEST_CACHE_SIZE = 128 | ||
| _manifest_cache_size = Config().get_int("manifest-cache-size") or _DEFAULT_MANIFEST_CACHE_SIZE | ||
| _manifest_cache_lock = threading.RLock() | ||
| _manifest_cache: LRUCache[str, ManifestFile] = LRUCache(maxsize=_manifest_cache_size) | ||
|
|
||
|
|
||
| def clear_manifest_cache() -> None: | ||
| """Clear the manifest cache.""" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there a specific use case / scenario, where one would use this method? It might be helpful to mention them here, as I assume in most cases, users wouldn't ever call this method - except for very specific scenarios.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When I was working though this issue I vaguely recalled someone suggesting the idea of a public function to disable it |
||
| with _manifest_cache_lock: | ||
| _manifest_cache.clear() | ||
|
|
||
|
|
||
| def _manifests(io: FileIO, manifest_list: str) -> tuple[ManifestFile, ...]: | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.