compact: build the successor in a private directory and publish it atomically
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 5/5
- Temps estimé
- Plus d'une semaine
- Accessibilité débutants
- 35/100
- Type d'issue
- Bug
- Clarté
- Clairement spécifiée
- Activité
- Active
- Stack technique
- javascript, node.js
Piste de recherche
Start with okf/faces/lib/compact.js and read guardCompactPaths(), claimDir(), and the staging and cleanup flow. The issue also identifies Bundle.init and the sign callback as key points to trace. Add the three listed race tests, then verify that compaction refuses a changed destination and cleanup preserves replacement directories and files.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
Summary
compact() in okf/faces/lib/compact.js (branch feat/okf-autobee-v2) checks its paths once, then writes into them in place. Another process that writes into the out-dir or the staging path while a compaction runs can lose its files. The review of the compaction hardening (T13 to T18) found two such races. The owner accepted both for the first release, as a fast follow after the branch lands.
The two races
- The out-dir check expires before the store opens.
guardCompactPaths()refuses a non-empty out-dir before the face step. Compaction then materializes, stages and awaits thesigncallback. If another process creates the out-dir and writes a file into it during that window,claimDir()accepts the directory, andBundle.init(Corestore) clears it. The foreign file is gone, and compaction reports success. - Cleanup equates a path name with ownership. On a failure, compaction removes the stage when
ownStageis true, andclaimDir().release()removes the out-dir or the entries that it did not see at claim time. If another process replaced the stage directory, or added a file to the out-dir after the claim, cleanup deletes that directory or file.
Both races need a concurrent writer on the same paths. A single user on one machine who runs one compaction at a time does not meet them.
The full fix
- Build the successor in a private directory that compaction creates exclusively, for example
mkdtemp(<out-dir>.compact-build-), beside the out-dir. - Stage, ingest and verify there. Close the successor vault.
- Publish with an atomic rename onto the out-dir. On POSIX,
rename(2)of a directory fails withENOTEMPTYorEEXISTwhen the destination is not empty, so a changed destination is refused, never cleared. - Reopen the published vault at the out-dir and return it.
compact()then returns a vault that it reopened, not the one that it built. That is an API change for callers that hold the build path. - Cleanup removes only the private build directory and the stage that this run created. Record the device and inode of each created directory, and refuse to remove a path whose identity changed.
Tests to add
- A
signcallback that creates the out-dir and writes a file into it: compaction refuses, and the file stays. - A stage replaced between staging and a failure: the replacement stays.
- A file added to the out-dir after the claim, then an init failure: the file stays.
- Langage dominant
- JavaScript
- Étoiles
- 0
- Forks
- 0
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Préparer son environnement
Ce projet ne fournit ni conteneur de développement, ni Dockerfile, ni guide de contribution : l'installation est à votre charge. Commencez par son README, et consultez notre guide de la première contribution pour les étapes générales.
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de indexzero/hyperdown
-
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 25/100
-
okf: align with upstream OKF v0.2 — vault→bundle vocabulary migration + conformance audit (ADR-009)Ouverte
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 25/100
Toutes les issues de indexzero/hyperdown
Issues similaires
-
Let TypeScript accept an initial object in ReactiveDictPeut-être pris @yograj-vijay-yadav l’a pris aujourd’hui. Ouvertebug good first issue help wanted workshop
Difficulté 2/5 1-3 heures Accessibilité débutants 92/100
meteor/meteor#14919 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 65/100
akitaonrails/FrankMD#268 ·
Les mainteneurs répondent en général sous 1 jour
-
account: profile
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
Les mainteneurs répondent en général sous 5 jours
-
Difficulté 1/5 Moins d'une heure Accessibilité débutants 82/100
mfreed7/xslt_polyfill#65 ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
Les mainteneurs répondent en général sous 1 jour