Created
November 2, 2022 14:05
-
-
Save tbg/da882967a802667f4a0e014f2a593807 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // When the server shuts down there may be proposals inflight. They may have | |
| // a trace span attached to them, so close those out properly. This is mostly | |
| // to appease the span leak check in TestCluster. | |
| // | |
| // TODO(during review): this doesn't actually fix it, when you make the skip | |
| // in TestReplicaRemovalClosesProposalQuota unconditional we still leak the | |
| // same spans within ~a minute. | |
| stopper.AddCloser(stop.CloserFn(func() { | |
| s.VisitReplicas(func(repl *Replica) (wantMore bool) { | |
| // NB: we may not need raftMu but doesn't hurt either. | |
| repl.raftMu.Lock() | |
| defer repl.raftMu.Unlock() | |
| repl.mu.Lock() | |
| defer repl.mu.Unlock() | |
| for _, p := range repl.mu.proposals { | |
| p.finishApplication(context.Background(), proposalResult{ | |
| Err: roachpb.NewError(roachpb.NewAmbiguousResultError(errors.New("shutting down"))), | |
| }) | |
| } | |
| return true // want more | |
| }) | |
| })) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment