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

Revert "server,session: make sure ResultSet.Close() errors return to the client (#48447)" #48668

Merged
Merged
Show file tree
Hide file tree
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
9 changes: 5 additions & 4 deletions pkg/server/conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -2050,7 +2050,11 @@ func (cc *clientConn) handleStmt(ctx context.Context, stmt ast.StmtNode, warns [
execStmt.(*executor.ExecStmt).FinishExecuteStmt(0, err, false)
}
}
return false, err
if err != nil {
return false, err
}

return false, nil
}

func (cc *clientConn) handleFileTransInConn(ctx context.Context, status uint16) (bool, error) {
Expand Down Expand Up @@ -2278,9 +2282,6 @@ func (cc *clientConn) writeChunks(ctx context.Context, rs resultset.ResultSet, b
stmtDetail.WriteSQLRespDuration += time.Since(start)
}
}
if err := rs.Close(); err != nil {
return false, err
}

if stmtDetail != nil {
start = time.Now()
Expand Down
16 changes: 6 additions & 10 deletions pkg/session/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -2475,20 +2475,16 @@ const ExecStmtVarKey ExecStmtVarKeyType = 0
// RecordSet, so this struct exists and RecordSet.Close() is overrided handle that.
type execStmtResult struct {
sqlexec.RecordSet
se *session
sql sqlexec.Statement
closed bool
se *session
sql sqlexec.Statement
}

func (rs *execStmtResult) Close() error {
if rs.closed {
return nil
}
se := rs.se
err := rs.RecordSet.Close()
err = finishStmt(context.Background(), se, err, rs.sql)
rs.closed = true
return err
if err := rs.RecordSet.Close(); err != nil {
return finishStmt(context.Background(), se, err, rs.sql)
}
return finishStmt(context.Background(), se, nil, rs.sql)
}

// rollbackOnError makes sure the next statement starts a new transaction with the latest InfoSchema.
Expand Down