Documentation ¶
Index ¶
- Constants
- type SQLKiller
- func (killer *SQLKiller) ClearFinishFunc()
- func (killer *SQLKiller) FinishResultSet()
- func (killer *SQLKiller) GetKillSignal() killSignal
- func (killer *SQLKiller) HandleSignal() error
- func (killer *SQLKiller) Reset()
- func (killer *SQLKiller) SendKillSignal(reason killSignal)
- func (killer *SQLKiller) SetFinishFunc(fn func())
Constants ¶
View Source
const ( UnspecifiedKillSignal killSignal = iota QueryInterrupted MaxExecTimeExceeded QueryMemoryExceeded ServerMemoryExceeded RunawayQueryExceeded )
KillSignal types.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SQLKiller ¶
type SQLKiller struct { Signal killSignal ConnID atomic.Uint64 // FinishFuncLock is used to ensure that Finish is not called and modified at the same time. // An external call to the Finish function only allows when the main goroutine to be in the writeResultSet process. // When the main goroutine exits the writeResultSet process, the Finish function will be cleared. FinishFuncLock sync.Mutex Finish func() // InWriteResultSet is used to indicate whether the query is currently calling clientConn.writeResultSet(). // If the query is in writeResultSet and Finish() can acquire rs.finishLock, we can assume the query is waiting for the client to receive data from the server over network I/O. InWriteResultSet atomic.Bool }
SQLKiller is used to kill a query.
func (*SQLKiller) ClearFinishFunc ¶
func (killer *SQLKiller) ClearFinishFunc()
ClearFinishFunc clears the finish function.1
func (*SQLKiller) FinishResultSet ¶
func (killer *SQLKiller) FinishResultSet()
FinishResultSet is used to close the result set. If a kill signal is sent but the SQL query is stuck in the network stack while writing packets to the client, encountering some bugs that cause it to hang, or failing to detect the kill signal, we can call Finish to release resources used during the SQL execution process.
func (*SQLKiller) GetKillSignal ¶
func (killer *SQLKiller) GetKillSignal() killSignal
GetKillSignal gets the kill signal.
func (*SQLKiller) HandleSignal ¶
HandleSignal handles the kill signal and return the error.
func (*SQLKiller) SendKillSignal ¶
func (killer *SQLKiller) SendKillSignal(reason killSignal)
SendKillSignal sends a kill signal to the query.
func (*SQLKiller) SetFinishFunc ¶
func (killer *SQLKiller) SetFinishFunc(fn func())
SetFinishFunc sets the finish function.
Click to show internal directories.
Click to hide internal directories.