Skip to content

Commit

Permalink
storage: improve message on slow Raft proposal
Browse files Browse the repository at this point in the history
Release note: None
  • Loading branch information
tbg committed Feb 11, 2019
1 parent 40e4035 commit 0c36412
Showing 1 changed file with 24 additions and 7 deletions.
31 changes: 24 additions & 7 deletions pkg/storage/replica_write.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,16 +221,33 @@ func (r *Replica) tryExecuteWriteBatch(
return propResult.Reply, propResult.Err, propResult.ProposalRetry
case <-slowTimer.C:
slowTimer.Read = true
log.Warningf(ctx, "have been waiting %s for proposing command %s",
base.SlowRequestThreshold, ba)
log.Warningf(ctx, `have been waiting %.2fs for proposing command %s.
This range is likely unavailable.
Please submit this message at
https://github.com/cockroachdb/cockroach/issues/new/choose
along with
https://yourhost:8080/#/reports/range/%d
and the following Raft status: %+v`,
timeutil.Since(tBegin).Seconds(),
ba,
r.RangeID,
r.RaftStatus(),
)
r.store.metrics.SlowRaftRequests.Inc(1)
defer func() {
r.store.metrics.SlowRaftRequests.Dec(1)
contextStr := ""
if err := ctx.Err(); err != nil {
contextStr = " with context cancellation"
}
log.Infof(ctx, "slow command %s finished after %s%s", ba, timeutil.Since(tBegin), contextStr)
log.Infof(
ctx,
"slow command %s finished after %.2fs with error %v, retry %d",
ba,
timeutil.Since(tBegin).Seconds(),
pErr,
retry,
)
}()

case <-ctxDone:
Expand Down

0 comments on commit 0c36412

Please sign in to comment.