fetch-tail-without-snapshot.td 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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 the SNAPSHOT=FALSE option is observed
  12. #
  13. $ set-regex match=\d{13} replacement=<TIMESTAMP>
  14. $ set int={"type": "record", "name": "field_int", "fields": [ {"name": "f1", "type": "int"} ] }
  15. $ kafka-create-topic topic=tail-without-snapshot
  16. $ kafka-ingest format=avro topic=tail-without-snapshot schema=${int} timestamp=1
  17. {"f1": 123}
  18. {"f1": 234}
  19. {"f1": 345}
  20. > CREATE CONNECTION kafka_conn
  21. TO KAFKA (BROKER '${testdrive.kafka-addr}', SECURITY PROTOCOL PLAINTEXT);
  22. > CREATE SOURCE tail_without_snapshot
  23. IN CLUSTER ${arg.single-replica-cluster}
  24. FROM KAFKA CONNECTION kafka_conn (TOPIC 'testdrive-tail-without-snapshot-${testdrive.seed}')
  25. FORMAT AVRO USING SCHEMA '${int}'
  26. ENVELOPE NONE
  27. > SELECT * FROM tail_without_snapshot;
  28. 123
  29. 234
  30. 345
  31. > BEGIN
  32. > DECLARE c CURSOR FOR SUBSCRIBE tail_without_snapshot WITH (SNAPSHOT = FALSE);
  33. > FETCH 1 FROM c WITH (timeout = '2s')
  34. $ kafka-ingest format=avro topic=tail-without-snapshot schema=${int} timestamp=1
  35. {"f1": 567}
  36. > FETCH 1 FROM c WITH (timeout = '60s')
  37. <TIMESTAMP> 1 567