foundationdb
AGENTS.md17k starsChanged 6 months agoApache-2.0View on GitHub
Key cmake options: - -DCMAKE_BUILD_TYPE=Debug (default Release) - -DUSE_WERROR=ON for development - -DOPEN_FOR_IDE=ON to generate IDE project without building macOS: add -DBUILD_SWIFT_BINDING=OFF if Swift issues arise. Linux with Clang: CC=clang CXX=clang++ cmake -DUSE_LD=LLD -DUSE_LIBCXX=1 -G Ninja .. Unit tests use TEST_CASE("/path/to/test") macros (defined in flow/include/flow/UnitTest.h). Prefer the narrowest dedicated unit-test target instead of fdbserver -r unittests; these targets compile and run faster. Use fdbclient_test for client tests or the relevant fdbserver_<library>_test target defined via add_fdbserver_unit_test (for example, fdbserver_core_test, fdbserver_kvstore_test, or…
- Installs packages
Trending
Less talk lately.about the whole repository
Who's talking about apple/foundationdb
- A Hacker News story“Flow: Actor-based language for C++, used by FoundationDB”Hacker News · Dec 8, 2025 · 189 points
- pingcap/tidb“Use FoundationDB as an alternative of TiKV for TiDB”GitHub · Aug 11, 2020 · 23 reactions
- deepseek-ai/3FS“[Build Guide] build 3FS with docker”GitHub · Mar 4, 2025 · 12 reactions
- jaytaylor/sql-layer“relationship to the open source FoundationDB repo?”GitHub · Apr 26, 2018 · 4 reactions
- golang/go“runtime/trace: crash during traceAdvance when collecting call stack for cgo-calling goroutine”GitHub · Aug 27, 2024 · 3 reactions
The biggest 5 of 55 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 55
Talked about on GitHub, Hacker News and Bluesky (55 times).
On GitHub · 50
- Aug 11, 2020Use FoundationDB as an alternative of TiKV for TiDB — pingcap/tidb23 reactions · 2 comments
- Mar 4, 2025[Build Guide] build 3FS with docker — deepseek-ai/3FS12 reactions · 21 comments
- Apr 26, 2018relationship to the open source FoundationDB repo? — jaytaylor/sql-layer4 reactions
- Aug 27, 2024runtime/trace: crash during traceAdvance when collecting call stack for cgo-calling goroutine — golang/go3 reactions · 10 comments
- Apr 23, 2018Higher-layer API: Directory — Clikengo/foundationdb-rs3 reactions · 9 comments
45 more on GitHub
- Nov 8, 2021Build failed for macOS arm64 when linking foundationdb — pingcap/go-ycsb2 reactions · 1 comment
- Feb 23, 2024Fix race condition in FDB go bindings — FoundationDB/fdb-kubernetes-operator1 reaction · 1 comment
- Oct 21, 2023x/tools/gopls: 'Check for upgrades' codelens argument can be lazily computed — golang/go1 reaction · 1 comment
- Oct 28, 2021Using DNS names in cluster files — FoundationDB/fdb-kubernetes-operator1 reaction · 1 comment
- Nov 30, 2018Create official Docker image on Docker Hub — FoundationDB/fdb-document-layer1 reaction · 15 comments
- Jul 11, 2018FoundationDB physical backend — hashicorp/vault1 reaction · 9 comments
- May 2, 2018add Subspace, #36 — Clikengo/foundationdb-rs1 reaction · 3 comments
- Oct 29, 2026[catalog-candidate] foundationdb-open-source-self-hosted — ePlus-DEV/free-tier-hub0 reactions · 3 comments
- Oct 29, 2026Configure Renovate — bluesky-social/kvdb0 reactions
- Oct 19, 2026fix(python): complete KV scans and expose resumable pages (#670) — alopex-db/alopex0 reactions
- Oct 1, 2026Support port blocks, so many pods can share an IP — ArniDagur/fdb-kubernetes-operator0 reactions
- Oct 1, 2026Host networking with per-pod port blocks, and keep previous coordinators reachable — ArniDagur/fdb-kubernetes-operator0 reactions · 1 comment
- Sep 26, 2026rockylinux9: specify --disable-icu for boost 1.89 build — FoundationDB/fdb-build-support0 reactions · 7 comments
- Sep 20, 2026Avoid native CDC buffer-reservation deadlocks — tclinkenbeard-oai/foundationdb0 reactions
- Sep 20, 2026Preserve committed CDC progress from quiet log replicas — tclinkenbeard-oai/foundationdb0 reactions
- Sep 16, 2026rgw/kvrgw: — ceph/ceph0 reactions
- Sep 9, 2026Watch replacement ratekeeper immediately and verify health metrics — tclinkenbeard-oai/foundationdb0 reactions
- Sep 5, 2026[foundationdb] Increase 7.1 stale release threshold to 2 years — endoflife-date/endoflife.date0 reactions
- Sep 1, 2026[P4][store] real build-tagged (//go:build fdb) FoundationDB adapter — msivraj/swarm0 reactions
- Aug 27, 2026FoundationDBBackup percent-encodes custom header separator into an invalid blobstore URL — FoundationDB/fdb-kubernetes-operator0 reactions
- Aug 24, 2026chore(deps): bump the gradle-minor-and-patch group with 3 updates — factstore-io/factstore0 reactions · 3 comments
- Aug 21, 2026Remove incompatible 7.4 version from Joshua — FoundationDB/fdb-joshua0 reactions
- Aug 20, 2026Bump the minor-java-dependencies group across 4 directories with 9 updates — signalapp/Signal-Server0 reactions · 1 comment
- Aug 17, 2026chore(deps): bump the gradle-minor-and-patch group across 1 directory with 8 updates — factstore-io/factstore0 reactions
- Aug 17, 2026update sphinx to 6.2.1 (and related requirements) in rockylinux9 — FoundationDB/fdb-build-support0 reactions · 4 comments
- Aug 10, 2026chore(deps): bump the gradle-minor-and-patch group across 1 directory with 5 updates — factstore-io/factstore0 reactions · 1 comment
- Aug 8, 2026storage/foundationdb: restore the FoundationDB physical storage backend — sigilr/openbao0 reactions
- Aug 3, 2026chore(deps): bump org.foundationdb:fdb-java from 7.3.67 to 7.4.6 in the gradle-minor-and-patch group — factstore-io/factstore0 reactions · 1 comment
- Aug 2, 2026chore(deps): bump org.foundationdb:fdb-java from 7.3.67 to 7.4.6 in the gradle-minor-and-patch group — factstore-io/factstore0 reactions · 2 comments
- Jul 27, 2026Bump org.foundationdb:fdb-java from 7.3.63 to 7.4.6 — making/redis-adapter-for-spring-session0 reactions · 1 comment
- Jul 26, 2026deps: bump org.foundationdb:fdb-java from 7.3.43 to 7.4.6 — CajunSystems/gumbo0 reactions
- Jul 22, 2026Support handling partial statuses from the database — FoundationDB/fdb-kubernetes-operator0 reactions · 1 comment
- Jul 21, 2026Update stacked: 2 packages — gominimal/pkgs0 reactions
- Jul 8, 2026Add support for backup related changes in 7.4.7 and newer — FoundationDB/fdb-kubernetes-operator0 reactions · 1 comment
- Jul 7, 2026Fix restore for newer FDB clusters — FoundationDB/fdb-kubernetes-operator0 reactions · 4 comments
- Jun 24, 2026feat(adapters): add foundationdb DCB layer — pyeventsourcing/event-store-benchmark0 reactions · 1 comment
- Jun 23, 2026build boost with NO_BZIP2 NO_LZMA NO_ZSTD and limited boost modules — FoundationDB/fdb-build-support0 reactions · 3 comments
- Jun 11, 2026rockylinux9: update toml11 to v3.8.1 — FoundationDB/fdb-build-support0 reactions · 4 comments
- Dec 18, 2025Support custom type codes in tuple layer (0x40-0x4f) — foundationdb-rs/foundationdb-rs0 reactions · 1 comment
- Oct 25, 2025Update github.com/apple/foundationdb/bindings/go digest to b1fbbd8 — awfixer-platform/awborg0 reactions · 1 comment
- Sep 2, 2025foundationDb | — MateuszNaKodach/SelfImprovement0 reactions
- Jun 19, 2025Compilation on Debian is not working — cybergarage/puzzledb-go0 reactions · 9 comments
- Mar 12, 2025Build Docker hf3fs-dev image failed — deepseek-ai/3FS0 reactions · 6 comments
- Mar 5, 2025Investigate support for running FDB on systems with 2GB memory — foundationdb-beam/ex_fdbmonitor0 reactions · 3 comments
- Jun 24, 2024"Out of the box" working example (docker) — foundationdb-rs/foundationdb-rs0 reactions · 1 comment
On Hacker News · 4
- Dec 8, 2025Flow: Actor-based language for C++, used by FoundationDB189 points · 53 comments
- Sep 30, 2024FoundationDB – open-source, distributed, transactional key-value store2 points
- Jan 19, 2023FoundationDB Design Internals2 points
- May 25, 2023Apple/FoundationDB: FoundationDB1 point
On Bluesky · 1
- Aug 17, 2025Hehe, I was about to make a joke about this DB being on #AppleTV , but actually #Foundation is indeed a DB project from Apple:… — @jokeyrhy.me1 likes and repost
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.
Of the AGENTS.md files we read, the 11,773 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repositoryOne other file it gives its agents.
- .github/copilot-instructions.mdCopilot instructions
The file
We split this AGENTS.md into the rules it gives an agent
6 rules. About 0 are common, 1 is distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 35
Use fdbserver for simulation or broader end-to-end validation, not as the default unit-test runner.
- Very specific: line 37
Simulation tests: use TOML workload definitions in tests/fast/, tests/slow/, etc.:
- Very specific: line 105
When the transaction system fails, the Cluster Controller drives nine recovery phases (READING_CSTATE through FULLY_RECOVERED.
- Very specific: line 121
Before changing a serialized type that persists on disk, inspect its serializer() and adjacent versioning or downgrade comments.
- Very specific: line 150
Do not write comments about mundane day-to-day development refactorings — junk like // This used to be part of xyzFunc in Foo.cpp but we …
- Distinctive: line 165
Should it be LGTM'd? (clear yes / no / not-yet)
≈ “Common” is an estimate: at least 1 in 5 of the 16,595 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
AGENTS.md
This file provides guidance to AI coding agents working in this repository.
Build
mkdir build && cd build
cmake -G Ninja <SOURCE_DIR>
ninja
# or: ninja fdbserver fdbcli fdbclient (specific targets)Key cmake options:
-DCMAKE_BUILD_TYPE=Debug(default Release)-DUSE_WERROR=ONfor development-DOPEN_FOR_IDE=ONto generate IDE project without building
macOS: add -DBUILD_SWIFT_BINDING=OFF if Swift issues arise.
Linux with Clang: CC=clang CXX=clang++ cmake -DUSE_LD=LLD -DUSE_LIBCXX=1 -G Ninja ..
Testing
Unit tests use TEST_CASE("/path/to/test") macros (defined in flow/include/flow/UnitTest.h). Prefer the narrowest dedicated unit-test target instead of fdbserver -r unittests; these targets compile and run faster. Use fdbclient_test for client tests or the relevant fdbserver_<library>_test target defined via add_fdbserver_unit_test (for example, fdbserver_core_test, fdbserver_kvstore_test, or fdbserver_storageserver_test). Find the applicable target in the affected component's CMakeLists.txt:
ninja fdbclient_test
bin/fdbclient_test # all tests in the target
bin/fdbclient_test -f "<test-prefix>" # tests matching a prefix
ninja fdbserver_core_test
bin/fdbserver_core_testUse fdbserver for simulation or broader end-to-end validation, not as the default unit-test runner.
Simulation tests use TOML workload definitions in tests/fast/, tests/slow/, etc.:
bin/fdbserver -r simulation -f tests/fast/CycleTest.tomlVia ctest:
ctest -L fast # all fast tests
ctest -R "StatusDuringOutage" # by name patternEnable simulation tests in cmake: -DENABLE_SIMULATION_TESTS=ON
Adding new tests:
- For a new otherwise-unreferenced translation unit containing
TEST_CASE, add aforceLinkXxxTests()stub and call it fromfdbserver/workloads/UnitTests.cpp, or the linker can drop the tests. - Register new
.tomlor.txttests undertests/intests/CMakeLists.txtviaadd_fdb_test.configure_testing(... ERROR_ON_ADDITIONAL_FILES)andverify_testing()should catch unregistered files during CMake configuration.
Joshua: bulk correctness/simulation testing runs on the internal Joshua cluster against optimized Release builds. Local fdbserver -r simulation runs are for iteration; large-scale shake-out happens on Joshua.
Trace logs: simulation and test runs emit trace.*.xml (or .json) files in the run directory. TraceEvent(...) is the canonical logging mechanism — search trace files by event name when debugging a simulation failure.
- A
SevError(Severity 40)TraceEventfails a simulation/Joshua run. UseSevWarnAlwaysfor "shouldn't happen but non-fatal." Errors carrying an injected fault are auto-downgraded; genuineSevErrors are not. Expected errors must be suppressed/allowlisted, never emitted atSevError. - Keep a
TraceEventsmall: any singledetail()value over 495 bytes is truncated (...), and an event whose fields total over 4000 bytes is dropped entirely and re-logged asTraceEventOverflow— atSevErrorin simulation, so an oversized event fails the test. Chunk long payloads (joined lists, command lines, serialized blobs) across multiple events.
Architecture
FoundationDB is a distributed ordered key-value store with strict serializability. The codebase is organized into ~12 subsystems. For background on subsystems before diving into code, the design/ directory holds human-authored design docs and design/AI-generated/ holds subsystem maps and per-subsystem diagrams (start with design/AI-generated/foundationdb_subsystem_map.md).
Concurrency Model: C++ Coroutines
FDB uses cooperative single-threaded concurrency. Asynchronous functions use
standard C++ coroutines with co_await and co_return in ordinary .cpp and
.h files. See design/coroutines.md for coroutine and cancellation semantics.
Key types: Future<T>, Promise<T>, PromiseStream<T>, Reference<T> (ref-counted pointer), Optional<T>, ErrorOr<T>, Arena (region-based allocation).
Common pitfalls
- C++ coroutines:
co_awaitis not allowed inside acatchhandler. Capture the error, exit the catch, thenco_awaitoutside. - Errors are integer codes (
flow/include/flow/error_definitions.h), not exceptions with messages. When youcatch (Error& e), re-throwactor_cancelled(and never silently swallowbroken_promise) — eating cancellation causes hangs and leaks. Transaction retry goes throughtr.onError(e), not a bare loop. StringRef/KeyRef/ValueRefare non-owning views into anArena. Returning or storing one past its arena's lifetime is a dangling-reference bug; useStandalone<>(orKey/Value) when you need to own the bytes.
Core Subsystems
flow/— Async runtime, event loop, tracing, deterministic random, arenasfdbrpc/— Endpoint-addressed RPC, peer management, failure monitor, Sim2 (deterministic simulation network)fdbclient/— Transaction API (NativeAPI.cpp), read-your-writes (ReadYourWrites.cpp), location cache, multi-version clientfdbserver/— All server roles, organized by subdirectory:clustercontroller/— Leader election, role recruitment, ServerDBInfo broadcastingcoordinator/— Paxos-based coordination state (generation registers)commitproxy/,grvproxy/,resolver/— Transaction commit pipelinetlog/,logsystem/— Durable mutation log (tag-partitioned)storageserver/— Serves reads, applies mutations from TLogskvstore/— Pluggable storage engines (RocksDB, SQLite, memory/DiskQueue)datadistributor/— Shard management, team building, data movementratekeeper/— Back-pressure and throttlingworkloads/— Simulation test workloads
Write Path
Client commit → GRV Proxy (assigns read version) → Commit Proxy (batches, sends to Resolver for conflict check, writes to TLogs) → TLogs (durable WAL) → Storage Servers (pull from TLogs, apply)
Read Path
Client read → Storage Server (serves from MVCC versioned data or underlying storage engine)
Recovery
When the transaction system fails, the Cluster Controller drives nine recovery phases (READING_CSTATE through FULLY_RECOVERED; UNINITIALIZED is state 0) defined in fdbserver/core/include/fdbserver/core/RecoveryState.h. Recovery reads coordinated state from coordinators, locks old TLogs, recruits the next transaction system, and recovers durable mutations from old log generations.
Coordinator Consensus
Coordinators implement generation registers in fdbserver/coordinator/Coordination.cpp. CoordinatedState in fdbserver/core/CoordinatedState.cpp performs quorum reads and writes over them for recovery metadata. Coordinators separately participate in leader election, but transaction commits use the resolver/TLog pipeline instead.
Simulation Testing
fdbserver -r simulation runs the entire cluster in a single process using Sim2, a deterministic simulated network. BUGGIFY macros inject faults (delays, failures, corruption). Tests are TOML files that compose workloads. This is FDB's primary testing strategy.
Knobs
Runtime-tunable parameters are declared in fdbserver/core/include/fdbserver/core/Knobs.h, fdbclient/include/fdbclient/Knobs.h, and flow/include/flow/Knobs.h (UPPER_CASE names). Access them via SERVER_KNOBS, CLIENT_KNOBS, or FLOW_KNOBS. Defaults and buggification ranges live in fdbserver/core/ServerKnobs.cpp, fdbclient/ClientKnobs.cpp, and flow/Knobs.cpp.
Compatibility
Before changing a serialized type that persists on disk, inspect its serializer() and adjacent versioning or downgrade comments. Do not reorder, remove, or change encoded fields without the appropriate version gate or migration and compatibility coverage.
Naming Conventions
- Variables, functions, methods: camelCase (
smoothTotal,getWorkerForRole) - Classes, structs, enums: PascalCase (
StorageServer,RecoveryState) - Knobs/constants: UPPER_CASE (
MAX_BATCH_SIZE,VERSIONS_PER_SECOND) - Globals:
g_prefix for important ones (g_network,g_simulator)
Code Formatting
clang-format is used. Python code uses black and flake8 (pre-commit hooks: pip install pre-commit && pre-commit install).
Edit tracked .cpp and .h sources, not generated output under the build directory.
Source File Headers
Every new .cpp / .h file starts with the standard Apache 2.0 license block, with the filename on line 2 and the current year on the copyright line. Copy from any existing file in the tree (e.g. flow/Knobs.cpp). Add file-purpose comments after the license block, not in place of it.
Code Comments
General guidance: comments should maximize clarity. They should be clear without being verbose. They should be concise without being cryptic.
Scope: the guidance here mainly governs inline and implementation comments. Comments on public-facing APIs are contract statements and must be clear, precise, and complete.
Audience: assume the readers of FDB are senior engineers fluent in asynchronous and concurrent programming, distributed systems, and stateful complex systems generally. Calibrate "non-obvious" to that reader — do not explain the language, the standard library, Flow/actor idioms, or established patterns they already know. Reserve comments for what such a reader could not quickly infer from the code itself.
Implementation comments should focus on important, non-obvious fundamental rationale, motivation, and explanation of extremely subtle phenomena. Writing down important invariants — and the preconditions a piece of code requires of its caller (e.g. a lock that must be held, or a version that must already be durable) — is also a good idea.
Do not write comments about mundane day-to-day development refactorings — junk like // This used to be part of xyzFunc in Foo.cpp but we moved it here so that aaaFunc could also call it.
Do not write caller-location / "happening elsewhere" comments — narration of who invokes this code or where it is used ("called from X", "used by Y"). They duplicate what a search answers instantly and rot when callers change; describe what the code requires and guarantees on its own terms. Stating a real invariant is fine — "recovery is the only path that repairs" — naming the callers that happen to exist today is not.
After writing or changing a bunch of code, make a pass over it one last time to review the comments. Ask yourself: am I rambling? Am I repeating what the code is showing? Am I just telling stories here? Is the information I'm writing going to be relevant and important a week from now, a month from now, a year from now? Is it genuinely essential and non-obvious from the code itself?
Code Review
Unless you have specific instructions to the contrary, when asked to review code (named files or a diff), address all of these explicitly:
- What is it trying to accomplish?
- Is it correct?
- Are there bugs?
- Are there omissions?
- Are there things that could be done better?
- Should it be LGTM'd? (clear yes / no / not-yet)
Branching
PRs target main. Release branches receive cherry-picks rather than direct PRs — don't open backport PRs without confirming first.
Design Docs
When collaborating on a design doc, at some point reconcile the user's draft against design/design-doc-template.md — the template defines the section structure (motivation, design, alternatives, etc.) expected for FDB design docs. Suggest this reconciliation step before the doc is considered finished, not at the very start, so the draft has time to take shape first.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

