Skip to content

Commit

Permalink
update legacy upgrade checks to use cluster other than default
Browse files Browse the repository at this point in the history
  • Loading branch information
ParkMyCar committed Jan 2, 2024
1 parent a261a77 commit 53c96a0
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 7 deletions.
2 changes: 1 addition & 1 deletion test/legacy-upgrade/check-from-v0.27.0-json.td
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
# by the Apache License, Version 2.0.

> SHOW CREATE MATERIALIZED VIEW json_view;
"materialize.public.json_view" "CREATE MATERIALIZED VIEW \"materialize\".\"public\".\"json_view\" IN CLUSTER \"default\" AS SELECT \"a\" -> 1 AS \"c1\", \"a\" ->> 'b' AS \"c2\", \"a\" #> '{b,1}' AS \"c3\", \"a\" #>> '{b, 1}' AS \"c4\", \"a\" - 'b' AS \"c5\", \"a\" @> '{b, 1}' AS \"c6\", \"a\" <@ '{b, 1}'::\"pg_catalog\".\"jsonb\" AS \"c7\", \"a\" ? 'b' AS \"c8\" FROM \"materialize\".\"public\".\"json_table\""
"materialize.public.json_view" "CREATE MATERIALIZED VIEW \"materialize\".\"public\".\"json_view\" IN CLUSTER \"json_compute_cluster\" AS SELECT \"a\" -> 1 AS \"c1\", \"a\" ->> 'b' AS \"c2\", \"a\" #> '{b,1}' AS \"c3\", \"a\" #>> '{b, 1}' AS \"c4\", \"a\" - 'b' AS \"c5\", \"a\" @> '{b, 1}' AS \"c6\", \"a\" <@ '{b, 1}'::\"pg_catalog\".\"jsonb\" AS \"c7\", \"a\" ? 'b' AS \"c8\" FROM \"materialize\".\"public\".\"json_table\""
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
#

> SHOW CREATE MATERIALIZED VIEW special_functions_view;
"materialize.public.special_functions_view" "CREATE MATERIALIZED VIEW \"materialize\".\"public\".\"special_functions_view\" IN CLUSTER \"default\" AS SELECT * FROM \"materialize\".\"public\".\"special_functions\" WHERE \"mz_catalog\".\"mz_now\"() > \"f1\""
"materialize.public.special_functions_view" "CREATE MATERIALIZED VIEW \"materialize\".\"public\".\"special_functions_view\" IN CLUSTER \"${arg.created-cluster}\" AS SELECT * FROM \"materialize\".\"public\".\"special_functions\" WHERE \"mz_catalog\".\"mz_now\"() > \"f1\""
2 changes: 1 addition & 1 deletion test/legacy-upgrade/check-from-v0.27.0-subquery.td
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@
# CREATE a view containing subqueries/derived tables of various types

> SHOW CREATE MATERIALIZED VIEW subquery_view;
"materialize.public.subquery_view" "CREATE MATERIALIZED VIEW \"materialize\".\"public\".\"subquery_view\" IN CLUSTER \"default\" AS SELECT (SELECT 1) FROM (SELECT 2) AS \"derived\" WHERE 2 NOT IN (SELECT 3) AND NOT EXISTS (SELECT 4) AND 5 >= ALL (SELECT 6) AND 7 < ANY (SELECT 8)"
"materialize.public.subquery_view" "CREATE MATERIALIZED VIEW \"materialize\".\"public\".\"subquery_view\" IN CLUSTER \"${arg.created-cluster}\" AS SELECT (SELECT 1) FROM (SELECT 2) AS \"derived\" WHERE 2 NOT IN (SELECT 3) AND NOT EXISTS (SELECT 4) AND 5 >= ALL (SELECT 6) AND 7 < ANY (SELECT 8)"
2 changes: 1 addition & 1 deletion test/legacy-upgrade/check-from-v0.61.0-regexp.td
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ $ skip-if
SELECT mz_version_num() < 6100;

> SHOW CREATE MATERIALIZED VIEW regexp_view;
"materialize.public.regexp_view" "CREATE MATERIALIZED VIEW \"materialize\".\"public\".\"regexp_view\" IN CLUSTER \"default\" AS SELECT \"a\" NOT LIKE 'b' AS \"c1\", \"a\" ILIKE 'b' AS \"c2\", \"a\" ~ 'b' AS \"c3\", \"a\" ~* 'b' AS \"c4\", \"a\" !~ 'b' AS \"c5\", \"a\" !~* 'b' AS \"c6\" FROM \"materialize\".\"public\".\"regexp_table\""
"materialize.public.regexp_view" "CREATE MATERIALIZED VIEW \"materialize\".\"public\".\"regexp_view\" IN CLUSTER \"${arg.created-cluster}\" AS SELECT \"a\" NOT LIKE 'b' AS \"c1\", \"a\" ILIKE 'b' AS \"c2\", \"a\" ~ 'b' AS \"c3\", \"a\" ~* 'b' AS \"c4\", \"a\" !~ 'b' AS \"c5\", \"a\" !~* 'b' AS \"c6\" FROM \"materialize\".\"public\".\"regexp_table\""
4 changes: 2 additions & 2 deletions test/legacy-upgrade/check-from-v0.67.0-object-with-avg.td
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
"materialize.public.view_with_avg_internal" "CREATE VIEW \"materialize\".\"public\".\"view_with_avg_internal\" (\"a\") AS SELECT \"mz_catalog\".\"avg_internal_v1\"(\"position\") FROM \"mz_catalog\".\"mz_columns\""

> SHOW CREATE MATERIALIZED VIEW mat_view_with_avg_internal;
"materialize.public.mat_view_with_avg_internal" "CREATE MATERIALIZED VIEW \"materialize\".\"public\".\"mat_view_with_avg_internal\" (\"a\") IN CLUSTER \"default\" AS SELECT \"mz_catalog\".\"avg_internal_v1\"(\"position\") FROM \"mz_catalog\".\"mz_columns\""
"materialize.public.mat_view_with_avg_internal" "CREATE MATERIALIZED VIEW \"materialize\".\"public\".\"mat_view_with_avg_internal\" (\"a\") IN CLUSTER \"${arg.created-cluster}\" AS SELECT \"mz_catalog\".\"avg_internal_v1\"(\"position\") FROM \"mz_catalog\".\"mz_columns\""


> SHOW CREATE VIEW view_with_avg_post_v0_67;
"materialize.public.view_with_avg_post_v0_67" "CREATE VIEW \"materialize\".\"public\".\"view_with_avg_post_v0_67\" (\"a\") AS SELECT \"pg_catalog\".\"avg\"(\"position\") FROM \"mz_catalog\".\"mz_columns\""

> SHOW CREATE MATERIALIZED VIEW mat_view_with_avg_post_v0_67;
"materialize.public.mat_view_with_avg_post_v0_67" "CREATE MATERIALIZED VIEW \"materialize\".\"public\".\"mat_view_with_avg_post_v0_67\" (\"a\") IN CLUSTER \"default\" AS SELECT \"pg_catalog\".\"avg\"(\"position\") FROM \"mz_catalog\".\"mz_columns\""
"materialize.public.mat_view_with_avg_post_v0_67" "CREATE MATERIALIZED VIEW \"materialize\".\"public\".\"mat_view_with_avg_post_v0_67\" (\"a\") IN CLUSTER \"${arg.created-cluster}\" AS SELECT \"pg_catalog\".\"avg\"(\"position\") FROM \"mz_catalog\".\"mz_columns\""
4 changes: 3 additions & 1 deletion test/legacy-upgrade/create-in-v0.27.0-json.td
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
# Make sure that any JSON operators in views are properly persisted
#

> CREATE CLUSTER json_compute_cluster SIZE '1';

> CREATE TABLE json_table (a JSONB);

> CREATE MATERIALIZED VIEW json_view AS SELECT a->1 c1, a->>'b' c2, a #> '{b,1}' c3, a #>> '{b, 1}' c4, a - 'b' c5, a @> '{b, 1}' c6, a <@ '{b, 1}'::jsonb c7, a ? 'b' c8 FROM json_table;
> CREATE MATERIALIZED VIEW json_view IN CLUSTER json_compute_cluster AS SELECT a->1 c1, a->>'b' c2, a #> '{b,1}' c3, a #>> '{b, 1}' c4, a - 'b' c5, a @> '{b, 1}' c6, a <@ '{b, 1}'::jsonb c7, a ? 'b' c8 FROM json_table;
8 changes: 8 additions & 0 deletions test/legacy-upgrade/mzcompose.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,12 +148,19 @@ def test_upgrade_from_version(
else:
c.up("materialized")

if from_version == "current_source" or MzVersion.parse_mz(
from_version
) >= MzVersion.parse_mz("v0.81.0-dev"):
created_cluster = "quickstart"
else:
created_cluster = "default"
temp_dir = f"--temp-dir=/share/tmp/upgrade-from-{from_version}"
seed = f"--seed={random.getrandbits(32)}"
c.run(
"testdrive",
"--no-reset",
f"--var=upgrade-from-version={from_version}",
f"--var=created-cluster={created_cluster}",
temp_dir,
seed,
f"create-in-{version_glob}-{filter}.td",
Expand Down Expand Up @@ -181,6 +188,7 @@ def test_upgrade_from_version(
"--no-reset",
f"--var=upgrade-from-version={from_version}",
f"--var=default-storage-size={Materialized.Size.DEFAULT_SIZE}-1",
f"--var=created-cluster={created_cluster}",
temp_dir,
seed,
f"check-from-{version_glob}-{filter}.td",
Expand Down

0 comments on commit 53c96a0

Please sign in to comment.