{
  "slug": "rocksdb-delete-files-in-range",
  "term": "RocksDB DeleteFilesInRange",
  "aliases": [
    "DeleteFilesInRange",
    "DeleteFilesInRanges"
  ],
  "definition": "RocksDB DeleteFilesInRange removes eligible SST files contained in a key interval rather than inserting a range tombstone.",
  "note": "This is not an alias for DeleteRange. In v9.7.3, include_end defaults to true, L0 files remain, and older snapshots may lose access to removed data. Boundary-crossing files can leave matching keys behind. [file-api]\n\nThe implementation searches levels below L0, selects a contained group, skips files already being compacted and records selected removals in a version edit. If nothing is selected, it can return OK without deleting a file. This is a file-selection outcome, not proof of complete logical deletion or physical erasure. [file-impl]\n\nSelection also accounts for adjacent files sharing a user-key endpoint. The upstream DeleteFileRangeFileEndpointsOverlapBug test retains an older version in one file and a newer version in its neighbor; removing only the latter could reveal the old value. This regression is evidence of why containment alone is insufficient, not a newly discovered defect in v9.7.3. [file-boundaries] [file-tests]\n\nA file-deletion pause is a separate control over obsolete-file removal, not a freeze of the logical database state. Compactions can continue while removal is paused; preserving a pathname alone does not preserve its role in current reads. [pause-api]",
  "related": [
    "range-tombstone",
    "sstable",
    "rocksdb-read-snapshot",
    "rocksdb-file-deletion-pause"
  ],
  "citations": [
    {
      "id": "file-api",
      "title": "RocksDB v9.7.3. convenience.h: DeleteFilesInRange contract.",
      "url": "https://github.com/facebook/rocksdb/blob/v9.7.3/include/rocksdb/convenience.h",
      "accessed": "2026-10-23"
    },
    {
      "id": "file-impl",
      "title": "RocksDB v9.7.3. DBImpl::DeleteFilesInRanges: selection, compaction exclusions and version edits.",
      "url": "https://github.com/facebook/rocksdb/blob/v9.7.3/db/db_impl/db_impl.cc",
      "accessed": "2026-10-23"
    },
    {
      "id": "file-boundaries",
      "title": "RocksDB v9.7.3. VersionStorageInfo::GetCleanInputsWithinInterval and endpoint grouping.",
      "url": "https://github.com/facebook/rocksdb/blob/v9.7.3/db/version_set.cc",
      "accessed": "2026-10-23"
    },
    {
      "id": "file-tests",
      "title": "RocksDB v9.7.3. DBDeleteFileRangeTest: range boundaries, L0 and shared-endpoint regression.",
      "url": "https://github.com/facebook/rocksdb/blob/v9.7.3/db/db_compaction_test.cc",
      "accessed": "2026-10-23"
    },
    {
      "id": "hesela",
      "title": "LSM tombstones: deleted is not yet reclaimed",
      "url": "https://hesela.com/analyses/lsm-tombstones-delete-persistence/",
      "accessed": "2026-10-23"
    },
    {
      "id": "pause-api",
      "title": "RocksDB v9.7.3. db.h: nested file-deletion pauses and live-copy enumeration.",
      "url": "https://github.com/facebook/rocksdb/blob/v9.7.3/include/rocksdb/db.h#L1581",
      "accessed": "2026-10-23"
    }
  ],
  "status": "shipping",
  "advantages": [
    {
      "text": "Whole-file removal can avoid rewriting data that is eligible for deletion.",
      "citationIds": [
        "file-impl"
      ]
    }
  ],
  "limitations": [
    {
      "text": "File boundaries, L0 contents and concurrent compaction can leave data in the requested interval.",
      "citationIds": [
        "file-api",
        "file-impl"
      ]
    },
    {
      "text": "This API does not preserve all earlier snapshot reads.",
      "citationIds": [
        "file-api"
      ]
    }
  ],
  "supersedes": [],
  "supersededBy": [],
  "firstSeen": null,
  "lastSeen": null,
  "updated": "2026-10-23",
  "provenance": [
    "Version-scoped source review of the v9.7.3 API, implementation and upstream tests; RocksDB was not executed by Hesela in this review.",
    "No measured reclamation latency, reclaimed-byte count, performance result or media-sanitization guarantee."
  ]
}
