Skip to content

Commit

Permalink
return a mysql warning
Browse files Browse the repository at this point in the history
Signed-off-by: Florent Poinsard <[email protected]>
  • Loading branch information
frouioui committed Mar 12, 2024
1 parent eecffd2 commit 1b6c139
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions go/vt/vtgate/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import (
"vitess.io/vitess/go/acl"
"vitess.io/vitess/go/cache/theine"
"vitess.io/vitess/go/mysql/collations"
"vitess.io/vitess/go/mysql/sqlerror"
"vitess.io/vitess/go/sqltypes"
"vitess.io/vitess/go/stats"
"vitess.io/vitess/go/streamlog"
Expand Down Expand Up @@ -234,7 +235,12 @@ func (e *Executor) Execute(ctx context.Context, mysqlCtx vtgateservice.MySQLConn
if err != nil {
piiSafeSQL = logStats.StmtType
}
exceedMemoryRowsLogger.Warningf("%q exceeds warning threshold of max memory rows: %v. Actual memory rows: %v", piiSafeSQL, warnMemoryRows, len(result.Rows))
warningMsg := fmt.Sprintf("%q exceeds warning threshold of max memory rows: %v. Actual memory rows: %v", piiSafeSQL, warnMemoryRows, len(result.Rows))
exceedMemoryRowsLogger.Warningf(sql, warningMsg)
safeSession.RecordWarning(&querypb.QueryWarning{
Code: uint32(sqlerror.EROutOfMemory),
Message: warningMsg,
})
}

logStats.SaveEndTime()
Expand Down Expand Up @@ -368,7 +374,12 @@ func (e *Executor) StreamExecute(
if err != nil {
piiSafeSQL = logStats.StmtType
}
exceedMemoryRowsLogger.Warningf("%q exceeds warning threshold of max memory rows: %v. Actual memory rows: %v", piiSafeSQL, warnMemoryRows, srr.rowsReturned)
warningMsg := fmt.Sprintf("%q exceeds warning threshold of max memory rows: %v. Actual memory rows: %v", piiSafeSQL, warnMemoryRows, srr.rowsReturned)
exceedMemoryRowsLogger.Warningf(sql, warningMsg)
safeSession.RecordWarning(&querypb.QueryWarning{
Code: uint32(sqlerror.EROutOfMemory),
Message: warningMsg,
})

Check warning on line 382 in go/vt/vtgate/executor.go

View check run for this annotation

Codecov / codecov/patch

go/vt/vtgate/executor.go#L377-L382

Added lines #L377 - L382 were not covered by tests
}

logStats.SaveEndTime()
Expand Down

0 comments on commit 1b6c139

Please sign in to comment.