Skip to content

feat(compaction)!: support max_source_rows and max_source_bytes limits - #8235

Open
zhangyue19921010 wants to merge 6 commits into
lance-format:mainfrom
zhangyue19921010:compaction-support-maxRows-maxBytes-new
Open

feat(compaction)!: support max_source_rows and max_source_bytes limits#8235
zhangyue19921010 wants to merge 6 commits into
lance-format:mainfrom
zhangyue19921010:compaction-support-maxRows-maxBytes-new

Conversation

@zhangyue19921010

Copy link
Copy Markdown
Contributor

Closes:#8234

@github-actions github-actions Bot added A-python Python bindings A-java Java bindings + JNI enhancement New feature or request labels Aug 4, 2026
@zhangyue19921010
zhangyue19921010 marked this pull request as draft August 4, 2026 13:46
@zhangyue19921010
zhangyue19921010 marked this pull request as ready for review August 5, 2026 03:28

@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: request changes.

The new budgets need to bound every Lance-owned source the compaction task rewrites and remain usable during rolling Java upgrades. Count Blob v2 sidecars in the byte budget, and make the distributed Java task representation explicitly versioned and backward-readable.

Please mark this PR with the breaking-change label.

Comment thread rust/lance/src/dataset/optimize.rs
Comment thread java/src/main/java/org/lance/compaction/CompactionOptions.java Outdated
@zhangyue19921010 zhangyue19921010 changed the title feat(compaction): support max_source_rows and max_source_bytes limits feat(compaction)!: support max_source_rows and max_source_bytes limits Aug 6, 2026
@codecov

codecov Bot commented Aug 6, 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 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 with a non-blocking risk.

The implementation matches the stated manifest data/overlay byte contract, so Blob v2 payloads are a scoped limitation rather than a correctness failure. Cross-version Java task deserialization is likewise an existing same-version limitation, not a new stable wire promise.

Operators should not treat this setting as a total compaction-I/O cap; explicitly documenting the Blob v2 exclusion would reduce that risk. Versioning all serialized Java compaction objects together is the right follow-up.

@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 with a non-blocking risk.

The Rust, Python, and Java documentation now makes the Blob v2 exclusion explicit and accurately distinguishes this metric from a total compaction-I/O cap. The implementation and public contract are aligned on this head.

Cross-version Java compaction-task serialization remains a non-blocking same-version limitation; versioning all serialized compaction objects together remains the appropriate follow-up.

@zhangyue19921010

Copy link
Copy Markdown
Contributor Author

Hi @yanghua would u mind to take a look? Thanks!

* href="https://docs.rs/lance/latest/src/lance/dataset/optimize.rs.html#118">rust code</a> for all
* default values.
*/
public class CompactionOptions implements Serializable {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This class would be serialized and transferred across the network. The old‑version serialization stream ends after maxSourceFragments, whereas the new readObject unconditionally continues to read maxSourceRows / maxSourceBytes, which may cause deserialization failures during rolling upgrades or replaying old tasks.

Can we assign a compatible fixed CompactionOptions serialVersionUID, and add compatibility handling for missing newly‑added trailing fields in readObject, setting them to Optional.empty() when absent?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done. Thanks for your review. :)

@Xuanwo Xuanwo added K-approved Latest Gatekeeper recommendation permits acceptance. K-risk Latest Gatekeeper recommendation includes a non-blocking risk. labels Aug 10, 2026
…maxRows-maxBytes-new

# Conflicts:
#	java/lance-jni/src/optimize.rs
…er writers

Pin serialVersionUID to the previously generated UID and treat the
maxSourceRows/maxSourceBytes tail fields as unset when absent from the
stream, so CompactionTask objects queued by older workers still
deserialize during a rolling upgrade. Backed by a checked-in fixture
stream produced by the pre-change class.
@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 11, 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 new revision resolves the remaining Java rolling-upgrade risk by preserving the historical serialization identity and tolerating streams written before the source-budget fields. Together with the documented Blob v2 scope, the implementation now matches the accepted row/byte-budget contract across Rust, Python, and Java.

@lance-gatekeeper lance-gatekeeper Bot added the K-approved Latest Gatekeeper recommendation permits acceptance. label Aug 11, 2026
@lance-gatekeeper lance-gatekeeper Bot removed the K-approved Latest Gatekeeper recommendation permits acceptance. label Aug 11, 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: request changes.

The Java compatibility implementation remains correct, but this head removes the only checked-in historical-stream regression proving that old queued tasks remain readable. Same-version round trips cannot protect that rolling-upgrade contract, and repository policy requires bug fixes to retain corresponding tests.

Restore an equivalent pre-change CompactionOptions stream fixture—inline or as a checked-in test resource—and assert that old fields survive while maxSourceRows and maxSourceBytes remain empty.

@lance-gatekeeper lance-gatekeeper Bot added the K-changes Latest Gatekeeper recommendation requests changes. label Aug 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-java Java bindings + JNI A-python Python bindings breaking-change enhancement New feature or request K-changes Latest Gatekeeper recommendation requests changes.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants