Window: Live, Constant Time Grep Feb 10, 2024

submited by
Style Pass
2024-02-10 20:30:04

In this post, I describe the design of window — a small grep-like utility I implemented in 500 lines of Rust. The utility itself is likely not that interesting — I bet someone greybeared can implement an equivalent in 5 lines of bash. But the design principles behind it might be interesting — this small utility manages to combine core ideas of rust-analyzer and TigerBeetle!

TigerBeetle is tested primarily through a deterministic simulator: a cluster of replicas runs in a single process (in a single thread even), replicas are connected to a virtual network and a virtual hard drive. Both the net and the disk are extra nasty, and regularly drop, reorder, and corrupt IO requests. The cluster has to correctly process randomly generated load in spite of this radioactive environment. You can play with visualization of the simulator here:

Of course, sometimes we have bugs, and need to debug crashes found by the simulator. Because everything is perfectly deterministic, a crash is a pair of commit hash and a seed for a random number generator. We don ’t yet have any minimization infrastructure, so some crashes tend to be rather large: a debug log from a crash can easily reach 50 gigabytes!

Leave a Comment