fix(db): make replica_heartbeat migration 26 idempotent - #3890
Open
Chessing234 wants to merge 3 commits into
Open
fix(db): make replica_heartbeat migration 26 idempotent#3890Chessing234 wants to merge 3 commits into
Chessing234 wants to merge 3 commits into
Conversation
Use IF NOT EXISTS and ON CONFLICT DO NOTHING so migration 26 can safely re-run after an in-doubt commit leaves the table but not the ledger row. Signed-off-by: Taksh <takshkothari09@gmail.com>
Brownfield relays already on version 26 need the updated sqlx checksum before startup; verify the heartbeat table is complete before refreshing. Signed-off-by: Taksh <takshkothari09@gmail.com>
Keep this PR scoped to replica_heartbeat idempotency only. Signed-off-by: Taksh <takshkothari09@gmail.com>
Contributor
Author
|
@tlongwell-block @wesbillman @wpfleger96 mind taking a look when you get a chance? |
Chessing234
force-pushed
the
fix/replica-heartbeat-migration-idempotent
branch
from
August 5, 2026 10:35
78c1bcf to
61e986d
Compare
Contributor
Author
|
@wpfleger96 migration 26 idempotency fix — keeps re-runs from failing. ok to merge? |
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.
Summary
replica_heartbeat) idempotent withCREATE TABLE IF NOT EXISTSandON CONFLICT DO NOTHINGinserts so a relay can recover when DDL committed but the_sqlx_migrationsledger row was lost during Postgres failover.schema/schema.sql.Fixes #3785
Test plan
cargo test -p buzz-db migrationreplica_heartbeatpresent but no version-26 ledger row and confirm migrations succeedMade with Cursor