Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

soroban-rpc: remove noisy rollback message #1052

Merged
merged 2 commits into from
Oct 26, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions cmd/soroban-rpc/internal/ingest/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/stellar/go/historyarchive"
"github.com/stellar/go/ingest"
backends "github.com/stellar/go/ingest/ledgerbackend"
supportdb "github.com/stellar/go/support/db"
"github.com/stellar/go/support/log"
"github.com/stellar/go/xdr"

Expand Down Expand Up @@ -208,9 +209,14 @@ func (s *Service) fillEntriesFromCheckpoint(ctx context.Context, archive history
if err != nil {
return err
}
transactionCommitted := false
defer func() {
if err := tx.Rollback(); err != nil {
s.logger.WithError(err).Warn("could not rollback fillEntriesFromCheckpoint write transactions")
if !transactionCommitted {
// Internally, we might already have rolled back the transaction. We should
// not generate benign error/warning here in case the transaction was already rolled back.
if rollbackErr := tx.Rollback(); rollbackErr != nil && rollbackErr != supportdb.ErrAlreadyRolledback {
s.logger.WithError(rollbackErr).Warn("could not rollback fillEntriesFromCheckpoint write transactions")
}
}
}()

Expand All @@ -222,9 +228,12 @@ func (s *Service) fillEntriesFromCheckpoint(ctx context.Context, archive history
}

s.logger.Info("committing checkpoint ledger entries")
if err := tx.Commit(checkpointLedger); err != nil {
err = tx.Commit(checkpointLedger)
transactionCommitted = true
if err != nil {
return err
}

s.logger.Info("finished checkpoint processing")
return nil
}
Expand Down
Loading