Skip to content

fix(compaction): avoid stranded remainder fragments - #8513

Merged
Xuanwo merged 10 commits into
mainfrom
gatekeeper/fix-8506-1
Aug 30, 2026
Merged

fix(compaction): avoid stranded remainder fragments#8513
Xuanwo merged 10 commits into
mainfrom
gatekeeper/fix-8506-1

Conversation

@lance-gatefixer

@lance-gatefixer lance-gatefixer Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Summary

  • derive target-scale output counts from surviving rows and balance remainders across outputs
  • keep ordinary planner-sized compaction tasks in one fragment without allowing oversized tasks to collapse into one file
  • cover both the reported small-fragment layout and an oversized deletion rewrite next to a small fragment

Root cause

The planner already groups adjacent small fragments into tasks with approximately target_rows_per_fragment rows. Execution applied that target again as a hard max_rows_per_file, so each task above the target produced a full fragment followed by a small remainder that could become isolated. Removing the cap solely based on source-fragment count then let an indivisible oversized source collapse into one arbitrarily large output.

The revised executor computes the output count from logical surviving rows and balances the tail across that count. Planner-sized tasks still produce one output, while genuinely oversized tasks remain target-scale.

Validation

  • cargo test -p lance --lib dataset::optimize::tests (123 passed)
  • cargo fmt --all
  • cargo clippy --all --tests --benches -- -D warnings
  • make install and make build from python/
  • uv run pytest python/tests/test_scalar_index.py::test_zonemap_index_remapping
  • uv run make lint

Fixes #8506

@github-actions github-actions Bot added the bug Something isn't working label Aug 12, 2026
lance-gatekeeper[bot]

This comment was marked as outdated.

@lance-gatekeeper lance-gatekeeper Bot added the K-changes Latest Gatekeeper recommendation requests changes. label Aug 12, 2026
@github-actions github-actions Bot added the A-python Python bindings label Aug 12, 2026
@lance-gatekeeper lance-gatekeeper Bot removed the K-changes Latest Gatekeeper recommendation requests changes. label Aug 12, 2026
lance-gatekeeper[bot]

This comment was marked as outdated.

@lance-gatekeeper lance-gatekeeper Bot added the K-changes Latest Gatekeeper recommendation requests changes. label Aug 12, 2026
@codecov

codecov Bot commented Aug 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@lance-gatekeeper lance-gatekeeper Bot removed the K-changes Latest Gatekeeper recommendation requests changes. label Aug 12, 2026
lance-gatekeeper[bot]

This comment was marked as outdated.

@lance-gatekeeper lance-gatekeeper Bot added K-approved Latest Gatekeeper recommendation permits acceptance. K-risk Latest Gatekeeper recommendation includes a non-blocking risk. labels Aug 12, 2026
@lance-gatefixer

Copy link
Copy Markdown
Contributor Author

Addressed in 5a9234d: planned row-group sizes are now generated and consumed lazily by the shared chunker, preserving the streaming memory bound. The chunker regression verifies that no sizes are consumed at construction and that sizes advance only as chunks are read.

@lance-gatekeeper lance-gatekeeper Bot removed K-approved Latest Gatekeeper recommendation permits acceptance. K-risk Latest Gatekeeper recommendation includes a non-blocking risk. labels Aug 12, 2026
lance-gatekeeper[bot]

This comment was marked as outdated.

@lance-gatekeeper lance-gatekeeper Bot added the K-approved Latest Gatekeeper recommendation permits acceptance. label Aug 12, 2026
@lance-gatekeeper lance-gatekeeper Bot removed the K-approved Latest Gatekeeper recommendation permits acceptance. label Aug 14, 2026
lance-gatekeeper[bot]

This comment was marked as outdated.

@lance-gatekeeper lance-gatekeeper Bot added the K-changes Latest Gatekeeper recommendation requests changes. label Aug 14, 2026
@lance-gatekeeper lance-gatekeeper Bot removed the K-changes Latest Gatekeeper recommendation requests changes. label Aug 14, 2026
lance-gatekeeper[bot]

This comment was marked as outdated.

@lance-gatekeeper lance-gatekeeper Bot added the K-changes Latest Gatekeeper recommendation requests changes. label Aug 14, 2026
@lance-gatekeeper lance-gatekeeper Bot added K-approved Latest Gatekeeper recommendation permits acceptance. and removed K-approved Latest Gatekeeper recommendation permits acceptance. labels Aug 21, 2026

@lance-gatekeeper lance-gatekeeper Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gate recommendation: approve.

The merged revision retains balanced Stable and Legacy compaction boundaries: planner-sized tasks avoid stranded remainders, while byte-limited and oversized rewrites replan remaining rows within the target-scale count. Cleanup and row-ID/index remapping behavior remain preserved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-python Python bindings bug Something isn't working K-approved Latest Gatekeeper recommendation permits acceptance.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

compact_files: compaction tasks may produce a sub-target fragment that can never be merged

1 participant