pingcap/tidb
Dependencies
TiDB is built on Go (currently go 1.25.9 per go.mod) plus a substantial set of third-party libraries. This page lists the most architecturally significant ones; the full list is in go.mod (~376 lines).
TiDB-family ("PingCAP/TiKV") dependencies
These are the closest neighbours — companion projects whose evolution moves in lockstep with TiDB:
| Module | Purpose |
|---|---|
github.com/tikv/client-go/v2 |
Go client for TiKV: 2PC, region cache, txn modes, snapshot reads. The single most important external dependency for the storage path. |
github.com/tikv/pd/client |
PD client: TSO, region routing, cluster membership. |
github.com/pingcap/kvproto |
gRPC protobuf definitions shared with TiKV/PD/TiFlash. |
github.com/pingcap/tipb |
Protobuf for the coprocessor and DAG protocol. |
github.com/pingcap/errors |
Errors with stack and context. Used everywhere. |
github.com/pingcap/failpoint |
Compile-time failpoints. Test-only in production builds. |
github.com/pingcap/log |
Wrapped Zap with project conventions. |
github.com/pingcap/sysutil |
System-info helpers. |
github.com/pingcap/badger |
Embedded BadgerDB used by unistore. |
github.com/pingcap/fn |
Light functional helpers. |
github.com/pingcap/metering_sdk |
Cloud metering SDK (used by some BR/Lightning paths). |
pkg/parser is a separate Go module inside this repo (pkg/parser/go.mod). The top-level go.mod includes it as a replace directive.
Cloud SDKs
TiDB integrates directly with cloud storage for backups, log backups, and Lightning imports:
- AWS:
aws-sdk-go-v2/...(config, credentials, kms, s3, sts, ec2, cloudwatch, …). - Azure:
Azure/azure-sdk-for-go/sdk/azcore,azidentity,azblob. - GCP:
cloud.google.com/go/kms,cloud.google.com/go/storage. - Aliyun OSS:
aliyun/alibaba-cloud-sdk-go,aliyun/alibabacloud-oss-go-sdk-v2,aliyun/credentials-go,alibabacloud-go/tea.
Encryption is centralised in br/pkg/encryption/ with KMS bridges to AWS/Azure/GCP.
Storage and cache
github.com/cockroachdb/pebble— in-process LSM-style storage used by some test fixtures.github.com/coocood/freecache— high-performance cache (statement cache, etc.).github.com/dgraph-io/ristretto— concurrent LRU cache.github.com/jellydator/ttlcache/v3— TTL caches.github.com/google/btree— in-memory btree.
SQL / parser tooling
github.com/YangKeao/go-mysql-driver— MySQL client driver fork used in tests and for some internal connections (Dumpling, BR glue).github.com/go-sql-driver/mysql— upstream Go MySQL driver (for tooling and tests).gorm.io/gorm,gorm.io/driver/mysql— used by some tools and a few tests.
Observability
github.com/prometheus/client_golang— exporter library.github.com/prometheus/client_model,prometheus/common— protobuf and helpers.github.com/grafana/pyroscope-go— continuous profiling integration (opt-in).github.com/uber/jaeger-client-go,github.com/opentracing/...— distributed tracing.go.opencensus.io— legacy stats collection.
Cluster coordination
go.etcd.io/etcd/...— etcd v3 client (used for DDL owner election, schema versioning, sysvar propagation).github.com/soheilhy/cmux— connection multiplexer for the server.
CLI / app tooling
github.com/spf13/cobra,spf13/pflag— CLI framework fortidb-server, BR, Lightning, Dumpling.github.com/spf13/afero— virtual file system abstraction.github.com/cheggaaa/pb/v3,github.com/vbauerster/mpb/v7— progress bars.github.com/jedib0t/go-pretty/v6— table renderer.github.com/cheynewallace/tabby— tabular output.github.com/fatih/color— colored output.
Crypto / auth
github.com/lestrrat-go/jwx/v2— JWT.github.com/go-ldap/ldap/v3— LDAP auth.golang.org/x/oauth2— OAuth flows.
Lint / dev tooling (build-time)
github.com/golangci/golangci-lint/v2— main linter.github.com/mgechev/revive— repo-defined linter (configured intools/check/revive.toml).github.com/bazelbuild/buildtools,bazelbuild/rules_go— Bazel toolchain.honnef.co/go/tools— staticcheck.github.com/timakin/bodyclose,gostaticanalysis/forcetypeassert,nishanths/predeclared,kisielk/errcheck, … — assorted Go analysers.
Notable other dependencies
github.com/apache/arrow-go/v18— Apache Arrow integration (TiFlash interop, parquet support).github.com/apache/skywalking-eyes— license header checker.github.com/bits-and-blooms/bitset— bitsets used in the planner and statistics.github.com/twmb/murmur3— hash function used widely.github.com/dgryski/go-farm— FarmHash for stable hashing.github.com/openai/openai-go— OpenAI client (used bytests/llmtest/).github.com/cloudfoundry/gosigar— system resource info (CPU, memory, disk).github.com/sasha-s/go-deadlock— sync.Mutex deadlock detector enabled by-tags=deadlock.
The complete list lives in go.mod. Updating any pingcap/tikv-family dependency typically requires make bazel_prepare afterwards because Bazel BUILD files reference the module versions.
Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.