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

rangedesc: add lazy iterator #116520

Merged
merged 5 commits into from Jan 23, 2024
Merged

rangedesc: add lazy iterator #116520

merged 5 commits into from Jan 23, 2024

Conversation

dt
Copy link
Member

@dt dt commented Dec 15, 2023

see commits.

@dt dt requested review from a team as code owners December 15, 2023 03:40
@dt dt requested review from msbutler and removed request for a team December 15, 2023 03:40
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@dt dt requested a review from a team as a code owner December 15, 2023 14:07
@dt dt force-pushed the rdi branch 2 times, most recently from 45d8df1 to 50a68d6 Compare December 15, 2023 16:19
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.

:lgtm: modulo comments.

Reviewed 4 of 4 files at r1, 2 of 2 files at r2, 3 of 3 files at r3, 1 of 1 files at r4, 2 of 2 files at r5, 1 of 1 files at r6, 2 of 2 files at r7, 2 of 2 files at r8, 1 of 1 files at r9, 4 of 4 files at r10, 1 of 1 files at r11, all commit messages.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @andrewbaptist, @dt, and @msbutler)


pkg/server/node.go line 2574 at r6 (raw file):

	const pageSize = 100

	iter, err := n.execCfg.RangeDescIteratorFactory.NewLazyIterator(stream.Context(), args.Span, 100)

nit: s/100/pageSize/g


pkg/util/rangedesc/rangedesc.go line 86 at r11 (raw file):

	// constructor fetches the entirety of the result set and the returned iter is
	// merely iterating over that buffered result set, so this is actually better
	// treated as if it is a batch API, eg GetAllRangeDescs(span). Callers should

After this comment was initially written, we spoke on Slack about NewLazyIterator giving an inconsistent view of range descriptors to callers, unlike NewIterator, which provides a consistent view. Some callers (notably the observability related ones) need a consistent view.

Consider softening the language in this comment to dissuade users from using this function entirely; instead, maybe let's add some words about the consistent/inconsistent nature of both these methods, and let callers decide what's appropriate for them.

Release note: none.
Epic: none.
Copy link
Member Author

@dt dt 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 (and 1 stale) (waiting on @andrewbaptist, @arulajmani, and @msbutler)


pkg/server/node.go line 2574 at r6 (raw file):

Previously, arulajmani (Arul Ajmani) wrote…

nit: s/100/pageSize/g

I think this is a stale revision since I switched this to pageSize back on dec 15 (oh reviewable).


pkg/util/rangedesc/rangedesc.go line 86 at r11 (raw file):

Previously, arulajmani (Arul Ajmani) wrote…

After this comment was initially written, we spoke on Slack about NewLazyIterator giving an inconsistent view of range descriptors to callers, unlike NewIterator, which provides a consistent view. Some callers (notably the observability related ones) need a consistent view.

Consider softening the language in this comment to dissuade users from using this function entirely; instead, maybe let's add some words about the consistent/inconsistent nature of both these methods, and let callers decide what's appropriate for them.

Softened it up a bit. I might just go add an asOf timestamp to the lazy iterator constructor and make it scan batches at a fixed timestamp so we can just retire the eager iterator instead, but I've softer the language for now until I do that.

Release note: none.
Epic: none.
Release note (enterprise change): BACKUPs now load range information as they need it to avoid a spike in metadata lookups when backups begin.
Epic: none.
@dt
Copy link
Member Author

dt commented Jan 23, 2024

TFTR!

bors r+

@craig
Copy link
Contributor

craig bot commented Jan 23, 2024

Build succeeded:

@craig craig bot merged commit 74b04b1 into cockroachdb:master Jan 23, 2024
8 of 9 checks passed
@dt dt deleted the rdi branch January 23, 2024 19:52
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.

None yet

3 participants