correctness-property-2.td 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. # Copyright Materialize, Inc. and contributors. All rights reserved.
  2. #
  3. # Use of this software is governed by the Business Source License
  4. # included in the LICENSE file at the root of this repository.
  5. #
  6. # As of the Change Date specified in that file, in accordance with
  7. # the Business Source License, use of this software will be governed
  8. # by the Apache License, Version 2.0.
  9. $ set-sql-timeout duration=1s
  10. $ postgres-execute connection=postgres://mz_system:materialize@${testdrive.materialize-internal-sql-addr}
  11. ALTER SYSTEM SET unsafe_enable_unorchestrated_cluster_replicas = true
  12. $ set count=10000
  13. $ mysql-connect name=mysql url=mysql://root@mysql password=${arg.mysql-root-password}
  14. $ mysql-execute name=mysql
  15. DROP DATABASE IF EXISTS public;
  16. CREATE DATABASE public;
  17. USE public;
  18. CREATE TABLE t1 (pk SERIAL PRIMARY KEY, f2 BIGINT);
  19. SET @i:=0;
  20. INSERT INTO t1 (f2) SELECT @i:=@i+1 FROM mysql.time_zone t1, mysql.time_zone t2 LIMIT ${count};
  21. # Create a cluster with no replicas so that we have time to submit queries at the minimum frontier.
  22. > CREATE CLUSTER storage REPLICAS ()
  23. > CREATE SECRET mysqlpass AS '${arg.mysql-root-password}'
  24. > CREATE CONNECTION mysql_conn TO MYSQL (
  25. HOST mysql,
  26. USER root,
  27. PASSWORD SECRET mysqlpass
  28. )
  29. > CREATE SOURCE mz_source
  30. IN CLUSTER storage
  31. FROM MYSQL CONNECTION mysql_conn
  32. FOR ALL TABLES
  33. WITH (RETAIN HISTORY = FOR '365000 days');
  34. # Grab a cursor at timestamp 0
  35. > BEGIN
  36. > DECLARE c CURSOR FOR SELECT 1, COUNT(*) FROM t1 AS OF 0
  37. # Start ingestion by adding a replica to the cluster. We must do this from a
  38. # different connection to not disturb the transaction we're in.
  39. $ postgres-execute connection=postgres://materialize:materialize@${testdrive.materialize-sql-addr}
  40. CREATE CLUSTER REPLICA storage.r1 SIZE = '1';
  41. # Verify that at timestamp 0 there is only one record whose value is the final value
  42. > FETCH 1 c WITH (timeout = '1d');
  43. 1 ${count}
  44. > COMMIT