-
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
backupinfo: introduce a backupinfo package #82623
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.
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.
func isGZipped(dat []byte) bool { | ||
func IsGZipped(dat []byte) bool { | ||
gzipPrefix := []byte("\x1F\x8B\x08") | ||
return bytes.HasPrefix(dat, gzipPrefix) | ||
} |
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.
[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)) |
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.
[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" |
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.
[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.
2b9cff3
to
0e109ae
Compare
@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 |
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
@adityamaru - mind filing a GH issue corresponding to this PR? |
Perfect, thank you! |
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.
Nice.
TFTR! bors r=stevendanna |
Build failed (retrying...): |
Build failed (retrying...): |
Build failed (retrying...): |
Build succeeded: |
The backupinfo package contains logic related to interacting
with information and metadata describing the backup. After this
change we have
backupdest
depending onbackupinfo
.Release note: None