Skip to content

feat(format): specify retention leases - #10428

Open
brendanclement wants to merge 18 commits into
lance-format:mainfrom
brendanclement:brendan/ongoing-work-pin-format-main
Open

brendanclement wants to merge 18 commits into
lance-format:mainfrom
brendanclement:brendan/ongoing-work-pin-format-main

Conversation

@brendanclement

@brendanclement brendanclement commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Compaction should be able to run while long-running jobs, such as async index builds, are in progress. The Fragment Reuse Index (FRI) records how compaction moves rows so those jobs can translate their results, but cleanup and FRI trimming need to know which versions and transitions the jobs still depend on.

This PR specifies retention leases. A lease is listed in the current manifest and keeps the leased version, every version after it through the head, and the FRI transitions connecting its fragments to the current layout. Leases are temporary: they expire unless renewed.

Design discussion: #10395.

Format changes:

  • Manifest.retention_leases (field 27) holds RetentionLease records: id, version, created_at, expires_at, and label.
  • Writer flag bit 20 (FLAG_RETENTION_LEASES) is set exactly when the lease list is nonempty, so writers without lease support reject the table only while leases exist.
  • New transactions: AcquireLease, RenewLease, and ReleaseLease. Acquisition creates a new version, which becomes the leased version, and is idempotent by lease ID.
  • A lease's ID is the UUID of the transaction its holder intends to publish. Committing that transaction releases the lease atomically.
  • Every attached commit derives the lease list from its predecessor and removes expired leases.
  • Restore, overwrite, and branch deletion end leases; new branches and clones start without any.

This PR contains the specification, protobuf definitions, and the minimum Rust changes needed to compile. Bit 20 stays unsupported and the lease operations decode to Operation::Unknown until the implementation lands in follow-up PRs. The Rust cleanup path rejects bit 20 starting with v14.0.0-beta.4.

Since the earlier revision of this proposal, "ongoing work pins" were renamed to retention leases, Transaction.release_pin_id was replaced by release-by-UUID, and the branch identity and branch deletion rules were removed.

🤖 Generated with Claude Code

@github-actions github-actions Bot added A-format On-disk format: protos and format spec docs format-change A change to the format spec, which requires a vote. Remove if minor (e.g. fixing typo). enhancement New feature or request labels Oct 28, 2026
@brendanclement
brendanclement force-pushed the brendan/ongoing-work-pin-format-main branch from 2ebb935 to 52fca11 Compare October 28, 2026 19:12
@brendanclement
brendanclement marked this pull request as ready for review October 28, 2026 19:53

@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 commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Important

Format specification vote

This PR modifies the Lance format specification, so it requires 3 binding +1 votes from PMC members (excluding the proposer), at least one of them on the latest commit, and a minimum 72-hour voting period, weekends excluded, before it can merge. Vote by approving this PR (+1) or requesting changes (−1, a veto). See the voting process.

Approvals carry over across pushes, so a rebase or a typo fix does not send everyone back to re-vote. Whoever approves the latest commit is vouching that nothing substantive has changed since the earlier approvals; if something has, ask for fresh votes.

Status: ❌ Blocked — 2 of 3 required approvals

Approvals @wjones127, @westonpace (2/3)
Latest commit approved by none — one PMC member must approve the latest commit
Vetoes none
Voting period elapsed — ended Mon 2026-11-02 19:53 UTC (11:53 PST)

Updated automatically by the format-spec vote gate, which re-checks every 15 minutes — just voted? Re-check now (press Run workflow; leave the input blank to re-check every open format PR). A PMC member may apply the format-waived label to waive the vote for a trivial edit (typo, wording, formatting).

lance-gatekeeper[bot]

This comment was marked as outdated.

@lance-gatekeeper lance-gatekeeper Bot added the K-approved Latest Gatekeeper recommendation permits acceptance. label Oct 28, 2026
@lance-gatekeeper lance-gatekeeper Bot removed the K-approved Latest Gatekeeper recommendation permits acceptance. label Oct 29, 2026
lance-gatekeeper[bot]

This comment was marked as outdated.

@lance-gatekeeper lance-gatekeeper Bot added K-approved Latest Gatekeeper recommendation permits acceptance. and removed K-approved Latest Gatekeeper recommendation permits acceptance. labels Oct 29, 2026

@westonpace westonpace left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Haven't finished. Some initial questions

