Skip to content

Conversation

@elioschmutz
Copy link
Member

@elioschmutz elioschmutz commented Jan 19, 2026

When running with a non shared blob directory, RelStorage uses the local filesystem only as a cache for blobs. Once the configured blob-cache-size is reached, cached blobs may be evicted and no longer exist on disk, even though they are still available in ZEO.

Several parts of the codebase were reading blob data directly via the committed filesystem path. This approach assumes that the blob file is always present locally, which is not guaranteed in a non shared blob setup. As a result, file access may fail when a blob has been removed from the local cache.

Fix
This change replaces direct filesystem access to blob paths with the official Zope API for reading file data. Files are now read via document.get_file().read() instead of opening the committed blob path.

Using the Zope API ensures that missing blobs are transparently re-synced when needed. This makes file access robust against blob cache eviction. This issue does not exists in the default FileStorage-setup. In only exists when using RelStorage in combination with shared-blob-dir=false.

See https://relstorage.readthedocs.io/en/latest/relstorage-options.html#blobs for more details about the options.

For TI-3545

Checklist

Everything has to be done/checked. Checked but not present means the author deemed it unnecessary.

  • Changelog entry
  • Link to issue (Jira or GitHub) and backlink in issue (Jira)

@elioschmutz elioschmutz force-pushed the es/TI-3545-fix-blob-access branch 2 times, most recently from fa0d37d to 791d158 Compare January 19, 2026 10:29
@elioschmutz elioschmutz requested review from a team and buchi January 19, 2026 10:29
@elioschmutz elioschmutz marked this pull request as ready for review January 19, 2026 10:29
@elioschmutz elioschmutz force-pushed the es/TI-3545-fix-blob-access branch from 791d158 to 8477694 Compare January 19, 2026 11:04
This will fix an issue reading non existing files when using a non shared blobs dir: https://relstorage.readthedocs.io/en/latest/relstorage-options.html#blobs
In this case, the blobs-directory only aces as a cache. File may be there but not necessarly. If using the zope api, files will be synced as soon as they're needed.
@elioschmutz elioschmutz force-pushed the es/TI-3545-fix-blob-access branch from 8477694 to 0c192e7 Compare January 19, 2026 14:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants