-
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
Add session flag for stream execute grpc api #14046
Merged
harshit-gangal
merged 7 commits into
vitessio:main
from
planetscale:grpc-streaming-session-change
Sep 20, 2023
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
b1ec97a
send session as last packet in stream execute grpc behind a flag
harshit-gangal f940fd4
fix help text output
harshit-gangal 0412fca
set the flag to true for test
harshit-gangal 2888f97
added release notes
harshit-gangal 1cd6ff4
update flag message
harshit-gangal 52760b3
Merge remote-tracking branch 'upstream/main' into grpc-streaming-sess…
harshit-gangal 3f0c3a4
exclude test from race
harshit-gangal 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
//go:build !race | ||
|
||
package tabletserver | ||
|
||
import ( | ||
"context" | ||
"strings" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
"github.com/stretchr/testify/require" | ||
|
||
"vitess.io/vitess/go/sqltypes" | ||
querypb "vitess.io/vitess/go/vt/proto/query" | ||
"vitess.io/vitess/go/vt/sqlparser" | ||
"vitess.io/vitess/go/vt/vttablet/tabletserver/tabletenv" | ||
) | ||
|
||
// TestHandlePanicAndSendLogStatsMessageTruncation tests that when an error truncation | ||
// length is set and a panic occurs, the code in handlePanicAndSendLogStats will | ||
// truncate the error text in logs, but will not truncate the error text in the | ||
// error value. | ||
func TestHandlePanicAndSendLogStatsMessageTruncation(t *testing.T) { | ||
ctx, cancel := context.WithCancel(context.Background()) | ||
defer cancel() | ||
tl := newTestLogger() | ||
defer tl.Close() | ||
logStats := tabletenv.NewLogStats(ctx, "TestHandlePanicAndSendLogStatsMessageTruncation") | ||
db, tsv := setupTabletServerTest(t, ctx, "") | ||
defer tsv.StopService() | ||
defer db.Close() | ||
|
||
longSql := "select * from test_table_loooooooooooooooooooooooooooooooooooong" | ||
longBv := map[string]*querypb.BindVariable{ | ||
"bv1": sqltypes.Int64BindVariable(1111111111), | ||
"bv2": sqltypes.Int64BindVariable(2222222222), | ||
"bv3": sqltypes.Int64BindVariable(3333333333), | ||
"bv4": sqltypes.Int64BindVariable(4444444444), | ||
} | ||
origTruncateErrLen := sqlparser.GetTruncateErrLen() | ||
sqlparser.SetTruncateErrLen(32) | ||
defer sqlparser.SetTruncateErrLen(origTruncateErrLen) | ||
|
||
defer func() { | ||
err := logStats.Error | ||
want := "Uncaught panic for Sql: \"select * from test_table_loooooooooooooooooooooooooooooooooooong\", BindVars: {bv1: \"type:INT64 value:\\\"1111111111\\\"\"bv2: \"type:INT64 value:\\\"2222222222\\\"\"bv3: \"type:INT64 value:\\\"3333333333\\\"\"bv4: \"type:INT64 value:\\\"4444444444\\\"\"}" | ||
require.Error(t, err) | ||
assert.Contains(t, err.Error(), want) | ||
want = "Uncaught panic for Sql: \"select * from test_t [TRUNCATED]\", BindVars: {bv1: \"typ [TRUNCATED]" | ||
gotWhatWeWant := false | ||
for _, log := range tl.getLogs() { | ||
if strings.HasPrefix(log, want) { | ||
gotWhatWeWant = true | ||
break | ||
} | ||
} | ||
assert.True(t, gotWhatWeWant) | ||
}() | ||
|
||
defer tsv.handlePanicAndSendLogStats(longSql, longBv, logStats) | ||
panic("panic from TestHandlePanicAndSendLogStatsMessageTruncation") | ||
} |
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.
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.
These changes were previously not behind a flag?
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.
If this is already there in a released version of Vitess, then maybe we should keep the flag to default false in this release too.
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 feel the breaking change was in v17 so, if you are already on v17 then the users would have already fixed it.
I do not see a point in keeping it to
false
in v18.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, but if someone upgrades from an existing version of v17 which is already released, its going to be a breaking change for them. We do not ask users to do major upgrades only with the latest patch versions.
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 grpc users are very limited and none except one has reported it, so for others, it should be a no-op.
It covers the functionality provided in v17 only i.e. transactions in streaming for grpc api.
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.
But it is still going to be a breaking change from v17.0.0 to v18.0.0. We should avoid it because it is easily avoidable by just postponing when we deprecate and delete the flag.