Skip to content

Drop the duplicate check's own transaction and the rev-parse process from writes - #269

Open
yasyf wants to merge 5 commits into
mainfrom
perf/write-floor
Open

yasyf wants to merge 5 commits into
mainfrom
perf/write-floor

Conversation

@yasyf

@yasyf yasyf commented Nov 10, 2026

Copy link
Copy Markdown
Owner

A task add on a real repository pays for a durable bolt transaction and a rev-parse process that it doesn't need. This removes both and caches the managed pack list.

Phase timings for this change and the monorepo repack will be added in a comment.

Change

  • Duplicate check: it read the task index, found the active generation behind current, and committed a separate bolt transaction with an fsync just to mark current active. That took 13-16 ms of the write. A read inside a write now records the binding, and applyManaged marks it active in the publication's own transaction. Other reads activate exactly as before.
  • rev-parse: Dirs finds the git directories in-process for the plain case. That means the nearest .git directory or gitdir file, owned by this user, on one filesystem, with no routing variable and no core.bare other than false. Everything else still runs rev-parse.
  • Managed pack list: the list is kept in cc-notes/managed-packs under the common directory, keyed on the pack directory's modification time. A repository whose pack directory holds 11,000 fetch packs then doesn't reread it on every read. A write changes that time with its own pack, so the next write still lists the directory once.

Verification

CI grades this, with no local test runs. TestDirsRepositoryLayouts now runs through the in-process path, and a parity test compares it with rev-parse and checks the layouts it hands back. Other tests pin the deferred activation and the list cache. The format and the gates don't change; the lease guardian and the publication fsync are untouched.

yasyf added 5 commits November 9, 2026 16:34
The task-add trace now expects two git processes, the doc-show store count
routes discovery through rev-parse with a ceiling, pinned reads activate in
place, the managed-cost evidence check no longer requires a git child, and
gosec reasons cover the discovery stats.
Deferred activation now marks active only the generation the duplicate check
read, skipping one another writer replaced since. Discovery declines a .git
file that is not a regular file this user owns, a HEAD git would reject, a
common dir without objects and refs, an unknown repository format or
extension, an escaped or unbalanced config line, and config passed through
the environment. A pack listing taken within a second of the directory's last
change is not kept, since a same-timestamp addition would leave it stale.
The test environment always sets one benign entry, so declining on the
variable's presence sent every test repository back through rev-parse.
Discovery now declines only a malformed count or an entry that sets a core,
safe, extensions or include key. The activation test proves the later
activation through an indexed read, which list reads never perform.

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.

1 participant