Skip to content

Commit

Permalink
Merge #61567
Browse files Browse the repository at this point in the history
61567: backupccl: add a BACKUP/RESTORE test with a virtual column r=RaduBerinde a=RaduBerinde

Release justification: non-production code change.

Release note: None

Informs #57608.

Co-authored-by: Radu Berinde <[email protected]>
  • Loading branch information
craig[bot] and RaduBerinde committed Mar 6, 2021
2 parents 15a1856 + 527d181 commit 21e975a
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,3 @@ BACKUP db1.t TO 'nodelocal://1/backup_2';
BACKUP DATABASE db1 TO 'nodelocal://1/backup_2';
----
pq: previous backup does not contain the complete database "db1"

51 changes: 51 additions & 0 deletions pkg/ccl/backupccl/testdata/backup-restore/virtual-columns
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Test full cluster backup/restore here.

new-server name=s1
----

exec-sql
CREATE DATABASE d;
USE d;
CREATE TABLE tab (
k int primary key,
a int,
b int,
v int AS (a+b) VIRTUAL,
INDEX (v),
UNIQUE (a,b) WHERE (v > 0)
);
INSERT INTO tab VALUES (1,1,1), (2,2,2), (3,3,3)
----

exec-sql
BACKUP TO 'nodelocal://0/test/'
----

# Start a new cluster with the same IO dir.
new-server name=s2 share-io-dir=s1
----

exec-sql server=s2
RESTORE FROM 'nodelocal://0/test/'
----

query-sql
SELECT * FROM d.tab ORDER BY k
----
1 1 1 2
2 2 2 4
3 3 3 6

query-sql
SHOW CREATE TABLE d.tab
----
d.public.tab CREATE TABLE public.tab (
k INT8 NOT NULL,
a INT8 NULL,
b INT8 NULL,
v INT8 NULL AS (a + b) VIRTUAL,
CONSTRAINT "primary" PRIMARY KEY (k ASC),
INDEX tab_v_idx (v ASC),
UNIQUE INDEX tab_a_b_key (a ASC, b ASC) WHERE v > 0:::INT8,
FAMILY "primary" (k, a, b)
)

0 comments on commit 21e975a

Please sign in to comment.