Open-Source Wikis

/

CockroachDB

/

Fun facts

cockroachdb/cockroach

Fun facts

A short collection of trivia gleaned from the source tree.

The cockroach name

CockroachDB is named after the actual insect: hardy, hard to kill, survives near-extinction events. The very first commit (2014-02-05) was already using the name. The mascot is plastered all over docs/media/. The default port (26257) is 0x6691 — a number frequently quoted by old-timers as a pun (the project's first prototype reportedly used 6669, but production ports prefer to avoid a triplet that triggers some ISP filters).

Oldest surviving code

  • pkg/util/hlc/hlc.go — the Hybrid Logical Clock has been a CockroachDB primitive for over a decade. The package documentation and core API are still recognizable from 2014.
  • pkg/storage/doc.go carries a 2014 copyright header and still accurately describes the MVCC encoding the engine uses today, even though the engine moved from RocksDB to Pebble underneath.
  • pkg/gossip/ — a gossip network was wired in within months of the first commit and is essentially unchanged in shape.

The longest files

A few files have grown beyond what most engineers would call comfortable:

  • pkg/storage/mvcc.go is around 340 KB. It owns the read and write paths of CockroachDB's MVCC layer.
  • pkg/kv/kvserver/replica_test.go is around 520 KB of test code — believed to be the largest test file in the repo.
  • pkg/sql/vars.go is around 210 KB and registers every session variable.
  • pkg/server/status.go is around 155 KB and implements the long-lived /status/ HTTP API.

Generated content

DEPS.bzl is 597 KB of vendored dependency declarations — larger than most actual source files. It is regenerated by ./dev generate bazel and includes every transitive Go dependency, with sha256 sums.

pkg/sql/txnstatetransitions_diagram.png is a 971 KB PNG that visualizes the SQL transaction state machine. The matching .gv source is checked in next to it. Few modern repos still ship a million-byte PNG of a state diagram.

A custom formatter

CockroachDB does not use gofmt exclusively. The repo ships its own crlfmt tool (under pkg/cmd/) that enforces 100-column code, 80-column comments, and CRDB-specific wrapping of long function signatures. Before sending a PR, contributors are expected to run crlfmt -w -tab 2 file.go.

A custom YACC grammar lives in tree

pkg/sql/parser/sql.y is the SQL grammar, fed through goyacc to produce a Go parser. It is the largest hand-maintained grammar in the project; the generated parser is one of the few generated artifacts that occasionally appears in commits because of conflict-resolution churn.

An internal Raft fork

pkg/raft/ started life as etcd/raft. CockroachDB has now diverged enough that the fork ships its own README, license, and design notes (pkg/raft/design.md). Highlights include a term cache (pkg/raft/term_cache.go), store-liveness integration (pkg/raft/raftstoreliveness/), and learner-replica support that predates etcd's.

A binary count that exceeds expectations

pkg/cmd/ contains around 70 separate command directories, including roachprod, roachtest, dev, workload, release, roachvet, cmp-protocol, cmp-sql, microbench-ci, tef, whoownsit, and urlcheck. Most of these are internal tools — many companies would publish them as separate repos. CockroachDB keeps them in-monorepo so they version-lock with the database.

The TEAMS.yaml roster

TEAMS.yaml lists the teams referenced from .github/CODEOWNERS. It includes 30+ teams covering everything from kv-prs to disaster-recovery to obs-india-prs to sqlproxy-prs. The CODEOWNERS file is over 600 lines long and uses #!-prefixed entries to opt out of automatic GitHub review while keeping internal tooling routing.

Author count that still grows

The git log author list has 1,047 unique names — a long tail that reflects external contributors as well as internal engineers. The EXTERNAL-CONTRIBUTORS-HALL-OF-FAME.md file (~36 KB) is a curated thank-you list, kept manually.

Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.

Fun facts – CockroachDB wiki | Factory