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
fix(migrations) ensure inserts are performed after schema agreement #7667
Conversation
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.
Having just skimmed the code a little bit as well as the up_f
implementation (f66c3ec), and unless I am missing something, I believe that there are fundamental issues with this approach: mixing DDL and DML queries in the up
migration step should be avoided because other replicas chosen for the DML (INSERT
) may still be digesting schema changes from the DDL (ALTER
) or may not even have received them yet. The new migrations framework (#3802) was adamant about this and that is why the up
step was meant to only receive a string of DDL queries: to make it fool-proof since this was a common mistake by migrations authors with the previous framework. Now, up_f
seems to have cancelled that?
Agreed, DDL and DML queries should not be mixed; DML queries should only be executed after schema agreement/consensus is met. During initial testing it appeared consensus was being reached when using the verbose output, but reading through the migration code it both |
I wonder if this occurs with C* 3.x series as well, I always have had weird r/w timeouts during migrations as well at times. |
It does; I tested on a 3.11.10 cluster as well. It makes sense that it would occur on all flavors of C* since DDL and DML statements were mixed without waiting on consensus. |
0d395fd
to
a1c31b1
Compare
b0549d3
to
9f4683b
Compare
When bootstrapping a multi-node Apache Cassandra cluster, the CREATE TABLE response from the coordinator node does guarantee that the schema altering statement will result in schema agreement across the cluster. This update moves the insert statement to occur after the CREATE TABLE statement to ensure schema agreement occurs before executing the insert statement.
9f4683b
to
e3c0c92
Compare
Summary
Using a multi-node Apache Cassandra 4.0.0 cluster fails bootstrap
When bootstrapping a multi-node Apache Cassandra cluster, the CREATE TABLE response from the coordinator node does guarantee that the schema altering statement will result in schema agreement across the cluster. This update moves the insert statement to occur after the CREATE TABLE statement to ensure schema agreement occurs before executing the insert statement.
Full changelog
Reproduction steps