-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
sql: creating a table and adding an index within a single transaction produces problems #39667
Comments
Assigning @dt for triage. |
This impacted our support for Flyway. We were able to enable Flyway to work for a customer if they separated schema changes into separate files as a temporary workaround. |
Zendesk ticket #3516 has been linked to this issue. |
Following are my findings after debugging (and discussing with @dt ): • The problem lies in the fact that the flyway scripts attempt to update a column in the same txn as it was added. This is a fundamental restriction in the way schema changes are setup. I traced down the error • I haven't debugged the txn retrying issue mentioned above yet. |
Previously, we would unconditionally create a job for a schema change issued in the same txn as the one in which its table was created. This is contrary to how we would handle these schema changes. In such scenarios schema changes would be applied synchronously without using the schema changer. Thus, these jobs would indefinitely remain in a pending state. This change adds a condition to check whether job creation is necessary. It fixes one symptom of cockroachdb#39667. Release note: None
39819: sql: Skip creation/update of job for schema change in same txn as CREATE r=adityamaru27 a=adityamaru27 Previously, we would unconditionally create a job for a schema change issued in the same txn as the one in which its table was created. This is contrary to how we would handle these schema changes. In such scenarios schema changes would be applied synchronously without using the schema changer. Thus, these jobs would indefinitely remain in a pending state. This change adds a condition to check whether job creation is necessary. It fixes one symptom of #39667. Release note: None Co-authored-by: Aditya Maru <[email protected]>
I think the bug here was fixed in #39819. What is left is a known-limitation of the SQL txn/schema-change interaction so I think this particular ticket can be closed now. |
The following has a number of issues and affects 19.1.x as well as master.
There are a number of issues here:
This is the problem that flyway migrations keep experiencing. Columns not being added is the most common.
The text was updated successfully, but these errors were encountered: