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

backupinfo: introduce a backupinfo package #82623

Merged
merged 1 commit into from
Jun 28, 2022

Conversation

adityamaru
Copy link
Contributor

@adityamaru adityamaru commented Jun 8, 2022

The backupinfo package contains logic related to interacting
with information and metadata describing the backup. After this
change we have backupdest depending on backupinfo.

Release note: None

@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link
Collaborator

@stevendanna stevendanna left a comment

Choose a reason for hiding this comment

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

Did an early read through since I'm thinking of also doing some reorganisation.

Overall, I think it makes sense to have a package focused on interacting with the context of a specific backup directory.

It's easy to spend a lot of time fretting about details (is a backup directory and the chain of incrementals related to it its own concept that deserve a name, should we separate the reading of the raw bytes out of the backup from parsing their meaning a bit more, etc). But, this seems like a reasonable first cut to me.

Comment on lines -96 to 98
func isGZipped(dat []byte) bool {
func IsGZipped(dat []byte) bool {
gzipPrefix := []byte("\x1F\x8B\x08")
return bytes.HasPrefix(dat, gzipPrefix)
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

[future] I could see this moving to somewhere in pkg/util

filename := fmt.Sprintf("%s_%d_%s",
backupPartitionDescriptorPrefix, nextPartitionedDescFilenameID, sanitizeLocalityKV(kv))
filename := fmt.Sprintf("%s_%d_%s", backupPartitionDescriptorPrefix,
nextPartitionedDescFilenameID, backupinfo.SanitizeLocalityKV(kv))
Copy link
Collaborator

Choose a reason for hiding this comment

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

[future] We use "Sanitize" in some places to mean "redaction" and then here we use it to mean "make a name suitable to be a filename". We can probably clean up the naming here.

// is stored if present. It can be found in the name of the backup manifest +
// this suffix.
backupManifestChecksumSuffix = "-CHECKSUM"
BackupManifestChecksumSuffix = "-CHECKSUM"
Copy link
Collaborator

Choose a reason for hiding this comment

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

[future,discussion] Some of these being public is a signal that perhaps we need some other methods in this package. That is, eventually do we expect it to be the case that most users of this package don't need to worry about the internal structure of these constants.

@adityamaru adityamaru force-pushed the backup-info branch 2 times, most recently from 2b9cff3 to 0e109ae Compare June 23, 2022 14:42
@adityamaru adityamaru marked this pull request as ready for review June 23, 2022 14:42
@adityamaru adityamaru requested a review from a team as a code owner June 23, 2022 14:42
@adityamaru adityamaru requested a review from a team June 23, 2022 14:42
@adityamaru adityamaru requested a review from a team as a code owner June 23, 2022 14:42
@adityamaru adityamaru requested review from rhu713 and stevendanna June 23, 2022 14:43
@adityamaru
Copy link
Contributor Author

@stevendanna I've made you wait a little but this should be RFAL 😃 I agree that there is definitely follow up cleanup that we should undertake including moving some of the constants in backupbase into relevant packages.

The backupinfo package contains logic related to interacting
with information and metadata describing the backup. After this
change we have `backupdest` depending on `backupinfo`.

Release note: None
@livlobo
Copy link
Contributor

livlobo commented Jun 23, 2022

@adityamaru - mind filing a GH issue corresponding to this PR?

@adityamaru
Copy link
Contributor Author

@livlobo filed #83338

@livlobo
Copy link
Contributor

livlobo commented Jun 24, 2022

Perfect, thank you!

Copy link
Collaborator

@stevendanna stevendanna left a comment

Choose a reason for hiding this comment

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

Nice.

@adityamaru
Copy link
Contributor Author

TFTR!

bors r=stevendanna

@craig
Copy link
Contributor

craig bot commented Jun 28, 2022

Build failed (retrying...):

@craig
Copy link
Contributor

craig bot commented Jun 28, 2022

Build failed (retrying...):

@craig
Copy link
Contributor

craig bot commented Jun 28, 2022

Build failed (retrying...):

@craig craig bot merged commit 5541cf8 into cockroachdb:master Jun 28, 2022
@craig
Copy link
Contributor

craig bot commented Jun 28, 2022

Build succeeded:

@adityamaru adityamaru deleted the backup-info branch June 28, 2022 20:54
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.

4 participants