cc_cluster_sizes.td 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  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. $ postgres-execute connection=postgres://mz_system:materialize@${testdrive.materialize-internal-sql-addr}
  10. ALTER SYSTEM SET allowed_cluster_replica_sizes = '1-no-disk';
  11. ALTER SYSTEM SET disk_cluster_replicas_default = false;
  12. # Cannot create clusters with cc cluster size naming schemes
  13. ! CREATE CLUSTER c SIZE '1cc';
  14. contains:unknown cluster replica size 1cc
  15. ! CREATE CLUSTER c SIZE '512C';
  16. contains:unknown cluster replica size 512C
  17. # Nor can we create an unmanaged replica directly
  18. $ postgres-execute connection=postgres://mz_system:materialize@${testdrive.materialize-internal-sql-addr}
  19. ALTER SYSTEM SET unsafe_enable_unorchestrated_cluster_replicas = true
  20. ! CREATE CLUSTER c REPLICAS (r1 (SIZE '1cc'))
  21. contains:unknown cluster replica size 1cc
  22. # The existing cluster names are fine
  23. > CREATE CLUSTER c SIZE '1-no-disk';
  24. # But ensure we cannot ALTER our way to a cc name either
  25. ! ALTER CLUSTER c SET (SIZE '1cc');
  26. contains:unknown cluster replica size 1cc
  27. > DROP CLUSTER c
  28. # Now flip the flag and test that we can create clusters
  29. # with this naming scheme.
  30. $ postgres-execute connection=postgres://mz_system:materialize@${testdrive.materialize-internal-sql-addr}
  31. ALTER SYSTEM RESET allowed_cluster_replica_sizes;
  32. > CREATE CLUSTER c SIZE '1cc';
  33. > SELECT disk FROM mz_clusters WHERE name = 'c'
  34. true
  35. > DROP CLUSTER c
  36. > CREATE CLUSTER c SIZE '1C';
  37. > SELECT disk FROM mz_clusters WHERE name = 'c'
  38. true
  39. > DROP CLUSTER c
  40. # Create a cluster with a legacy size with disk enabled.
  41. > CREATE CLUSTER c SIZE '1-no-disk', DISK = true
  42. > SELECT disk FROM mz_clusters WHERE name = 'c'
  43. true
  44. # Altering to a cc size with disk explicitly toggled is not allowed.
  45. ! ALTER CLUSTER c SET (SIZE = '1cc', DISK = true)
  46. contains: DISK option not supported for modern cluster sizes because disk is always enabled
  47. ! ALTER CLUSTER c SET (SIZE = '1cc', DISK = false)
  48. contains: DISK option not supported for modern cluster sizes because disk is always enabled
  49. # But it's fine as long as the ALTER command doesn't mention disk explicitly,
  50. # even though the cluster's initial creation specified disk explicitly. The
  51. # DISK value is just forced to true.
  52. > ALTER CLUSTER c SET (SIZE = '1cc')
  53. > SELECT disk FROM mz_clusters WHERE name = 'c'
  54. true
  55. > DROP CLUSTER c
  56. # Same test as before, except the legacy size cluster has disk explicitly
  57. # disabled.
  58. > CREATE CLUSTER c SIZE '1-no-disk', DISK = false
  59. > ALTER CLUSTER c SET (SIZE = '1cc')
  60. > SELECT disk FROM mz_clusters WHERE name = 'c'
  61. true
  62. > DROP CLUSTER c
  63. # Same test as before, except the legacy size cluster has no disk explicitly
  64. # configured.
  65. > CREATE CLUSTER c SIZE = '1-no-disk'
  66. > SELECT disk FROM mz_clusters WHERE name = 'c'
  67. false
  68. > ALTER CLUSTER c SET (SIZE = '1cc')
  69. > SELECT disk FROM mz_clusters WHERE name = 'c'
  70. true
  71. # Cannot explicitly alter DISK option for new sizes.
  72. ! ALTER CLUSTER c SET (DISK = false)
  73. contains: DISK option not supported for modern cluster sizes because disk is always enabled
  74. ! ALTER CLUSTER c SET (DISK = true)
  75. contains: DISK option not supported for modern cluster sizes because disk is always enabled
  76. # But it's okay if you're going back to a legacy size.
  77. > ALTER CLUSTER c SET (DISK = true, SIZE = '1-no-disk')
  78. > SELECT disk FROM mz_clusters WHERE name = 'c'
  79. true
  80. > DROP CLUSTER c
  81. # Ensure that altering from a legacy size to a legacy size does not enable disk.
  82. > CREATE CLUSTER c SIZE = '1-no-disk'
  83. > SELECT disk FROM mz_clusters WHERE name = 'c'
  84. false
  85. > ALTER CLUSTER c SET (SIZE = '2-no-disk')
  86. > SELECT disk FROM mz_clusters WHERE name = 'c'
  87. false
  88. > DROP CLUSTER c
  89. # Ensure that disk isn't configurable for the new sizes (as it's force enabled).
  90. > CREATE CLUSTER c SIZE '1cc', DISK = true;
  91. > DROP CLUSTER c;
  92. ! CREATE CLUSTER c SIZE '1cc', DISK = false;
  93. contains: DISK option disabled is not supported for non-legacy cluster sizes because disk is always enabled
  94. > CREATE CLUSTER c REPLICAS (r1 (SIZE '1cc'))
  95. > CREATE CLUSTER REPLICA c.r2 SIZE '1cc';
  96. > CREATE CLUSTER REPLICA c.r3 SIZE '1C';
  97. ! CREATE CLUSTER REPLICA c.r SIZE '1cc', DISK = true;
  98. contains: DISK option not supported for non-legacy cluster sizes because disk is always enabled
  99. ! CREATE CLUSTER REPLICA c.r SIZE '1cc', DISK = false;
  100. contains: DISK option not supported for non-legacy cluster sizes because disk is always enabled