Hi all,
I'd like to share a bug fix introduced by the following PRs:
- master: https://github.com/apache/iotdb/pull/19386
- dev/1.3: https://github.com/apache/iotdb/pull/19387
During fast compaction of aligned time series, one point is assembled from
overlapping pages that are discovered incrementally, and each column should
come from the highest-priority page that has a value for it. The aligned
null filling, however, could run while candidate pages were still being
discovered, so a lower-priority page could fill a null column first. If a
page with intermediate priority for the same timestamp was loaded later,
its value could no longer replace the already-filled one, because aligned
filling only replaces nulls. The compacted file then permanently kept the
lower-priority value.
For example, at timestamp 2 with pages of priority 3 / 1 / 2 providing
s0=12, s1=1 and s1=2 respectively, the result was [12, 1] instead of [12,
2].
The fix delays the aligned null filling until the point is actually about
to be written:
- null filling is no longer performed while candidate pages are still being
discovered;
- filling happens only immediately before output, so all candidate pages
for a timestamp are considered and the highest-priority value wins.
Main changes include:
- keep point lookup side-effect free during candidate discovery and add an
output-time accessor that performs the aligned filling;
- use the output-time accessor at both fast-compaction write sites;
- add a regression test for an intermediate-priority page that is loaded
after an earlier low-priority fill.
Feedback and suggestions are welcome.

大家好,
我想分享以下 PR 中修复的一个问题:
- master:https://github.com/apache/iotdb/pull/19386
- dev/1.3:https://github.com/apache/iotdb/pull/19387
在对齐时间序列的快速合并(fast compaction)中,一个数据点由逐步发现的多个重叠 page
组装而成,每一列都应该取自拥有该列值的最高优先级 page。但之前的对齐空值填充可能在候选 page 还没发现完时就开始执行,于是低优先级的 page
先把空列填上了。之后即使加载到同一时间戳、优先级居中的
page,它的值也无法再覆盖已填充的值,因为对齐填充只会替换空值。最终合并出的文件就永久保留了低优先级的值。
举个例子:时间戳 2 上,优先级为 3 / 1 / 2 的三个 page 分别提供 s0=12、s1=1 和 s1=2,结果得到的是 [12,
1],而不是 [12, 2]。
本次修复把对齐空值填充推迟到数据点真正要写出的时候:
- 在候选 page 仍在发现阶段时不再做空值填充;
- 只在写出前才执行填充,从而把该时间戳的所有候选 page 都纳入比较,让最高优先级的值胜出。
主要修改包括:
- 保证候选发现阶段的取点操作没有副作用,并新增一个在写出时执行对齐填充的取点入口;
- 两处快速合并的写出位置都改用写出时的取点入口;
- 新增回归测试,覆盖“低优先级空值填充之后才加载到中间优先级 page”的场景。
欢迎大家提出反馈和建议。
Best regards,
Wenwei Shu

Reply via email to