MarcosZyk commented on code in PR #9602:
URL: https://github.com/apache/iotdb/pull/9602#discussion_r1164899896
##########
server/src/main/java/org/apache/iotdb/db/metadata/rescon/MemSchemaEngineStatistics.java:
##########
@@ -69,19 +69,27 @@ public long getMemoryUsage() {
public void requestMemory(long size) {
memoryUsage.addAndGet(size);
if (memoryUsage.get() >= memoryCapacity) {
- logger.warn("Current series memory {} is too large...", memoryUsage);
- allowToCreateNewSeries = false;
+ synchronized (this) {
+ if (allowToCreateNewSeries && memoryUsage.get() >= memoryCapacity) {
+ logger.warn("Current series memory {} is too large...", memoryUsage);
+ allowToCreateNewSeries = false;
+ }
+ }
}
}
public void releaseMemory(long size) {
memoryUsage.addAndGet(-size);
- if (!allowToCreateNewSeries && memoryUsage.get() < memoryCapacity) {
- logger.info(
- "Current series memory {} come back to normal level, total series
number is {}.",
- memoryUsage,
- totalSeriesNumber);
- allowToCreateNewSeries = true;
+ if (memoryUsage.get() < memoryCapacity) {
+ synchronized (this) {
Review Comment:
Fixed.
##########
server/src/main/java/org/apache/iotdb/db/metadata/rescon/MemSchemaEngineStatistics.java:
##########
@@ -69,19 +69,27 @@ public long getMemoryUsage() {
public void requestMemory(long size) {
memoryUsage.addAndGet(size);
if (memoryUsage.get() >= memoryCapacity) {
- logger.warn("Current series memory {} is too large...", memoryUsage);
- allowToCreateNewSeries = false;
+ synchronized (this) {
Review Comment:
Fixed.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]