jt2594838 commented on a change in pull request #2488:
URL: https://github.com/apache/iotdb/pull/2488#discussion_r559278962
##########
File path:
server/src/main/java/org/apache/iotdb/db/engine/storagegroup/StorageGroupProcessor.java
##########
@@ -280,6 +280,13 @@ public void setReady(boolean ready) {
private int currentWalPoolSize = 0;
+ // this field is used to avoid when one writer release bytebuffer back to
pool,
+ // and the next writer has already arrived, but the check thread get the
lock first, it find the pool
+ // is not empty, so it free the memory. When the next writer get the lock,
it will apply the memory again.
+ // So our free memory strategy is only when the expected size less than the
current pool size
+ // and the pool is not empty and the time interval since the pool is not
empty is larger than DEFAULT_POOL_TRIM_INTERVAL_MILLIS
+ private long timeWhenPoolNotEmpty = Long.MAX_VALUE;
Review comment:
Please check for grammar errors.
##########
File path:
server/src/main/java/org/apache/iotdb/db/engine/storagegroup/StorageGroupProcessor.java
##########
@@ -320,6 +331,10 @@ public void releaseWalBuffer(ByteBuffer[] byteBuffers) {
byteBuffer.clear();
}
synchronized (walByteBufferPool) {
+ // if the pool is empty before, update the time
+ if (walByteBufferPool.isEmpty()) {
+ timeWhenPoolNotEmpty = System.nanoTime();
+ }
Review comment:
Maybe `currentTimeMillis` is enough.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]