Skip to content

kvserver: version gate locality-aware load-based rebalancing#80190

Merged
craig[bot] merged 2 commits intocockroachdb:masterfrom
aayushshah15:20220328_reintroduceOldStoreRebalancer
Apr 26, 2022
Merged

kvserver: version gate locality-aware load-based rebalancing#80190
craig[bot] merged 2 commits intocockroachdb:masterfrom
aayushshah15:20220328_reintroduceOldStoreRebalancer

Conversation

@aayushshah15
Copy link
Copy Markdown
Contributor

@aayushshah15 aayushshah15 commented Apr 19, 2022

This commit introduces a set of deprecated store rebalancer methods
corresponding to the pre-22.1 load-rebalancing scheme. Until a store detects
that the version upgrade (to 22.1) has been finalized, the store will fall back
to the old (pre-22.1) load-based rebalancing logic that wasn't locality aware.

This is done in order to minimize risk of unexpected behavior in mixed version
clusters.

All the tests corresponding to the old logic have been re-introduced, and are unchanged.

Resolves #76702

Release note: None

@aayushshah15 aayushshah15 requested a review from a team as a code owner April 19, 2022 18:53
@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

@aayushshah15 aayushshah15 force-pushed the 20220328_reintroduceOldStoreRebalancer branch 3 times, most recently from 6c95ef6 to 1439337 Compare April 19, 2022 21:16
@aayushshah15 aayushshah15 requested a review from nvb April 19, 2022 21:35
@aayushshah15 aayushshah15 force-pushed the 20220328_reintroduceOldStoreRebalancer branch from 1439337 to c2dc4bb Compare April 19, 2022 21:35
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.

Reviewed 7 of 7 files at r1, 1 of 1 files at r2, all commit messages.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @aayushshah15)


-- commits, line 7 at r1:
Could you link to the commit(s) that this is referencing? I know a lot of this was changed in 13ac983, but it's difficult for me to convince myself that the logic in pkg/kv/kvserver/deprecated_store_rebalancer.go is exactly the same as it was before that commit. It doesn't appear to be. Were there other changes in this area that impacted that logic?

Did you pull pkg/kv/kvserver/deprecated_store_rebalancer.go straight from the release-21.2 release branch? Were any changes needed?


pkg/cmd/roachtest/tests/rebalance_load.go, line 72 at r2 (raw file):

			// Upgrade some (or all) of the first N-1 nodes. Ignore the very last node
			// since it is the app node.
			lastNodeToUpgrade := rand.Intn(c.Spec().NodeCount - 1)

rand.Intn returns a value from the interval [0,n). So this is returning a value between [0, node_count - 1). We then pass this to c.Range, which expects 1-indexed node IDs. Does this mean that we'll never update the last CRDB node and sometimes not even update the first?


pkg/kv/kvserver/allocator_scorer.go, line 919 at r1 (raw file):

		// NB: This is only applicable in mixed version clusters.
		// `rankedCandidateListForAllocation` will never be called in 22.1 with a
		// `qpsScorerOptions`.

When should we plan to remove this kind of compatibility logic?

@aayushshah15 aayushshah15 force-pushed the 20220328_reintroduceOldStoreRebalancer branch from c2dc4bb to 1a9d18d Compare April 20, 2022 22:06
Copy link
Copy Markdown
Contributor Author

@aayushshah15 aayushshah15 left a comment

Choose a reason for hiding this comment

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

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


-- commits, line 7 at r1:

Previously, nvanbenschoten (Nathan VanBenschoten) wrote…

Could you link to the commit(s) that this is referencing? I know a lot of this was changed in 13ac983, but it's difficult for me to convince myself that the logic in pkg/kv/kvserver/deprecated_store_rebalancer.go is exactly the same as it was before that commit. It doesn't appear to be. Were there other changes in this area that impacted that logic?

Did you pull pkg/kv/kvserver/deprecated_store_rebalancer.go straight from the release-21.2 release branch? Were any changes needed?

This was pulled straight from release-21.2 with no material changes. None of the tests were changed either.

I did so because, as you mentioned, there were a bunch of changes in the area because of #65379 and #72296 (and other minor commits), which I didn't want.


pkg/cmd/roachtest/tests/rebalance_load.go, line 72 at r2 (raw file):

Does this mean that we'll never update the last CRDB node

Yep, this was intentional, though I did want to update at least one node. Updated.


pkg/kv/kvserver/allocator_scorer.go, line 919 at r1 (raw file):

Previously, nvanbenschoten (Nathan VanBenschoten) wrote…

When should we plan to remove this kind of compatibility logic?

Updated the comment.

We don't need to merge this PR on master but I thought that was a good idea regardless, in order to get the extra CI coverage.

@aayushshah15 aayushshah15 force-pushed the 20220328_reintroduceOldStoreRebalancer branch 3 times, most recently from 01d15a6 to 0bdf58f Compare April 20, 2022 22:18
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 4 of 5 files at r3, 1 of 1 files at r4, all commit messages.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @aayushshah15)

@aayushshah15 aayushshah15 force-pushed the 20220328_reintroduceOldStoreRebalancer branch 2 times, most recently from 2809e19 to a93168a Compare April 25, 2022 22:19
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 10 of 13 files at r5, 3 of 3 files at r6, all commit messages.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @aayushshah15)

This commit introduces a set of deprecated store rebalancer methods
corresponding to the pre-22.1 load-rebalancing scheme. Until a store detects
that the version upgrade (to 22.1) has been finalized, the store will fall back
to the old (pre-22.1) load-based rebalancing logic that wasn't locality aware.

This is done in order to minimize risk of unexpected behavior in mixed version
clusters.

Resolves cockroachdb#76702

Release note: None
…htests

This is meant to de-risk the first commit in this patch, which re-introduces
the 21.2 store-rebalancer logic to be used in mixed-version settings.

Release note: None
@aayushshah15
Copy link
Copy Markdown
Contributor Author

TFTR!

bors r+

@aayushshah15
Copy link
Copy Markdown
Contributor Author

Bumping the priority on this so this can go in before I merge the backport and we can close the blocker out.

bors p=999

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Apr 26, 2022

Build succeeded:

@craig craig bot merged commit 8944fd0 into cockroachdb:master Apr 26, 2022
irfansharif added a commit to irfansharif/cockroach that referenced this pull request Aug 12, 2022
This code was (re-)added in cockroachdb#80190 to version gate the new 22.1 store
rebalancer behavior by keeping the 21.2 one form around. In 22.2 code
though we can and did get rid of the version gate (cockroachdb#85777), so all this
code can be removed.

Release note: None
craig bot pushed a commit that referenced this pull request Aug 13, 2022
86060: kvserver: rm EnableNewStoreRebalancer detritus r=irfansharif a=irfansharif

This code was (re-)added in #80190 to version gate the new 22.1 store
rebalancer behavior by keeping the 21.2 form around. In 22.2 code
though we can and did get rid of the version gate (#85777), so all this
code can be removed.

Release note: None

86064: vendor: bump Pebble to 84fa6a019ed4 r=erikgrinaker,nicktrav a=jbowens

```
84fa6a01 db: add Metrics.Keys.RangeKeySetsCount
f4b082db db: avoid defragmenting beyond prefix bounds during prefix iteration
c135b6df metamorphic: use pointer receiver
```

Release note: None

Co-authored-by: irfan sharif <irfanmahmoudsharif@gmail.com>
Co-authored-by: Jackson Owens <jackson@cockroachlabs.com>
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.

kvserver: version gate the new StoreRebalancer implementation

3 participants