Ordered include windows load children for a parent row the top-K holds only while refilling
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 18/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- typescript
- Lĩnh vực
- data
Hướng nghiên cứu
Start with the includes-work oracle in packages/db/tests/query/includes-work-counter-oracle.test.ts, which pins the three overshoot replays. The change belongs in the demand plane: packages/db/src/query/live/collection-config-builder.ts and the subset demand controller. Done means the replays no longer exceed the work bound, the work-bound exclusion is removed from the generated campaigns, and the readiness and demand oracles still pass.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Problem
An ordered live query with an index-backed parent window can load child rows for a parent row that its settled window does not show. The parent's ordered loader refills the window within one graph run. Until the refill completes, the top-K briefly holds a row outside the settled window, and the include routes that row. The child source then loads that row's children.
The published rows stay correct. The extra work is the children of one parent row for each such checkpoint.
Traces
The includes-work oracle (packages/db/tests/query/includes-work-counter-oracle.test.ts) pins these traces as replays. Each replay loads one child row more than the bound.
- A held row moves out. The parent query has
orderBy(rank),offset 1andlimit 1. A step moves the parent row at position 0 past every other rank. The top-K briefly shows the moved row before its loader refills the slot. That row's children load. - A tie at the window edge during preload. Two parent rows have the same rank at the window edge. The loader loads the tie after the first prefix. The window first shows one tied row, then the other row, and both rows load their children.
- A window move while the loader refills. A step moves a parent row, and a second step inserts a parent row with a copied rank. Then
setWindowmoves the window. The top-K briefly shows a row outside the moved window.
Why the published rows stay correct
The graph publishes only after the loader settles. The top-K retracts the transient row in the same graph run, so no subscriber receives it. Only the child demand sees the transient row, because setDemand takes effect when the include's parent keys change.
How the oracle observes it
The harness counts the change batches that the parent Collection delivers to the query. At preload, more batches than the initial load show that the ordered loader acquired more rows. After a step, more batches than the step's own parent write show the same. The generated campaigns skip the work bound at those checkpoints only (about 2.5% of them).
Proposed change
Hold include demand until the ordered loader settles. The include records demand changes during a graph run. When the live query's graph loop has no pending work and its loaders are idle, the include sends one net demand change. If that change loads child rows, the graph loop runs again. A transient parent row then adds and removes its key in the same loop, and the child source does not load it.
This change is in the demand plane (packages/db/src/query/live/collection-config-builder.ts and the subset demand controller). It can change when demand starts within a sync turn. The readiness and demand oracles must show that readiness stays correct.
After this change, remove the overshoot from the replays and the work-bound exclusion from the generated campaigns.
This issue was written by Isaac.
- Ngôn ngữ chính
- TypeScript
- Star
- 3.9k
- Fork
- 272
- Merge trung bình
- 1 ngày 48 phút
- Pull request đã merge (30 ngày)
- 238
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của TanStack/db
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 12/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Ordered, limited live query over a string key commits `loading` first (and `orderBy().findOne()` since 0.11.1)Có thể đã có người làm @KyleAMathews đã nhận hôm nay. Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 18/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 18/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 8/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 3/5 Nửa ngày Mức phù hợp với người mới 58/100
Maintainer thường phản hồi trong vòng 1 ngày
Issue tương tự
-
fix(frontend): correct VITE_IS_DEVELPOMENT typo in shared/app.ts and align dev environment flagsĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
vicharanashala/ajrasakha#1439 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Add: TV5Monde AsieĐang mởapproved check:passed streams:add
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
codex-team/editor.js#3037 ·
-
complexity: trivial good first issue impact: low
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 78/100
ueberdosis/tiptap#8522 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Bump anybuf version to ^1.0.0Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
wormhole-foundation/wormhole#5062 ·
Maintainer thường phản hồi trong vòng 1 ngày