Skip to content

backupccl: Cosmetic changes to backup_processor.go to improve clarity.#80991

Merged
craig[bot] merged 1 commit intocockroachdb:masterfrom
benbardin:sf2
May 16, 2022
Merged

backupccl: Cosmetic changes to backup_processor.go to improve clarity.#80991
craig[bot] merged 1 commit intocockroachdb:masterfrom
benbardin:sf2

Conversation

@benbardin
Copy link
Copy Markdown
Collaborator

Release note: None

Renames a few things, and moves the sstsink into its own file.

@benbardin benbardin requested review from a team and dt May 4, 2022 17:43
@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

@benbardin benbardin force-pushed the sf2 branch 2 times, most recently from 017382e to 31a095f Compare May 4, 2022 19:02
@benbardin
Copy link
Copy Markdown
Collaborator Author

Required tests are passing!

type returnedSST struct {
f BackupManifest_File
sst []byte
type returnedSpans struct {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think this should be singular?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

maybe should be called "exportedSpan" actually; "returnedSpan" just sounds like somebody returned a roachpb.Span, but this is much more than that; it is the actual data from that span.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Changed, but you sure about singular? There's literally a field called completedSpans in the object.

for i, file := range res.Files {
f := BackupManifest_File{
for i, file := range KVResponse.Files {
partialFile := BackupManifest_File{
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

calling this a "file" at all is a tad weird; it is just a some data and metadata that identified the span of keys and time that data came from and how much is in it, and isn't a "file" at all just yet, partial or otherwise (it could be complete when we go to write it, for all we know). it could be less confusing to avoid the extra local var completely here: make the ret returnedSpan here, embed Manifest_File in it with a comment saying "BackupManifest_File conveniently already has all the metadata fields we need to identify a key/time span" and avoid the word file in this block entirely?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Yeah I like that! How's this look?

}
}

func makeFileSSTSink(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm not sure that "fileSSTSink" is really telling me anything that "sstSink" didn't, but I also sympathize that it wasn't telling much / enough before.

I think the distinguishing characteristics of this thing are that it takes chunks of exported data (which just so happens to be in sst format), buffers and merges it, and then writes SSTables. So maybe bufferedSSTWriter or something like that?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

To me, calling the object a FileSSTSink highlights that it's not a generic sst sink. It outputs BackupManifest_File objects to the progress channel as one of two core outputs, and takes in a BackupManifest_File as an input in exportedSpan (though we're now more subtly calling that metadata). This isn't something that can be used to buffer any other kind of object, which took me a few hours to totally figure out.

Have I convinced?

@benbardin
Copy link
Copy Markdown
Collaborator Author

bors r+

@craig craig bot merged commit e2f3965 into cockroachdb:master May 16, 2022
@craig
Copy link
Copy Markdown
Contributor

craig bot commented May 16, 2022

Build succeeded:

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