Fix handling of warnings on DML batches#1643
Open
ggilder wants to merge 7 commits intogithub:masterfrom
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Improves --panic-on-warnings safety during binlog replay by ensuring warnings emitted by any statement inside a batched DML multi-statement are detected (not just the last statement), addressing the masking/data-loss scenario from #1636 / follow-up to #1633.
Changes:
- Add
executeBatchWithWarningChecking()to interleaveSHOW WARNINGSafter each DML in a batch whenPanicOnWarningsis enabled. - Update
ApplyDMLEventQueries()to use the new warning-checking execution path only forPanicOnWarnings(keep existing fast path otherwise). - Add a new unit test and a new local integration test case to validate “warning in the middle of a batch” behavior.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| localtests/panic-on-warnings-batch-middle/extra_args | Adds localtest arguments enabling --panic-on-warnings with a unique index alter. |
| localtests/panic-on-warnings-batch-middle/expect_failure | Asserts failure output contains warning-detection text. |
| localtests/panic-on-warnings-batch-middle/create.sql | Sets up event-driven DML to reproduce a batched replay scenario. |
| go/logic/applier_test.go | Adds unit test asserting mid-batch warning causes rollback of entire batch. |
| go/logic/applier.go | Implements per-statement warning detection for batched DML execution under PanicOnWarnings. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Contributor
Author
|
@meiji163 important correction to earlier data loss fix — lmk if you have questions |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related issue: #1636
Description
This is a follow-up to #1633 — this was actually an incomplete fix for the data loss issue described there, because any DML events that would cause data loss that happened in the middle of a batch could be masked by success of the final statement in the batch. This code change now runs
SHOW WARNINGSafter each statement in a batch so that we collect all warnings.script/cibuildreturns with no formatting errors, build errors or unit test errors.