123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153 |
- # Copyright Materialize, Inc. and contributors. All rights reserved.
- #
- # Use of this software is governed by the Business Source License
- # included in the LICENSE file at the root of this repository.
- #
- # As of the Change Date specified in that file, in accordance with
- # the Business Source License, use of this software will be governed
- # by the Apache License, Version 2.0.
- mode cockroach
- simple conn=mz_system,user=mz_system
- ALTER SYSTEM SET enable_session_timelines = true;
- ----
- COMPLETE 0
- # Use explicit conn names to guarantee that the same session is used for all queries.
- simple conn=materialize,user=materialize
- SET TRANSACTION_ISOLATION TO "strong session serializable";
- ----
- COMPLETE 0
- simple conn=materialize,user=materialize
- CREATE CLUSTER stuck SIZE '1';
- ----
- COMPLETE 0
- # TODO(jkosh44) Read mz_clusters once DDL is working
- simple conn=materialize,user=materialize
- CREATE TABLE t (a INT);
- ----
- COMPLETE 0
- # TODO(jkosh44) Read mz_tables once DDL is working
- simple conn=materialize,user=materialize
- CREATE MATERIALIZED VIEW mv IN CLUSTER stuck AS SELECT SUM(a) FROM t;
- ----
- COMPLETE 0
- # TODO(jkosh44) Read mz_materialized_views once DDL is working
- simple conn=materialize,user=materialize
- INSERT INTO t VALUES (1);
- ----
- COMPLETE 1
- simple conn=materialize,user=materialize
- SELECT * FROM mv;
- ----
- 1
- COMPLETE 1
- simple conn=materialize,user=materialize
- INSERT INTO t VALUES (1);
- ----
- COMPLETE 1
- simple conn=materialize,user=materialize
- SELECT * FROM mv
- ----
- 2
- COMPLETE 1
- simple conn=materialize,user=materialize
- ALTER CLUSTER stuck SET (REPLICATION FACTOR = 0);
- ----
- COMPLETE 0
- simple conn=materialize,user=materialize
- SELECT * FROM mv;
- ----
- 2
- COMPLETE 1
- simple conn=materialize,user=materialize
- INSERT INTO t VALUES (1);
- ----
- COMPLETE 1
- # TODO(jkosh44) It would be nice to assert that a SELECT would block indefinitely.
- simple conn=materialize,user=materialize
- ALTER CLUSTER stuck SET (REPLICATION FACTOR = 1);
- ----
- COMPLETE 0
- simple conn=materialize,user=materialize
- SELECT * FROM mv;
- ----
- 3
- COMPLETE 1
- # Test that reading from a constant materialized view doesn't send our session timeline too far
- # into the future.
- simple conn=materialize,user=materialize
- CREATE MATERIALIZED VIEW const_mv AS SELECT 1;
- ----
- COMPLETE 0
- simple conn=materialize,user=materialize
- SELECT * FROM const_mv;
- ----
- 1
- COMPLETE 1
- simple conn=materialize,user=materialize
- SELECT * FROM mv;
- ----
- 3
- COMPLETE 1
- # Test that reading from a constant materialized view with a temporal filter doesn't send our
- # session timeline too far into the future.
- # This test will break in the year 10000. Please update the year 10000 in the view days to a much
- # larger year.
- simple conn=materialize,user=materialize
- CREATE VIEW days AS
- SELECT generate_series(
- CAST('1970-08-06' AS timestamp),
- CAST('1970-08-07' AS timestamp),
- CAST('1 day' AS interval)
- ) AS day
- UNION ALL
- SELECT generate_series(
- CAST('10000-08-06' AS timestamp),
- CAST('10000-08-07' AS timestamp),
- CAST('1 day' AS interval)
- ) AS day;
- ----
- COMPLETE 0
- simple conn=materialize,user=materialize
- CREATE MATERIALIZED VIEW days_mv AS SELECT day FROM days WHERE mz_now() <= day;
- ----
- COMPLETE 0
- simple conn=materialize,user=materialize
- SELECT * FROM days_mv;
- ----
- 10000-08-06 00:00:00
- 10000-08-07 00:00:00
- COMPLETE 2
- simple conn=materialize,user=materialize
- SELECT * FROM mv;
- ----
- 3
- COMPLETE 1
|