-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Better handling of vreplication setState() failure #13488
Merged
shlomi-noach
merged 4 commits into
vitessio:main
from
planetscale:vreplication-controller-error-log
Jul 16, 2023
Merged
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
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 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 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
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.
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.
I don't understand this line.
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.
strings.ToValidUTF8
replaces all non-UTF8 characters inmessage
with�
, which is the same character you see on your terminal or in CI logs etc. for non-UTF8 characters. The main thing is to remove non-UTF8 characters, of course.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.
I thought that strings in go were already utf8 encoded and that unicode character is used for invalid characters. Do you have any examples of what we're trying to fix?
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.
Yeah, so the story is this: we've seen a production issue where a
vitess
Online DDL failed, and the error message wasPicked source tablet...
, which is really not an error message. Upon investigation, we found a log entry saying (details redacted):Now, the underlying problem was that the migration converted a column from
NULL
able toNOT NULL
. So far so good. The table data did in fact haveNULL
data. OK fine, too bad, but we do handle this scenario and know how to fail the migration. Which we did.But then the problem was that calling
setState
(updating_vt.vreplication.message
) failed. So we were unable to store the actual error message in Vitess's DB.Why would that happen? I was reminded of this: #13487 ; when you attempt to write an arbitrary binary, that can fail. The error message contains specific table data, which could be binary. This is why in #13487 we converted non UTF8 characters to
�
. I am unable to determine the precise data that caused this failure, but13487
seems very relevant.Moreover, Vitess did not print out the
setState
(i.e. theUPDATE _vt.vreplication
) error. This PR therefore: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.
OK, it doesn't hurt to do this. I would note that the field in the table is varbinary too. That may be a relevant factor here.