Skip to content

Commit

Permalink
backupccl: download pre restore data in cluster restore
Browse files Browse the repository at this point in the history
This patch adds the pre restore data spans to the list of spans to download.
While these pre restore spans map to data in the temporary system table
database that are then rewwritten to the actual system table, the download job
ought to download all external data linked into the cluster out of principle.

Fixes cockroachdb#124330

Release note: none
  • Loading branch information
msbutler committed Jun 3, 2024
1 parent 959b239 commit e5aa619
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion pkg/ccl/backupccl/restore_online.go
Original file line number Diff line number Diff line change
Expand Up @@ -502,13 +502,25 @@ func (r *restoreResumer) maybeWriteDownloadJob(
if !details.ExperimentalOnline {
return nil
}
rekey := mainRestoreData.getRekeys()
rekey = append(rekey, preRestoreData.getRekeys()...)

kr, err := MakeKeyRewriterFromRekeys(execConfig.Codec, mainRestoreData.getRekeys(), mainRestoreData.getTenantRekeys(),
tenantRekey := mainRestoreData.getTenantRekeys()
tenantRekey = append(tenantRekey, preRestoreData.getTenantRekeys()...)
kr, err := MakeKeyRewriterFromRekeys(execConfig.Codec, rekey, tenantRekey,
false /* restoreTenantFromStream */)
if err != nil {
return errors.Wrap(err, "creating key rewriter from rekeys")
}
downloadSpans := mainRestoreData.getSpans()

// Intentionally download preRestoreData after the main data. During a cluster
// restore, preRestore data are linked to a temp system db that are then
// copied over to the real system db. This temp system db is then deleted and
// should never be queried. We still want to download this data, however, to
// protect against external storage deletions of these linked in ssts, but at
// lower priority to the main data.
downloadSpans = append(downloadSpans, preRestoreData.getSpans()...)
for i := range downloadSpans {
var err error
downloadSpans[i], err = rewriteSpan(kr, downloadSpans[i].Clone(), execinfrapb.ElidePrefix_None)
Expand Down

0 comments on commit e5aa619

Please sign in to comment.