ci: Add cache of Synapse migration setup - #5856
Closed
backspace wants to merge 3 commits into
Closed
Conversation
Synapse takes ~52s from container start to answering its healthcheck, and `create realm users` spends that time waiting: in a shard log all twelve realm users queue at 18:34:33 and the first registration goes out at 18:35:03. Almost all of it is first-run schema migration against an empty SQLite file, and every one of the 20 shards pays it. Bake it once on main and drop the result in before the services start. This removes work rather than moving it, which is the only thing that helps here: shard setup is bound by the runner's cores, not by latency. Starting Synapse earlier was measured twice — its own boot stretched from 52s to 84s as it competed with the image warm and the index import, and setup did not move. Schema only. No users are registered into the bake, so `create realm users` still runs and nothing about credentials is pinned into an artifact. Staleness is handled by the artifact's name rather than a separate gate: the key hashes the Synapse support tree, the docker helpers and the pinned image tag, so a checkout that changes any of them asks for a name that does not exist and boots from scratch. Those inputs moved 18 times in the last 7,246 commits. The key reads content through `git ls-files -s` rather than hashing files, because the support tree gains a signing key and a rendered homeserver.yaml the first time Synapse runs, and hashing those would make the key depend on whether the caller had booted Synapse before. Every failure path degrades: a missing artifact, an expired one, no gh CLI, or a half-unpacked database all leave Synapse migrating from scratch. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The patch that added the job wrote Python string-concatenation syntax into the YAML verbatim, so the job's `if` and the consumer's `SYNAPSE_CACHE_BRANCH` were nonsense and GitHub rejected the whole workflow file — every job on the branch, not just the new ones. Valid YAML is not a valid workflow: `yaml.safe_load` accepted this happily. `actionlint` is installed locally and would have caught it, so it is now the check that runs before pushing workflow changes. Also swaps the bake step's `ls | head -1` for a nullglob array, which shellcheck flags, and fails the job loudly if Synapse produced no database rather than uploading an empty artifact for shards to trip over. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The previous run published boxel-synapse-db-b8c4cbc56dd3cf0c (1.9M migrated, 40K compressed); its own shards ran before it existed. This run's shards should restore it and skip Synapse's schema migration. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Contributor
Host Test Results 1 files 1 suites 1h 49m 57s ⏱️ Results for commit dfa3d3e. |
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.
Claude explanation
Synapse takes ~52s from container start to answering its healthcheck, and `create realm users` spends that time waiting: in a shard log all twelve realm users queue at 18:34:33 and the first registration goes out at 18:35:03. Almost all of it is first-run schema migration against an empty SQLite file, and every one of the 20 shards pays it.Bake it once on main and drop the result in before the services start. This removes work rather than moving it, which is the only thing that helps here: shard setup is bound by the runner's cores, not by latency. Starting Synapse earlier was measured twice — its own boot stretched from 52s to 84s as it competed with the image warm and the index import, and setup did not move.
Schema only. No users are registered into the bake, so
create realm usersstill runs and nothing about credentials is pinned into an artifact.Staleness is handled by the artifact's name rather than a separate gate: the key hashes the Synapse support tree, the docker helpers and the pinned image tag, so a checkout that changes any of them asks for a name that does not exist and boots from scratch. Those inputs moved 18 times in the last 7,246 commits. The key reads content through
git ls-files -srather than hashing files, because the support tree gains a signing key and a rendered homeserver.yaml the first time Synapse runs, and hashing those would make the key depend on whether the caller had booted Synapse before.Every failure path degrades: a missing artifact, an expired one, no gh CLI, or a half-unpacked database all leave Synapse migrating from scratch.