Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

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

Aperta
#199 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@MuhammadBilal64 ci sta già lavorando.

Dal 6/10/2026.

  • #236 di @MuhammadBilal64 — aperta

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
48/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Tranquilla
Stack tecnologico
python
Ambito
backend

Direzione di ricerca

Inizia da src/borgstore/store.py alle righe 124, 251 e 334-344 per tracciare l’inizializzazione dello stato della cache e la produzione delle statistiche, quindi esamina come borg esegue il rendering di queste chiavi. Definisci una struttura delle statistiche che distingua tra un backend non configurato, una cache funzionante e una cache disabilitata, aggiorna i consumer interessati e verifica che gli store senza cache non mostrino più uno stato della cache né contatori fuorvianti.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Store.stats always reports the cache_* keys, even when no cache backend is configured at all. In that case cache_disabled is False (and every other cache counter is 0), which reads as "there is a cache and it is enabled" — the opposite of the truth.

Seen from borg, whose stats output renders one line per stats key:

Store cache disabled: False
Store cache hits: 0
Store cache misses: 0
Store cache hit ratio: 0.0%
...

for a repo where BORG_STORE_CACHE was not set, i.e. borg passed no cache_url/cache_backend and Store.cache_backend is None.

Cause

_cache_disabled is a runtime kill-switch, not a "do we have a cache" flag:

  • src/borgstore/store.py:124 — self._cache_disabled = False in __init__, unconditionally, regardless of whether a cache backend was given.
  • src/borgstore/store.py:251 — it is only ever set to True when opening the cache backend fails at runtime.
  • src/borgstore/store.py:334 — st["cache_disabled"] = self._cache_disabled, and lines 335-344 unconditionally add cache_hits, cache_misses, cache_hit_ratio, cache_errors, cache_{load,store,delete}_calls, cache_{load,store}_volume.

So "no cache configured" and "cache configured and working fine" are indistinguishable in the stats dict.

Suggested fix

Make the three states distinguishable, e.g.:

  • Report cache_enabled = self.cache_backend is not None and not self._cache_disabled (positive phrasing avoids the double negative in rendered output), and/or
  • only include the cache_* keys when self.cache_backend is not None, so consumers that render the dict generically drop the whole cache block for uncached stores.

Either way consumers (borg) would need a matching update to their key ordering / rendering. Happy to send a PR if you want to settle on which shape.

Lingua principale
Python
Stelle
26
Fork
9
Merge medio
1h 45m
PR unite (30g)
17

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di borgbackup/borgstore

Tutte le issue di borgbackup/borgstore

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.