Skip to content

Commit

Permalink
Merge #69990
Browse files Browse the repository at this point in the history
69990: backupccl: use FmtParsable when storing statement in scheduled backup r=rhu713 a=rhu713

Previously, the executed backup statement for schedules was serialized and
stored using FmtSimple. This format can be lossy and the preferred format to
retain all information is FmtParsable. This patch switches the serialization to
use FmtParsable.

Resolves #63216

Release justification: change should have no impact on current backup schedules.

Release note: None

Co-authored-by: Rui Hu <[email protected]>
  • Loading branch information
craig[bot] and Rui Hu committed Sep 10, 2021
2 parents eaafe77 + c30d567 commit 9d5e6ab
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions pkg/ccl/backupccl/create_scheduled_backup.go
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ func doCreateBackupSchedules(
if err != nil {
return errors.Wrapf(err, "failed to evaluate backup encryption_passphrase")
}
backupNode.Options.EncryptionPassphrase = tree.NewDString(pw)
backupNode.Options.EncryptionPassphrase = tree.NewStrVal(pw)
}

// Evaluate encryption KMS URIs if set.
Expand All @@ -363,7 +363,7 @@ func doCreateBackupSchedules(
}
for _, kmsURI := range kmsURIs {
backupNode.Options.EncryptionKMSURI = append(backupNode.Options.EncryptionKMSURI,
tree.NewDString(kmsURI))
tree.NewStrVal(kmsURI))
}
}

Expand All @@ -374,7 +374,7 @@ func doCreateBackupSchedules(
}

for _, dest := range destinations {
backupNode.To = append(backupNode.To, tree.NewDString(dest))
backupNode.To = append(backupNode.To, tree.NewStrVal(dest))
}

backupNode.Targets = eval.Targets
Expand Down Expand Up @@ -603,10 +603,7 @@ func makeBackupSchedule(

// We do not set backupNode.AsOf: this is done when the scheduler kicks off the backup.
// Serialize backup statement and set schedule executor and its args.
//
// TODO(bulkio): this serialization is erroneous, see issue
// https://github.com/cockroachdb/cockroach/issues/63216
args.BackupStatement = tree.AsStringWithFlags(backupNode, tree.FmtSimple|tree.FmtShowPasswords)
args.BackupStatement = tree.AsStringWithFlags(backupNode, tree.FmtParsable|tree.FmtShowPasswords)
any, err := pbtypes.MarshalAny(args)
if err != nil {
return nil, nil, err
Expand Down

0 comments on commit 9d5e6ab

Please sign in to comment.