diff --git a/src/sql/src/plan/statement/ddl.rs b/src/sql/src/plan/statement/ddl.rs index b316070b6b770..82e9c640e122f 100644 --- a/src/sql/src/plan/statement/ddl.rs +++ b/src/sql/src/plan/statement/ddl.rs @@ -6264,7 +6264,7 @@ pub fn plan_alter_cluster( } } false => { - if !alter_strategy.is_none() { + if !with_options.is_empty() { sql_bail!("ALTER... WITH not supported for unmanaged clusters"); } if availability_zones.is_some() { diff --git a/test/sqllogictest/managed_cluster.slt b/test/sqllogictest/managed_cluster.slt index 189f6ac2ad9da..1d9f475eb3fe2 100644 --- a/test/sqllogictest/managed_cluster.slt +++ b/test/sqllogictest/managed_cluster.slt @@ -424,6 +424,35 @@ ALTER CLUSTER foo set (SIZE 'scale=1,workers=4') WITH (WAIT UNTIL READY (TIMEOUT statement ok DROP CLUSTER foo +# Regression: SQL-217. `WITH (WAIT ...)` must be rejected on unmanaged +# clusters, both when the cluster is already unmanaged and when the same +# statement transitions it from managed to unmanaged. Previously the WAIT +# options were silently ignored. + +statement ok +CREATE CLUSTER foo REPLICAS (r1 (SIZE 'scale=1,workers=1')) + +statement error ALTER\.\.\. WITH not supported for unmanaged clusters +ALTER CLUSTER foo SET (REPLICAS ()) WITH (WAIT FOR '0s') + +statement error ALTER\.\.\. WITH not supported for unmanaged clusters +ALTER CLUSTER foo SET (REPLICAS ()) WITH (WAIT UNTIL READY (TIMEOUT '0s', ON TIMEOUT 'COMMIT')) + +statement ok +DROP CLUSTER foo + +statement ok +CREATE CLUSTER foo (SIZE 'scale=1,workers=1') + +statement error ALTER\.\.\. WITH not supported for unmanaged clusters +ALTER CLUSTER foo SET (MANAGED = false) WITH (WAIT FOR '0s') + +statement error ALTER\.\.\. WITH not supported for unmanaged clusters +ALTER CLUSTER foo SET (MANAGED = false) WITH (WAIT UNTIL READY (TIMEOUT '0s', ON TIMEOUT 'COMMIT')) + +statement ok +DROP CLUSTER foo + # Regression: zero-downtime finalization (PR #28836) reads workload_class from # the catalog instead of the planned config, silently dropping the change.