Skip to content

kvserver: make RangeStatsRequest return the desc explicitly#51378

Merged
craig[bot] merged 1 commit intocockroachdb:masterfrom
andreimatei:range-cache.range-stats-explicit-range-info
Jul 15, 2020
Merged

kvserver: make RangeStatsRequest return the desc explicitly#51378
craig[bot] merged 1 commit intocockroachdb:masterfrom
andreimatei:range-cache.range-stats-explicit-range-info

Conversation

@andreimatei
Copy link
Copy Markdown
Contributor

Before this patch, the main user of RangeStatsRequest would ask to get
the range's descriptor through the batches' ReturnRangeInfo field. I'm
trying to get rid of the ReturnRangeInfo field because it's pretty
hacky: it's a batch field, not an individual request field, which means
that the results are not associated with a particular request. Also, the
server does not acquire latches on the range's descriptor/lease keys,
which means that the request is not serialized with others changing
this data, which in turn may or may not be a problem for any particular
caller.

This patch makes the RangeStatsRequest return descriptor/lease info
explicitly, and acquire said latches. The API is now cleaner for the
users of this request.

Release note: None

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

This change is Reviewable

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 9 of 9 files at r1.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @andreimatei and @tbg)


pkg/kv/kvserver/batcheval/cmd_range_stats.go, line 36 at r1 (raw file):

func init() {
	RegisterReadOnlyCommand(roachpb.RangeStats, DefaultDeclareKeys, RangeStats)

s/DefaultDeclareKeys/declareKeysRangeStats/

Hopefully this was caught by testrace.

@andreimatei andreimatei force-pushed the range-cache.range-stats-explicit-range-info branch from bbb2151 to 8a36ec7 Compare July 14, 2020 22:27
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/kvserver/batcheval/cmd_range_stats.go, line 36 at r1 (raw file):

Previously, nvanbenschoten (Nathan VanBenschoten) wrote…

s/DefaultDeclareKeys/declareKeysRangeStats/

Hopefully this was caught by testrace.

it was

Before this patch, the main user of RangeStatsRequest would ask to get
the range's descriptor through the batches' ReturnRangeInfo field. I'm
trying to get rid of the ReturnRangeInfo field because it's pretty
hacky: it's a batch field, not an individual request field, which means
that the results are not associated with a particular request. Also, the
server does not acquire latches on the range's descriptor/lease keys,
which means that the request is not serialized with others changing
this data, which in turn may or may not be a problem for any particular
caller.

This patch makes the RangeStatsRequest return descriptor/lease info
explicitly, and acquire said latches. The API is now cleaner for the
users of this request.

Release note: None
@andreimatei andreimatei force-pushed the range-cache.range-stats-explicit-range-info branch from 8a36ec7 to 1c993e0 Compare July 14, 2020 23:31
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.range-stats-explicit-range-info branch July 22, 2020 15:02
nvb added a commit to nvb/cockroach that referenced this pull request Jan 25, 2021
This commit completes a series of migrations relating to RangeInfo state
and the client/server protocol for keeping the range descriptor cache up
to date. The migrations were started in cockroachdb#51168, cockroachdb#51378, cockroachdb#51437.

Concretely, this commit removes the following cluster versions:
- `ClientRangeInfosOnBatchResponse`
- `RangeStatsRespHasDesc`

It addresses 6 TODOs.

And it makes the following changes to the KV APi:
- makes `Header.ClientRangeInfo` non-nullable.
- deletes `Header.ReturnRangeInfo`.
- deletes `ResponseHeader.DeprecatedRangeInfos`.
- stops propagating `BatchResponse.RangeInfos` past `DistSender`.
- makes RangeStatsResponse.RangeInfo non-nullable.
nvb added a commit to nvb/cockroach that referenced this pull request Jan 26, 2021
This commit completes a series of migrations relating to RangeInfo state
and the client/server protocol for keeping the range descriptor cache up
to date. The migrations were started in cockroachdb#51168, cockroachdb#51378, cockroachdb#51437.

Concretely, this commit removes the following cluster versions:
- `ClientRangeInfosOnBatchResponse`
- `RangeStatsRespHasDesc`

It addresses 6 TODOs.

And it makes the following changes to the KV APi:
- makes `Header.ClientRangeInfo` non-nullable.
- deletes `Header.ReturnRangeInfo`.
- deletes `ResponseHeader.DeprecatedRangeInfos`.
- stops propagating `BatchResponse.RangeInfos` past `DistSender`.
- makes RangeStatsResponse.RangeInfo non-nullable.
craig bot pushed a commit that referenced this pull request Jan 26, 2021
59395: kv: complete client range info migrations r=nvanbenschoten a=nvanbenschoten

This commit completes a series of migrations relating to RangeInfo state
and the client/server protocol for keeping the range descriptor cache up
to date. The migrations were started in #51168, #51378, #51437.

Concretely, this commit removes the following cluster versions:
- `ClientRangeInfosOnBatchResponse`
- `RangeStatsRespHasDesc`

It addresses 6 TODOs.

And it makes the following changes to the KV APi:
- makes `Header.ClientRangeInfo` non-nullable.
- deletes `Header.ReturnRangeInfo`.
- deletes `ResponseHeader.DeprecatedRangeInfos`.
- stops propagating `BatchResponse.RangeInfos` past `DistSender`.
- makes RangeStatsResponse.RangeInfo non-nullable.

Co-authored-by: Nathan VanBenschoten <nvanbenschoten@gmail.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.

3 participants