Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allocator: add support for store pool liveness overrides #91965

Merged

Conversation

AlexTalks
Copy link
Contributor

While previously the allocator only evaluated using liveness obtained
from gossip, this change introduces a new OverrideStorePool struct
which can be used to override the liveness of a node for the purposes of
evaluating allocator actions and targets. This OverrideStorePool is
backed by an existing actual StorePool, which retains the majority of
its logic.

Depends on #91461.

Part of #91570.

Release note: None

@AlexTalks AlexTalks requested a review from a team as a code owner November 16, 2022 01:31
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@AlexTalks AlexTalks force-pushed the dpf_allocator_override_storepool branch from d1ed4e0 to 74a4d61 Compare November 16, 2022 01:32
AlexTalks added a commit to AlexTalks/cockroach that referenced this pull request Nov 16, 2022
This change adds methods to be to evaluate allocator actions and targets
utilizing a passed-in `StorePool` object, allowing for the allocator to
consider potential scenarios rather than those simply based on the
current liveness.

Depends on cockroachdb#91461, cockroachdb#91965.

Part of cockroachdb#91570.

Release note: None
@AlexTalks AlexTalks force-pushed the dpf_allocator_override_storepool branch 2 times, most recently from 06e8e09 to a8b0179 Compare November 17, 2022 20:08
@AlexTalks AlexTalks force-pushed the dpf_allocator_override_storepool branch from a8b0179 to 225fa94 Compare November 18, 2022 20:28
@AlexTalks AlexTalks force-pushed the dpf_allocator_override_storepool branch from 225fa94 to 45dd43f Compare November 18, 2022 22:31
AlexTalks added a commit to AlexTalks/cockroach that referenced this pull request Nov 18, 2022
This change adds methods to be to evaluate allocator actions and targets
utilizing a passed-in `StorePool` object, allowing for the allocator to
consider potential scenarios rather than those simply based on the
current liveness.

Depends on cockroachdb#91461, cockroachdb#91965.

Part of cockroachdb#91570.

Release note: None
@AlexTalks AlexTalks force-pushed the dpf_allocator_override_storepool branch from 45dd43f to e79788d Compare November 23, 2022 05:04
AlexTalks added a commit to AlexTalks/cockroach that referenced this pull request Nov 23, 2022
This change adds methods to be to evaluate allocator actions and targets
utilizing a passed-in `StorePool` object, allowing for the allocator to
consider potential scenarios rather than those simply based on the
current liveness.

Depends on cockroachdb#91461, cockroachdb#91965.

Part of cockroachdb#91570.

Release note: None
Copy link
Collaborator

@kvoli kvoli left a comment

Choose a reason for hiding this comment

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

Reviewed 5 of 5 files at r1, all commit messages.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @AlexTalks and @andrewbaptist)


pkg/kv/kvserver/allocator/storepool/override_store_pool.go line 29 at r1 (raw file):

// The OverrideStorePool's methods fall through to the underlying StorePool
// while passing in the configured NodeLivenessFunc to be used in place of the
// underlying StorePool's. This is only the case, however, for StorePool methods

nit: This last sentence is hard to parse - could it be reworded to be clearer?

Code quote:

// underlying StorePool's. This is only the case, however, for StorePool methods
// that are read-only, despite StorePool.DetailsMu being held in write mode in
// some functions, avoiding the possibility of mutating underlying state.

pkg/kv/kvserver/allocator/storepool/override_store_pool_test.go line 179 at r1 (raw file):

	liveReplicas, deadReplicas := sp.LiveAndDeadReplicas(replicas, false /* includeSuspectAndDrainingStores */)
	if len(liveReplicas) != 5 {
		t.Fatalf("expected five live replicas, found %d (%v)", len(liveReplicas), liveReplicas)

Why not use the require lib in these tests?

While previously the allocator only evaluated using liveness obtained
from gossip, this change introduces a new `OverrideStorePool` struct
which can be used to override the liveness of a node for the purposes of
evaluating allocator actions and targets.  This `OverrideStorePool` is
backed by an existing actual `StorePool`, which retains the majority of
its logic.

Depends on cockroachdb#91461.

Part of cockroachdb#91570.

Release note: None
@AlexTalks AlexTalks force-pushed the dpf_allocator_override_storepool branch from e79788d to 8ae3466 Compare December 9, 2022 23:29
Copy link
Contributor Author

@AlexTalks AlexTalks 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 @andrewbaptist and @kvoli)


pkg/kv/kvserver/allocator/storepool/override_store_pool_test.go line 179 at r1 (raw file):

Previously, kvoli (Austen) wrote…

Why not use the require lib in these tests?

Done.

@AlexTalks
Copy link
Contributor Author

bors r+

@craig
Copy link
Contributor

craig bot commented Dec 10, 2022

Build succeeded:

@craig craig bot merged commit 072ec8d into cockroachdb:master Dec 10, 2022
AlexTalks added a commit to AlexTalks/cockroach that referenced this pull request Dec 15, 2022
This change adds methods to be to evaluate allocator actions and targets
utilizing a passed-in `StorePool` object, allowing for the allocator to
consider potential scenarios rather than those simply based on the
current liveness.

Depends on cockroachdb#91461, cockroachdb#91965.

Part of cockroachdb#91570.

Release note: None
AlexTalks added a commit to AlexTalks/cockroach that referenced this pull request Dec 19, 2022
This change adds methods to be to evaluate allocator actions and targets
utilizing a passed-in `StorePool` object, allowing for the allocator to
consider potential scenarios rather than those simply based on the
current liveness.

Depends on cockroachdb#91461, cockroachdb#91965.

Part of cockroachdb#91570.

Release note: None
AlexTalks added a commit to AlexTalks/cockroach that referenced this pull request Dec 20, 2022
This change adds methods to be to evaluate allocator actions and targets
utilizing a passed-in `StorePool` object, allowing for the allocator to
consider potential scenarios rather than those simply based on the
current liveness.

Depends on cockroachdb#91461, cockroachdb#91965.

Part of cockroachdb#91570.

Release note: None
AlexTalks added a commit to AlexTalks/cockroach that referenced this pull request Dec 21, 2022
This change adds methods to evaluate allocator actions and targets
utilizing a passed-in `StorePool` object, allowing for the allocator to
consider potential scenarios rather than those simply based on the
current liveness.

Depends on cockroachdb#91461, cockroachdb#91965.

Part of cockroachdb#91570.

Release note: None
AlexTalks added a commit to AlexTalks/cockroach that referenced this pull request Dec 21, 2022
This change adds methods to evaluate allocator actions and targets
utilizing a passed-in `StorePool` object, allowing for the allocator to
consider potential scenarios rather than those simply based on the
current liveness.

Depends on cockroachdb#91461, cockroachdb#91965.

Part of cockroachdb#91570.

Release note: None
adityamaru pushed a commit to adityamaru/cockroach that referenced this pull request Dec 22, 2022
This change adds methods to evaluate allocator actions and targets
utilizing a passed-in `StorePool` object, allowing for the allocator to
consider potential scenarios rather than those simply based on the
current liveness.

Depends on cockroachdb#91461, cockroachdb#91965.

Part of cockroachdb#91570.

Release note: None
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