Skip to content

fix: release compact writer ownership before stats refresh - #309

Merged
beinan merged 1 commit into
mainfrom
codex/compact-release-before-stats
Oct 5, 2026
Merged

beinan merged 1 commit into
mainfrom
codex/compact-release-before-stats

Conversation

@beinan

@beinan beinan commented Oct 5, 2026 •

Copy link
Copy Markdown
Collaborator

Production compaction still retained table writer ownership while waiting up to 10 seconds for the global stats-writer lock. After #308, nine production commit-phase observations averaged 12.51 seconds despite file encoding already running outside ownership.

Finish successful prepared compactions durably before reopening a read handle and refreshing statistics. This releases the existing task/table keys through the normal completion transaction; it does not bypass fencing, drain guards, or dedicated publishers. Keep the caller's task and compaction permits through refresh to bound concurrency, and report its latency separately as stats_refresh. No-op preparations and failed publication/completion skip refresh. A crash after completion may omit the best-effort compaction counter update; scans still refresh table counts.

Validation: add an etcd-backed regression covering owned and legacy publication with a competing stats writer. The Compact must become Done and the next MergeWal must acquire the table while refresh is blocked; the local compaction permit remains occupied until refresh finishes. Validation passed locally: all 139 master library tests including the full etcd HA suite (0 failures); focused prepared-compaction tests 4/4; master Clippy all targets with warnings denied; formatting and diff whitespace checks. GitHub CI is running.

@beinan
beinan merged commit 670855d into main Oct 5, 2026
11 checks passed
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