Skip to content

Add deletion support to B+ tree #102

@kevmo314

Description

@kevmo314

We want the ability to delete records from the B+ tree. To do this, we will tombstone leaf nodes.

Because the B+ tree can store multiple values per key, we will delete by key/value pair. But crucially, we will match the values by offset only. This is pretty subtle so it should be documented carefully. That is, our function signature should look like:

func (t *BPTree) Delete(key []byte, valueOffset uint64) (bool, error) {

The algorithm for deleting will be as follows:

  1. Find the first node matching key. This is identical to Find today.
  2. Call .Next() for each matching key, update the leafPointer to have offset ^uint64(0) (ie tombstone it).
  3. Update .Next() to skip tombstoned entries.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions