Splits left behind by a moved or deleted pipeline are never merged: proposal for a one-shot `defrag` tool
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
- 35/100
Hướng nghiên cứu
Read MergePlanner::belongs_to_pipeline, fetch_immature_splits_for_new_merge_pipelines, and the existing quickwit tool merge and tool gc implementations to understand the ownership filters and CLI patterns. The proposal leaves key design choices open, including CLI versus janitor placement and packing policy, so first agree on the command shape with maintainers. Done means a one-shot tool safely merges mature orphan splits and publishes replacements through the production actors.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Context
Merge ownership is scoped to the indexer that produced a split. A merge pipeline only ever considers splits whose node_id, index_uid and source_id match its own (MergePlanner::belongs_to_pipeline), and when IndexingService (re)creates a merge pipeline it only reloads splits that are both immature and tagged with its own node_id (fetch_immature_splits_for_new_merge_pipelines: .with_node_id(self.node_id).retain_immature(now)).
This is a sensible choice: no coordination is needed between indexers, and fresh splits are merged from the local split cache instead of being re-downloaded. But it has a consequence that we think deserves an explicit answer: a split whose producing node no longer runs a pipeline for that source will never be merged by anyone. It stays as is until it reaches maturation_period (48h by default), after which it is mature forever, however small it is.
Three situations produce such splits:
- The control plane moves a pipeline from node A to node B (rebalancing, node restart, resize). Every move leaves behind the last split(s) committed on A.
- A node crash-loops for a while (OOM, etc.). Each restart publishes small splits, and the merge pipeline never lives long enough to merge them.
- A source is deleted and recreated under a new
source_id(e.g.foo->foo-v2). Nothing will ever create a merge pipeline forfooagain.
Case 1 is cheap in practice: on one of our indexes we counted 9 small splits out of ~1,400 after the pipeline had been hosted on each of our 4 indexers in turn. Cases 2 and 3 combined are not: the same index carries 2,224 published splits for 2.6 billion docs (1.3 TB) left by a now-deleted source, 1,200 of them under 1M docs, next to 1,322 splits >= 10M docs for the current source. The index has a 1 year retention, so this fragmentation will be paid on every query touching that 9-day window for the next 11 months.
Current options
- Delete the splits (
mark-for-deletion): data loss. - Reindex: there is no document export path; the search API cannot realistically page through billions of docs.
quickwit tool merge: it spawns a regular merge pipeline, so it inherits the samenode_id+ immature filters and does not see these splits.- Direct metastore surgery (
UPDATE splits SET node_id = ..., maturity_timestamp = ...plus the JSON column) and a dummy source with the oldsource_idso that a merge pipeline adopts them. It works on paper but is not something we want to do on a production metastore.
Proposal: a one-shot defrag tool
We would like to contribute a maintenance command (working name quickwit tool defrag --index <id> [--source <id>] [--dry-run]) that is deliberately not a merge pipeline:
- Candidates:
Publishedsplits of the index, mature (bymaturity_timestamp), withnum_docs < split_num_docs_target, grouped bysource_id, regardless ofnode_id. - Planning: a single pass, sorted by
time_range.start, greedily packing consecutive splits up tosplit_num_docs_target/max_merge_factor. Each input is rewritten exactly once and outputs are time-contiguous (unlike the stable-log policy, which is designed for a continuous stream and rewrites data across levels). - Execution: reuse the existing
MergeSplitDownloader->MergeExecutor->Packager->Uploader->Publisheractors, so the split format, hotcache, tags,delete_opstamppropagation and the atomicpublish_splits(replaced_split_ids)are the production ones. - Output splits: same
source_idas inputs, forcedMature,node_idset to a sentinel so no merge pipeline ever adopts them. - Safety: because only mature splits are touched, the tool never competes with indexing or merge pipelines. The only concurrent writers are the janitor (retention, delete tasks); those races are already resolved by the metastore, which refuses to publish when a replaced split is no longer
Published(FailedPrecondition), so the worst case is a wasted merge. Sequential execution, resumable, staged leftovers collected bytool gc.
Questions for the maintainers
- Is the "merges are owned by the producing node, orphans are accepted" model an intentional design decision you want to keep? If so, is a maintenance tool like the above an acceptable way to deal with the leftovers, and would you take it upstream?
- Would you rather see this as a CLI
toolsubcommand (runs out of the cluster with a node config, liketool gc), as a janitor task, or as a REST endpoint on an indexer (which would benefit from the local split cache andMergeSchedulerServicepermits)? - Any objection to the single-pass, time-ordered packing instead of going through
MergePolicy? We can also make the policy pluggable. - Is there an existing plan to change ownership (e.g. a lease on splits in the metastore, or control-plane-scheduled merges) that would make this tool unnecessary?
Happy to open a PR once we agree on the shape.
- Ngôn ngữ chính
- Rust
- Star
- 11.8k
- Fork
- 628
- Merge trung bình
- 2 ngày 22 giờ
- Pull request đã merge (30 ngày)
- 50
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Có Dockerfile hoặc 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 quickwit-oss/quickwit
-
area:otel documentation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
quickwit-oss/quickwit#6686 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Add some examples of requests in the REST API reference docsCó thể đã có người làm @Cunninger đã nhận 88 ngày trước. Đang mởenhancement good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
quickwit-oss/quickwit#4266 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
documentation
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 65/100
quickwit-oss/quickwit#3872 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Update docs on range queriesĐang mởdocumentation
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 65/100
quickwit-oss/quickwit#3666 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
implement retry for ListTermsĐang mởenhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
quickwit-oss/quickwit#2769 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của quickwit-oss/quickwit
Issue tương tự
-
p2 ready-mac
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
quickwit-oss/tantivy#3299 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
`stream enable` fails with "already enabled" on every fresh session since streaming became always-onĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
vercel-labs/agent-browser#2797 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
witchesofthehill/manabrew#1309 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug help wanted ui
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
userFRM/egui-charts#4494 ·
Maintainer thường phản hồi trong vòng 1 ngày