未验证 提交 815c21b3 编写于 作者: Z Zhijia Cao 提交者: GitHub

Fixed wal triggering disk threshold loop too many times (#11017)

上级 43aa7db3
......@@ -172,16 +172,23 @@ public class WALManager implements IService {
}
private void deleteOutdatedFiles() {
List<WALNode> walNodes = walNodesManager.getNodesSnapshot();
walNodes.sort((node1, node2) -> Long.compare(node2.getDiskUsage(), node1.getDiskUsage()));
for (WALNode walNode : walNodes) {
walNode.deleteOutdatedFiles();
}
if (shouldThrottle()) {
logger.warn(
"WAL disk usage {} is larger than the iot_consensus_throttle_threshold_in_byte {}, please check your write load, iot consensus and the pipe module. It's better to allocate more disk for WAL.",
getTotalDiskUsage(),
getThrottleThreshold());
// Normally, only need to delete the expired file once. When the WAL disk file size exceeds the
// threshold, the system continues to delete expired files until the disk size is smaller than
// the threshold.
boolean firstLoop = true;
while (firstLoop || shouldThrottle()) {
List<WALNode> walNodes = walNodesManager.getNodesSnapshot();
walNodes.sort((node1, node2) -> Long.compare(node2.getDiskUsage(), node1.getDiskUsage()));
for (WALNode walNode : walNodes) {
walNode.deleteOutdatedFiles();
}
if (firstLoop && shouldThrottle()) {
logger.warn(
"WAL disk usage {} is larger than the iot_consensus_throttle_threshold_in_byte {}, please check your write load, iot consensus and the pipe module. It's better to allocate more disk for WAL.",
getTotalDiskUsage(),
getThrottleThreshold());
}
firstLoop = false;
}
}
......
......@@ -267,10 +267,7 @@ public class WALNode implements IWALNode {
public void run() {
// The intent of the loop execution here is to try to get as many memTable flush or snapshot
// as possible when the valid information ratio is less than the configured value.
// In addition, if the disk space used by wal exceeds the limit threshold, resulting in a
// write rejection, the task will continue to attempt to delete expired files until the
// threshold is no longer exceeded
while (recursionTime < MAX_RECURSION_TIME || WALManager.getInstance().shouldThrottle()) {
while (recursionTime < MAX_RECURSION_TIME) {
// init delete outdated file task fields
init();
......@@ -286,8 +283,7 @@ public class WALNode implements IWALNode {
// decide whether to snapshot or flush based on the effective info ration and throttle
// threshold
if (trySnapshotOrFlushMemTable()
&& safelyDeletedSearchIndex != DEFAULT_SAFELY_DELETED_SEARCH_INDEX
&& !WALManager.getInstance().shouldThrottle()) {
&& safelyDeletedSearchIndex != DEFAULT_SAFELY_DELETED_SEARCH_INDEX) {
return;
}
recursionTime++;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册