Comment on lines +62 to +63
A version-1 history is called **tagged**. If it also contains legacy versions,
it is called **mixed**.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Are we trying to move away from the "tagged" terminology (in preference of "version 1")? I don't actually know. But yeah, Claude seems to like "tagged" (maybe we have a bunch of comments referring to it?)

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.

I switched the prose to FRI version 1 and spelled out when a version 1 history contains legacy records. I think the agents like "tagged" because of comments and it kindof stuck.

Comment on lines 203 to 206
@@ -202,6 +205,30 @@ trimmed. Cleanup must retain intermediate transitions still needed to translate
old addresses. External mapping files can be deleted only when no retained
dataset version references them.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can we fold this paragraph into the new section and just title it Cleanup?

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.

Combined these into one Cleanup section so the existing-index and in-progress-job requirements are explained together

that union at the final commit target of every operation that trims or replaces
history, including work planned before registration. Restore and Overwrite
apply this check to the resulting current history; they may discard translation
paths while preserving current pins and their source snapshots.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is very LLM-ish. It reads like a dump of dense facts. Can we provide a bit of motivation first?

Something like...

An FRI can be removed (cleaned up) once all artifacts referencing the source fragments have been removed. For example, an index that maps search results to fragments A and B will prevent an FRI from getting cleaned up when A and B are source fragments in the FRI. This is because the FRI is still needed to map the results of index searches.

Sometimes we also want to keep an FRI alive even when there are no artifacts referencing source fragments because those artifacts are currently being created by an in-progress task. For example, if an index is being trained against fragments A and B, this process may take several hours. We do not want the an FRI that maps A or B to be cleaned up while this training takes place.

To solve this problem we utilize ongoing-work pins...

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.

Ok i changed this so cleanup now starts with the example of an index pointing at A/B after compaction moves the rows to C, then explains why an index still being built needs the same history.

Comment thread docs/src/format/table/index.md Outdated
a monotonically increasing version number, and an optional reference to the index section that describes a list of index metadata.

[Ongoing work pins](ongoing_work_pins.md) record unfinished jobs' source snapshots
and FRI retention requirements in the current manifest. See that specification

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can we prefer "in-progress" over "unfinished"? When I see the latter term I think "failed" or "abandoned"

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.

Changed to in-progress.

Comment thread docs/src/format/table/index.md Outdated

[Ongoing work pins](ongoing_work_pins.md) record unfinished jobs' source snapshots
and FRI retention requirements in the current manifest. See that specification
for their lifecycle and the existing maintenance concurrency limits.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What does "existing maintenance concurrency limits" mean?

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.

This meant that checking for pins and physically deleting a branch are separate steps. A deletion could check an empty pin list, then continue after a job registers a pin. I decided that this vague phrase from this overview just leads to more questions and instead I added that example to the limitations section.

Comment on lines +212 to +213
inclusive source-version boundary. Tagged and mixed histories retain records
reachable from pinned source fragments, including all downstream dependencies

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

How is "pinned source fragments" determined? Do we read the pin's version and load all fragments at that version?

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.

Yes, we load and validate the manifest at the pin's source version and use all fragment IDs listed there. That just reads metadata. For FRI version 1, we follow the movement records forward from those IDs. I've made this more explicit in both sections.

Comment thread protos/transaction.proto Outdated
Comment on lines +425 to +428
/* UUID of the source manifest's committing transaction.
* Absent or empty is invalid; compare exact UTF-8 bytes.
*/
optional string source_transaction_uuid = 1;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why does this need a UUID?

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.

So originally this was to distinguish snapshots in a case where the table is deleted and recreated at the same path, but the agent went all-out in trying to red-team and break this implementation. I've removed this from the schema because i think it's overkill.

@@ -0,0 +1,275 @@
# Ongoing Work Pins

An ongoing-work pin adds a retention requirement for a fixed source snapshot

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
An ongoing-work pin adds a retention requirement for a fixed source snapshot
An ongoing-work pin adds a retention requirement for a fixed source version

I find LLMs like to use snapshot (likely due to the prevalence of Iceberg) but the proper term should be "version" or "manifest" to match the rest of the spec.

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.

I’ve changed the pin documentation to use version for the table state and manifest for the metadata describing it.

Comment on lines +251 to +275
This feature does not add atomic coordination between protection acquisition,
restore, and destructive maintenance. Existing tags also use separate
acquisition and retention checks. A tag created after cleanup's inspection can
succeed while that sweep still deletes its old source files. An earlier sweep
can likewise delete files adopted by a concurrent restore, and a delayed branch
deletion can damage a replacement after overlapping recovery and name reuse.

