fetch-concurrent-same-source.td 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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. #
  11. # Make sure that FETCH-ing using multiple cursors from the same source works as expected
  12. #
  13. $ postgres-execute connection=postgres://mz_system:materialize@${testdrive.materialize-internal-sql-addr}
  14. ALTER SYSTEM SET min_timestamp_interval = '10ms'
  15. $ set int={"type": "record", "name": "field_int", "fields": [ {"name": "f1", "type": "int"} ] }
  16. $ kafka-create-topic topic=fetch-concurrent-same-source
  17. > CREATE CONNECTION kafka_conn
  18. TO KAFKA (BROKER '${testdrive.kafka-addr}', SECURITY PROTOCOL PLAINTEXT);
  19. > CREATE SOURCE fetch_concurrent_same_source
  20. IN CLUSTER ${arg.single-replica-cluster}
  21. FROM KAFKA CONNECTION kafka_conn (TOPIC 'testdrive-fetch-concurrent-same-source-${testdrive.seed}')
  22. WITH (TIMESTAMP INTERVAL '10ms')
  23. > CREATE TABLE fetch_concurrent_same_source_tbl FROM SOURCE fetch_concurrent_same_source (REFERENCE "testdrive-fetch-concurrent-same-source-${testdrive.seed}")
  24. FORMAT AVRO USING SCHEMA '${int}'
  25. ENVELOPE NONE
  26. $ kafka-ingest format=avro topic=fetch-concurrent-same-source schema=${int} timestamp=1
  27. {"f1": 123}
  28. {"f1": 234}
  29. {"f1": 345}
  30. > SELECT COUNT(*) FROM fetch_concurrent_same_source_tbl;
  31. 3
  32. > BEGIN
  33. > DECLARE c1 CURSOR FOR SELECT * FROM fetch_concurrent_same_source_tbl;
  34. > DECLARE c2 CURSOR FOR SELECT * FROM fetch_concurrent_same_source_tbl;
  35. > FETCH ALL c1;
  36. 123
  37. 234
  38. 345
  39. > FETCH ALL c2;
  40. 123
  41. 234
  42. 345
  43. > DECLARE c3 CURSOR FOR SELECT * FROM fetch_concurrent_same_source_tbl;
  44. > FETCH ALL c3;
  45. 123
  46. 234
  47. 345