log rollback errors

This commit is contained in:
vyzo 2023-03-13 11:41:46 +02:00 committed by Maciej Witowski
parent 64a380fce3
commit 50d15e32c0

View File

@ -332,14 +332,18 @@ func (x *msgIndex) processHeadChanges(ctx context.Context) error {
for _, hc := range pend {
for _, ts := range hc.rev {
if err := x.doRevert(ctx, tx, ts); err != nil {
tx.Rollback() //nolint
if err := tx.Rollback(); err != nil {
log.Errorf("error rolling back transaction: %s", err)
}
return xerrors.Errorf("error reverting %s: %w", ts, err)
}
}
for _, ts := range hc.app {
if err := x.doApply(ctx, tx, ts); err != nil {
tx.Rollback() //nolint
if err := tx.Rollback(); err != nil {
log.Errorf("error rolling back transaction: %s", err)
}
return xerrors.Errorf("error applying %s: %w", ts, err)
}
}