Skip to content

Commit

Permalink
Cherry-pick 8ba7607 with conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
vitess-bot[bot] authored and vitess-bot committed Jan 6, 2025
1 parent e7af629 commit 4baf2b3
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions go/vt/vtgate/vcursor_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"io"
"sort"
"strings"
"sync"
"sync/atomic"
"time"

Expand Down Expand Up @@ -133,6 +134,8 @@ type (

resultsObserver resultsObserver

// this protects the interOpStats and shardsStats fields from concurrent writes
mu sync.Mutex
// this is a map of the number of rows that every primitive has returned
// if this field is nil, it means that we are not logging operator traffic
interOpStats map[engine.Primitive]engine.RowsReceived
Expand Down Expand Up @@ -536,6 +539,7 @@ func (vc *vcursorImpl) ExecutePrimitive(ctx context.Context, primitive engine.Pr
return nil, vterrors.New(vtrpcpb.Code_UNAVAILABLE, "upstream shards are not available")
}

<<<<<<< HEAD:go/vt/vtgate/vcursor_impl.go

Check failure on line 542 in go/vt/vtgate/vcursor_impl.go

View workflow job for this annotation

GitHub Actions / Code Coverage

syntax error: non-declaration statement outside function body

Check failure on line 542 in go/vt/vtgate/vcursor_impl.go

View workflow job for this annotation

GitHub Actions / Code Coverage

syntax error: non-declaration statement outside function body
func (vc *vcursorImpl) logOpTraffic(primitive engine.Primitive, res *sqltypes.Result) {
if vc.interOpStats != nil {
rows := vc.interOpStats[primitive]
Expand All @@ -545,13 +549,38 @@ func (vc *vcursorImpl) logOpTraffic(primitive engine.Primitive, res *sqltypes.Re
rows = append(rows, len(res.Rows))
}
vc.interOpStats[primitive] = rows
=======

Check failure on line 552 in go/vt/vtgate/vcursor_impl.go

View workflow job for this annotation

GitHub Actions / Code Coverage

syntax error: unexpected ==, expected }

Check failure on line 552 in go/vt/vtgate/vcursor_impl.go

View workflow job for this annotation

GitHub Actions / Code Coverage

syntax error: unexpected ==, expected }
func (vc *VCursorImpl) logOpTraffic(primitive engine.Primitive, res *sqltypes.Result) {
if vc.interOpStats == nil {
return
>>>>>>> 8ba7607230 (vexplain to protect the log fields from concurrent writes (#17460)):go/vt/vtgate/executorcontext/vcursor_impl.go

Check failure on line 556 in go/vt/vtgate/vcursor_impl.go

View workflow job for this annotation

GitHub Actions / Code Coverage

syntax error: unexpected >>, expected }

Check failure on line 556 in go/vt/vtgate/vcursor_impl.go

View workflow job for this annotation

GitHub Actions / Code Coverage

invalid character U+0023 '#'

Check failure on line 556 in go/vt/vtgate/vcursor_impl.go

View workflow job for this annotation

GitHub Actions / Code Coverage

syntax error: unexpected >>, expected }

Check failure on line 556 in go/vt/vtgate/vcursor_impl.go

View workflow job for this annotation

GitHub Actions / Code Coverage

invalid character U+0023 '#'
}

Check failure on line 557 in go/vt/vtgate/vcursor_impl.go

View workflow job for this annotation

GitHub Actions / Code Coverage

syntax error: unexpected }, expected expression

Check failure on line 557 in go/vt/vtgate/vcursor_impl.go

View workflow job for this annotation

GitHub Actions / Code Coverage

syntax error: unexpected }, expected expression

vc.mu.Lock()

Check failure on line 559 in go/vt/vtgate/vcursor_impl.go

View workflow job for this annotation

GitHub Actions / Code Coverage

syntax error: non-declaration statement outside function body

Check failure on line 559 in go/vt/vtgate/vcursor_impl.go

View workflow job for this annotation

GitHub Actions / Code Coverage

syntax error: non-declaration statement outside function body
defer vc.mu.Unlock()

rows := vc.interOpStats[primitive]
if res == nil {
rows = append(rows, 0)
} else {
rows = append(rows, len(res.Rows))
}
vc.interOpStats[primitive] = rows
}

<<<<<<< HEAD:go/vt/vtgate/vcursor_impl.go
func (vc *vcursorImpl) logShardsQueried(primitive engine.Primitive, shardsNb int) {
if vc.shardsStats != nil {
vc.shardsStats[primitive] += engine.ShardsQueried(shardsNb)
=======

Check failure on line 575 in go/vt/vtgate/vcursor_impl.go

View workflow job for this annotation

GitHub Actions / Code Coverage

syntax error: unexpected ==, expected }

Check failure on line 575 in go/vt/vtgate/vcursor_impl.go

View workflow job for this annotation

GitHub Actions / Code Coverage

syntax error: unexpected ==, expected }
func (vc *VCursorImpl) logShardsQueried(primitive engine.Primitive, shardsNb int) {
if vc.shardsStats == nil {
return
>>>>>>> 8ba7607230 (vexplain to protect the log fields from concurrent writes (#17460)):go/vt/vtgate/executorcontext/vcursor_impl.go

Check failure on line 579 in go/vt/vtgate/vcursor_impl.go

View workflow job for this annotation

GitHub Actions / Code Coverage

syntax error: unexpected >>, expected }

Check failure on line 579 in go/vt/vtgate/vcursor_impl.go

View workflow job for this annotation

GitHub Actions / Code Coverage

invalid character U+0023 '#'

Check failure on line 579 in go/vt/vtgate/vcursor_impl.go

View workflow job for this annotation

GitHub Actions / Code Coverage

syntax error: unexpected >>, expected }

Check failure on line 579 in go/vt/vtgate/vcursor_impl.go

View workflow job for this annotation

GitHub Actions / Code Coverage

invalid character U+0023 '#'
}

Check failure on line 580 in go/vt/vtgate/vcursor_impl.go

View workflow job for this annotation

GitHub Actions / Code Coverage

syntax error: unexpected }, expected expression

Check failure on line 580 in go/vt/vtgate/vcursor_impl.go

View workflow job for this annotation

GitHub Actions / Code Coverage

syntax error: unexpected }, expected expression
vc.mu.Lock()
defer vc.mu.Unlock()
vc.shardsStats[primitive] += engine.ShardsQueried(shardsNb)
}

func (vc *vcursorImpl) ExecutePrimitiveStandalone(ctx context.Context, primitive engine.Primitive, bindVars map[string]*querypb.BindVariable, wantfields bool) (*sqltypes.Result, error) {
Expand Down

0 comments on commit 4baf2b3

Please sign in to comment.