Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
125854: kv: log warnings on merge txn starvation r=nvanbenschoten a=nvanbenschoten

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 (see cockroachdb#110340).

Release note: None

Co-authored-by: Nathan VanBenschoten <[email protected]>
  • Loading branch information
craig[bot] and nvanbenschoten committed Jun 18, 2024
2 parents 5f8edb7 + f94ae01 commit dd4e4ca
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 @@ -950,11 +950,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 dd4e4ca

Please sign in to comment.