Repository navigation
migrate: {reindex} rebuilds battle's indexes concurrently, one at a time - #644
Merged
Merged
Conversation
The report ({"reindex": {"table": "battle"}}) reads each index's size,
scans, validity, the constraint and foreign keys it carries and a bloat
estimate from planner statistics, with any invalid _ccnew/_ccold
leftover. The rebuild ({"index": "<name>", "apply": true}) runs
REINDEX INDEX CONCURRENTLY on one of the table's indexes under a 240 s
statement timeout and a 60 s lock timeout, refused while any index on
the table is invalid; drop_invalid drops one invalid leftover
concurrently. battle is the only table. npm run op classes only the
bare report as a read.
DECISIONS gains two [Jamie, 2026-10-21] lines: shared_buffers follows
RDS's memory-pressure setting, and battle's indexes are rebuilt
concurrently by {reindex}. The template's shared_buffers comment cites
the first. Refs #630.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
jthingelstad
force-pushed
the
session/battle-reindex-op
branch
from
October 21, 2026 11:41
eb4fe28 to
00ac016
Compare
jthingelstad
marked this pull request as ready for review
October 21, 2026 11:41
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
The maintenance ran early, on 10-21, and shared_buffers is still the engine default (23081 pages, about 180 MB) after both restarts. The template comment goes back to saying so; the DECISIONS line records only the decision (RDS's own setting, nothing pins it) and what the restarts showed; the rebuild runs after the 10-21 maintenance. Refs #630 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Owner
Author
|
Deployed to production 2026-10-21T11:57:35Z (2026-10-21 06:57:35 CDT).
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #630 (does not close it).
Jamie, 2026-10-21: "Approved: add an ops command to elixir-mcp and rebuild the battle table's indexes concurrently in production after the 10-23 maintenance".
What
A migrate op,
{reindex}(services/migrate/src/ops-reindex.mjs).REINDEX CONCURRENTLYcannot run inside the migrate runner's transaction, so it is an op, as{vacuum}is.{"reindex": {"table": "battle"}}. Returns each index's size, scans, validity, the constraint it backs, the foreign keys that use it, and a bloat estimate. Also the heap size, the row estimate, and every invalid index, with_ccnew/_ccoldleftovers marked.{"reindex": {"table": "battle", "index": "<name>", "apply": true}}. RunsREINDEX INDEX CONCURRENTLYon exactly one of the table's indexes, by quoted name.statement_timeoutis 240 s (the Lambda times out at 300 s) andlock_timeoutis 60 s. Returns the size before and after,ms, and validity after. It is refused while any index on the table is invalid.{"reindex": {"table": "battle", "drop_invalid": "<name>"}}. RunsDROP INDEX CONCURRENTLYon one INVALID index. It is refused for a valid index or for one a constraint needs.battleis the only table on the allowlist.npm run optreats only the bare{table}form as a read.The bloat estimate needs no extension. It uses
reltuples, thepg_statswidths and the fillfactor. On test data it came within 7% of every freshly rebuilt index.Docs
ops.mdbeside{vacuum}, and a line in the ops skill's "Choosing the read".docs/notes/2026-10-21-battle-reindex-op.md.shared_buffersfollows RDS's own setting and nothing pins it (Operations and AWS; RDS warned of 88 MB at a restart, but after the 10-21 restarts it was still 180 MB);battle's indexes are rebuilt concurrently by{reindex}(Schema and migrations).infra/template.yamlis unchanged: its comment thatshared_buffersis the engine default is still true.Tests
services/migrate/test/ops-reindex.test.mjs, on a scratch database:battle_pkeyis rebuilt valid and smaller, and both foreign keys follow it;_ccnewleftover comes from a rebuild cancelled behind an open writer; rebuilds are refused while it stands,drop_invalidrefuses the valid index and drops the leftover, and the rebuild then succeeds;npm run verifyis green on Node 24 (32/32 units).e2e-needed.shsays false.Deploy
No tool changed, so there is no acceptance family. The rebuild itself is not part of this PR. It runs after the 10-21 maintenance, one index per invocation, smallest first, when Jamie says.
🤖 Generated with Claude Code