-
Notifications
You must be signed in to change notification settings - Fork 198
maria: require resync on partial row events #4530
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
Open
dtunikov
wants to merge
10
commits into
main
Choose a base branch
from
fix/dbi-815/mysql-fail-on-maria-partial-row-data-event
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
a98a696
fail loudly on partial row maria event
dtunikov ce8eca6
- classify error
dtunikov 50ae9f7
e2e test for partial row event + test container helper for e2e tests
dtunikov 5e96c0f
cleanup comments
dtunikov 7ef6ee3
fix lint errs
dtunikov 1d13df1
classify "NOTIFY_BINLOG_EVENT_EXCEEDED_MAX_ALLOWED_PACKET" as distinc…
dtunikov d91b0b5
event type label as integer
dtunikov 110681c
don't fail if partial row event belong to out of pipe table
dtunikov 48bf84d
fix parsePartialRowEventTableID
dtunikov 730295c
common resource flags for mysql/maria test container
dtunikov File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,6 +2,7 @@ package connmysql | |
|
|
||
| import ( | ||
| "context" | ||
| "encoding/hex" | ||
| "fmt" | ||
| "log/slog" | ||
| "slices" | ||
|
|
@@ -438,3 +439,35 @@ func TestIntegrationGetTableSchemaPrimaryKeyVariants(t *testing.T) { | |
| }) | ||
| } | ||
| } | ||
|
|
||
| func TestParsePartialRowEventTableID(t *testing.T) { | ||
| t.Parallel() | ||
|
|
||
| // Real PARTIAL_ROW_DATA_EVENT payloads captured from MariaDB 12.3 | ||
| decode := func(s string) []byte { | ||
| b, err := hex.DecodeString(s) | ||
| require.NoError(t, err) | ||
| return b | ||
| } | ||
| // first fragment: total=9, seq=1, flags=FL_ORIG_EVENT_SIZE, then origSize + embedded rows event | ||
| firstFragment := decode("09000000010000000126200000000000002cc0476a" + | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. these are real payloads captured during local testing, so I think we can keep this unit test in addition to e2e one (would be faster to run locally when we make changes to parsing logic) |
||
| "17010000002a20000000000000000012000000000001000203fc0100000000200000") | ||
| // a continuation fragment: total=9, seq=2, no flags, raw row data | ||
| continuationFragment := decode("09000000020000000079797979797979797979") | ||
|
|
||
| tableID, total, ok := parsePartialRowEventTableID(firstFragment) | ||
| require.True(t, ok, "first fragment table id should be recoverable") | ||
| require.Equal(t, uint64(18), tableID) | ||
| require.Equal(t, uint32(9), total) | ||
|
|
||
| _, total, ok = parsePartialRowEventTableID(continuationFragment) | ||
| require.False(t, ok, "continuation fragment carries no table id") | ||
| require.Equal(t, uint32(9), total, "total_fragments is still readable on continuation fragments") | ||
|
|
||
| // too short for even the post-header | ||
| _, _, ok = parsePartialRowEventTableID([]byte{0x09, 0x00, 0x00}) | ||
| require.False(t, ok) | ||
| // post-header present but content truncated before the embedded table id | ||
| _, _, ok = parsePartialRowEventTableID(firstFragment[:partialRowsHeaderLen+8+binlogCommonHeaderLen+2]) | ||
| require.False(t, ok) | ||
| } | ||
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.