-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
unify cluster alter commands #628
Conversation
628a016
to
268c887
Compare
pkg/materialize/cluster.go
Outdated
} else { | ||
// Reset the schedule settings if not enabled. | ||
q = fmt.Sprintf("ALTER CLUSTER %s RESET (SCHEDULE);", b.QualifiedName()) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great! Thanks a lot @jubrad!
The only issue that I've noticed while manually testing this is that if you were to change the scheduling from enabled true to false, it generates the following alter statement which will fail:
ALTER CLUSTER "scheduling_cluster" SET ();
Repro:
resource "materialize_cluster" "scheduling_cluster" {
name = "scheduling_cluster"
size = "50cc"
scheduling {
on_refresh {
enabled = true # Apply and then change to false and apply again
hydration_time_estimate = "3 hour"
}
}
}
268c887
to
cbcc42e
Compare
cbcc42e
to
6acf49d
Compare
func (b *ClusterBuilder) AlterClusterScheduling(s SchedulingConfig) error { | ||
q := strings.Builder{} | ||
q.WriteString(fmt.Sprintf(`ALTER CLUSTER %s`, b.QualifiedName())) | ||
q.WriteString(fmt.Sprintf(` SET (%s)`, b.GenSchedulingConfigSql(s))) | ||
q.WriteString(`;`) | ||
return b.ddl.exec(q.String()) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bobbyiliev the plan now is that we do AlterClusterScheduling separate from AlterCluster and always first.
This will allow us to from a cluster with scheduling and no replication factor to a cluster without scheduling and a replication factor, and vice versa.
Note, we only really set the scheduling option on the ClusterBuilder directly in the create phase where everything can be done in a single statement.
6acf49d
to
4c935b9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe that this looks good! Thank you for putting this all together @jubrad 👏
Unifying cluster alter commands. This is a pre-req for adding graceful reconfiguration.