Range rename
Range rename is a key-value operation that atomically replaces one key prefix with another in every key that carries it, leaving the values unchanged.
Given prefixes p1 and p2, the operation rewrites every key that begins with p1 so that it begins with p2, the key-space analogue of renaming a directory under full-path indexing. It was introduced for a write-optimized B-epsilon tree and is a research primitive, not a generic filesystem or database API. [1]
For large ranges the tree is sliced at the source and destination, the isolated subtree moves by a pointer swing, and key lifting stores shared prefixes in parent nodes, so the work grows with tree height rather than subtree size. Files smaller than 4 MiB fit in at most two leaves and are copied instead, and renaming over an existing file pairs a range delete with the range rename in one transaction. [1]
Without the primitive, a full-path filesystem re-inserts every key under its new name and deletes the old ones, a deep copy that took 21.17 s for a Linux source tree. [3] With it, rename throughput stayed within the 30 to 120 renames per second measured for conventional filesystems, except for files near the 4 MiB node size. [1]
In BetrFS 0.4, rename return, log persistence and deferred tree surgery are separate endpoints. VFS-buffered file writes can reach the log after the rename, so the recorded new name does not establish durable payload. The latency discussion explicitly makes rename durability conditional on syncing the log. [1]
Relations
Advantages
- Recovery can replay the range-rename message from the redo log; durability requires the log fsync, not just insertion into a memory buffer. [1]
Limitations
- Tree surgery pins and dirties the fringe nodes and their common ancestors, and read transactions that began before the rename must finish first, so concurrent work on the range waits. [1]
Citations
- Zhan et al. The Full Path to Full-Path Indexing. FAST 2018, pp. 123-138, sections 3-7.
- Jannen et al. BetrFS: A Right-Optimized Write-Optimized File System. USENIX FAST 2015, pp. 301-315, sections 4 and 7.
Further reading
Sources & caveats
- fullpath is the USENIX FAST 2018 paper that defines the primitive, read in sections 2-7; betrfs15 is the FAST 2015 paper on the earlier copy-based rename, read in sections 4 and 7.
- Throughput and timing figures are single-testbed measurements of research prototypes in those papers.