-
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: actually enable auto stats at end of download job
PR #116977 didn't re-enable auto stats collection for online restored tables after the download job. This patch fixes this bug. Fixes #119935 Release note: none
- Loading branch information
Showing
7 changed files
with
132 additions
and
9 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
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
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
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
65 changes: 65 additions & 0 deletions
65
pkg/ccl/backupccl/testdata/backup-restore/online-restore-auto-stats
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,65 @@ | ||
# This test ensures that online restore restores the backed up auto stats | ||
# settings | ||
|
||
reset test-nodelocal | ||
---- | ||
|
||
new-cluster name=s1 disable-tenant | ||
---- | ||
|
||
exec-sql | ||
USE data; | ||
CREATE TABLE reg (i INT PRIMARY KEY, s STRING); | ||
INSERT INTO reg VALUES (1, 'x'),(2,'y'),(3,'z'); | ||
CREATE TABLE stats (i INT PRIMARY KEY, s STRING); | ||
CREATE TABLE nostats (i INT PRIMARY KEY, s STRING); | ||
ALTER TABLE stats SET (sql_stats_automatic_collection_enabled = true); | ||
ALTER TABLE nostats SET (sql_stats_automatic_collection_enabled = false); | ||
---- | ||
|
||
exec-sql | ||
BACKUP INTO 'nodelocal://1/cluster/'; | ||
---- | ||
|
||
|
||
new-cluster name=s2 share-io-dir=s1 allow-implicit-access disable-tenant | ||
---- | ||
|
||
|
||
exec-sql | ||
RESTORE DATABASE data FROM LATEST IN 'nodelocal://1/cluster/' with EXPERIMENTAL DEFERRED COPY; | ||
---- | ||
|
||
# Wait for download job to complete | ||
|
||
query-sql retry | ||
SELECT count(*) FROM [SHOW JOBS] WHERE job_type='RESTORE' and status='succeeded'; | ||
---- | ||
2 | ||
|
||
query-sql | ||
SHOW CREATE TABLE data.reg | ||
---- | ||
data.public.reg CREATE TABLE public.reg ( | ||
i INT8 NOT NULL, | ||
s STRING NULL, | ||
CONSTRAINT reg_pkey PRIMARY KEY (i ASC) | ||
) | ||
|
||
query-sql | ||
SHOW CREATE TABLE data.stats | ||
---- | ||
data.public.stats CREATE TABLE public.stats ( | ||
i INT8 NOT NULL, | ||
s STRING NULL, | ||
CONSTRAINT stats_pkey PRIMARY KEY (i ASC) | ||
) WITH (sql_stats_automatic_collection_enabled = true) | ||
|
||
query-sql | ||
SHOW CREATE TABLE data.nostats | ||
---- | ||
data.public.nostats CREATE TABLE public.nostats ( | ||
i INT8 NOT NULL, | ||
s STRING NULL, | ||
CONSTRAINT nostats_pkey PRIMARY KEY (i ASC) | ||
) WITH (sql_stats_automatic_collection_enabled = false) |
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
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