-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
backupccl: support materialized view mutation in restore
Release note (bug fix): Fixed a bug that could prevent RESTORE from working if the backup had a refresh materialized view mutation in it.
- Loading branch information
Showing
2 changed files
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
pkg/ccl/backupccl/testdata/backup-restore/materialized_view
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# We allow implicit access to non-admin users so that we can test | ||
# with nodelocal. | ||
new-cluster name=s1 allow-implicit-access | ||
---- | ||
|
||
exec-sql | ||
CREATE DATABASE testdb; | ||
USE testdb; | ||
CREATE TABLE testdb.t (a int primary key, b int); | ||
CREATE MATERIALIZED VIEW testdb.mv AS SELECT a, b FROM testdb.t; | ||
INSERT INTO testdb.t (a, b) VALUES (1, 2); | ||
---- | ||
|
||
exec-sql | ||
REFRESH MATERIALIZED VIEW mv; | ||
---- | ||
|
||
exec-sql | ||
INSERT INTO testdb.t (a, b) VALUES (2, 3); | ||
---- | ||
|
||
exec-sql | ||
REFRESH MATERIALIZED VIEW mv; | ||
---- | ||
|
||
exec-sql | ||
BACKUP INTO 'nodelocal://1/test/' | ||
---- | ||
|
||
|
||
new-cluster name=s2 share-io-dir=s1 allow-implicit-access | ||
---- | ||
|
||
exec-sql | ||
RESTORE DATABASE testdb FROM LATEST IN 'nodelocal://1/test/' WITH new_db_name = 'newdb'; | ||
---- | ||
|
||
query-sql | ||
SELECT * FROM newdb.mv; | ||
---- | ||
1 2 | ||
2 3 |