backupccl: move descriptors and descriptor changes field from manifest to SST#96245
backupccl: move descriptors and descriptor changes field from manifest to SST#96245craig[bot] merged 1 commit intocockroachdb:masterfrom
Conversation
e6f4520 to
90efbb5
Compare
|
I'm going to review this today, adding @dt as well in case he wants to take a look. |
adityamaru
left a comment
There was a problem hiding this comment.
Flushing out my first round of comments, overall it looks really good!
| // a slice of mutable descriptors. | ||
| func BackupManifestDescriptors( | ||
| backupManifest *backuppb.BackupManifest, | ||
| ctx context.Context, backupManifest *backuppb.BackupManifest, iterFactory *IterFactory, |
There was a problem hiding this comment.
nit: I'd prefer if we stopped passing in backupManifest to this method, and only passed in the EndTime. I like the mental model of only using the iter to access descriptors from a manifest, and it was a little confusing seeing us also pass in the manifest to this method.
There was a problem hiding this comment.
done, changed to pass in the end time.
| func (f *IterFactory) NewFileIter( | ||
| ctx context.Context, | ||
| ) (bulk.Iterator[*backuppb.BackupManifest_File], error) { | ||
| if f.m.HasExternalFilesList { |
There was a problem hiding this comment.
nit: can we rename the proto field now that it encompasses more than just Files. Maybe HasExternalSSTs?
There was a problem hiding this comment.
done, changed to HasExternalManifestSSTs
| return err | ||
| } | ||
| defer w.Close() | ||
| fileSST := storage.MakeBackupSSTWriter(ctx, dest.Settings(), w) |
| "github.com/cockroachdb/cockroach/pkg/sql/isql" | ||
| "github.com/cockroachdb/cockroach/pkg/sql/stats" | ||
| "github.com/cockroachdb/cockroach/pkg/testutils/testcluster" | ||
| "github.com/cockroachdb/cockroach/pkg/util/bulk" |
There was a problem hiding this comment.
Is there any reason this file isn't in backupinfo? Doesn't have to be done in this PR but just curious if you knew.
There was a problem hiding this comment.
I thought it was more of a util method not just related to backups so I put it in the utils package.
There was a problem hiding this comment.
ahh sorry I meant why is backup_metadata_test.go in backupccl as compared to backupinfo? Anyways, we can move it in a smaller followup if need be!
| t.Fatal(err) | ||
| } | ||
| if info.Name() == backupbase.BackupManifestName || !strings.HasSuffix(path, ".sst") { | ||
| if info.Name() == backupbase.BackupManifestName || !strings.HasSuffix(path, ".sst") || info.Name() == backupinfo.BackupMetadataDescriptorsListPath { |
There was a problem hiding this comment.
do we need to add files list sst to this check as well?
There was a problem hiding this comment.
yeah I think it's better to add the files list SST to this exclusion list just so we're not relying on existing behavior for this test to pass.
| return nil | ||
| } | ||
|
|
||
| // We do not need to upgrade descriptors that exist in the external SST |
There was a problem hiding this comment.
I like this, and I'll probably delete this soon once we restrict restores to our new policy. In the meantime though can we check backupManifests[0].ClusterVersion instead?
There was a problem hiding this comment.
done, used cluster version.
06c6435 to
13eb67a
Compare
| "github.com/cockroachdb/cockroach/pkg/sql/isql" | ||
| "github.com/cockroachdb/cockroach/pkg/sql/stats" | ||
| "github.com/cockroachdb/cockroach/pkg/testutils/testcluster" | ||
| "github.com/cockroachdb/cockroach/pkg/util/bulk" |
There was a problem hiding this comment.
ahh sorry I meant why is backup_metadata_test.go in backupccl as compared to backupinfo? Anyways, we can move it in a smaller followup if need be!
| @@ -1269,100 +1367,116 @@ func (dri *DescriptorRevisionIterator) Err() error { | |||
| // revision, and false if there are no more elements or if an error was | |||
There was a problem hiding this comment.
nit: the comment specifies we return true/false but I don't think thats the case anymore.
| // descriptors at the start time, so we don't have to look back further | ||
| // than the very last backup. | ||
| if m.StartTime.IsEmpty() { | ||
| if m.StartTime.IsEmpty() || m.MVCCFilter == backuppb.MVCCFilter_Latest { |
There was a problem hiding this comment.
was this previously a bug? if so do we have a test for it now.
| continue | ||
| } | ||
|
|
||
| if rev.ID == prevRevID { |
There was a problem hiding this comment.
maybe it's just me but the sorting comment is a little far from this logic. Can I bug you to add a sentence that since revisions are sorted by ID and the descending order of revisions we can skip over older revisions once we have seen a revision for an ID.
|
I'd really like if we added a mixed-version database/table restore roachtest. I'll file an issue for this that we should try to get to before backporting this. |
742a2c6 to
0d9bd2a
Compare
…t to SST As part of an effort to make backup manifests scale better for larger clusters, this patch moves descriptors and descriptor changes from the manifest to an external SST. This avoids the need to alloc enough memory to hold every descriptor and descriptor revision for every layer of a backup during a backup or restore job. This patch also changes the access pattern for descriptors and descriptor changes to use iterators, so that they can be accessed in a streaming manner from the external SST. Release note: None
0d9bd2a to
002f294
Compare
|
bors r+ |
|
Build succeeded: |
As part of an effort to make backup manifests scale better for larger clusters, this patch moves descriptors and descriptor changes from the manifest to an external SST. This avoids the need to alloc enough memory to hold every descriptor and descriptor revision for every layer of a backup during a backup or restore job. This patch also changes the access pattern for descriptors and descriptor changes to use iterators, so that they can be accessed in a streaming manner from the external SST.
Release note: None