-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…14053) Signed-off-by: Harshit Gangal <[email protected]> Co-authored-by: Harshit Gangal <[email protected]>
- Loading branch information
1 parent
3a8fce7
commit bc93cae
Showing
7 changed files
with
102 additions
and
51 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
## Summary | ||
|
||
### Table of Contents | ||
|
||
- **[Major Changes](#major-changes)** | ||
- **[New command line flags and behavior](#new-flag)** | ||
- [VTGate flag `--grpc-send-session-in-streaming`](#new-vtgate-streaming-sesion) | ||
|
||
## <a id="major-changes"/>Major Changes | ||
|
||
### <a id="new-flag"/>New command line flags and behavior | ||
|
||
#### <a id="new-vtgate-streaming-sesion"/>VTGate GRPC stream execute session flag `--grpc-send-session-in-streaming` | ||
|
||
This flag enables transaction support on `StreamExecute` api. | ||
One enabled, VTGate `StreamExecute` grpc api will send session as the last packet in the response. | ||
The client should enable it only when they have made the required changes to expect such a packet. | ||
|
||
It is disabled by default from v17.0.3. | ||
|
||
This was a breaking change when v17.0.0 was released was causing upgrade issue for client | ||
who relied on a certain behaviour of receiving streaming packets on `StreamExecute` call. |
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, "") | ||
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