Skip to content

Commit

Permalink
Revert "server,session: make sure ResultSet.Close() errors return to …
Browse files Browse the repository at this point in the history
…the client (#48447) (#48486)"

This reverts commit 87107b5.
  • Loading branch information
tiancaiamao authored Nov 17, 2023
1 parent 56cccb6 commit 5c11979
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 14 deletions.
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

0 comments on commit 5c11979

Please sign in to comment.