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

server: make SpanStats authoritative #104423

Merged
merged 1 commit into from
Jun 15, 2023

Conversation

zachlite
Copy link
Contributor

@zachlite zachlite commented Jun 6, 2023

This commit guarantees that SpanStats uses up-to-date range
descriptors on all nodes. The dependency on DistSender is removed
and is replaced with a dependency on rangedesc.Scanner.

rangedesc.Scanner is used to:

  1. Locate nodes that house replicas of a span to avoid cluster-wide fan-outs.
  2. Find Range Descriptors that touch a span, to build a SpanStatsResponse.

This commit also fixes #103809, where a SpanStatsResponse incorrectly returned
the replica_count for a span, instead of the range_count.

Epic: https://cockroachlabs.atlassian.net/browse/CRDB-24928
Issue: #103957
Release note (bug fix): SpanStats is no longer subject to stale
information, and should be considered authoritative.

@zachlite zachlite requested a review from a team June 6, 2023 17:47
@zachlite zachlite requested a review from a team as a code owner June 6, 2023 17:47
@zachlite zachlite requested a review from a team June 6, 2023 17:47
@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link
Contributor

@knz knz left a comment

Choose a reason for hiding this comment

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

Great work. Thanks for this change. Don't forget to update the test expectation in TestAdminAPITableStats.

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


-- commits line 8 at r1:
tip: add a blank line after the colon and in-between the two list items to fix the markdown formatting. (You can also upgrade the PR description after that)

@zachlite zachlite force-pushed the 230606.authoritative-span-stats branch from 32ab463 to 2359c2a Compare June 9, 2023 16:47
@zachlite zachlite requested a review from a team as a code owner June 9, 2023 16:47
This commit guarantees that SpanStats uses up-to-date range
descriptors on all nodes. The dependency on DistSender is removed
and is replaced with a dependency on rangedesc.Scanner.

rangedesc.Scanner is used to:
1) Locate nodes that house replicas of a span to avoid cluster-wide fan-outs.
2) Find Range Descriptors that touch a span, to build a SpanStatsResponse.

This commit also fixes cockroachdb#103809, where a SpanStatsResponse incorrectly returned
the replica_count for a span, instead of the range_count.

Epic: https://cockroachlabs.atlassian.net/browse/CRDB-24928
Issue: cockroachdb#103957
Release note (bug fix): SpanStats is no longer subject to stale
information, and should be considered authoritative.
@zachlite zachlite force-pushed the 230606.authoritative-span-stats branch from 2359c2a to 455148e Compare June 9, 2023 17:43
@zachlite zachlite requested a review from arulajmani June 13, 2023 16:38
Copy link
Collaborator

@arulajmani arulajmani left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 5 files at r1, 3 of 5 files at r2, all commit messages.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @knz and @zachlite)


-- commits line 6 at r2:
To confirm, this only runs on the system tenant, right?

If not, we might need to use a rangedesc.Iterator instead, much like crdb_internal.ranges_no_leases does.

Copy link
Collaborator

@arulajmani arulajmani left a comment

Choose a reason for hiding this comment

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

Didn't mean to publish just yet. Change looks good, just a question in-line.

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @knz and @zachlite)

Copy link
Contributor Author

@zachlite zachlite left a comment

Choose a reason for hiding this comment

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

Yep, span stats are fulfilled by the system tenant (KV nodes). Other tenant requests for span stats are forwarded through tenantConnect.

TFTR

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

@zachlite
Copy link
Contributor Author

bors r+

@zachlite zachlite added the backport-23.1.x Flags PRs that need to be backported to 23.1 label Jun 15, 2023
@craig
Copy link
Contributor

craig bot commented Jun 15, 2023

Build succeeded:

@craig craig bot merged commit faaa732 into cockroachdb:master Jun 15, 2023
@blathers-crl
Copy link

blathers-crl bot commented Jun 15, 2023

Encountered an error creating backports. Some common things that can go wrong:

  1. The backport branch might have already existed.
  2. There was a merge conflict.
  3. The backport branch contained merge commits.

You might need to create your backport manually using the backport tool.


error setting reviewers, but backport branch blathers/backport-release-23.1-104423 is ready: POST https://api.github.com/repos/cockroachdb/cockroach/pulls/105000/requested_reviewers: 422 Reviews may only be requested from collaborators. One or more of the teams you specified is not a collaborator of the cockroachdb/cockroach repository. []

Backport to branch 23.1.x failed. See errors above.


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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-23.1.x Flags PRs that need to be backported to 23.1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

server: incorrect value of RangeCount after SpanStats fan-out
4 participants