mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-06-16 20:01:23 +02:00
sqldb: add trace logs in ExecuteSQLTransactionWithRetry
This commit is contained in:
parent
e8875e06fe
commit
16348e61db
@ -247,6 +247,9 @@ func ExecuteSQLTransactionWithRetry(ctx context.Context, makeTx MakeTx,
|
|||||||
tx, err := makeTx()
|
tx, err := makeTx()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
dbErr := MapSQLError(err)
|
dbErr := MapSQLError(err)
|
||||||
|
log.Tracef("Failed to makeTx: err=%v, dbErr=%v", err,
|
||||||
|
dbErr)
|
||||||
|
|
||||||
if IsSerializationError(dbErr) {
|
if IsSerializationError(dbErr) {
|
||||||
// Nothing to roll back here, since we haven't
|
// Nothing to roll back here, since we haven't
|
||||||
// even get a transaction yet. We'll just wait
|
// even get a transaction yet. We'll just wait
|
||||||
@ -266,6 +269,8 @@ func ExecuteSQLTransactionWithRetry(ctx context.Context, makeTx MakeTx,
|
|||||||
}()
|
}()
|
||||||
|
|
||||||
if bodyErr := txBody(tx); bodyErr != nil {
|
if bodyErr := txBody(tx); bodyErr != nil {
|
||||||
|
log.Tracef("Error in txBody: %v", bodyErr)
|
||||||
|
|
||||||
// Roll back the transaction, then attempt a random
|
// Roll back the transaction, then attempt a random
|
||||||
// backoff and try again if the error was a
|
// backoff and try again if the error was a
|
||||||
// serialization error.
|
// serialization error.
|
||||||
@ -285,6 +290,8 @@ func ExecuteSQLTransactionWithRetry(ctx context.Context, makeTx MakeTx,
|
|||||||
|
|
||||||
// Commit transaction.
|
// Commit transaction.
|
||||||
if commitErr := tx.Commit(); commitErr != nil {
|
if commitErr := tx.Commit(); commitErr != nil {
|
||||||
|
log.Tracef("Failed to commit tx: %v", commitErr)
|
||||||
|
|
||||||
// Roll back the transaction, then attempt a random
|
// Roll back the transaction, then attempt a random
|
||||||
// backoff and try again if the error was a
|
// backoff and try again if the error was a
|
||||||
// serialization error.
|
// serialization error.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user