-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Add Memory Threshold #14597
base: master
Are you sure you want to change the base?
Add Memory Threshold #14597
Conversation
@@ -515,7 +509,7 @@ public void createDataRegionMemoryCostMetrics(DataRegion dataRegion) { | |||
MetricService.getInstance() | |||
.createAutoGauge( | |||
Metric.DATA_REGION_MEM_COST.toString(), | |||
MetricLevel.IMPORTANT, | |||
MetricLevel.NORMAL, |
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.
Do not change existing metrics's level to normal?
|
||
public class IoTDBRuntimeOutOfMemoryException extends RuntimeException { | ||
|
||
private final long timeStamp; |
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.
use timestamp
import java.nio.ByteBuffer; | ||
import java.util.Objects; | ||
|
||
public class IoTDBRuntimeOutOfMemoryException extends RuntimeException { |
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.
This is not actually an OutOfMemoryException, right? Maybe a more reasonable name could be changed
return memoryUsageInBytes.get(); | ||
} | ||
|
||
public void setMaxMemorySizeInByte(final long maxMemorySizeInByte) { |
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.
mobe to line 39?
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.
When will this function be called?
@Override | ||
public boolean useMemory(final long size) { | ||
if (size <= 0) { | ||
memoryUsageInBytes.addAndGet(-size); |
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.
when will size be negetive?
import java.util.concurrent.atomic.AtomicLong; | ||
import java.util.concurrent.locks.ReentrantLock; | ||
|
||
public abstract class IIoTDBMemoryBlock implements AutoCloseable { |
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.
IMemoryBlock
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 some javadoc and description for this basic class
public abstract class IIoTDBMemoryBlock implements AutoCloseable { | ||
protected IoTDBMemoryManager memoryManager; | ||
protected IoTDBMemoryBlockType memoryBlockType; | ||
protected final ReentrantLock lock = new ReentrantLock(); |
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.
if you use this only in close method, why not directly use method synchronized?
Quality Gate passedIssues Measures |
Add Memory Threshold Metrics