-
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
ExecuteFetch
: error on multiple result sets
#14949
Merged
Merged
Changes from 47 commits
Commits
Show all changes
48 commits
Select commit
Hold shift + click to select a range
222a174
ExecuteFetch: error on multiple results
shlomi-noach 0125804
more suggestive description
shlomi-noach 48bc86d
exhaust further result sets. Prioritize multi-results error over resu…
shlomi-noach 232da20
break down ExecuteFetch multi-statements
shlomi-noach a6d97f5
ExecuteFetchMultiDrain
shlomi-noach 4e3544f
remove uneccessary (though unharmful) semicolon
shlomi-noach a4d0271
fix multi statements
shlomi-noach 7b28d8f
fix multi statements
shlomi-noach 2cde946
fix multi statements
shlomi-noach 7867fb2
fix multi statements
shlomi-noach 0c88aa8
fix multi statements
shlomi-noach c039998
fix multi statements
shlomi-noach 313487c
fix test rewrite
shlomi-noach 9adac78
collect errors rather than number of errors
shlomi-noach 1690cc0
fix multi statements
shlomi-noach 1003574
useDB rather than 'USE ...' statement
shlomi-noach 7be46ad
Fix failover test for reparenting
dbussink 3f8a010
use QueryTabletMultiple
shlomi-noach c26b25a
Merge branch 'main' into execute-fetch-error-more
shlomi-noach 245b9bc
fix multi statements
shlomi-noach 8e30a12
log query/queries in error message
shlomi-noach 2ef3fa5
RunSQLs runs queries in single connection
shlomi-noach ed7e27a
fix multi statements
shlomi-noach 02a39e8
fix multi statements
shlomi-noach b15e38d
clearer error message
shlomi-noach 953330f
QueryTablet loop -> QueryTabletMultiple with no loop
shlomi-noach 2147a8b
fix multi statements
shlomi-noach 28b42a2
fix multi statements
shlomi-noach 3d05639
fix multi statements
shlomi-noach b87350e
rewording
shlomi-noach 760c64d
fix multi statements
shlomi-noach dab41b1
generic fix for multi-statements in NewMySQL()
shlomi-noach 8f07a3b
fix multi statements
shlomi-noach 6e1ec2f
simplify test error check
shlomi-noach 5b1d205
Ignore sqlerror.ERNonExistingGrant
shlomi-noach 262a8da
UnwrappedIs
shlomi-noach ca09be0
turn ErrExecuteFetchMultipleResults to existing/expected muti-result …
shlomi-noach fb6f8d4
feat: update vtorc tests to function properly
GuptaManan100 dcffe94
test both before and after multi-result procs
shlomi-noach 404ddb6
do not limit rows, so that we can consume them all
shlomi-noach fbb23a6
remove grant relaxation patch
shlomi-noach 4351f12
resolved conflict
shlomi-noach 8e1eb7f
refactor: move drain to it's own little method
harshit-gangal 50c2243
fix test: drop table (previously there was a hidden 'Table 'test_idx'…
shlomi-noach a30c804
FETCH_NO_ROWS
shlomi-noach 39ab378
multi-drain still fully reads packet rows, just not into memory
shlomi-noach db5de4f
code comments
shlomi-noach 9620d3c
errors: do not re-implement errors.Is
vmg 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
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
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 |
---|---|---|
|
@@ -258,10 +258,16 @@ func getMysqlConnParam(tablet *cluster.Vttablet) mysql.ConnParams { | |
return connParams | ||
} | ||
|
||
// RunSQLs is used to run SQL commands directly on the MySQL instance of a vttablet | ||
// RunSQLs is used to run SQL commands directly on the MySQL instance of a vttablet. All commands are | ||
// run in a single connection. | ||
func RunSQLs(ctx context.Context, t *testing.T, sqls []string, tablet *cluster.Vttablet) (results []*sqltypes.Result) { | ||
tabletParams := getMysqlConnParam(tablet) | ||
conn, err := mysql.Connect(ctx, &tabletParams) | ||
require.Nil(t, err) | ||
defer conn.Close() | ||
|
||
for _, sql := range sqls { | ||
result := RunSQL(ctx, t, sql, tablet) | ||
result := execute(t, conn, sql) | ||
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. The change in this function is that we ensure all queries run in the same conection. This is required for sequences like |
||
results = append(results, result) | ||
} | ||
return results | ||
|
@@ -704,7 +710,7 @@ func SetReplicationSourceFailed(tablet *cluster.Vttablet, prsOut string) bool { | |
|
||
// CheckReplicationStatus checks that the replication for sql and io threads is setup as expected | ||
func CheckReplicationStatus(ctx context.Context, t *testing.T, tablet *cluster.Vttablet, sqlThreadRunning bool, ioThreadRunning bool) { | ||
res := RunSQL(ctx, t, "show slave status;", tablet) | ||
res := RunSQL(ctx, t, "show slave status", tablet) | ||
if ioThreadRunning { | ||
require.Equal(t, "Yes", res.Rows[0][10].ToString()) | ||
} else { | ||
|
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
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.
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.
Question: should we iterate and consume all results?
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 we must here, otherwise we leave the connection in an invalid state. And a subsequent query on the same connection would see the previous result here.
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.
Done.
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.
@shlomi-noach are there other places in the code base where we pass in 0 incorrectly and do want to consume all the results?
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'm not sure.
ExecuteFetchMulti
potentially? But then, this bugs me, because we should be able to passmaxrows = 17
in any place, so why would the draining inExecuteFetch
necessarily have to use-1
? And yet, it does, as per #14949 (comment). I'm not sure if this is again limited to stored procedure behavior. I don't think it is.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.
There's not other explicit
c.ReadQueryResult(0, ...)
call in the code, FWIW.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.
@harshit-gangal further edited the
ExecuteFetch
/drain logic to fix potential leaks, and consolidated the draining logic. I think we should be good now.