kvdb/sqlbase: relax bulk migration isolation

This commit is contained in:
ziggie 2026-07-17 21:57:20 -03:00
parent f02cf4c470
commit 18bbdb5363
No known key found for this signature in database
GPG key ID: 1AFF9C4DCED6D666

View file

@ -88,8 +88,13 @@ func (p *postgresDB) BeginBulk(ctx context.Context) (MigrationBulkKVTx, error) {
return nil, err
}
// A bulk migration can touch millions of rows in a single transaction.
// PostgreSQL retains predicate locks until a serializable transaction
// ends, which can make its predicate lock table consume excessive memory.
// Read committed is sufficient because the migration owns the empty
// destination database while loading it.
tx, err := conn.BeginTx(ctx, &sql.TxOptions{
Isolation: sql.LevelSerializable,
Isolation: sql.LevelReadCommitted,
})
if err != nil {
locker.Unlock()