Skip to content

Process-global manifest cache is keyed only on manifest_path #3978

Description

@sungwy

pyiceberg/manifest.py holds a module-level cache:

_manifest_cache = _ManifestCache()

Its docstring describes it accurately: "Process-wide ManifestFile cache keyed by manifest_path." The key is the path string alone — no catalog, table, session, or tenant forms part of it.

def get_or_cache(self, manifest_file: ManifestFile) -> ManifestFile:
    ...
    manifest_path = manifest_file.manifest_path
    if manifest_path in self._cache:
        return self._cache[manifest_path]
    self._cache[manifest_path] = manifest_file
    return manifest_file

On a hit it returns the cached object and discards the one just read. Since read_manifest_list constructs ManifestFile objects from the entries of a manifest list rather than by reading each manifest file, the cached object reflects whatever the first manifest list to name that path declared — including its partition summaries, counts and sequence numbers.

Two tables in the same process that reference the same manifest_path therefore share one ManifestFile, and the first read wins. Because those fields drive scan pruning, a stale or mismatched entry changes which files a scan considers.


Issue investigation generated via claude, reviewed by Sung, Kevin, Fokko.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions