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
util: record more information before OOM #37987
util: record more information before OOM #37987
Conversation
[REVIEW NOTIFICATION] This pull request has been approved by:
To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. Reviewer can indicate their review by submitting an approval review. |
/cc @XuHuaiyu |
/cc @wshwsh12 |
…n9014/tidb into mx/recordMoreInformationBeforeOOM
…n9014/tidb into mx/recordMoreInformationBeforeOOM
) | ||
|
||
func (reason AlarmReason) String() string { | ||
return [...]string{"memory increase too fast", "memory used exceed", "no reason"}[reason] |
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.
return [...]string{"memory increase too fast", "memory used exceed", "no reason"}[reason] | |
return [...]string{"memory usage grows too fast", "memory usage exceeds alarm ratio", "no reason"}[reason] |
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.
done
const ( | ||
// IncreaseFast is the reason that memory increasing too fast. | ||
IncreaseFast AlarmReason = iota | ||
// MemoryExceed is the reason that memory used exceed threshold. | ||
MemoryExceed | ||
// NoReason means no alarm | ||
NoReason | ||
) |
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.
const ( | |
// IncreaseFast is the reason that memory increasing too fast. | |
IncreaseFast AlarmReason = iota | |
// MemoryExceed is the reason that memory used exceed threshold. | |
MemoryExceed | |
// NoReason means no alarm | |
NoReason | |
) | |
const ( | |
// GrowTooFast is the reason that memory usage grows too fast. | |
GrowTooFast AlarmReason = iota | |
// ExceedAlarmRatio is the reason that memory usage exceeds the alarm ratio. | |
ExceedAlarmRatio | |
// NoReason means no alarm | |
NoReason | |
) |
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.
done.
record.lastCheckTime = time.Now() | ||
record.lastRecordMemUsed = memoryUsage | ||
record.doRecord(memoryUsage, instanceStats.HeapAlloc, sm, reason) | ||
record.tryRemoveNoNeedRecords() |
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.
tryRemoveRedundantRecords
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.
tryRemoveRedundantRecords
done.
# The alarm threshold when memory usage of the tidb-server exceeds. The valid value range is greater than or equal to 0 | ||
# and less than or equal to 1. The default value is 0.8. | ||
# and less than or equal to 1. The default value is 0.7. | ||
# If this configuration is set to 0 or 1, it'll disable the alarm. | ||
# <snip> | ||
memory-usage-alarm-ratio = 0.8 | ||
memory-usage-alarm-ratio = 0.7 |
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.
remove this block
tk.MustQuery("select @@global.tidb_memory_usage_alarm_keep_record_num").Check(testkit.Rows("100")) | ||
tk.MustExec("set @@global.tidb_memory_usage_alarm_keep_record_num=0") | ||
tk.MustQuery("SHOW WARNINGS").Check(testkit.Rows("Warning 1292 Truncated incorrect tidb_memory_usage_alarm_keep_record_num value: '0'")) | ||
tk.MustQuery("select @@global.tidb_memory_usage_alarm_keep_record_num").Check(testkit.Rows("1")) |
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.
Add a test for the MAXVALUE
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.
Add a test for the MAXVALUE
done.
…n9014/tidb into mx/recordMoreInformationBeforeOOM
…n9014/tidb into mx/recordMoreInformationBeforeOOM
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.
LGTM
/merge |
This pull request has been accepted and is ready to merge. Commit hash: 2618c09
|
@mengxin9014: Your PR was out of date, I have automatically updated it for you. At the same time I will also trigger all tests for you: /run-all-tests If the CI test fails, you just re-trigger the test that failed and the bot will merge the PR for you after the CI passes. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository. |
What problem does this PR solve?
Issue Number: close ##37409
Problem Summary:
What is changed and how it works?
record more information:
modify record logic:
Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.