Skip to content

fix(index): keep the earliest-created segment when every index segment is empty - #10107

Merged
wjones127 merged 1 commit into
lance-format:mainfrom
ump45nose:fix/keep-earliest-created-empty-index
Oct 17, 2026
Merged

wjones127 merged 1 commit into
lance-format:mainfrom
ump45nose:fix/keep-earliest-created-empty-index

Conversation

@ump45nose

Copy link
Copy Markdown
Contributor

Closes #10097.

When every segment of an index has empty live coverage, retain_relevant_indices keeps a single segment as the index definition. It picked the lowest dataset_version, but that's a watermark rather than a creation time (merges take the minimum of their sources, remaps raise it), so it could keep a newer segment and lose the earliest created_at.

This sorts the all-empty segments by created_at instead, as #10097 / #10090 describe: segments without a created_at go after those with one, and ties fall back to the lowest dataset_version. Segments that all lack created_at behave exactly as before.

Testing: added test_retain_multiple_empty_indices_keeps_earliest_created (fails on main, passes here). cargo test -p lance-table --lib passes, and cargo fmt / cargo clippy -p lance-table --tests show nothing new.

I used an AI coding assistant to help write this change and the test; I reviewed the diff and ran the tests above.

When every segment of an index has empty live coverage,
retain_relevant_indices kept the one with the lowest dataset_version.
That is a watermark, not a creation time, so it could keep a newer
segment and lose the earliest created_at. Order by created_at instead,
with segments lacking one last and ties on the lowest dataset_version.

Closes lance-format#10097

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

@github-actions github-actions Bot added the bug Something isn't working label Oct 17, 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 earliest known creation timestamp now survives all-empty retention, addressing #10097. All 20 focused retention tests pass, including the new ordering regression and the existing coverage and missing-timestamp cases.

@lance-gatekeeper lance-gatekeeper Bot added the K-approved Latest Gatekeeper recommendation permits acceptance. label Oct 17, 2026

@wjones127 wjones127 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.

Thanks!

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

Labels

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.

bug: all-empty index keeps lowest dataset_version segment instead of earliest created_at

2 participants