Wrong `ObjectStore` key logged when the backup object store can't be retrieved in the instance sidecar
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 88/100
Direzione di ricerca
Esamina internal/cnpgi/instance/backup.go in Backup e internal/cnpgi/instance/metrics.go in Collect. Confronta la chiave passata a GetBarmanObjectKey() con la chiave registrata in ciascun log di errore, quindi verifica che entrambi i percorsi riportino la chiave ObjectStore del backup richiesto quando la ricerca non riesce.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Description
In the instance sidecar, two code paths fetch the cluster's backup ObjectStore with GetBarmanObjectKey(), but their error log reports GetRecoveryBarmanObjectKey():
internal/cnpgi/instance/backup.go (Backup):
var objectStore barmancloudv1.ObjectStore
if err := b.Client.Get(ctx, configuration.GetBarmanObjectKey(), &objectStore); err != nil {
contextLogger.Error(err, "while getting object store", "key", configuration.GetRecoveryBarmanObjectKey())
return nil, err
}
internal/cnpgi/instance/metrics.go (Collect) has the same lines.
So when the lookup fails, the key field names a different object from the one that was requested:
- on a cluster without a recovery source (the usual case),
RecoveryBarmanObjectNameis empty, sokeyhas an empty name; - on a cluster bootstrapped from an
ObjectStorethroughexternalClusters,keynames the recoveryObjectStore, which exists, pointing the reader at the wrong object.
Impact
Low, but confusing. The error message itself (for example objectstores.barmancloud.cnpg.io "s3-store" not found, or ... is forbidden) still has the right name, so the information is in the log line. But the structured key field contradicts it, and anything that filters or alerts on key gets the wrong value. Collect runs on every metrics scrape, so a missing or forbidden ObjectStore repeats the misleading line on every scrape.
This is the same kind of problem as #539/#504, which were about the operator pre-hook in reconciler.go. These two lines are on the instance side and weren't covered there.
History
The backup.go line dates from e4735a2 (#83, "separate recovery object store from replica source"). The metrics.go one was added in 33172b6 (#459) with the same lines. Open PR #1076 touches the surrounding code in backup.go but leaves this line as it is.
Proposed fix
Log configuration.GetBarmanObjectKey() in both places, the key that is actually passed to Get. I'm happy to send the PR.
How this was found
While working on #1140 on my fork, I ran an AI code review (Claude Code) over my change. It flagged the mismatched key in backup.go, even though my change didn't touch that line. I then searched the code base for the same pattern, which found the copy in metrics.go, and confirmed both on main by reading the code. I haven't triggered the failing lookup on a live cluster, so the error messages quoted above are examples, not captured output.
I used an AI assistant (Claude) to help find this and draft this issue, as the AI policy asks for disclosure.
- Lingua principale
- Go
- Stelle
- 196
- Fork
- 76
- Merge medio
- 4g 13h
- PR unite (30g)
- 19
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di cloudnative-pg/plugin-barman-cloud
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
cloudnative-pg/plugin-barman-cloud#1117 · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
data.compression rejects zstd although barman-cloud-backup supports itForse già presa Una pull request collegata a questa issue è aperta o già unita. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
cloudnative-pg/plugin-barman-cloud#1104 · 4 reazioni ·
I maintainer di solito rispondono entro 1 giorno
-
Add RBAC aggregation labels to ObjectStore editor/viewer ClusterRolesForse già presa @stefanpeknik l’ha presa 18 giorni fa. Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 82/100
cloudnative-pg/plugin-barman-cloud#1102 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 55/100
cloudnative-pg/plugin-barman-cloud#1143 ·
I maintainer di solito rispondono entro 1 giorno
-
Record the object store and server name of a backup in Backup.status.pluginMetadataForse già presa @BoxBoxJason l’ha presa 1 giorno fa. Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
cloudnative-pg/plugin-barman-cloud#1140 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di cloudnative-pg/plugin-barman-cloud
Issue simili
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
AOSSIE-Org/DebateAI#611 ·
I maintainer di solito rispondono entro 3 giorni
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
MHSanaei/3x-ui#6737 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
terraform-provider
Difficoltà 2/5 1-3 ore Idoneità per principianti 73/100
ClickHouse/terraform-provider-clickhousedbops#281 ·
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
open-telemetry/opentelemetry-go-compile-instrumentation#1450 ·
I maintainer di solito rispondono entro 2 giorni