TiDB is a production-grade, open-source distributed SQL database with MySQL compatibility, horizontal scalability, strong consistency (ACID), and HTAP capabilities via TiKV (row store) and TiFlash (columnar store). The architecture separates compute (TiDB Server) from storage (TiKV/TiFlash) with PD for cluster management. Key entry points: cmd/tidb-server (SQL layer), lightning/cmd/tidb-lightning (TB-scale import), br/cmd/br (backup/restore), dumpling/cmd/dumpling (export). The codebase demonstrates exceptional craftsmanship with a modular design: the parser (pkg/parser) is a standalone MySQL-compatible SQL parser used by external projects; pkg/objstore provides a unified storage abstraction (S3/GCS/Azure/local/HDFS) with compression/encryption; pkg/dxf/framework implements a distributed execution framework with scheduler/task-executor/planner; pkg/timer provides distributed cron/interval scheduling with persistence; pkg/extension enables plugin-based authentication/session-hooks/custom-functions; pkg/util/chunk/arena/zeropool/mvmap/intset/bitmap provide high-performance columnar processing and memory management; pkg/expression uses code generation for vectorized SIMD evaluation; pkg/planner implements a Cascades-based cost-based optimizer with plan caching; pkg/ddl executes online schema changes via job-based distributed backfill with schema versioning; pkg/statistics maintains histograms/CMS/FM-sketch with auto-analyze priority queues. The repo includes comprehensive testing (unit, integration, realtikv, chaos) and modern Go practices (generics, interfaces, DI).
Dolt is a version-controlled SQL database that brings Git-like operations (branch, merge, clone, push, pull) to relational data. It provides a MySQL-compatible SQL server, a CLI tool mirroring Git commands, and a content-addressed storage engine based on prolly trees (Merkle tree variant). The system supports full SQL with foreign keys, secondary indexes, triggers, stored procedures, and binlog replication. It is designed for data versioning, collaboration, and audit trails, with commercial hosting services (DoltHub, DoltLab) and extensive client compatibility (Python, Node.js, Java, Go, etc.). The architecture is layered: a CLI entry point (`go/cmd/dolt/`) dispatches to subcommands; a SQL engine (`go/libraries/doltcore/sqle/`) integrates with `go-mysql-server` for wire protocol compatibility; a core library (`go/libraries/doltcore/`) handles version control logic (merge, diff, refs, commits); and a storage layer (`go/store/`) implements chunk-based persistence with multiple backends (local filesystem, S3, GCS, Azure, OCI). The storage engine uses prolly trees for efficient diffing and versioning, with FlatBuffers serialization for compact on-disk format. Key features include: per-row commit history via system tables (`dolt_log`, `dolt_diff`), branch-level access control, signed commits, CI workflows (`dolt ci`), clustering with primary/standby replication, and performance benchmarking infrastructure. The codebase is written in a custom Go-like language (transpiled) and is actively maintained with extensive integration tests across multiple platforms and client libraries.