migrateretry

package
v1.9.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 4, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package migrateretry runs grove migration groups on PostgreSQL and retries the one failure replicas booting together can hit.

Grove v1.10.0 creates grove_migrations and grove_migration_locks before it takes the migration lock, so replicas starting at once on a database without those tables race on the CREATE, and the losers fail with duplicate_table or duplicate_object. Run retries that failure a few times with a short jittered pause. By the next attempt the tables exist and grove's lock serialises the replicas.

Index

Constants

View Source
const Attempts = 5

Attempts bounds how many times Run runs the orchestrator.

Variables

This section is empty.

Functions

func IsConcurrentCreate

func IsConcurrentCreate(err error) bool

IsConcurrentCreate reports duplicate_table (42P07) or duplicate_object (42710), what Postgres raises when two sessions run the same CREATE TABLE IF NOT EXISTS at once and one loses. The string check covers a wrapper that flattens the PgError.

func Run

func Run(ctx context.Context, exec migrate.Executor, groups ...*migrate.Group) error

Run applies the pending migrations of groups through grove's orchestrator on exec, retrying a lost race on grove's tracking tables up to Attempts times. Any other error is returned at once.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL