github-6335.td 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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. # Regression test for https://github.com/MaterializeInc/database-issues/issues/6335.
  10. #
  11. # This test confirms that subscribes that advance to the empty frontier are
  12. # fully cleaned up.
  13. #
  14. # This test relies on testdrive's automatic retries, since it queries
  15. # introspection sources that take a while to update.
  16. $ set-regex match=\d{13,20} replacement=<TIMESTAMP>
  17. $ set-sql-timeout duration=120s
  18. # This test uses introspection queries that need to be targeted to a replica
  19. > SET cluster_replica = r1
  20. # Create a collection with an empty frontier to subscribe from.
  21. > CREATE MATERIALIZED VIEW mv AS SELECT 1 AS a
  22. > BEGIN
  23. > DECLARE c CURSOR FOR SUBSCRIBE mv
  24. > FETCH c
  25. <TIMESTAMP> 1 1
  26. > COMMIT
  27. # To ensure that the subscribe has reached the introspection sources, we
  28. # install another dataflow and wait for that to show up. Introspection sources
  29. # are not serializable, but dataflows still show up in order.
  30. > CREATE INDEX mv_idx ON mv(a)
  31. > SELECT count(*)
  32. FROM
  33. mz_indexes i,
  34. mz_introspection.mz_compute_exports e
  35. WHERE
  36. i.name = 'mv_idx' AND
  37. e.export_id = i.id
  38. 1
  39. > SELECT count(*) FROM mz_internal.mz_subscriptions
  40. 0
  41. > SELECT count(*)
  42. FROM mz_introspection.mz_compute_exports e
  43. JOIN mz_introspection.mz_dataflows d ON d.id = e.dataflow_id
  44. WHERE e.export_id LIKE 't%' AND
  45. d.name NOT LIKE '%introspection-subscribe%'
  46. 0