kvclient: simplify DistSender replica sending loop#51388
Conversation
bb27092 to
7162165
Compare
nvb
left a comment
There was a problem hiding this comment.
Reviewed 1 of 1 files at r1.
Reviewable status:complete! 1 of 0 LGTMs obtained (waiting on @andreimatei and @tbg)
pkg/kv/kvclient/kvcoord/dist_sender.go, line 1765 at r1 (raw file):
var br *roachpb.BatchResponse first := true for {
nit: for first := true; ; first = false {
pkg/kv/kvclient/kvcoord/dist_sender.go, line 1770 at r1 (raw file):
} lastErr := err if err == nil && br != nil {
nit: if lastErr == nil && br != nil {
The DistSender has a loop for trying out the replicas one by one. The first attempt had special code. This made the loop confusing to read, since every iteration was doing its SendNext() attempt at the end and ther next iteration was responsible for dealing with the previous iteration's result. Now there's a single SendNext() call. Release note: None
7162165 to
a014e54
Compare
andreimatei
left a comment
There was a problem hiding this comment.
TFTR!
bors r+
Reviewable status:
complete! 0 of 0 LGTMs obtained (and 1 stale) (waiting on @nvanbenschoten and @tbg)
pkg/kv/kvclient/kvcoord/dist_sender.go, line 1765 at r1 (raw file):
Previously, nvanbenschoten (Nathan VanBenschoten) wrote…
nit:
for first := true; ; first = false {
done
pkg/kv/kvclient/kvcoord/dist_sender.go, line 1770 at r1 (raw file):
Previously, nvanbenschoten (Nathan VanBenschoten) wrote…
nit:
if lastErr == nil && br != nil {
done
andreimatei
left a comment
There was a problem hiding this comment.
bors r+
Reviewable status:
complete! 0 of 0 LGTMs obtained (and 1 stale) (waiting on @nvanbenschoten and @tbg)
Build succeeded |
The DistSender has a loop for trying out the replicas one by one. The
first attempt had special code. This made the loop confusing to read,
since every iteration was doing its SendNext() attempt at the end and
ther next iteration was responsible for dealing with the previous
iteration's result. Now there's a single SendNext() call.
Release note: None