*: global memory controller should not kill session whose mem less than limit_sess_min_size (#42803)
This commit is contained in:
@ -33,7 +33,7 @@ type MockSessionManager struct {
|
||||
SerID uint64
|
||||
TxnInfo []*txninfo.TxnInfo
|
||||
Dom *domain.Domain
|
||||
conn map[uint64]session.Session
|
||||
Conn map[uint64]session.Session
|
||||
mu sync.Mutex
|
||||
}
|
||||
|
||||
@ -44,8 +44,8 @@ func (msm *MockSessionManager) ShowTxnList() []*txninfo.TxnInfo {
|
||||
if len(msm.TxnInfo) > 0 {
|
||||
return msm.TxnInfo
|
||||
}
|
||||
rs := make([]*txninfo.TxnInfo, 0, len(msm.conn))
|
||||
for _, se := range msm.conn {
|
||||
rs := make([]*txninfo.TxnInfo, 0, len(msm.Conn))
|
||||
for _, se := range msm.Conn {
|
||||
info := se.TxnInfo()
|
||||
if info != nil {
|
||||
rs = append(rs, info)
|
||||
@ -66,7 +66,7 @@ func (msm *MockSessionManager) ShowProcessList() map[uint64]*util.ProcessInfo {
|
||||
return ret
|
||||
}
|
||||
msm.mu.Lock()
|
||||
for connID, pi := range msm.conn {
|
||||
for connID, pi := range msm.Conn {
|
||||
ret[connID] = pi.ShowProcess()
|
||||
}
|
||||
msm.mu.Unlock()
|
||||
@ -89,7 +89,7 @@ func (msm *MockSessionManager) GetProcessInfo(id uint64) (*util.ProcessInfo, boo
|
||||
}
|
||||
msm.mu.Lock()
|
||||
defer msm.mu.Unlock()
|
||||
if sess := msm.conn[id]; sess != nil {
|
||||
if sess := msm.Conn[id]; sess != nil {
|
||||
return sess.ShowProcess(), true
|
||||
}
|
||||
if msm.Dom != nil {
|
||||
@ -130,7 +130,7 @@ func (*MockSessionManager) GetInternalSessionStartTSList() []uint64 {
|
||||
|
||||
// KillNonFlashbackClusterConn implement SessionManager interface.
|
||||
func (msm *MockSessionManager) KillNonFlashbackClusterConn() {
|
||||
for _, se := range msm.conn {
|
||||
for _, se := range msm.Conn {
|
||||
processInfo := se.ShowProcess()
|
||||
ddl, ok := processInfo.StmtCtx.GetPlan().(*core.DDL)
|
||||
if !ok {
|
||||
@ -148,7 +148,7 @@ func (msm *MockSessionManager) KillNonFlashbackClusterConn() {
|
||||
// CheckOldRunningTxn is to get all startTS of every transactions running in the current internal sessions
|
||||
func (msm *MockSessionManager) CheckOldRunningTxn(job2ver map[int64]int64, job2ids map[int64]string) {
|
||||
msm.mu.Lock()
|
||||
for _, se := range msm.conn {
|
||||
for _, se := range msm.Conn {
|
||||
session.RemoveLockDDLJobs(se, job2ver, job2ids)
|
||||
}
|
||||
msm.mu.Unlock()
|
||||
|
||||
@ -74,10 +74,10 @@ func NewTestKit(t testing.TB, store kv.Storage) *TestKit {
|
||||
mockSm, ok := sm.(*MockSessionManager)
|
||||
if ok {
|
||||
mockSm.mu.Lock()
|
||||
if mockSm.conn == nil {
|
||||
mockSm.conn = make(map[uint64]session.Session)
|
||||
if mockSm.Conn == nil {
|
||||
mockSm.Conn = make(map[uint64]session.Session)
|
||||
}
|
||||
mockSm.conn[tk.session.GetSessionVars().ConnectionID] = tk.session
|
||||
mockSm.Conn[tk.session.GetSessionVars().ConnectionID] = tk.session
|
||||
mockSm.mu.Unlock()
|
||||
}
|
||||
tk.session.SetSessionManager(sm)
|
||||
|
||||
Reference in New Issue
Block a user