Current-version-only acquisition avoids selecting an arbitrary old version
already eligible for cleanup. A sweep retains the head it inspected, and the
usual grace period protects newly written, unverified files while they remain
recent. This narrows exposure compared with old-version tags, but is not a
general concurrency guarantee: the grace period can elapse or be bypassed by
`delete_unverified`, and restore can reintroduce older files. The old-version
tag case is not evidence that every current-version pin has the same exposure.

The pin checks do not cancel an earlier deletion plan or prevent a destructive
operation from running after confirmation. A successful registration therefore
does not guarantee safety against these overlapping operations. Callers must
not treat the pin as a lock against destructive maintenance.

These are existing maintenance and branch-coordination gaps. Their fixes are
outside this proposal; no deletion marker, permanent name retirement, new
branch layout, or reference journal is specified. Branch names remain reusable.
This limitation does not relax the required active-pin checks, the retention
of sources selected by those checks, or the transactional FRI retention rules.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This entire paragraph is difficult to parse. I think what we are trying to say here is that a race condition potentially exists between acquiring a pin and running cleanup. We can both succeed in acquiring a pin and still clean up the version if the two operations were running at the same time?

Is there any advice on mitigation? It seems we should generally be ok as long as the cleanup interval is long enough right? For example, if the cleanup interval is one hour then as long as we pin at the start of a long-running operation then we're probably safe right?

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.

yeah so registration can succeed before an earlier deletion finishes, though I think this paragraph made it sound broader than it actually is. pins only register against the current version, and cleanup retains the current version it inspected.

one case where this can happen is a restore. cleanup selects some old files for deletion, then a user restores a version that references those files and a job pins that restored version. cleanup can still delete those files based on its earlier check. adding the pin doesn't cancel that decision. so running cleanup once an hour wouldn't guarantee we're safe here either, because the restore could still happen while cleanup is running.

incompatible operations already in flight. Existing branch deleters that never
inspect capability flags are not made safe by this bit.

## Maintenance concurrency limits

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Calling these "maintenance concurrency limits" is a little confusing. We aren't really talking about limiting concurrency here are we?

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.

I’ve renamed it to Cleanup and deletion races and updated the links.

@lance-gatekeeper lance-gatekeeper Bot removed the K-approved Latest Gatekeeper recommendation permits acceptance. label Nov 2, 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. and removed K-risk Latest Gatekeeper recommendation includes a non-blocking risk. K-approved Latest Gatekeeper recommendation permits acceptance. labels Nov 2, 2026
@lance-gatekeeper lance-gatekeeper Bot added K-approved Latest Gatekeeper recommendation permits acceptance. K-risk Latest Gatekeeper recommendation includes a non-blocking risk. labels Nov 10, 2026
Revert drive-by edits to unrelated feature flags and FRI wording, restore
the external mapping file rule, and renumber RetentionLease fields. Align
no-op and expiry rules across files, drop the "attached" qualifier, and
shorten the lease section in transaction.md.

A decoded manifest that lists leases now always carries writer bit 20, so
this build refuses writes that would drop the list.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@lance-gatekeeper lance-gatekeeper Bot removed K-risk Latest Gatekeeper recommendation includes a non-blocking risk. K-approved Latest Gatekeeper recommendation permits acceptance. labels Nov 10, 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 with a non-blocking risk.

Release by the planned publication UUID keeps publication and lease removal in one commit. Listed leases now block this implementation’s writers even when bit 20 is omitted; lease support remains disabled.

The accepted complete-version retention accumulates intermediate data and index generations. The idle-table expiration concern remains: expired leases retain resources until another commit or explicit release. Restore, overwrite, and branch deletion end protection and can interrupt holders. Publication still requires normal conflict validation and transaction evidence; lease absence alone does not establish success.

This can land as a specification while bit 20 remains unsupported. Activation requires complete version/transaction retention and commit-time FRI checks across lease-aware writers and maintenance clients. Applications coordinating restore and cleanup can drain cleanup before restore and pause it through acquisition; a flag cannot stop deletion already in flight. The runtime history protection reverted by #10440 cannot supply these guarantees.

@lance-gatekeeper lance-gatekeeper Bot added K-approved Latest Gatekeeper recommendation permits acceptance. K-risk Latest Gatekeeper recommendation includes a non-blocking risk. labels Nov 10, 2026
@wjones127

