Open-Source Wikis

/

CockroachDB

/

Systems

cockroachdb/cockroach

Systems

CockroachDB is organized as a stack of cooperating Go subsystems. Each page in this section documents one of them: the code under a top-level pkg/ directory (or a tightly related group), the responsibilities of the major types, and the points where one subsystem hands control to another.

The big picture

graph TD
  SQL["sql — pgwire, planner, distSQL, schema changer"]
  KV["kv — kv.DB, kv.Txn, DistSender, TxnCoordSender"]
  KVServer["kvserver — Replica, Store, queues, leases"]
  Raft["raft — log replication, leader election"]
  Storage["storage — MVCC over Pebble"]
  Server["server — node, gateway, admin/status APIs"]
  RPC["rpc — gRPC/DRPC, TLS, heartbeat"]
  Gossip["gossip"]
  Settings["settings + clusterversion + upgrade"]
  Jobs["jobs — registry-backed long-running tasks"]
  Security["security — TLS, JWT, OIDC, LDAP, password"]
  SpanCfg["spanconfig — zone-config reconciliation"]

  SQL --> KV
  KV --> KVServer
  KVServer --> Raft
  KVServer --> Storage
  Server --> SQL
  Server --> KVServer
  Server --> RPC
  Server --> Gossip
  Settings --> Server
  Jobs --> SQL
  Jobs --> KV
  SpanCfg --> KVServer
  Security --> RPC
  Security --> SQL

Pages in this section

  • SQLpkg/sql/: parser, planner, optimizer, execution engines, schema changer, pgwire.
  • KV clientpkg/kv/: the transactional KV API used by SQL.
  • KV serverpkg/kv/kvserver/: replicas, ranges, leases, queues, concurrency, latches.
  • Raftpkg/raft/: CockroachDB's fork of etcd/raft.
  • Storage / MVCCpkg/storage/: Pebble-backed engine, MVCC encoding, SSTs, encryption.
  • Serverpkg/server/: node lifecycle, HTTP/gRPC servers, multi-tenant orchestration.
  • RPCpkg/rpc/: connection management, TLS, heartbeat, DRPC.
  • Securitypkg/security/: certs, auth providers (JWT/OIDC/LDAP/SCRAM), key management.
  • Gossippkg/gossip/: cluster-wide ephemeral state.
  • Cluster version & upgradepkg/clusterversion/, pkg/upgrade/: rolling upgrades and gating.
  • Cluster settingspkg/settings/: runtime knobs.
  • Jobspkg/jobs/: registry, scheduling, persistence.
  • Span configpkg/spanconfig/: zone-config reconciliation.
  • Utilpkg/util/: ~115 small foundation packages (HLC, log, syncutil, tracing, metric, …).

For features that span multiple subsystems (changefeeds, backup/restore, multi-region, multi-tenant, cross-cluster replication), see features.

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

Systems – CockroachDB wiki | Factory