lance-format / lance-format/lance

Atomic dataset deletion

Open
#5,423 4 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement needs-info
Dominant language
Rust
Stars
7.1k
Forks
852
Avg merge
3d 18h
Merged PRs (30d)
272

Description

Motivation

Right now, to delete a dataset we delete all the files. This causes concurrent readers and writers to hit random "not found" errors. Even worse, if deletion fails halfway, this can leave the dataset in a corrupt state with missing files.

We also want to make it safe to immediately re-create a dataset at the same location, which is a common pattern many users expect. Currently it's safest to do write_dataset(..., mode="overwrite"). But if we could make dropping the table and recreating it just as safe, that would remove a major footgun.

Solution

  1. Create a new manifest state for a soft deleted table: zero fragments and zero fields in the schema.
    • Any concurrent reader / writer should report the dataset as being dropped when in this state.
  2. Create a new transaction type to delete a dataset. It should be compatible on top of any other transaction, but all other transactions except possibly overwrite should fail.
  3. Add a method (maybe part of cleanup) that does hard deletion of the file, but in a specific order: Old manifests should go first, then all data files, and finally the latest manifest. This order determines no concurrent readers should load a manifest and then try to read a file that isn't there.
  4. Allow write_dataset in create or overwrite mode to write to the dropped dataset.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the dataset deletion and write_dataset entry points, then trace manifest states, transaction handling, and cleanup. Review how readers and writers interpret manifests and how files are removed. Done means deletion is atomic for concurrent access, failed cleanup cannot corrupt the dataset, recreation at the same location is safe, and the specified hard-deletion order is enforced.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
data-engineering, databases
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.