From 548c5e4e579eccb84aa442f7f4c7718cac0462a0 Mon Sep 17 00:00:00 2001 From: Aditya Maru Date: Mon, 21 Mar 2022 17:06:36 +0530 Subject: [PATCH] backupccl: add datadriven tests for deprecation notice Informs: #78153 Release note: None --- pkg/ccl/backupccl/restore_planning.go | 4 +-- .../testdata/backup-restore/feature-flags | 35 +++++++++++++++++++ 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/pkg/ccl/backupccl/restore_planning.go b/pkg/ccl/backupccl/restore_planning.go index f085cc2d9b20..da7d3b2a1ae8 100644 --- a/pkg/ccl/backupccl/restore_planning.go +++ b/pkg/ccl/backupccl/restore_planning.go @@ -1079,8 +1079,8 @@ func restorePlanHook( // Deprecation notice for non-colelction `RESTORE FROM` syntax. Remove this // once the syntax is deleted in 22.2. p.BufferClientNotice(ctx, - pgnotice.Newf("Note the `RESTORE FROM ` syntax will be removed in a future release, please"+ - "switch over to using `RESTORE FROM IN ` to restore a particular backup from a collection: %s", + pgnotice.Newf("The `RESTORE FROM ` syntax will be removed in a future release, please"+ + " switch over to using `RESTORE FROM IN ` to restore a particular backup from a collection: %s", "https://www.cockroachlabs.com/docs/stable/restore.html#view-the-backup-subdirectories")) } diff --git a/pkg/ccl/backupccl/testdata/backup-restore/feature-flags b/pkg/ccl/backupccl/testdata/backup-restore/feature-flags index 210675465e44..19405d2621fd 100644 --- a/pkg/ccl/backupccl/testdata/backup-restore/feature-flags +++ b/pkg/ccl/backupccl/testdata/backup-restore/feature-flags @@ -1,3 +1,5 @@ +subtest backup-feature-flags + new-server name=s1 ---- @@ -48,3 +50,36 @@ SET CLUSTER SETTING feature.restore.enabled = TRUE; exec-sql RESTORE TABLE d.t FROM LATEST IN 'nodelocal://0/test-root/'; ---- + +subtest end + +# TODO(adityamaru): Delete in 22.2 once the syntax is removed. We don't want +# to start a testserver just for this test. +subtest backup-restore-deprecation-notice + +exec-sql +BACKUP TO 'nodelocal://1/deprecated'; +---- +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 TO 'nodelocal://1/deprecated/incfrom' INCREMENTAL FROM 'nodelocal://1/deprecated'; +---- +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 +DROP TABLE d.t; +---- + +exec-sql +RESTORE TABLE d.t FROM 'nodelocal://1/deprecated'; +---- +NOTICE: The `RESTORE FROM ` syntax will be removed in a future release, please switch over to using `RESTORE FROM IN ` to restore a particular backup from a collection: https://www.cockroachlabs.com/docs/stable/restore.html#view-the-backup-subdirectories + + +exec-sql +RESTORE SYSTEM USERS FROM 'nodelocal://1/deprecated'; +---- +NOTICE: The `RESTORE FROM ` syntax will be removed in a future release, please switch over to using `RESTORE FROM IN ` to restore a particular backup from a collection: https://www.cockroachlabs.com/docs/stable/restore.html#view-the-backup-subdirectories + +subtest end