Sign in

Search issue titles and bodies, change requests and comments. Private repositories you cannot read are not included.

vole
Clone

Read only, no credentials:

https://rodent.software/vole.git

Write over SSH with a registered key:

git clone ssh://git@rodent.software:2222/vole.git

A free and open-source forge that lives in your Git repo.

#125

Keep the index current at push time and check it without a process

merged · by keenan 10d ago · merged into main at e2a58f3a by keenan 10d ago

keenan opened this 10d ago

Why

Closes #124. Two costs remained after #113: a push’s metadata delta was applied by the next reader (so the first page after a big push paid for the push), and search checked every visible repository with two git processes — symbolic-ref to open it and rev-parse to see whether the metadata branch moved — so N repositories cost 2N processes per search.

What changed

  • Post-receive applies the delta when the push lands. The SSH server hands the hook VOLE_INDEX_DB and the repository id; the hook opens the index and runs Ensure after the refs have moved, which is also after a followed request’s head has moved. A failure is reported on the pusher’s terminal and ignored: the refs have landed, and the next read still repairs the rows.
  • git.Repo.RefCommit reads a loose ref file — what git writes for every branch update — and falls back to rev-parse for a packed ref, a symbolic ref, or a missing ref. The index’s Ensure and the web’s metadata-head read use it. A test packs the refs and checks that the fallback still answers.
  • repo.Store.Meta builds a repository handle without a HEAD lookup, and search uses it: the refresh needs the directory and the ACL, not the default branch. The check is now two file reads instead of two processes per visible repository.

Measurement

Load harness search-find (three visible repositories), concurrency 4, 5 s:

req/s p50 p90 p99
before (#100) 510.2 7 ms 11 ms 15 ms
after 814.8 4 ms 8 ms 12 ms

A push that changes the vole branch leaves the rows current before the push command returns: TestPushRefreshesTheIndexBeforeTheNextRead queries them with no Ensure in between.

Checks

gofmt, go vet ./..., python3 scripts/check-links.py, ./vole workflow check, and the full -race suite with GOFLAGS=-tags=sqlite_fts5. Docs: docs/architecture.md now says how the index is kept current.

Notes

This does not remove the ref update itself or the diff/merge work a change page does; those are the work, not a check. A page whose index is stale because a hook did not run applies the delta on read, exactly as before — the loose-ref read is only how the check is made cheap.

Discussion (0)

No discussion yet.