Skip to content
This repository has been archived by the owner on Dec 16, 2022. It is now read-only.

Fix potential nil pointer error #128

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