blurb

Random bits and pieces about programming.

Writing a Crappy SQL Database from Scratch

Surprisingly, I’ve never had to write much SQL (i.e. any) in any of my previous jobs or current job before. So I thought it would be fun to get my hands dirty and try implementing a subset of SQL with an in-memory backend. It mostly follows from this blog post. But, I also wasn’t super interested in writing my own SQL parser, so I decided to use a fork of Vitess’ sqlparser library....

November 10, 2024 · 1244 words · agao

Taming Randomness With Hello World

Note: This post was updated on 2024/11/17 to include support for mutexes. There is a lot of nondeterminism (or randomness) in modern software, from the obvious like random number generation to the less obvious like syscalls, scheduling and network latency. This makes debugging and troubleshooting very troublesome especially in distributed systems where multiple machines and networks are involved. However, if we could somehow control this randomness, then this would allow us to reproduce issues at will, no matter how rare or difficult....

July 5, 2024 · 1871 words · agao

Writing a Key-Value Store From Scratch

A few months ago I was inspired by this post on how RocksDB works, and decided that it would be a fun exercise to implement a database myself. This post is more of a documentation of how I built my own key-value store, but I still hope to give an overview of how they work, and provide enough details for someone to implement one themselves. The database and code snippets are written in Go, and the source code can be found here....

August 23, 2023 · 2653 words · agao