Skip to content

kvclient: simplify DistSender replica sending loop#51388

Merged
craig[bot] merged 1 commit intocockroachdb:masterfrom
andreimatei:range-cache.distsender-simplify-repl-loop
Jul 15, 2020
Merged

kvclient: simplify DistSender replica sending loop#51388
craig[bot] merged 1 commit intocockroachdb:masterfrom
andreimatei:range-cache.distsender-simplify-repl-loop

Conversation

@andreimatei
Copy link
Copy Markdown
Contributor

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

@andreimatei andreimatei requested review from nvb and tbg July 13, 2020 19:16
@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

@andreimatei andreimatei force-pushed the range-cache.distsender-simplify-repl-loop branch 2 times, most recently from bb27092 to 7162165 Compare July 14, 2020 20:38
Copy link
Copy Markdown
Contributor

@nvb nvb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewed 1 of 1 files at r1.
Reviewable status: :shipit: 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
@andreimatei andreimatei force-pushed the range-cache.distsender-simplify-repl-loop branch from 7162165 to a014e54 Compare July 14, 2020 22:26
Copy link
Copy Markdown
Contributor Author

@andreimatei andreimatei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TFTR!

bors r+

Reviewable status: :shipit: 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

Copy link
Copy Markdown
Contributor Author

@andreimatei andreimatei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bors r+

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (and 1 stale) (waiting on @nvanbenschoten and @tbg)

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Jul 15, 2020

Build succeeded

@craig craig bot merged commit 94ea451 into cockroachdb:master Jul 15, 2020
@andreimatei andreimatei deleted the range-cache.distsender-simplify-repl-loop branch July 22, 2020 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants