forked from cockroachdb/cockroach
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
backupccl: do not backup or restore stat forecasts
Statistics forecasts are not persisted and are reconstructed on demand from the persisted statistics. As such, they don't need to be included in a backup or restored. This has the additional effect of solving a bug in which we would fail to write statistics into our metadata SST if it included more than 1 forecast since the in-memory forecasts have a 0 statistic_id. Fixes cockroachdb#86806 Epic: none Release note: None
- Loading branch information
1 parent
8d1865f
commit 9059e80
Showing
6 changed files
with
110 additions
and
59 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
new-cluster name=s | ||
---- | ||
|
||
# Make sure that the presence of forecasted stats doesn't break | ||
# metadata SST writing. This is a regression test for #86806. | ||
# | ||
# We create 3 statistics manually which is the minimum needed to | ||
# create a forecast. Automatic collection is disabled to avoid | ||
# flakiness. | ||
exec-sql | ||
SET CLUSTER SETTING kv.bulkio.write_metadata_sst.enabled = true; | ||
---- | ||
|
||
exec-sql | ||
SET CLUSTER SETTING sql.stats.automatic_collection.enabled = false; | ||
---- | ||
|
||
exec-sql | ||
CREATE DATABASE db1; | ||
USE db1; | ||
CREATE TABLE tab (a INT PRIMARY KEY, b INT); | ||
---- | ||
|
||
exec-sql | ||
CREATE STATISTICS __auto__ ON a FROM tab; | ||
CREATE STATISTICS __auto__ ON b FROM tab; | ||
CREATE STATISTICS __auto__ ON a FROM tab; | ||
CREATE STATISTICS __auto__ ON b FROM tab; | ||
CREATE STATISTICS __auto__ ON a FROM tab; | ||
CREATE STATISTICS __auto__ ON b FROM tab; | ||
---- | ||
|
||
# The previous bug occurs when there are two or more forecasts since | ||
# forecasts do not hava a statistics ID. | ||
query-sql | ||
SELECT count(1) FROM [ SHOW STATISTICS FOR TABLE tab WITH FORECAST ] WHERE statistics_name = '__forecast__' | ||
---- | ||
2 | ||
|
||
exec-sql | ||
BACKUP DATABASE db1 INTO 'nodelocal://0/test/' | ||
---- |