THUMarkLau commented on code in PR #12476:
URL: https://github.com/apache/iotdb/pull/12476#discussion_r1622383815
##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/wal/buffer/WALBuffer.java:
##########
@@ -535,12 +535,13 @@ public void run() {
memTableIdsOfWal
.computeIfAbsent(currentWALFileVersion, memTableIds -> new
HashSet<>())
.addAll(info.metaData.getMemTablesId());
-
checkpointManager.updateCostOfActiveMemTables(info.memTableId2WalDiskUsage);
+
checkpointManager.updateCostOfActiveMemTables(info.memTableId2WalDiskUsage,
compressionRate);
boolean forceSuccess = false;
// try to roll log writer
if (info.rollWALFileWriterListener != null
- || (forceFlag && currentWALFileWriter.size() >=
config.getWalFileSizeThresholdInByte())) {
+ || (forceFlag
+ && currentWALFileWriter.originalSize() >=
config.getWalFileSizeThresholdInByte())) {
Review Comment:
It's @OneSizeFitsQuorum 's suggestion.
The main reason to control the writer with originalSize is that when
flushing a WALEntry into a buffer, an instance of WALFlushListener will be
created. These objects are released when the file writer is closed. If the
compression ratio is high, and we are using the actual size to control the
writer, a lot of WALFlushListener instance will be kept in memory and cause an
OOM error. This happened in the unit-test, so we fix it in this way.
--
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]