Skip to content

stats: add cache_enabled, only report cache_* keys if a cache is configured - #236

Open
MuhammadBilal64 wants to merge 1 commit into
borgbackup:mainfrom
MuhammadBilal64:fix-199-cache-enabled-stats
Open

MuhammadBilal64 wants to merge 1 commit into
borgbackup:mainfrom
MuhammadBilal64:fix-199-cache-enabled-stats

Conversation

@MuhammadBilal64

Copy link
Copy Markdown

Fixes #199

Store.stats reported cache_disabled: False and all-zero cache counters
for stores without any cache backend, which reads as "cache present and enabled".

Changes:

  • New key cache_enabled (cache_backend is not None and not _cache_disabled).
  • The other cache_* keys are only present if a cache backend is configured,
    so generic renderers drop the whole cache block for uncached stores.
  • cache_disabled is unchanged: True if the cache backend failed to open.
  • Tests for the three states (no cache / working cache / cache fails to open),
    test_stats adjusted.
  • Docs updated.

Note: consumers that render the stats dict generically (e.g. borg) need a
matching update for the new key and for the cache_* keys now being optional.

… is configured

Store.stats always contained the cache_* keys, so 'no cache configured' and 'cache configured and working' were indistinguishable (cache_disabled was False in both cases).

- add cache_enabled: True only if a cache backend is configured and was not disabled at runtime
- only include the other cache_* keys if a cache backend is configured
- cache_disabled keeps its meaning: True if the cache backend failed to open at runtime
- tests for no cache / working cache / cache failing to open, adjust test_stats
- docs: describe the new stats keys

Fixes borgbackup#199

This branch has not been deployed

No deployments
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.

stats: cache_disabled is False even when no cache backend is configured

1 participant