Electric on-demand skips updates to unknown rows that enter a served ordered range
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 25/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- typescript
- 领域
- data
调研方向
Start at packages/electric-db-collection/src/electric.ts near line 2382, where updates for rows the Collection does not know are skipped unless the shape uses replica: 'full'. Read docs/collections/electric-collection.md around line 414 for the documented 'unknown partial rows are ignored' behavior. Done means a witness test with the mocked ShapeStream shows the window moving from [10, 4] to [10, 7], and the server's actual messages for this row are confirmed. The fix approach is still an open design choice among the options in the issue.
由索引模型根据 Issue 内容生成。
描述
Problem
An on-demand Electric collection with the default replica mode can show a wrong ordered window. A row that the Collection did not load can move into a served ordered range, and the Collection never receives it.
Electric skips an update for a row that the Collection does not know, unless the shape uses replica: 'full' (packages/electric-db-collection/src/electric.ts, near line 2382). A default-replica update contains only the changed columns, so the client cannot make the row from it. The documentation states this behavior: "unknown partial rows are ignored" (docs/collections/electric-collection.md:414).
This conflicts with the LoadSubset rule from #2136: a provider keeps each served ordered range whole. After a load serves an ordered, limited page, every row that later sorts inside that range must arrive. Electric's move-in and tag messages apply to rows that Electric already knows. They do not cover a row that newly sorts into a limited ordered range.
Reproduction
On-demand mode, default replica, live query orderBy(rank desc).limit(2).
- Rows with rank 10, 4, 1, 0. The window is
[10, 4]. - The shape stream sends an update for the row with rank 0, which the Collection did not load. Its rank changes to 7.
- Expected window:
[10, 7]. Actual window:[10, 4].
With replica: 'full', the row arrives and the window is [10, 7].
A witness test uses the package's mocked ShapeStream. It will go into the fix PR. It does not prove which messages a real Electric server sends for this row. The fix PR must confirm that against the server or its documentation.
Options
- When an update arrives for an unknown row, fetch the full row, or reload the served subsets that the row can enter.
- Invalidate the limited ordered subsets when such an update arrives, so that the DB loader requests them again.
- Accept the gap as a limit, and document that ordered on-demand windows need
replica: 'full'.
Related: #2136 (the same rule for query-db).
This issue was written by Isaac.
- 主要语言
- TypeScript
- 星标
- 3.9k
- 派生
- 272
- 平均合并
- 1 天 48 分钟
- 30 天内合并 PR
- 238
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
TanStack/db 的其他 Issue
-
难度 5/5 一周以上 新手友好度 12/100
维护者通常 1 天内回复
-
Ordered, limited live query over a string key commits `loading` first (and `orderBy().findOne()` since 0.11.1)可能已有人在做 @KyleAMathews 今天认领。 未关闭
难度 4/5 3-5 天 新手友好度 18/100
维护者通常 1 天内回复
-
难度 5/5 一周以上 新手友好度 18/100
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 18/100
维护者通常 1 天内回复
-
难度 5/5 一周以上 新手友好度 8/100
维护者通常 1 天内回复
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 75/100
apollographql/apollo-client#13493 ·
维护者通常 1 天内回复
-
Custom hosts written as trailing-dot FQDNs (`host.local.`) aren't detected as local backends可能已有人在做 @roboomp 今天认领。 未关闭bug prio:p2 providers triaged
难度 2/5 1-3 小时 新手友好度 82/100
can1357/oh-my-pi#15798 · 3 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 62/100
code-yeongyu/oh-my-openagent#10172 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 70/100
PDFCraftTool/pdfcraft#189 ·
-
Add the Yahoo chart API duplicate last-day row (yfinance#573) to incidents.md (about 1 hour)可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭data docs good first issue
难度 1/5 1 小时以内 新手友好度 80/100
pacocartones/market-data-sanity-checker#160 ·
维护者通常 1 天内回复