Skip to content

Commit

Permalink
kv: log warnings on merge txn starvation
Browse files Browse the repository at this point in the history
Informs cockroachdb#125779.

This commit makes logging more verbose when a merge txn appears to be
starved. This would help with debugging cockroachdb#125779, which appears to be a
long-standing rare test flake.

Release note: None
  • Loading branch information
nvanbenschoten committed Jun 18, 2024
1 parent a388af3 commit f94ae01
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pkg/kv/kvserver/replica_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -931,11 +931,15 @@ func (r *Replica) AdminMerge(
// is finicky and only allows disabling pipelining before any operations have
// been sent, even in prior epochs. Calling DisablePipelining() on a restarted
// transaction yields an error.
for {
for attempt := 1; ; attempt++ {
txn := kv.NewTxn(ctx, r.store.DB(), r.NodeID())
err := runMergeTxn(txn)
if err != nil {
log.VEventf(ctx, 2, "merge txn failed: %s", err)
if attempt < 3 {
log.VEventf(ctx, 2, "merge txn failed: %s", err)
} else {
log.Warningf(ctx, "merge txn failed (attempt %d): %s", attempt, err)
}
if rollbackErr := txn.Rollback(ctx); rollbackErr != nil {
log.VEventf(ctx, 2, "merge txn rollback failed: %s", rollbackErr)
}
Expand Down

0 comments on commit f94ae01

Please sign in to comment.