-
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
schema.Reload(): ignore column reading errors for views only, error for tables #13442
Merged
shlomi-noach
merged 8 commits into
vitessio:main
from
planetscale:reload-schema-errors-views
Jul 7, 2023
Merged
Changes from 7 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
61e3ce5
schema.Reload(): ignore column reading errors for views only, error f…
shlomi-noach d48fea6
restore to pre-PR
shlomi-noach bfd05a2
add ERNoSuchUser error (view's definer not found)
shlomi-noach 20dfcc5
Error
shlomi-noach bb7bd0a
ignore either missing columns or unknown definer -- for views
shlomi-noach b18c261
adapt tests
shlomi-noach f034dcf
cleanup
shlomi-noach 72d2e6d
update comment
shlomi-noach 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -447,18 +447,16 @@ func TestOpenFailedDueToLoadTableErr(t *testing.T) { | |
db.AddQueryPattern(fmt.Sprintf(mysql.GetColumnNamesQueryPatternForTable, "test_view"), | ||
sqltypes.MakeTestResult(sqltypes.MakeTestFields("column_name", "varchar"), "")) | ||
// rejecting the impossible query | ||
db.AddRejectedQuery("SELECT * FROM `fakesqldb`.`test_view` WHERE 1 != 1", errors.New("The user specified as a definer ('root'@'%') does not exist (errno 1449) (sqlstate HY000)")) | ||
db.AddRejectedQuery("SELECT * FROM `fakesqldb`.`test_view` WHERE 1 != 1", mysql.NewSQLErrorFromError(errors.New("The user specified as a definer ('root'@'%') does not exist (errno 1449) (sqlstate HY000)"))) | ||
|
||
AddFakeInnoDBReadRowsResult(db, 0) | ||
se := newEngine(10, 1*time.Second, 1*time.Second, 0, db) | ||
err := se.Open() | ||
// failed load should not return any error, instead should be logged. | ||
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. This comment has to change 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. Updated comment |
||
require.NoError(t, err) | ||
assert.ErrorContains(t, err, "Row count exceeded") | ||
|
||
logs := tl.GetAllLogs() | ||
logOutput := strings.Join(logs, ":::") | ||
assert.Contains(t, logOutput, "WARNING:Failed reading schema for the table: test_table") | ||
assert.Contains(t, logOutput, "Row count exceeded") | ||
assert.Contains(t, logOutput, "WARNING:Failed reading schema for the table: test_view") | ||
assert.Contains(t, logOutput, "The user specified as a definer ('root'@'%') does not exist (errno 1449) (sqlstate HY000)") | ||
} | ||
|
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 think this is not the only error that can happen on view.
The table on which the view is defined does not exist can also happen and in that case there can be a different error.
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.
The scenario you're refrring to is covered by the fact the query on
information_schema
does not return a row. It is handled here: https://github.com/vitessio/vitess/pull/13442/files#diff-106487fd3d9cbbb2b783c2d8aff23d3f448de495303a13801c6eebdbcefc0c7aR311There 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.
Following up on this, do we have a unit test for this case?