HTHou commented on code in PR #18276:
URL: https://github.com/apache/iotdb/pull/18276#discussion_r3628747530
##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/memtable/TsFileProcessor.java:
##########
@@ -1124,13 +1132,21 @@ private void updateAlignedMemCost(
+ (newPointNum % PrimitiveArrayManager.ARRAY_SIZE > 0 ? 1 : 0);
long acquireArray = newArrayCnt - currentArrayCnt;
+ boolean writesExistingLastBlock =
+ currentPointNum % PrimitiveArrayManager.ARRAY_SIZE != 0 &&
incomingPointNum > 0;
+ for (TSDataType dataType : dataTypesInTVList) {
+ if (writesExistingLastBlock) {
+ memIncrements[0] += AlignedTVList.primitiveArrayMemCost(dataType);
+ }
+ // Reserve a bitmap as well as a value array for new blocks because
the tablet may contain
+ // null or failed rows in those blocks.
+ memIncrements[0] += acquireArray *
AlignedTVList.valueListArrayMemCost(dataType);
+ }
+
if (acquireArray != 0) {
// memory of extending the TVList
memIncrements[0] +=
acquireArray *
alignedMemChunk.getWorkingTVList().alignedTvListArrayMemCost();
- for (TSDataType dataType : dataTypesInTVList) {
- memIncrements[0] += acquireArray *
AlignedTVList.valueListArrayMemCost(dataType);
- }
}
Review Comment:
This still charges the dense per-block cost for every existing column
whenever a new block is acquired, while AlignedTVList.expandValues() now only
adds null placeholders and allocates primitive arrays on their first actual
write.
--
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]