Copy link
Copy Markdown
Contributor

Implementation plan for retention leases, stacked on this PR:

  1. This PR (format). Amended: cleanup must keep unreferenced files written after the oldest lease's created_at (staged index segments), and compaction under a lease creates a tagged FRI if none exists.
  2. Core (Rust): Acquire/Renew/Release ops; a pure derive_retention_leases called on every commit attempt with an injected now; no-op lease requests write no version; cleanup/expire protect F..H via ProtectedVersions; FRI retention; conflict-matrix coverage; flag 20 becomes supported.
  3. Bug fixes, independent of the stack, landing before (5): bug: post-cleanup in-place rewrite check compares against the commit handle, not the read version #10912, bug: CreateIndex can cover rows a Restore revived, causing index false negatives #10913.
  4. Python/Java bindings for the general lease API.
  5. Index integration: a LeaseKeeper for renewals; a managed single-shot build; the distributed path takes the lease explicitly and commits with read_version = lease.version(); a user guide page.

API decisions:

  • RetentionLease is opaque and serializable, with getters. You get one only by acquiring or deserializing.
  • Publish with TransactionBuilder::retention_lease(&lease). It is an error to also set .uuid(..), or to attach a lease to lease ops or Clone.
  • acquire_retention_lease returns the lease and a Dataset at the leased version. Workers call checkout_lease(&lease).
  • Leases are opt-in, because they fence writers that don't support them. The default TTL is 30 min.
  • Publishing is lenient: if the lease is no longer listed, the commit proceeds with a warning. The commit path errors or narrows index coverage when history is missing, once bug: post-cleanup in-place rewrite check compares against the commit handle, not the read version #10912 and bug: CreateIndex can cover rows a Restore revived, causing index false negatives #10913 are fixed. Stable-row-ID tables were checked: results stay correct.
  • The keeper is optimistic: on a transient failure it warns and retries. A lost lease is terminal, is never re-acquired, and shows in the keeper's status. It never aborts the build.
  • Acquiring a lease on a stable-row-ID table returns NotSupported until FRI with stable row IDs ships (flag 9).

@lance-gatekeeper lance-gatekeeper Bot removed K-risk Latest Gatekeeper recommendation includes a non-blocking risk. K-approved Latest Gatekeeper recommendation permits acceptance. labels Nov 10, 2026
…n stable-row-ID tables

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@westonpace westonpace left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks great, just some minor nits

Comment on lines +215 to +218
{1, 2} -> {5} keep: an index references fragment 1
{4} -> {6} keep: the leased version contains fragment 4
{6} -> {7} keep: translating fragment 4 to 7 passes through 6
{8} -> {9} trim: no index or retention lease references fragment 8

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can you show an example where the target frag (but not the source) intersects with an index/lease? In this case I think you can trim correct?

For example, compaction combines 8 and 9 into 10 and then a new index is created on a new column (and so it covers frag 10) but nothing else needs 8 or 9 anymore.

Comment thread docs/src/format/table/index.md Outdated
It contains the complete schema definition including nested fields, the list of data fragments comprising this version,
a monotonically increasing version number, and an optional reference to the index section that describes a list of index metadata.

[Retention leases](retention_leases.md) retain a leased version, the versions

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This seems like a slightly odd place to put this concept. Maybe put it way down after overlay files or potentially even as a related specification?

It'll be an implementation detail for all but the most hardcore of readers

Comment on lines +118 to +120
and cleanup must retain the transactions of versions after F. If cleanup cannot
confirm that a required version or transaction is present, it **must not
delete** files that version might need.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What does this last sentence mean? Why would cleanup not be able to confirm a required version or transaction is present?

confirm that a required version or transaction is present, it **must not
delete** files that version might need.

Acquisition does not cancel deletions that cleanup approved before it.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Maybe we can add "to avoid job failure the lease should be applied well before any configured retention interval so that lease acquisition does not race with cleanup operations"

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.

Honestly, I think I can just remove this sentence entirely. Because we atomically create the lease and the version it's on, cleanup should never race. This sentence is really about versions before F, which aren't really relevant.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Cleanup isn't a transaction though so I think it can still race. We could avoid it with some kind of "mark for death" operation (which is incredibly tempting now that I've thought of that name) but we don't have that.

