diff options
author | Neil Alexander <neilalexander@users.noreply.github.com> | 2022-10-03 11:38:20 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-03 11:38:20 +0100 |
commit | d32f60249d8e248d8f8334b044e016ee384797aa (patch) | |
tree | 1bdb07b623d84781fcb499ec0916b5b280a71740 /syncapi/storage | |
parent | d4710217f8d96ee6889e1e4e7c26defc5456b523 (diff) |
Modify sync transaction behaviour (#2758)
This now uses a transaction per stream, so that errors in one stream
don't propagate to another, and we therefore no longer need to do hacks
to reopen a new transaction after aborting a failed one.
Diffstat (limited to 'syncapi/storage')
-rw-r--r-- | syncapi/storage/interface.go | 1 | ||||
-rw-r--r-- | syncapi/storage/shared/storage_sync.go | 13 |
2 files changed, 0 insertions, 14 deletions
diff --git a/syncapi/storage/interface.go b/syncapi/storage/interface.go index be75f8ad..4a03aca7 100644 --- a/syncapi/storage/interface.go +++ b/syncapi/storage/interface.go @@ -29,7 +29,6 @@ import ( type DatabaseTransaction interface { sqlutil.Transaction - Reset() (err error) SharedUsers MaxStreamPositionForPDUs(ctx context.Context) (types.StreamPosition, error) diff --git a/syncapi/storage/shared/storage_sync.go b/syncapi/storage/shared/storage_sync.go index 6cc83ebc..0e19d97d 100644 --- a/syncapi/storage/shared/storage_sync.go +++ b/syncapi/storage/shared/storage_sync.go @@ -31,19 +31,6 @@ func (d *DatabaseTransaction) Rollback() error { return d.txn.Rollback() } -func (d *DatabaseTransaction) Reset() (err error) { - if d.txn == nil { - return nil - } - if err = d.txn.Rollback(); err != nil { - return err - } - if d.txn, err = d.DB.BeginTx(d.ctx, nil); err != nil { - return err - } - return -} - func (d *DatabaseTransaction) MaxStreamPositionForPDUs(ctx context.Context) (types.StreamPosition, error) { id, err := d.OutputEvents.SelectMaxEventID(ctx, d.txn) if err != nil { |