-
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
Add Memory Threshold #14597
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #14597 +/- ##
============================================
- Coverage 39.33% 39.28% -0.05%
Complexity 193 193
============================================
Files 4379 4385 +6
Lines 277511 277882 +371
Branches 33881 33911 +30
============================================
+ Hits 109158 109177 +19
- Misses 168353 168705 +352 ☔ View full report in Codecov by Sentry. |
@@ -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 |
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
Add Memory Threshold Metrics