This is an automated email from the ASF dual-hosted git repository.
jt2594838 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/master by this push:
new a6cfe257b1d Avoid size estimation for fixed-length compaction points
(#18707)
a6cfe257b1d is described below
commit a6cfe257b1d257bfd42310f096e5d5cdfa5ac05c
Author: Hongzhi Gao <[email protected]>
AuthorDate: Tue Sep 29 11:00:48 2026 +0800
Avoid size estimation for fixed-length compaction points (#18707)
* Avoid size estimation for fixed-length compaction points
* Trigger CI rerun for compaction fix
* Fix ImportWAL TSDataType switch architecture violations
---
.../execute/utils/writer/AbstractCompactionWriter.java | 10 ++++++----
.../utils/writer/AbstractCompactionWriterTest.java | 17 ++++++++---------
2 files changed, 14 insertions(+), 13 deletions(-)
diff --git
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/execute/utils/writer/AbstractCompactionWriter.java
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/execute/utils/writer/AbstractCompactionWriter.java
index da85dcbbce4..2b99ca67552 100644
---
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/execute/utils/writer/AbstractCompactionWriter.java
+++
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/execute/utils/writer/AbstractCompactionWriter.java
@@ -177,18 +177,20 @@ public abstract class AbstractCompactionWriter implements
AutoCloseable {
protected void writeDataPoint(
long timestamp, TsPrimitiveType value, IChunkWriter chunkWriter, int
subTaskId) {
- long writtenPointTotalSize;
if (chunkWriter instanceof ChunkWriterImpl) {
ChunkWriterImpl chunkWriterImpl = (ChunkWriterImpl) chunkWriter;
Type.fromTsDataType(chunkWriterImpl.getDataType()).write(chunkWriterImpl,
timestamp, value);
- writtenPointTotalSize = Long.BYTES + estimateWrittenValueSize(value);
+ if (hasVariableLengthTypeArray[subTaskId]) {
+ writtenPointTotalSizeArray[subTaskId] += Long.BYTES +
estimateWrittenValueSize(value);
+ }
} else {
AlignedChunkWriterImpl alignedChunkWriter = (AlignedChunkWriterImpl)
chunkWriter;
alignedChunkWriter.write(timestamp, value.getVector());
- writtenPointTotalSize = estimateWrittenPointTotalSize(value);
+ if (hasVariableLengthTypeArray[subTaskId]) {
+ writtenPointTotalSizeArray[subTaskId] +=
estimateWrittenPointTotalSize(value);
+ }
}
chunkPointNumArray[subTaskId]++;
- writtenPointTotalSizeArray[subTaskId] += writtenPointTotalSize;
}
private long estimateWrittenPointTotalSize(TsPrimitiveType value) {
diff --git
a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/compaction/execute/utils/writer/AbstractCompactionWriterTest.java
b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/compaction/execute/utils/writer/AbstractCompactionWriterTest.java
index 7d501570066..673ab709df5 100644
---
a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/compaction/execute/utils/writer/AbstractCompactionWriterTest.java
+++
b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/compaction/execute/utils/writer/AbstractCompactionWriterTest.java
@@ -120,13 +120,13 @@ public class AbstractCompactionWriterTest {
@Test
public void testWriteDataPointForAllDataTypes() {
- assertWrittenPointTotalSize(TSDataType.BOOLEAN, true, Long.BYTES +
Byte.BYTES);
- assertWrittenPointTotalSize(TSDataType.INT32, 1, Long.BYTES +
Integer.BYTES);
- assertWrittenPointTotalSize(TSDataType.DATE, 1, Long.BYTES +
Integer.BYTES);
- assertWrittenPointTotalSize(TSDataType.INT64, 1L, Long.BYTES + Long.BYTES);
- assertWrittenPointTotalSize(TSDataType.TIMESTAMP, 1L, Long.BYTES +
Long.BYTES);
- assertWrittenPointTotalSize(TSDataType.FLOAT, 1F, Long.BYTES +
Float.BYTES);
- assertWrittenPointTotalSize(TSDataType.DOUBLE, 1D, Long.BYTES +
Double.BYTES);
+ assertWrittenPointTotalSize(TSDataType.BOOLEAN, true, 0);
+ assertWrittenPointTotalSize(TSDataType.INT32, 1, 0);
+ assertWrittenPointTotalSize(TSDataType.DATE, 1, 0);
+ assertWrittenPointTotalSize(TSDataType.INT64, 1L, 0);
+ assertWrittenPointTotalSize(TSDataType.TIMESTAMP, 1L, 0);
+ assertWrittenPointTotalSize(TSDataType.FLOAT, 1F, 0);
+ assertWrittenPointTotalSize(TSDataType.DOUBLE, 1D, 0);
Binary binary = new Binary("abc", TSFileConfig.STRING_CHARSET);
assertWrittenPointTotalSize(TSDataType.TEXT, binary, Long.BYTES +
binary.getLength());
@@ -154,8 +154,7 @@ public class AbstractCompactionWriterTest {
compactionWriter.startMeasurement("aligned", chunkWriter, SUB_TASK_ID);
compactionWriter.writePoint(vector, chunkWriter);
- Assert.assertEquals(
- Long.BYTES + Integer.BYTES + Byte.BYTES,
compactionWriter.getWrittenPointTotalSize());
+ Assert.assertEquals(0, compactionWriter.getWrittenPointTotalSize());
}
private static void assertWrittenPointTotalSize(