Skip to content
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

Fix potential nil pointer error #4761

Merged
merged 1 commit into from
Mar 28, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion go/vt/vttablet/tabletserver/tabletserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -1076,12 +1076,16 @@ func (tsv *TabletServer) ExecuteBatch(ctx context.Context, target *querypb.Targe
defer tsv.endRequest(false)
defer tsv.handlePanicAndSendLogStats("batch", nil, nil)

if options == nil {
options = &querypb.ExecuteOptions{}
}

// When all these conditions are met, we send the queries directly
// to the MySQL without creating a transaction. This optimization
// yields better throughput.
// Setting ExecuteOptions_AUTOCOMMIT will get a connection out of the
// pool without actually begin/commit the transaction.
if (options == nil || options.TransactionIsolation == querypb.ExecuteOptions_DEFAULT) &&
if (options.TransactionIsolation == querypb.ExecuteOptions_DEFAULT) &&
tsv.qe.autoCommit.Get() &&
asTransaction &&
tsv.qe.passthroughDMLs.Get() {
Expand Down