-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
kvserver, server: new implementation of SpanStats suitable for use with coalesced ranges #96223
kvserver, server: new implementation of SpanStats suitable for use with coalesced ranges #96223
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am so happy to see this PR. Thank you zach.
As a minor point, would you be open to having this code inside the sql
package or one of its sub-packages. This way we can also think about embedding this estimate in SQL functions that the SQL obs team is currently implementing (@THardy98)
Reviewable status: complete! 0 of 0 LGTMs obtained
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would you be open to having this code inside the sql package or one of its sub-packages.
Sure! Pending any feedback or issues with my implementation so far, I'll make this more accessible for other callers.
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @ajwerner)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @ajwerner and @zachlite)
pkg/server/status.go
line 3415 at r1 (raw file):
return status.SpanStats(ctx, req) } fetcher := rangestats.NewFetcher(s.db)
Before we move forward with the review, may I suggest you extract this code into a separate function, with a clear API interface.
It should probably take start/end keys as parameters. And return StoreKeySpanStats. Probably something like the same API interface as the original Compute function you've removed.
Inside this function, it would also be good to avoid accumulating the descriptors in an array. You can interleave the iteration with the extraction of the stats below.
Nice :) Looking a bit further ahead, it would be really nice to be able to get stats for multiple spans at once - which I understand is outside the scope of the initial issue description:
but would be incredibly useful on the SQL Obs side to get stats for many table spans. Currently, we have to get table stats per table, which means a node fanout for each table span, where we could be dealing with 100s or 1000s of tables. It would be great to issue a single fanout for a collection of table spans, considering that (as I understand it), the actual range stats collection for multiple spans can be done cheaply. Perhaps not for this PR, but would be really nice in a followup. |
13ca09a
to
4835645
Compare
4835645
to
69b6714
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@knz
I've made span stats available for consumption by pkg/sql
by putting the logic behind a new spanstats.Accessor
interface. The idea is that there will be two implementations of spanstats.Accessor
, because access to KV is dependent on the type and location of the tenant.
So far, this PR includes the first implementation: spanstatsaccessor.LocalAccessor
. This implementation is meant for consumers of span stats that are co-located on a KV node.
For the second implementation, I'm planning on kvtenantccl.Connector
implementing the spanstats.Accessor
interface.
And I'm sorry about the diff noise - I had to reclaim the name span_stats_server
from my work on the Key Visualizer, so there's a file rename in this PR.
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @ajwerner, @knz, and @mgartner)
pkg/server/status.go
line 3415 at r1 (raw file):
Previously, knz (Raphael 'kena' Poss) wrote…
Before we move forward with the review, may I suggest you extract this code into a separate function, with a clear API interface.
It should probably take start/end keys as parameters. And return StoreKeySpanStats. Probably something like the same API interface as the original Compute function you've removed.Inside this function, it would also be good to avoid accumulating the descriptors in an array. You can interleave the iteration with the extraction of the stats below.
ack.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay this PR is in a much better shape now. Thanks for the investment.
The main remaining topic I'd like to cover is the selection of node IDs.
In the code you're replacing, we have this function nodeIDsAndRangeCountForSpan()
in pkg/server
which is used by (s *adminServer) statsForSpan()
to avoid going to every node to ask about stats for just a few ranges.
Your solution as currently implemented goes to talk to every node in every case. That seems a bit expensive.
Is there a way to be more intelligent here, by discovering which nodes have ranges for the span under consideration, and only calling InternalSpanStats on these nodes?
Reviewed 2 of 7 files at r1, 20 of 20 files at r2, all commit messages.
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @ajwerner, @mgartner, and @zachlite)
-- commits
line 2 at r2:
Please massage this commit title / message to give it more structure.
pkg/kv/kvclient/spanstats/span_stats.go
line 23 at r2 (raw file):
// boundary. type Accessor interface {
nit: remove empty line.
pkg/kv/kvclient/spanstats/spanstatsaccessor/accessor.go
line 27 at r2 (raw file):
endKey roachpb.Key, nodeID roachpb.NodeID, ) (*serverpb.InternalSpanStatsResponse, error) {
nit: ditto
pkg/server/key_visualizer_server.go
line 48 at r2 (raw file):
ctx context.Context, req *keyvispb.UpdateBoundariesRequest, ) error {
nit: ditto
pkg/server/key_visualizer_server.go
line 50 at r2 (raw file):
encoded, err := protoutil.Marshal(req)
nit: remove empty line here too.
pkg/server/key_visualizer_server.go
line 117 at r2 (raw file):
"iterating nodes for key visualizer samples", dialFn, nodeFn, responseFn, errorFn)
ditto
pkg/server/key_visualizer_server.go
line 140 at r2 (raw file):
// spans. func verifySampleBoundariesEqual(fragments []keyvispb.Sample) bool {
ditto
pkg/server/server.go
line 847 at r2 (raw file):
// Instantiate the span stats server. There is a circular dependency // between server.spanStatsServer and server.systemStatusServer. spanStats := &spanStatsServer{
Can you coordinate with @dhartunian to double check how this is meant to work for secondary tenant servers.
pkg/server/serverpb/span_stats.proto
line 43 at r2 (raw file):
service SpanStats { rpc GetSpanStats(InternalSpanStatsRequest) returns (InternalSpanStatsResponse) {} }
nit: missing newline at end of file.
pkg/kv/kvserver/client_status_test.go
line 81 at r2 (raw file):
_ = tcase t.Errorf("implement me") //start, end := tcase.startKey, tcase.endKey
Don't forget to do this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the feedback. I'll take a look.
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @ajwerner and @mgartner)
69b6714
to
3baa165
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @ajwerner, @dhartunian, @knz, and @mgartner)
pkg/kv/kvclient/spanstats/span_stats.go
line 23 at r2 (raw file):
Previously, knz (Raphael 'kena' Poss) wrote…
nit: remove empty line.
Done.
pkg/kv/kvclient/spanstats/spanstatsaccessor/accessor.go
line 27 at r2 (raw file):
Previously, knz (Raphael 'kena' Poss) wrote…
nit: ditto
Done.
pkg/server/key_visualizer_server.go
line 48 at r2 (raw file):
Previously, knz (Raphael 'kena' Poss) wrote…
nit: ditto
Done.
pkg/server/key_visualizer_server.go
line 50 at r2 (raw file):
Previously, knz (Raphael 'kena' Poss) wrote…
nit: remove empty line here too.
Done.
pkg/server/key_visualizer_server.go
line 117 at r2 (raw file):
Previously, knz (Raphael 'kena' Poss) wrote…
ditto
Done.
pkg/server/key_visualizer_server.go
line 140 at r2 (raw file):
Previously, knz (Raphael 'kena' Poss) wrote…
ditto
Done.
pkg/server/server.go
line 847 at r2 (raw file):
Previously, knz (Raphael 'kena' Poss) wrote…
Can you coordinate with @dhartunian to double check how this is meant to work for secondary tenant servers.
👍
pkg/server/serverpb/span_stats.proto
line 43 at r2 (raw file):
Previously, knz (Raphael 'kena' Poss) wrote…
nit: missing newline at end of file.
Done.
pkg/kv/kvserver/client_status_test.go
line 81 at r2 (raw file):
Previously, knz (Raphael 'kena' Poss) wrote…
Don't forget to do this.
Done.
3baa165
to
385d4ef
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: i've renamed the PR: the work is about enabling coalesced ranges and is not specific to multi-tenancy. (Coalesced ranges are pretty much necessary to CC serverless, but they would be useful to everyone else too, but we can't enable them until the issue you're working on here is fixed.)
Beyond that, this mostly looks good. I'm generally happy with where you brought this. Let's be extra careful about the authorization rule though.
After that, let's also be mindful that the folk who need to sign off on your approach (because they maintain this API infrastructure) are our obs-inf coworkers. So please go through the remaining review iterations with them as well.
Reviewed 23 of 27 files at r3, 4 of 4 files at r4, all commit messages.
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @ajwerner, @mgartner, and @zachlite)
-- commits
line 2 at r4:
NB: the first line in a commit message has a special role, it is called the "commit title" and shows up in many places - the git log summary, patch headers, etc.
So it needs to be structured like a title. See this for guidance:
https://cockroachlabs.atlassian.net/wiki/spaces/CRDB/pages/73072807/Git+Commit+Messages#Commit-title
-- commits
line 8 at r4:
Thanks for enumerating the 3 components.
For each of them, can you also sketch what client components use the new component and where in the source code this happens.
Generally, it would be useful to understand by reading the commit message which go interface / components you've connected to each other to make it work.
pkg/rpc/auth_tenant.go
line 119 at r4 (raw file):
case "/cockroach.server.serverpb.Status/SpanStats": return a.authTenant(tenID)
That won't do. You need to extend the verification to the start/end keys in the request, that they are properly contained inside the tenant keyspace.
See authRangeFeed
for an example.
385d4ef
to
0516358
Compare
Extends: cockroachdb#96223 This PR extends the implementation of our SpanStats RPC endpoint to fetch stats for multiple spans at once. By extending the endpoint, we amortize the cost of the RPC's node fanout across all requested spans, whereas previously, we were issuing a fanout per span requested. Additionally, this change batches KV layer requests for ranges fully contained by the span, instead of issuing a request per fully contained range. Release note: None https://cockroachlabs.atlassian.net/browse/DOC-1355 #Informs: cockroachdb#33316 #Epic: CRDB-8035
Extends: cockroachdb#96223 This PR extends the implementation of our SpanStats RPC endpoint to fetch stats for multiple spans at once. By extending the endpoint, we amortize the cost of the RPC's node fanout across all requested spans, whereas previously, we were issuing a fanout per span requested. Additionally, this change batches KV layer requests for ranges fully contained by the span, instead of issuing a request per fully contained range. Release note: None https://cockroachlabs.atlassian.net/browse/DOC-1355 #Informs: cockroachdb#33316 #Epic: CRDB-8035
Extends: cockroachdb#96223 This PR extends the implementation of our SpanStats RPC endpoint to fetch stats for multiple spans at once. By extending the endpoint, we amortize the cost of the RPC's node fanout across all requested spans, whereas previously, we were issuing a fanout per span requested. Additionally, this change batches KV layer requests for ranges fully contained by the span, instead of issuing a request per fully contained range. Release note (sql change): span statistics are unavailable on mixed-version clusters CRDB-8035
Extends: cockroachdb#96223 This PR extends the implementation of our SpanStats RPC endpoint to fetch stats for multiple spans at once. By extending the endpoint, we amortize the cost of the RPC's node fanout across all requested spans, whereas previously, we were issuing a fanout per span requested. Additionally, this change batches KV layer requests for ranges fully contained by the span, instead of issuing a request per fully contained range. Release note (sql change): span statistics are unavailable on mixed-version clusters CRDB-8035
Extends: cockroachdb#96223 This PR extends the implementation of our SpanStats RPC endpoint to fetch stats for multiple spans at once. By extending the endpoint, we amortize the cost of the RPC's node fanout across all requested spans, whereas previously, we were issuing a fanout per span requested. Additionally, this change batches KV layer requests for ranges fully contained by the span, instead of issuing a request per fully contained range. Release note (sql change): span statistics are unavailable on mixed-version clusters
Extends: cockroachdb#96223 This PR extends the implementation of our SpanStats RPC endpoint to fetch stats for multiple spans at once. By extending the endpoint, we amortize the cost of the RPC's node fanout across all requested spans, whereas previously, we were issuing a fanout per span requested. Additionally, this change batches KV layer requests for ranges fully contained by the span, instead of issuing a request per fully contained range. Release note (sql change): span statistics are unavailable on mixed-version clusters
101378: server: support multi-span statistics endpoint r=THardy98 a=THardy98 Epic: None Extends: #96223 This PR extends the implementation of our SpanStats RPC endpoint to fetch stats for multiple spans at once. By extending the endpoint, we amortize the cost of the RPC's node fanout across all requested spans, whereas previously, we were issuing a fanout per span requested. Additionally, this change batches KV layer requests for ranges fully contained by the span, instead of issuing a request per fully contained range. Note that we do not deprecate the `start_key` and `end_key` fields as they're used to determine whether an old node is calling out to a node using the new proto format. The changes here explicitly do not support mixed-version clusters. ---- **BENCHMARK RESULTS** Here are some benchmark results from running: ``` BENCHTIMEOUT=72h PKG=./pkg/server BENCHES=BenchmarkSpanStats ./scripts/bench HEAD^ HEAD ``` **Note** that `HEAD` is actually a temp change to revert to old logic (request per span) and `HEAD^` is the new logic (multi-span request). As such the _increases_ in latency/memory are actually _reductions_. ``` name old time/op new time/op delta SpanStats/3node/BenchmarkSpanStats_-_span_stats_for_3_node_cluster,_collecting_10_spans_with_25_ranges_each-24 10.3ms ± 2% 24.5ms ± 2% +137.38% (p=0.000 n=10+10) SpanStats/3node/BenchmarkSpanStats_-_span_stats_for_3_node_cluster,_collecting_10_spans_with_50_ranges_each-24 17.1ms ± 2% 31.3ms ± 1% +83.29% (p=0.000 n=10+10) SpanStats/3node/BenchmarkSpanStats_-_span_stats_for_3_node_cluster,_collecting_10_spans_with_100_ranges_each-24 30.5ms ± 2% 102.7ms ± 3% +236.55% (p=0.000 n=10+10) SpanStats/3node/BenchmarkSpanStats_-_span_stats_for_3_node_cluster,_collecting_100_spans_with_25_ranges_each-24 1.75s ± 5% 2.10s ± 2% +19.89% (p=0.000 n=10+8) SpanStats/3node/BenchmarkSpanStats_-_span_stats_for_3_node_cluster,_collecting_100_spans_with_50_ranges_each-24 3.00s ± 1% 3.43s ± 1% +14.35% (p=0.000 n=8+9) SpanStats/3node/BenchmarkSpanStats_-_span_stats_for_3_node_cluster,_collecting_100_spans_with_100_ranges_each-24 5.01s ± 1% 5.53s ± 1% +10.44% (p=0.000 n=9+9) SpanStats/3node/BenchmarkSpanStats_-_span_stats_for_3_node_cluster,_collecting_200_spans_with_25_ranges_each-24 9.66s ± 1% 10.63s ± 1% +10.10% (p=0.000 n=9+9) SpanStats/3node/BenchmarkSpanStats_-_span_stats_for_3_node_cluster,_collecting_200_spans_with_50_ranges_each-24 15.2s ± 1% 16.2s ± 0% +6.61% (p=0.000 n=9+9) SpanStats/3node/BenchmarkSpanStats_-_span_stats_for_3_node_cluster,_collecting_200_spans_with_100_ranges_each-24 17.4s ± 1% 18.6s ± 1% +7.31% (p=0.000 n=9+9) name old alloc/op new alloc/op delta SpanStats/3node/BenchmarkSpanStats_-_span_stats_for_3_node_cluster,_collecting_10_spans_with_25_ranges_each-24 3.91MB ± 2% 18.55MB ± 1% +374.43% (p=0.000 n=9+9) SpanStats/3node/BenchmarkSpanStats_-_span_stats_for_3_node_cluster,_collecting_10_spans_with_50_ranges_each-24 6.95MB ± 2% 21.18MB ± 1% +204.85% (p=0.000 n=8+8) SpanStats/3node/BenchmarkSpanStats_-_span_stats_for_3_node_cluster,_collecting_10_spans_with_100_ranges_each-24 13.3MB ± 1% 134.6MB ± 1% +912.92% (p=0.000 n=8+8) SpanStats/3node/BenchmarkSpanStats_-_span_stats_for_3_node_cluster,_collecting_100_spans_with_25_ranges_each-24 1.99GB ± 4% 2.27GB ± 4% +14.11% (p=0.000 n=8+9) SpanStats/3node/BenchmarkSpanStats_-_span_stats_for_3_node_cluster,_collecting_100_spans_with_50_ranges_each-24 4.16GB ± 2% 4.43GB ± 3% +6.57% (p=0.000 n=9+10) SpanStats/3node/BenchmarkSpanStats_-_span_stats_for_3_node_cluster,_collecting_100_spans_with_100_ranges_each-24 7.50GB ± 1% 7.75GB ± 1% +3.27% (p=0.000 n=10+10) SpanStats/3node/BenchmarkSpanStats_-_span_stats_for_3_node_cluster,_collecting_200_spans_with_25_ranges_each-24 11.8GB ± 0% 12.4GB ± 0% +4.70% (p=0.000 n=7+9) SpanStats/3node/BenchmarkSpanStats_-_span_stats_for_3_node_cluster,_collecting_200_spans_with_50_ranges_each-24 21.1GB ± 2% 21.6GB ± 1% +2.70% (p=0.000 n=10+10) SpanStats/3node/BenchmarkSpanStats_-_span_stats_for_3_node_cluster,_collecting_200_spans_with_100_ranges_each-24 25.8GB ± 0% 26.4GB ± 0% +2.29% (p=0.000 n=8+10) name old allocs/op new allocs/op delta SpanStats/3node/BenchmarkSpanStats_-_span_stats_for_3_node_cluster,_collecting_10_spans_with_25_ranges_each-24 26.9k ± 0% 90.1k ± 2% +235.04% (p=0.000 n=9+9) SpanStats/3node/BenchmarkSpanStats_-_span_stats_for_3_node_cluster,_collecting_10_spans_with_50_ranges_each-24 51.8k ± 3% 114.9k ± 1% +121.89% (p=0.000 n=8+8) SpanStats/3node/BenchmarkSpanStats_-_span_stats_for_3_node_cluster,_collecting_10_spans_with_100_ranges_each-24 106k ± 3% 1426k ± 1% +1240.14% (p=0.000 n=8+8) SpanStats/3node/BenchmarkSpanStats_-_span_stats_for_3_node_cluster,_collecting_100_spans_with_25_ranges_each-24 23.2M ± 5% 23.9M ± 3% +3.19% (p=0.003 n=9+9) SpanStats/3node/BenchmarkSpanStats_-_span_stats_for_3_node_cluster,_collecting_100_spans_with_50_ranges_each-24 48.7M ± 2% 49.4M ± 2% ~ (p=0.075 n=10+10) SpanStats/3node/BenchmarkSpanStats_-_span_stats_for_3_node_cluster,_collecting_100_spans_with_100_ranges_each-24 87.9M ± 1% 88.6M ± 1% ~ (p=0.075 n=10+10) SpanStats/3node/BenchmarkSpanStats_-_span_stats_for_3_node_cluster,_collecting_200_spans_with_25_ranges_each-24 140M ± 0% 142M ± 0% +1.04% (p=0.000 n=8+9) SpanStats/3node/BenchmarkSpanStats_-_span_stats_for_3_node_cluster,_collecting_200_spans_with_50_ranges_each-24 248M ± 1% 249M ± 1% +0.65% (p=0.001 n=10+10) SpanStats/3node/BenchmarkSpanStats_-_span_stats_for_3_node_cluster,_collecting_200_spans_with_100_ranges_each-24 306M ± 1% 308M ± 0% +0.57% (p=0.002 n=10+9) ``` Some notable improvements particularly with requests for spans with fewer ranges. After a point, the raw number of ranges becomes the bottleneck, despite reducing the number of fanouts. Not sure if there is a better way to fetch range statistics but I think the improvement here is enough for this PR. If improvements for fetching range statistics are identified, they can be done in a follow up PR and backported. ---- Release note (sql change): span statistics are unavailable on mixed-version clusters 101481: ui: add KeyedCachedDataReducer selector factory util, refactor jobs page props to use RequestState r=xinhaoz a=xinhaoz See individual commits. Epic: none Release note: None Co-authored-by: Thomas Hardy <[email protected]> Co-authored-by: Xin Hao Zhang <[email protected]>
Extends: #96223 This PR extends the implementation of our SpanStats RPC endpoint to fetch stats for multiple spans at once. By extending the endpoint, we amortize the cost of the RPC's node fanout across all requested spans, whereas previously, we were issuing a fanout per span requested. Additionally, this change batches KV layer requests for ranges fully contained by the span, instead of issuing a request per fully contained range. Release note (sql change): span statistics are unavailable on mixed-version clusters
Extends: #96223 This PR extends the implementation of our SpanStats RPC endpoint to fetch stats for multiple spans at once. By extending the endpoint, we amortize the cost of the RPC's node fanout across all requested spans, whereas previously, we were issuing a fanout per span requested. Additionally, this change batches KV layer requests for ranges fully contained by the span, instead of issuing a request per fully contained range. Release note (sql change): span statistics are unavailable on mixed-version clusters
Fixes cockroachdb#81008. We built the basic infrastructure to coalesce ranges across table boundaries back in 22.2 as part of cockroachdb#66063. We've enabled this optimization for secondary tenants since then, but hadn't for the system tenant because of two primary blockers: - cockroachdb#93617: SHOW RANGES was broken by coalesced ranges. - cockroachdb#84105: APIs to compute sizes for schema objects (used in our UI) was broken by coalesced ranges. In both these cases we baked in assumptions about there being a minimum of one-{table,index,partition}-per-range. These blockers didn't apply to secondary tenants at the time since they didn't have access to SHOW RANGES, nor the UI pages where these schema statistics were displayed. We've addressed both these blockers in the 23.1 cycle as part of bridging the compatibility between secondary tenants and yesteryear's system tenant. - cockroachdb#93644 revised SHOW RANGES and crdb_internal.ranges{,_no_leases}, both internally and its external UX, to accommodate ranges straddling table/database boundaries. - cockroachdb#96223 re-worked our SpanStats API to work in the face of coalesced ranges, addressing cockroachdb#84105. Release note (general change): CockroachDB would previously use separate ranges for each table, index, or partition. This is no longer true -- it's possible now to have multiple tables, indexes, and partitions to get packed into the same range. For users with many such "schema objects", this will reduce the total range count in their clusters. This is especially true if individual tables, indexes, or partitions are smaller than the default configured maximum range size (controlled using zone configs, specifically the range_max_bytes parameter). We made this change to improve scalability with respect to the number of schema objects, since the underlying range count now no longer a bottleneck. Users upgrading from 22.2, once finalizing their upgrade, may observe a round of range merges and snapshot transfers (to power said range merges) as a result of this change. If users want to opt-out of this optimization, they can use the following cluster setting: SET CLUSTER SETTING spanconfig.storage_coalesce_adjacent.enabled = false;
Fixes cockroachdb#81008. We built the basic infrastructure to coalesce ranges across table boundaries back in 22.2 as part of cockroachdb#66063. We've enabled this optimization for secondary tenants since then, but hadn't for the system tenant because of two primary blockers: - cockroachdb#93617: SHOW RANGES was broken by coalesced ranges. - cockroachdb#84105: APIs to compute sizes for schema objects (used in our UI) was broken by coalesced ranges. In both these cases we baked in assumptions about there being a minimum of one-{table,index,partition}-per-range. These blockers didn't apply to secondary tenants at the time since they didn't have access to SHOW RANGES, nor the UI pages where these schema statistics were displayed. We've addressed both these blockers in the 23.1 cycle as part of bridging the compatibility between secondary tenants and yesteryear's system tenant. - cockroachdb#93644 revised SHOW RANGES and crdb_internal.ranges{,_no_leases}, both internally and its external UX, to accommodate ranges straddling table/database boundaries. - cockroachdb#96223 re-worked our SpanStats API to work in the face of coalesced ranges, addressing cockroachdb#84105. Release note (general change): CockroachDB would previously use separate ranges for each table, index, or partition. This is no longer true -- it's possible now to have multiple tables, indexes, and partitions to get packed into the same range. For users with many such "schema objects", this will reduce the total range count in their clusters. This is especially true if individual tables, indexes, or partitions are smaller than the default configured maximum range size (controlled using zone configs, specifically the range_max_bytes parameter). We made this change to improve scalability with respect to the number of schema objects, since the underlying range count now no longer a bottleneck. Users upgrading from 22.2, once finalizing their upgrade, may observe a round of range merges and snapshot transfers (to power said range merges) as a result of this change. If users want to opt-out of this optimization, they can use the following cluster setting: SET CLUSTER SETTING spanconfig.storage_coalesce_adjacent.enabled = false;
98820: spanconfig: enable range coalescing by default r=irfansharif a=irfansharif Fixes #81008. We built the basic infrastructure to coalesce ranges across table boundaries back in 22.2 as part of #66063. We've enabled this optimization for secondary tenants since then, but hadn't for the system tenant because of two primary blockers: - #93617: SHOW RANGES was broken by coalesced ranges. - #84105: APIs to compute sizes for schema objects (used in our UI) was broken by coalesced ranges. In both these cases we baked in assumptions about there being a minimum of one-{table,index,partition}-per-range. These blockers didn't apply to secondary tenants at the time since they didn't have access to SHOW RANGES, nor the UI pages where these schema statistics were displayed. We've addressed both these blockers in the 23.1 cycle as part of bridging the compatibility between secondary tenants and yesteryear's system tenant. - #93644 revised SHOW RANGES and crdb_internal.ranges{,_no_leases}, both internally and its external UX, to accommodate ranges straddling table/database boundaries. - #96223 re-worked our SpanStats API to work in the face of coalesced ranges, addressing #84105. Release note (general change): CockroachDB would previously use separate ranges for each table, index, or partition. This is no longer true -- it's possible now to have multiple tables, indexes, and partitions to get packed into the same range. For users with many such "schema objects", this will reduce the total range count in their clusters. This is especially true if individual tables, indexes, or partitions are smaller than the default configured maximum range size (controlled using zone configs, specifically the range_max_bytes parameter). We made this change to improve scalability with respect to the number of schema objects, since the underlying range count now no longer a bottleneck. Users upgrading from 22.2, once finalizing their upgrade, may observe a round of range merges and snapshot transfers (to power said range merges) as a result of this change. If users want to opt-out of this optimization, they can use the following cluster setting: ``` SET CLUSTER SETTING spanconfig.storage_coalesce_adjacent.enabled = false; ``` Co-authored-by: irfan sharif <[email protected]>
This commit provides a re-implementation of fetching the MVCC stats
and range count for a given span. The previous implementation relied on
the assumption that 1 range can contain at most 1 table/index. Since
GH-79700, this assumption is no longer true.
This re-implementation allows secondary tenants to access span stats
via the serverpb.TenantStatusServer interface.
If a roachpb.SpanStatsRequest has a node_id value of 0, instead of a specific
node id, the response will yield cluster-wide values. To achieve this,
the server does a fan-out to nodes that are known to have replicas for the
span requested.
The interaction between tenants is illustrated below:
Part of: https://cockroachlabs.atlassian.net/browse/CRDB-22711
Release note: None