fetch-concurrent-same-source.td 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. FORMAT AVRO USING SCHEMA '${int}'
  23. ENVELOPE NONE
  24. WITH (TIMESTAMP INTERVAL '10ms')
  25. $ kafka-ingest format=avro topic=fetch-concurrent-same-source schema=${int} timestamp=1
  26. {"f1": 123}
  27. {"f1": 234}
  28. {"f1": 345}
  29. > SELECT COUNT(*) FROM fetch_concurrent_same_source;
  30. 3
  31. > BEGIN
  32. > DECLARE c1 CURSOR FOR SELECT * FROM fetch_concurrent_same_source;
  33. > DECLARE c2 CURSOR FOR SELECT * FROM fetch_concurrent_same_source;
  34. > FETCH ALL c1;
  35. 123
  36. 234
  37. 345
  38. > FETCH ALL c2;
  39. 123
  40. 234
  41. 345
  42. > DECLARE c3 CURSOR FOR SELECT * FROM fetch_concurrent_same_source;
  43. > FETCH ALL c3;
  44. 123
  45. 234
  46. 345