top | item 44208399

(no title)

schubart | 8 months ago

> we have around 6,000+ assertions in TigerBeetle.

Are they enabled in production? Are there some expensive ones that aren’t?

discuss

order

jorangreef|8 months ago

Yes, we drive with the seat belts on.

It’s not expensive.

Because we batch, this naturally separates the control plane from the data plane, amortizing assertions against the (larger) buffers now flowing through the data plane.

We do also have some intensive online verification checks, and these are gated behind a comptime flag.

Finally, we compile Zig with ReleaseSafe and further have all Zig’s own assertions enabled. For example, checked arithmetic for bounds overflow, which is not something you see enabled by default in safe builds for most languages, but which is critically important for safety.

The reason why all this is so important, is because if your program does something wrong in production, with people’s money, you want to know about it immediately and shutdown safely.

In other words, production is where you most need the safety, not in development (although you obviously want them there too to find bugs faster). But again, it’s the bugs that make it to production that we’re trying to catch with assertions.

schubart|8 months ago

Thanks for your reply!

> it’s the bugs that make it to production that we’re trying to catch with assertions.

Nicely put, I think I’ll steal this!