Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
79447: backupccl: add deprecation notice for backup cmd with explicit subdir r=benbardin a=msbutler

backupccl: add deprecation notice for backup cmd with explicit subdir
    
  Release note (sql change): Previously, Backup commands allowed the user to
  specify a custom subdirectory name for their backups via `BACKUP .. INTO
  <subdir> IN <collectionURI>`. After this change, this will no longer be
  supported. Users can only create a full backup via `Backup ... INTO
  <collectionURI>` or an incremental backup on the latest full backup in their
  collection via `BACKUP ... INTO LATEST IN <collectionURI>`. This deprecation
  also removes the need to address a bug in `SHOW BACKUPS IN` which cannot display
  user defined subdirectories.


Co-authored-by: Michael Butler <[email protected]>
  • Loading branch information
craig[bot] and msbutler committed Apr 8, 2022
2 parents 51cd007 + 7d2d1d2 commit 5cf9811
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pkg/ccl/backupccl/backup_planning.go
Original file line number Diff line number Diff line change
Expand Up @@ -701,6 +701,14 @@ func backupPlanHook(
initialDetails.Destination.Subdir = latestFileName
} else if subdir != "" {
initialDetails.Destination.Subdir = "/" + strings.TrimPrefix(subdir, "/")
// Deprecation notice for `BACKUP INTO` syntax with an explicit subdir.
// Remove this once the syntax is deleted in 22.2.
p.BufferClientNotice(ctx,
pgnotice.Newf("BACKUP commands with an explicitly specified"+
" subdirectory will be removed in a future release. Users can create a full backup via `BACKUP ... "+
"INTO <collectionURI>`, or an incremental backup on the latest full backup in their "+
"collection via `BACKUP ... INTO LATEST IN <collectionURI>`"))

} else {
initialDetails.Destination.Subdir = endTime.GoTime().Format(DateBasedIntoFolderName)
}
Expand Down
5 changes: 5 additions & 0 deletions pkg/ccl/backupccl/testdata/backup-restore/feature-flags
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@ BACKUP TO 'nodelocal://1/deprecated/incfrom' INCREMENTAL FROM 'nodelocal://1/dep
----
NOTICE: The `BACKUP TO` syntax will be removed in a future release, please switch over to using `BACKUP INTO` to create a backup collection: https://www.cockroachlabs.com/docs/stable/backup.html#considerations. Backups created using the `BACKUP TO` syntax may not be restoreable in the next major version release.

exec-sql
BACKUP INTO 'deprecatedExplicitSubdir' IN 'nodelocal://1/deprecated';
----
NOTICE: BACKUP commands with an explicitly specified subdirectory will be removed in a future release. Users can create a full backup via `BACKUP ... INTO <collectionURI>`, or an incremental backup on the latest full backup in their collection via `BACKUP ... INTO LATEST IN <collectionURI>`

exec-sql
DROP TABLE d.t;
----
Expand Down

0 comments on commit 5cf9811

Please sign in to comment.