-
Notifications
You must be signed in to change notification settings - Fork 9
Fix crash due to incompatible headers when mutation changed the schema between scheduling and executing part exports #1150
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
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.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
This PR fixes the issue for export part, but the export partition will not run because of schema mismatch. I need to look into that. It is ok to ship this as is since export partition is experimental |
|
To make the reviewers life: This is a classical race condition / TOCTOU problem. When the user issues the export query, the schema validation takes place. After that, the export is scheduled to run in the background. When it is picked up by the background executor, in order to create the pipeline / read from merge tree, we need the storage metadata. If a mutation changed the metadata in this time window, there will be a schema mismatch between the source and destination tables. This PR fixes it by capturing the snapshot at the time of interpreting the query / validating the schema and re-uses that to create the pipeline |
ianton-ru
left a comment
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.
Can changing schema cause some errors, if node exports some parts with old schema, schema is changed, replica restarts and reloads schema, and exports other parts with new schema?
This will only happen if the user requests those news parts to be esportes. Remember, this is the export part functionality - not export partition. |
|
|
The PR that fixes it is here #1158, it just hasn't been merged yet |
To make the reviewers life:
This is a classical race condition / TOCTOU problem.
When the user issues the export query, the schema validation takes place. After that, the export is scheduled to run in the background. When it is picked up by the background executor, in order to create the pipeline / read from merge tree, we need the storage metadata. If a mutation changed the metadata in this time window, there will be a schema mismatch between the source and destination tables.
This PR fixes it by capturing the snapshot at the time of interpreting the query / validating the schema and re-uses that to create the pipeline
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
Fix crash due to incompatible headers when mutation changed the schema between scheduling and executing part exports
Documentation entry for user-facing changes
...
CI/CD Options
Exclude tests:
Regression jobs to run: