Follow-ups to the withLock() completion purge retry

Aperta
#1,122 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
45/100
Tipo di issue
Refactoring
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
cpp, node.js
Ambito
backend, databases

Direzione di ricerca

Read src/binding/database/db_descriptor.cpp and the releaseDescriptorPin() helper introduced by #1110; compare the existing retry sites in the backup/checkpoint state destructors and purgeAfterCommit(). The issue describes three follow-ups, including an allocation failure edge case and a Deno timing concern. Done means deciding which follow-ups to address and aligning completeLockCallback with the shared helper where appropriate.

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

Descrizione

Context

The #1092 fix (branch fix/withlock-purge-skip) makes withLock() completions in src/binding/database/db_descriptor.cpp retry DBRegistry::PurgeIfUnreferenced() after releasing their transient descriptor pin (completeLockCallback / LockCompletionPurge). Pre-push review left three follow-ups, all small and none reopening the leak.

Follow-ups

  1. Fold into the shared helper. This is the third copy of the "release the pin, then retry the purge" tail, after the backup/checkpoint state destructors and purgeAfterCommit(). #1110 adds releaseDescriptorPin() for it. Whichever of #1110 and the #1092 fix merges second should switch completeLockCallback to it. Consider whether the helper should carry the lock completion's post-release use_count() == 1 fast path, which keeps ordinary completions off databasesMutex.
  2. Allocation failure loses the retry. descriptorKey() copies the path strings while the second, brief pin is held. If that copy throws, the pin is released with no retry. Every existing retry site has the same best-effort limit. Making the key copy non-throwing (for example, caching the key on the descriptor) would close it for all of them.
  3. Purge runs after the caller's promise settles. This matches commit completion, so a possible close-time flush never runs ahead of the caller's continuation. On Deno, which runs the continuation inside the settle call, that continuation can briefly see an unreferenced database still registered. Deno is local-only and unsupported, so this is noted rather than fixed.

Review-Deferral: 0c80b1bff4f36a9c severity=nit category=maintainability
Review-Deferral: 4511645710d48f61 severity=nit category=concurrency
Review-Deferral: 2f0dfed9b51352fa severity=minor category=reliability

🤖 Generated with Claude Code (Claude Opus 5.5); posted via @cb1kenobi.

Lingua principale
C++
Stelle
24
Fork
3
Merge medio
1g 14h
PR unite (30g)
102

Preparare l'ambiente

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 HarperFast/rocksdb-js

Tutte le issue di HarperFast/rocksdb-js

Issue simili

Altre issue su C++

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.