0:00 - Cleanup begins, starts scanning versions to see which ones are still too old
0:30 - Cleanup decides versions 5, 6, and 7 can be deleted and starts scanning to find appropriate files
0:45 - User decides to create an index using version 7 as the read version and commits a retention lease (oops too late)
1:00 - Cleanup deletes version 7 and all its files

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.

#10924
I actually am considering implementing a "mark for death" in this other proposal.

@wjones127 wjones127 Nov 13, 2026 •

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.

The design here is that a user can't commit a retention lease for a version that exists. They request a lease, and they get back a new version number. Because cleanup never deletes the latest version, a lease can never refer to something that's already being cleaned up.

So your sequence corrected:

0:00 - Cleanup begins, starts scanning versions to see which ones are still too old
0:30 - Cleanup decides versions 5, 6, and 7 can be deleted and starts scanning to find appropriate files
0:45 - User decides to create an index. Requests a retention lease, gets back new version 9 as the read version to use and commits a retention lease (oops too late)
1:00 - Cleanup deletes version 7 and all its files

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Oh wait, now I see your point (here and in the other question). The user wouldn't use version 7 as the read version. They would have to use the newly created version 8 and version 8 would already be protected 🤔 Clever!

@westonpace westonpace Nov 13, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yes, this whole sentence can be removed then.

Comment thread docs/src/format/table/transaction.md Outdated
| Rewrite | If the rewrite replaces fragments a listed lease requires, it must record FRI transitions for them; otherwise it conflicts and must be replanned. |
| Restore, Overwrite | Remove all leases. Existing data conflicts remain. |
| Clone | Start the destination with no leases and no lease flag. |
| AcquireLease | Return a listed ID without changing it. Otherwise, add the lease against the new head with an unexpired request. |

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Minor nit: can we rephrase so the typical case is first?

Add the lease against the new head with an unexpired request if the ID is not listed. Otherwise return it without changing it.

Clarify why leases are listed while expired, why the holder is handed its
version, and when cleanup cannot confirm lease history; drop the
acquisition/cleanup race note; add a destination-only FRI trim example;
move the lease summary to related specifications.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Transaction V2 took field 116 for CompositeOperation.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

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

Not trying to block but, and sorry for being late but, did we consider something like matching FRI retention to the existing dataset retention period, so leases are only needed for builds that outlive normal GC or need stronger guarantees?

I tested a 48h FRI window locally, and index builds committed across multiple compactions while the old versions were retained. For ordered compaction on 100M rows, mapping files stay small like ~40KiB (meaning a week of hourly history might roughly be ~270 KiB, compared to ~16.4 GiB for the dataset directory). So storage shouldnt be a problem.

Since the builds only fail once cleanup deletes the old manifests and data files, matching the FRI and dataset retention seems like it would cover the common case.

I'm mostly wondering if we need to add some additional complexity in the commit protocol and another feature flag, especially with everything we're already adding to the transaction layer. Is there a reason the existing retention mechanisms wouldn't be enough?

@wjones127

Copy link
Copy Markdown
Contributor

Not trying to block but, and sorry for being late but, did we consider something like matching FRI retention to the existing dataset retention period, so leases are only needed for builds that outlive normal GC or need stronger guarantees?

That's a good question. And I would like that solution if GC was still based off of a time based threshold. Unfortunately, there's been recent changes in GC scheduling that make it not just a pure time cut off. Now there's mechanisms that are based off of how many versions to keep and there's mechanisms that do thinning based on hourly or daily time windows. Because of this, we can't guarantee that cleanup will only delete things after us a certain period—it might also delete things sooner than long running jobs complete and so I think that does make this necessary.

@geruh

geruh commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

ahh I see... I think I'm used to a world where retention policies use both a minimum number of versions and a time window, so both conditions need to be met before cleanup.

maybe we could support something similar here, where we keep every version within a minimum window before "thinning" or version based cleanup kicks in? file retention or gc could still handle file reachability from the retained manifests, and we'd keep FRI mappings for that same window, or longer if committed indexes still need them.

compaction would also need to record those mappings even when no committed index exists, but that would let builds finishing within the window commit without having to track each one.

I know longer builds wouldn't have that guarantee, and keeping all those intermediate data files could get expensive. Is that the main reason for leases, or do we have workloads that actually need stronger guarantees than a retention window provides?

This branch has not been deployed

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

Labels

A-format On-disk format: protos and format spec docs enhancement New feature or request format-change A change to the format spec, which requires a vote. Remove if minor (e.g. fixing typo).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants