mirror of
https://github.com/matrix-org/dendrite.git
synced 2026-01-16 10:33:11 -06:00
Restore repeatable read for NewDatabaseSnapshot
This commit is contained in:
parent
e91e25d6dc
commit
878d1249d9
|
|
@ -56,25 +56,22 @@ type Database struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *Database) NewDatabaseSnapshot(ctx context.Context) (*DatabaseTransaction, error) {
|
func (d *Database) NewDatabaseSnapshot(ctx context.Context) (*DatabaseTransaction, error) {
|
||||||
return d.NewDatabaseTransaction(ctx) // TODO: revert
|
txn, err := d.DB.BeginTx(ctx, &sql.TxOptions{
|
||||||
/*
|
// Set the isolation level so that we see a snapshot of the database.
|
||||||
txn, err := d.DB.BeginTx(ctx, &sql.TxOptions{
|
// In PostgreSQL repeatable read transactions will see a snapshot taken
|
||||||
// Set the isolation level so that we see a snapshot of the database.
|
// at the first query, and since the transaction is read-only it can't
|
||||||
// In PostgreSQL repeatable read transactions will see a snapshot taken
|
// run into any serialisation errors.
|
||||||
// at the first query, and since the transaction is read-only it can't
|
// https://www.postgresql.org/docs/9.5/static/transaction-iso.html#XACT-REPEATABLE-READ
|
||||||
// run into any serialisation errors.
|
Isolation: sql.LevelRepeatableRead,
|
||||||
// https://www.postgresql.org/docs/9.5/static/transaction-iso.html#XACT-REPEATABLE-READ
|
ReadOnly: true,
|
||||||
Isolation: sql.LevelRepeatableRead,
|
})
|
||||||
ReadOnly: true,
|
if err != nil {
|
||||||
})
|
return nil, err
|
||||||
if err != nil {
|
}
|
||||||
return nil, err
|
return &DatabaseTransaction{
|
||||||
}
|
Database: d,
|
||||||
return &DatabaseTransaction{
|
txn: txn,
|
||||||
Database: d,
|
}, nil
|
||||||
txn: txn,
|
|
||||||
}, nil
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *Database) NewDatabaseTransaction(ctx context.Context) (*DatabaseTransaction, error) {
|
func (d *Database) NewDatabaseTransaction(ctx context.Context) (*DatabaseTransaction, error) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue