mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-12-04 00:15:29 +00:00
docs(rfcs): say which lifetime is reused, and guard the EOF on the count already there
Two wording fixes from review; neither changes the design. "Keep the existing check" was ambiguous next to a requirement to restack onto #9777's piece semantics: a reader could take it as keeping the old `history.closed` rule, or as building a second lifetime model. The rule is now stated in one sentence - a piece ending does not permanently close the label set, a repeated value in one field at one position is still an error, and only the cross-piece check moves to the merge boundary, under §4.4's condition. Implementations keep their local check and let the merge add the cross-partition one. The channel-close branch does not need a new completion protocol. The fork already forwards input errors and panics as errors and only sends a completion sentinel on success, so an ordinary upstream failure cannot arrive as a successful early EOF. What the branch lacks is a guard, and the stream already counts what it needs: close with `remaining_partitions > 0` is a terminal error, and success EOF only once the count reaches zero. Also adds the failure-path case to acceptance: fragments produced before an error must make the downstream segment fail, not run a window over what it happened to receive. Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com>
This commit is contained in:
@@ -167,10 +167,22 @@ Fused 阶段 B(合并后运行外层 Window)partition 0, 1
|
||||
|
||||
**修法(规则,不是口号)**:
|
||||
|
||||
1. **A 的可输出 fragment 节点不再把「一个 source piece 关闭」解释为「canonical label set 永久关闭」**——保留 piece 内的合法性检查,跨 piece 的冲突由合并阶段统一验证。
|
||||
2. **不能全局删除 `Emitted` 检查。** 默认的完整-series 模式保留现有检查;只有新的 fragment 模式才放宽。
|
||||
3. **piece 的身份要单独定义**:不能用改写后的标签代替来源身份。
|
||||
4. **A 中任何后续有状态消费者都不能直接接未合并的 pieces**——这是构建期必须拒绝的形状。
|
||||
> 复用 restack 后的 source-piece 语义:**一个 piece 结束不永久关闭 canonical label set。保留重复有效位置等合法性检查**;fragment 输出仅在满足 §4.4 的条件下,允许将跨 piece 冲突检查移至指定的 Merge 边界。
|
||||
|
||||
这把两件事分清楚了:
|
||||
|
||||
| | |
|
||||
|---|---|
|
||||
| **同标签的后续 piece** | 可以出现 |
|
||||
| **同 field、同 position 的重复有效值** | 仍然必须报错 |
|
||||
|
||||
实现上**保留已有的本地检查**,让 Merge 补齐跨分区检查即可——不需要为了「统一验证」而先移除已经有效的检查。
|
||||
|
||||
另外三条:
|
||||
|
||||
1. **不能全局删除 `Emitted` 检查。** fragment 模式只放宽「同标签后续 piece」,不放宽「重复有效位置」。
|
||||
2. **piece 的身份要单独定义**:不能用改写后的标签代替来源身份。
|
||||
3. **A 中任何后续有状态消费者都不能直接接未合并的 pieces**——这是构建期必须拒绝的形状。
|
||||
|
||||
### 4.4 冲突检查不能被「清空有效位置」的操作吞掉
|
||||
|
||||
@@ -263,7 +275,19 @@ DataFusion 已经提供了:
|
||||
|
||||
如果不读 channel 就等生产者完成,生产者会阻塞在 send(`send` 是 `.await`),形成死锁。
|
||||
|
||||
**异常关闭也要交代**:`:2403-2405` 在 channel 意外关闭时也返回 EOF,所以不能把「EOF」直接等同于「所有上游成功结束」。需要检测或排除异常路径。
|
||||
**异常关闭要交代清楚。** fork 的任务结构是这样的(已核对):
|
||||
|
||||
- 每个输入任务有单独的 waiter,waiter 自己持有输出 sender
|
||||
- 输入返回错误或 panic,waiter 向输出**发送错误**;只有成功完成才发完成哨兵
|
||||
- 活着的输出 stream 持有后台任务的共享 handle(`repartition/mod.rs:562-604`、`:2207-2245`、`:2302-2325`)
|
||||
|
||||
所以**普通上游错误、输入任务 panic,不会自然变成一个无错误的提前 EOF**。不能只因为代码里有「channel 关闭就返回 EOF」的分支,就断言普通查询必然可能吞错。
|
||||
|
||||
不过 `:2393-2406` 那个分支确实缺守卫。实施时收口到现成的计数即可:
|
||||
|
||||
> channel 关闭时,如果 `remaining_partitions > 0`,返回终止错误;只有完成计数归零,才向 Merge 暴露成功 EOF。
|
||||
|
||||
这属于实施时的小项,不需要扩大 exchange 的设计。
|
||||
|
||||
### 6.3 初版保守方案
|
||||
|
||||
@@ -335,6 +359,8 @@ DataFusion 已经提供了:
|
||||
|
||||
最后一条要针对**优化后的物理路径**检查,不能只看 scan 自身的声明。
|
||||
|
||||
**失败路径也要验**:A 已产生部分 fragments 后报错,B 必须**丢弃缓冲并失败**,不能拿已有片段运行窗口然后返回成功结果。
|
||||
|
||||
---
|
||||
|
||||
## 8. 复用,不造框架
|
||||
|
||||
Reference in New Issue
Block a user