coord-read-holds.td 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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-arg-default single-replica-cluster=quickstart
  10. # Make sure the Coordinator maintains read holds and that up-to-date objects are
  11. # "immediately" queryable.
  12. # Insert Postgres data
  13. $ postgres-execute connection=postgres://postgres:postgres@postgres
  14. ALTER USER postgres WITH replication;
  15. DROP SCHEMA IF EXISTS public CASCADE;
  16. DROP PUBLICATION IF EXISTS mz_source;
  17. CREATE SCHEMA public;
  18. CREATE TABLE pg_t1 (a INT);
  19. ALTER TABLE pg_t1 REPLICA IDENTITY FULL;
  20. INSERT INTO pg_t1 VALUES (100), (101), (102);
  21. CREATE PUBLICATION mz_source FOR ALL TABLES;
  22. # Create a Postgres Source
  23. > CREATE SECRET pgpass AS 'postgres'
  24. > CREATE CONNECTION pg TO POSTGRES (
  25. HOST postgres,
  26. DATABASE postgres,
  27. USER postgres,
  28. PASSWORD SECRET pgpass
  29. )
  30. > CREATE SOURCE mz_source
  31. IN CLUSTER ${arg.single-replica-cluster}
  32. FROM POSTGRES CONNECTION pg (PUBLICATION 'mz_source')
  33. FOR ALL TABLES;
  34. # Create a user table.
  35. > CREATE TABLE t1 (a int);
  36. > INSERT INTO t1 VALUES (201), (202), (203);
  37. # TODO: Reenable when database-issues#8619 is fixed
  38. $ skip-if
  39. SELECT true
  40. # Note: the important bit is making sure this EXPLAIN returns "can respond immediately: true"
  41. $ set-regex match=(\d{13}|([\d\-]{10}\s[\d:.]{12})|u\d+) replacement=<NON_CONSTANT>
  42. > EXPLAIN TIMESTAMP FOR SELECT COUNT(t1.a) FROM t1, pg_t1;
  43. " query timestamp: <NON_CONSTANT> (<NON_CONSTANT>)\n oracle read timestamp: <NON_CONSTANT> (<NON_CONSTANT>)\nlargest not in advance of upper: <NON_CONSTANT> (<NON_CONSTANT>)\n upper:[<NON_CONSTANT> (<NON_CONSTANT>)]\n since:[<NON_CONSTANT> (<NON_CONSTANT>)]\n can respond immediately: true\n timeline: Some(EpochMilliseconds)\n session wall time: <NON_CONSTANT> (<NON_CONSTANT>)\n\nsource materialize.public.pg_t1 (<NON_CONSTANT>, storage):\n read frontier:[<NON_CONSTANT> (<NON_CONSTANT>)]\n write frontier:[<NON_CONSTANT> (<NON_CONSTANT>)]\n\nsource materialize.public.t1 (<NON_CONSTANT>, storage):\n read frontier:[<NON_CONSTANT> (<NON_CONSTANT>)]\n write frontier:[<NON_CONSTANT> (<NON_CONSTANT>)]\n\nbinding constraints:\nlower:\n (IsolationLevel(StrictSerializable)): [<NON_CONSTANT> (<NON_CONSTANT>)]\n"