Skip to content

Expose two-phase delete API (DeleteJob::execute_uncommitted analog) #6658

Description

@ragnorc

Problem

DeleteBuilder::execute() (src/dataset/write/delete.rs:136) couples "compute deletion vector / rewrite fragments" with "advance HEAD via manifest commit" as a single operation. There is no public API to stage a delete (compute the DeleteData without advancing HEAD) and commit it later via CommitBuilder.

InsertBuilder::execute_uncommitted (src/dataset/write/insert.rs) and MergeInsertBuilder::execute_uncommitted both expose a public stage-then-commit shape that returns a Transaction for the caller to commit via CommitBuilder::execute.

The two-phase shape is already implemented internally for deletes. DeleteJob (private struct DeleteJob at src/dataset/write/delete.rs:152 — no visibility modifier; not exposed to consumers) implements RetryExecutor, splitting work into execute_impl() (build DeleteData) and commit(). DeleteJob::commit() at delete.rs:248-263 constructs Transaction::new(dataset.manifest.version, Operation::Delete { ... }, None) and then calls CommitBuilder::execute(transaction). The Transaction is built but never returned to callers.

What we'd like

A public DeleteBuilder::execute_uncommitted() -> Result<Transaction> method that runs the same execute_impl + Transaction construction that DeleteJob::commit runs today, but returns the Transaction instead of executing the commit:

let transaction = DeleteBuilder::new(dataset.clone(), "age > 65")
    .execute_uncommitted()
    .await?;
// ... do other work, decide whether to commit ...
let new_dataset = CommitBuilder::new(dataset).execute(transaction).await?;

Implementation-wise: split DeleteJob::commit() into "build Transaction" (already isolated at delete.rs:248-255) and "execute via CommitBuilder", then expose the build step through a new DeleteBuilder method. No new conflict-resolution work, no change to Operation::Delete's protobuf, no new internals.

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions