-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
*: print an expensive query log when a query is out of memQuota #10799
Changes from all commits
9394c32
43a6086
e4d3867
ac124e0
35e7ce5
b0dd725
a760fd4
fa77b14
81b27aa
b96ea5a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1303,11 +1303,15 @@ func ResetContextOfStmt(ctx sessionctx.Context, s ast.StmtNode) (err error) { | |
} | ||
switch config.GetGlobalConfig().OOMAction { | ||
case config.OOMActionCancel: | ||
sc.MemTracker.SetActionOnExceed(&memory.PanicOnExceed{}) | ||
action := &memory.PanicOnExceed{ConnID: ctx.GetSessionVars().ConnectionID} | ||
action.SetLogHook(domain.GetDomain(ctx).ExpensiveQueryHandle().LogOnQueryExceedMemQuota) | ||
sc.MemTracker.SetActionOnExceed(action) | ||
case config.OOMActionLog: | ||
sc.MemTracker.SetActionOnExceed(&memory.LogOnExceed{}) | ||
fallthrough | ||
default: | ||
sc.MemTracker.SetActionOnExceed(&memory.LogOnExceed{}) | ||
action := &memory.LogOnExceed{ConnID: ctx.GetSessionVars().ConnectionID} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should we return an |
||
action.SetLogHook(domain.GetDomain(ctx).ExpensiveQueryHandle().LogOnQueryExceedMemQuota) | ||
zz-jason marked this conversation as resolved.
Show resolved
Hide resolved
|
||
sc.MemTracker.SetActionOnExceed(action) | ||
} | ||
|
||
if execStmt, ok := s.(*ast.ExecuteStmt); ok { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -490,8 +490,9 @@ func (s *Server) ShowProcessList() map[uint64]*util.ProcessInfo { | |
if atomic.LoadInt32(&client.status) == connStatusWaitShutdown { | ||
continue | ||
} | ||
pi := client.ctx.ShowProcess() | ||
rs[pi.ID] = pi | ||
if pi := client.ctx.ShowProcess(); pi != nil { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. a bugfix? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, #10740 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do release 2.1 and 3.0 have this issue? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, only master branch has this issue now. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But this PR needs to be cherry-picked to release-3.0, so we'd better use another PR to fix it? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you add an UT about it? |
||
rs[pi.ID] = pi | ||
} | ||
} | ||
s.rwlock.RUnlock() | ||
return rs | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we don't need to add this log. When the query runs out of memory quota, it panics. The upper layer will recover that goroutine and log the panic reason and sql, which is "out of memory quota".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think they are two different logs.
Expensive query log can provide us more info about the query.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we change the panic message to the content we want to log?