MongoDB#
driver/mongodb is the same driver on the deprecated mongo-driver v1, with
mongo.SessionContext as the transaction type. Both use the same collections
and document format, so you can switch processes one by one: replace the
import, connect with mongo-driver v2, and pass the session to EnqueueTx.
gorm#
bun#
Redis#
Jobs and results are Redis keys without a TTL. Under an allkeys-*
maxmemory-policy, Redis may evict them under memory pressure, silently
dropping pending jobs and stored results, so Migrate fails with
redisdriver.ErrEvictionPolicy. Use noeviction (writes fail loudly when
memory is full) or a volatile-* policy, which never touches keys without a
TTL. redisdriver.WithAllowEviction() disables the check; when CONFIG is
blocked, as on some managed services, the check is skipped. If a result is
evicted anyway, Await returns future.ErrResultLost rather than the
misleading future.ErrNoResult.
Migrate also builds the retention indexes for jobs written before v2.5.0.
During a rolling upgrade, older instances keep finalizing jobs without
indexing them, so run Migrate once more after every instance is upgraded.
Cassandra / ScyllaDB#
ClickHouse#
Amazon DynamoDB#
Cloud Firestore#
MariaDB#
MariaDB uses the MySQL dialect, through database/sql or gorm:
CI runs the MySQL test suite on MariaDB 11.4; 10.11 passes it too. Use
MariaDB 10.6 or newer, which added SKIP LOCKED, and stdlib v2.7.2 or newer:
earlier versions fail to record a job error on MariaDB.
SQLite (no Docker, good for tests)#
All driver constructors are non-owning: a client, pool, connection, database,
or session passed to New remains the caller’s responsibility. Driver.Close
only releases resources created internally by a driver and never closes the
supplied resource.
Migrate may be called concurrently during a rolling deployment. PostgreSQL
and MySQL use database advisory locks, while SQLite holds an immediate write
transaction across the complete migration set. Cassandra, ClickHouse, MongoDB,
DynamoDB, Redis, and Firestore use idempotent server-side schema operations;
DynamoDB also waits for tables created by another instance to become active.