unified_cluster.slt 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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. # Basic tests of colocating compute and storage objects
  10. mode cockroach
  11. # Start from a pristine state
  12. reset-server
  13. statement ok
  14. CREATE CLUSTER c SIZE '1', REPLICATION FACTOR 2;
  15. statement ok
  16. ALTER CLUSTER c SET (REPLICATION FACTOR 1)
  17. statement ok
  18. CREATE SOURCE ldgen IN CLUSTER c FROM LOAD GENERATOR COUNTER (TICK INTERVAL '1s');
  19. statement ok
  20. ALTER CLUSTER c SET (REPLICATION FACTOR 2)
  21. statement ok
  22. CREATE TABLE t(a int);
  23. statement ok
  24. CREATE INDEX t_idx IN CLUSTER c ON t(a);
  25. statement ok
  26. SET CLUSTER = c;
  27. query TT
  28. SELECT s.name, c.name FROM mz_sources s JOIN mz_clusters c ON s.cluster_id = c.id
  29. ----
  30. ldgen c
  31. statement ok
  32. INSERT INTO t VALUES (1);
  33. query T
  34. SELECT * FROM t;
  35. ----
  36. 1
  37. statement ok
  38. ALTER CLUSTER c SET (REPLICATION FACTOR 0);
  39. statement ok
  40. ALTER CLUSTER c SET (REPLICATION FACTOR 1);
  41. statement ok
  42. INSERT INTO t VALUES (2);
  43. query T
  44. SELECT * FROM t;
  45. ----
  46. 1
  47. 2
  48. statement ok
  49. DROP CLUSTER c CASCADE;
  50. # First create a compute item, then a storage item
  51. statement ok
  52. CREATE CLUSTER c SIZE '1';
  53. statement ok
  54. CREATE MATERIALIZED VIEW mv IN CLUSTER c AS SELECT 1;
  55. statement ok
  56. CREATE SOURCE ldgen IN CLUSTER c FROM LOAD GENERATOR COUNTER (TICK INTERVAL '1s');
  57. statement ok
  58. SET CLUSTER = c;
  59. query T
  60. SELECT * FROM mv;
  61. ----
  62. 1