Skip to content

Conversation

@sumeerbhola
Copy link
Collaborator

Informs #128308

Epic: CRDB-37515

Release note: None

@sumeerbhola sumeerbhola requested review from kvoli and pav-kv August 9, 2024 19:48
@sumeerbhola sumeerbhola requested a review from a team as a code owner August 9, 2024 19:48
@blathers-crl
Copy link

blathers-crl bot commented Aug 9, 2024

It looks like your PR touches production code but doesn't add or edit any test code. Did you consider adding tests to your PR?

🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.

@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link
Contributor

@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.

:lgtm: - see nit on using roachpb.ReplicaSet, I don't feel strongly enough to block on it but it'd be worthwhile writing down why we don't use it.

Reviewed 2 of 2 files at r1, all commit messages.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @pav-kv and @sumeerbhola)


pkg/kv/kvserver/kvflowcontrol/rac2/range_controller.go line 47 at r1 (raw file):

	//
	// Requires replica.raftMu to be held.
	SetReplicasRaftMuLocked(ctx context.Context, replicas ReplicaSet) error

nit: do we need to use a new replica set type, instead of using the existing roachpb.ReplicaSet? It makes sense to use it internally, within the datastructure if we want map accesses but as an argument it might be nicer to use roachpb.ReplicaSet, which is a wrapped slice and used in many other parts of KV for similar purposes.

@sumeerbhola sumeerbhola requested a review from kvoli August 12, 2024 18:41
Copy link
Collaborator Author

@sumeerbhola sumeerbhola 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! 1 of 0 LGTMs obtained (waiting on @kvoli and @pav-kv)


pkg/kv/kvserver/kvflowcontrol/rac2/range_controller.go line 47 at r1 (raw file):

Previously, kvoli (Austen) wrote…

nit: do we need to use a new replica set type, instead of using the existing roachpb.ReplicaSet? It makes sense to use it internally, within the datastructure if we want map accesses but as an argument it might be nicer to use roachpb.ReplicaSet, which is a wrapped slice and used in many other parts of KV for similar purposes.

The replicaRACv2Integration uses a map for lookups by ReplicaID. There is also one case of such lookups in RangeControllerImpl. These sets are only replaced with a new map (never updated), so it is convenient to share.

And it reduces unnecessary code: in replicaRACv2Integration it would need to produce a map for its internal use and produce a roachpb.ReplicaSet for RangeController, which would then proceed to convert the roachpb.ReplicaSet to a map.

Informs cockroachdb#128308

Epic: CRDB-37515

Release note: None
Copy link
Collaborator Author

@sumeerbhola sumeerbhola left a comment

Choose a reason for hiding this comment

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

TFTR!

I tweaked the commentary about ReplicaSet and SetReplicasRaftMuLocked.

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (and 1 stale) (waiting on @kvoli and @pav-kv)

Copy link
Contributor

@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.

:lgtm:

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

@sumeerbhola
Copy link
Collaborator Author

bors r=kvoli

@craig craig bot merged commit f6b88f5 into cockroachdb:master Aug 12, 2024
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