Skip to content

Commit

Permalink
Merge pull request cockroachdb#10625 from a-robinson/consist
Browse files Browse the repository at this point in the history
storage: Use background ctx when rerunning replica consistency check
  • Loading branch information
a-robinson authored Nov 11, 2016
2 parents a9cd9f5 + 3b6f6cb commit c67ee45
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions pkg/storage/replica_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -1902,17 +1902,18 @@ func (r *Replica) CheckConsistency(
}
logFunc(ctx, "consistency check failed with %d inconsistent replicas", inconsistencyCount)
} else {
if err := r.store.stopper.RunAsyncTask(ctx, func(ctx context.Context) {
log.Errorf(ctx, "consistency check failed with %d inconsistent replicas; fetching details",
inconsistencyCount)
// Keep the request from crossing the local->global boundary.
if bytes.Compare(key, keys.LocalMax) < 0 {
key = keys.LocalMax
}
if err := r.store.db.CheckConsistency(ctx, key, endKey, true /* withDiff */); err != nil {
log.Error(ctx, errors.Wrap(err, "could not rerun consistency check"))
}
}); err != nil {
if err := r.store.stopper.RunAsyncTask(
r.AnnotateCtx(context.Background()), func(ctx context.Context) {
log.Errorf(ctx, "consistency check failed with %d inconsistent replicas; fetching details",
inconsistencyCount)
// Keep the request from crossing the local->global boundary.
if bytes.Compare(key, keys.LocalMax) < 0 {
key = keys.LocalMax
}
if err := r.store.db.CheckConsistency(ctx, key, endKey, true /* withDiff */); err != nil {
log.Error(ctx, errors.Wrap(err, "could not rerun consistency check"))
}
}); err != nil {
log.Error(ctx, errors.Wrap(err, "could not rerun consistency check"))
}
}
Expand Down

0 comments on commit c67ee45

Please sign in to comment.