Another update: FBSimCity v0.4.0 adds a backup yard, built around what gbak and nbackup actually do.
- gbak runs a logical backup online, and its snapshot transaction pins the OIT for the entire run. Start one against a busy city and watch garbage collection stall while the version towers climb — the reason a nightly backup and a mysteriously bloating database are so often the same story. You can watch it happen here:
- nbackup does physical backup by level. Level 0 is the whole file, level 1 only the pages changed since level 0, and the chain is enforced: asking for L1 without an L0 is refused, and "restore chain" reports which levels a restore would apply, in order.
- The difference file is a new pit beside the excavation. Locking the database (nbackup -L) freezes the main file and every page write diverts into the delta, which fills up visibly and merges back on unlock. Forget to unlock and it grows forever — shareable as a link:
I also fixed a real falsehood in the simulation: evicting a dirty buffer used to cost nothing. It now writes the page out first, so a reader pays for someone else's write. Since commits flush their page under forced writes, dirty evictions stay rare on a healthy database and only start to bite when the cache is too small for the working set.
There is now also a knob audit that documents every control as real, merely scaled, or a modeled stand-in, together with the deliberate simplifications, so nobody has to read the source to find out what is honest:
Corrections are very welcome, especially on the backup mechanics — I modeled those from the documentation rather than from the engine source.
Marius