Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport to 2.12.x: #6231: Fix flaky upgrade test #6232

Merged
merged 1 commit into from
Oct 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions test/sql/updates/post.continuous_aggs.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@
-- Please see the included NOTICE for copyright information and
-- LICENSE-APACHE for a copy of the license.

SELECT
extversion < '2.0.0' AS has_refresh_mat_view
FROM pg_extension
WHERE extname = 'timescaledb' \gset

\if :has_refresh_mat_view
REFRESH MATERIALIZED VIEW mat_before;
\else
CALL refresh_continuous_aggregate('mat_before',NULL,NULL);
\endif

\x on
SELECT * FROM mat_before ORDER BY bucket, location;
\x off
Expand Down
12 changes: 12 additions & 0 deletions test/sql/updates/post.continuous_aggs.v3.sql
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,18 @@

\ir post.continuous_aggs.v2.sql

-- Ensure CAgg is refreshed
SELECT
extversion < '2.0.0' AS has_refresh_mat_view
FROM pg_extension
WHERE extname = 'timescaledb' \gset

\if :has_refresh_mat_view
REFRESH MATERIALIZED VIEW rename_cols;
\else
CALL refresh_continuous_aggregate('rename_cols',NULL,NULL);
\endif

SELECT "time", count(*) from rename_cols GROUP BY 1 ORDER BY 1;

--verify compression can be enabled
Expand Down
2 changes: 1 addition & 1 deletion test/sql/updates/setup.catalog.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
-- Please see the included NOTICE for copyright information and
-- LICENSE-APACHE for a copy of the license.

-- Catalog tables are occationally rewritten as part of updates, so
-- Catalog tables are occasionally rewritten as part of updates, so
-- this is to test that privileges are maintained over updates of the
-- extension. We could verify that other properties (e.g., comments)
-- are maintained here as well, but this is not something we use right
Expand Down
1 change: 0 additions & 1 deletion test/sql/updates/setup.continuous_aggs.sql
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ SELECT generate_series('2018-11-01 00:00'::timestamp, '2018-12-15 00:00'::timest
\else
GROUP BY bucket, location
HAVING min(location) >= 'NYC' and avg(temperature) > 2 WITH NO DATA;
SELECT add_continuous_aggregate_policy('mat_before', NULL, '-30 days'::interval, '336 h');
ALTER MATERIALIZED VIEW mat_before SET (timescaledb.materialized_only=true);
\endif

Expand Down
3 changes: 0 additions & 3 deletions test/sql/updates/setup.continuous_aggs.v2.sql
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ SELECT generate_series('2018-11-01 00:00'::timestamp, '2018-12-15 00:00'::timest
\else
GROUP BY bucket, location
WITH NO DATA;
SELECT add_continuous_aggregate_policy('rename_cols', NULL, '14 days'::interval, '336 h');
\endif

\if :has_refresh_mat_view
Expand Down Expand Up @@ -141,7 +140,6 @@ SELECT generate_series('2018-11-01 00:00'::timestamp, '2018-12-15 00:00'::timest
\else
GROUP BY bucket, location
HAVING min(location) >= 'NYC' and avg(temperature) > 2 WITH NO DATA;
SELECT add_continuous_aggregate_policy('mat_before', NULL, '-30 days'::interval, '336 h');

ALTER MATERIALIZED VIEW rename_cols RENAME COLUMN bucket TO "time";
\endif
Expand Down Expand Up @@ -218,7 +216,6 @@ CREATE SCHEMA cagg;
\else
GROUP BY bucket, location
HAVING min(location) >= 'NYC' and avg(temperature) > 2 WITH NO DATA;
SELECT add_continuous_aggregate_policy('cagg.realtime_mat', NULL, '-30 days'::interval, '336 h');
\endif
\if :WITH_SUPERUSER
GRANT SELECT ON cagg.realtime_mat TO cagg_user;
Expand Down
Loading