Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
b624489
perf: reduce coroutine overhead on storage-server paths
tclinkenbeard-oai Jul 14, 2026
a82b102
Bound degraded-team relocation retries across pipeline transitions
tclinkenbeard-oai Aug 10, 2026
c9e3c1d
Convert LoadBalance.actor.h to standard coroutines
tclinkenbeard-oai Aug 12, 2026
6b284c0
Fix load-balancing header clang-tidy failures
tclinkenbeard-oai Aug 12, 2026
241ad54
Release completed load-balancing request resources
tclinkenbeard-oai Aug 12, 2026
d0e1799
Merge origin/main to refresh CI
tclinkenbeard-oai Aug 18, 2026
37e5a6a
Merge origin/main into PR #13838
tclinkenbeard-oai Aug 18, 2026
c17d77a
Merge origin/main into LoadBalance coroutine conversion
tclinkenbeard-oai Aug 19, 2026
8308211
Fix datacenter-aware wording in load-balancing design doc
tclinkenbeard-oai Aug 20, 2026
f57e2b9
Index native CDC tag owners by representative stream
tclinkenbeard-oai Aug 21, 2026
24a0586
Merge main into storage coroutine optimizations
tclinkenbeard-oai Aug 21, 2026
c695f86
Fix GET span lifetime and PR validation diagnostics
tclinkenbeard-oai Aug 21, 2026
6355a78
Preserve sampled GET span queueing time
tclinkenbeard-oai Aug 21, 2026
edca362
Merge origin/main into dev/tclinkenbeard/native-cdc-tag-ownership
tclinkenbeard-oai Aug 22, 2026
2a9865a
Merge origin/main into dev/tclinkenbeard/native-cdc-tag-ownership
tclinkenbeard-oai Aug 24, 2026
b538567
Prevent removing range-lock owners with active locks
tclinkenbeard-oai Aug 25, 2026
aaf915b
Convert NativeAPI actors to standard C++ coroutines
tclinkenbeard-oai Aug 25, 2026
70c54c8
Fix NativeAPI clang-tidy diagnostics
tclinkenbeard-oai Aug 25, 2026
2fa0148
Fix native CDC tag-owner guard coroutine lowering
tclinkenbeard-oai Aug 25, 2026
eb3c296
Merge main into storage coroutine optimizations
tclinkenbeard-oai Aug 25, 2026
9c7441a
Check shared CDC tag ownership against current assignments
tclinkenbeard-oai Aug 26, 2026
603da02
Reuse GRV proxy load balancing in NativeAPI
tclinkenbeard-oai Aug 26, 2026
711ad28
Remove GRV helper tests from NativeAPI
tclinkenbeard-oai Aug 26, 2026
f002560
BulkDump: keep the read failure that a bulkdump retry is hiding (#13944)
saintstack Aug 26, 2026
a49f4de
Simplify Reference declarations and pager initialization awaits
tclinkenbeard-oai Aug 26, 2026
6fa9de8
test: tighten storage optimization regression coverage
tclinkenbeard-oai Aug 26, 2026
40cd46c
Backup: time bulkdump and bulkload jobs out on absence of progress (#…
saintstack Aug 26, 2026
418c93d
fix: preserve unexpected exception reporting in detached operations
tclinkenbeard-oai Aug 26, 2026
1dac555
Merge pull request #13942 from tclinkenbeard-oai/dev/tclinkenbeard/ra…
tclinkenbeard-oai Aug 26, 2026
c059756
Merge origin/main into PR #13838
tclinkenbeard-oai Aug 27, 2026
e11c7a8
Merge origin/main into dev/tclinkenbeard/ast-grep-six-cleanups
tclinkenbeard-oai Aug 27, 2026
3cb3081
Merge origin/main into LoadBalance coroutine conversion
tclinkenbeard-oai Aug 27, 2026
6169498
Merge pull request #13951 from tclinkenbeard-oai/dev/tclinkenbeard/as…
tclinkenbeard-oai Aug 27, 2026
6766663
Merge pull request #13854 from tclinkenbeard-oai/dev/tclinkenbeard/lo…
tclinkenbeard-oai Aug 27, 2026
9ad0cb7
Merge pull request #13838 from tclinkenbeard-oai/dev/tclinkenbeard/sh…
tclinkenbeard-oai Aug 27, 2026
946e01d
Fix typos in documentation (#13953)
mengxu-oai Aug 27, 2026
cdfba4b
fix: keep cached load-balancer future thread-local
tclinkenbeard-oai Aug 27, 2026
ebd61c3
add new commit statistics metrics (#13416)
MarkSh1 Aug 27, 2026
6b05920
Merge pull request #13947 from tclinkenbeard-oai/dev/tclinkenbeard/na…
tclinkenbeard-oai Aug 27, 2026
f300794
Annotate rolled tracked-latest trace events so they carry LogGroup/Ma…
neethuhaneesha Aug 27, 2026
c8c36a5
Merge pull request #13928 from tclinkenbeard-oai/dev/tclinkenbeard/na…
tclinkenbeard-oai Aug 27, 2026
976eeeb
Convert FlowTests to standard coroutines
tclinkenbeard-oai Aug 27, 2026
765965b
docs: replace legacy ACTOR documentation with coroutine guidance
tclinkenbeard-oai Aug 27, 2026
2f55de7
Merge pull request #13958 from tclinkenbeard-oai/dev/tclinkenbeard/do…
tclinkenbeard-oai Aug 28, 2026
080e429
StorageServer: remove duplicate AuditRange detail in AuditRequestInva…
PARTHDESHMUKH2005 Aug 28, 2026
41ffc89
Merge pull request #13957 from tclinkenbeard-oai/dev/tclinkenbeard/fl…
tclinkenbeard-oai Aug 28, 2026
319704b
add ipv6 support to docker container entrypoint
edameki Aug 28, 2026
407ae2b
Remove the actor compiler and migrate remaining uses
tclinkenbeard-oai Aug 28, 2026
e32ca2c
Remove obsolete compiler tests and fix gRPC header include
tclinkenbeard-oai Aug 28, 2026
895543f
Move Azure backup cleanup to a separate PR
tclinkenbeard-oai Aug 28, 2026
4d46cd5
Remove orphaned Azure backup integration
tclinkenbeard-oai Aug 28, 2026
c589828
BulkLoad: do not lose a bulkload task, and fail a restore that cannot…
saintstack Aug 28, 2026
90a6320
Merge pull request #13963 from tclinkenbeard-oai/dev/tclinkenbeard/re…
tclinkenbeard-oai Aug 28, 2026
a11d58e
Merge main into storage coroutine optimizations
tclinkenbeard-oai Aug 28, 2026
b81903e
BulkLoad: split an unplaceable bulkload task instead of failing the r…
saintstack Aug 28, 2026
3207053
Merge pull request #13961 from tclinkenbeard-oai/dev/tclinkenbeard/re…
tclinkenbeard-oai Aug 29, 2026
59c56b6
[main] Release notes 7.4.7 (#13964)
spraza Aug 29, 2026
2e61b79
Merge latest main into storage coroutine optimizations
tclinkenbeard-oai Aug 29, 2026
ffcb19a
Merge pull request #13699 from tclinkenbeard-oai/dev/tclinkenbeard/fd…
tclinkenbeard-oai Aug 29, 2026
6f25fd3
Enable three clang-tidy safety and vector checks
tclinkenbeard-oai Aug 30, 2026
3df537e
Give Redwood cache-hit test sufficient cache capacity
tclinkenbeard-oai Aug 30, 2026
ef8284b
Audit: bound validate_restore's slowest task instead of its average b…
saintstack Aug 31, 2026
970bb85
Merge pull request #13970 from tclinkenbeard-oai/dev/tclinkenbeard/cl…
tclinkenbeard-oai Aug 31, 2026
8abd7cf
Merge pull request #13974 from tclinkenbeard-oai/dev/tclinkenbeard/re…
tclinkenbeard-oai Aug 31, 2026
50e9068
Report degraded multi-region status when failover is stuck on an unav…
MarkSh1 Aug 20, 2026
8c54e31
Apply clang-format to Status.cpp
MarkSh1 Aug 27, 2026
999512e
Refresh remote-region stall event in a separate actor to avoid period…
MarkSh1 Aug 28, 2026
37db9a9
Fix NormalRecoveryFalsePositive test for some seeds
MarkSh1 Aug 29, 2026
799b637
fixed the included header
MarkSh1 Aug 31, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
Checks: >
-*,
bugprone-assignment-in-if-condition,
bugprone-dangling-handle,
bugprone-implicit-widening-of-multiplication-result,
bugprone-inaccurate-erase,
Expand All @@ -13,6 +14,7 @@ Checks: >
bugprone-sizeof-expression,
bugprone-string-constructor,
bugprone-string-integer-assignment,
bugprone-string-literal-with-embedded-nul,
bugprone-stringview-nullptr,
bugprone-suspicious-memory-comparison,
bugprone-suspicious-memset-usage,
Expand All @@ -32,6 +34,7 @@ Checks: >
modernize-use-using,
performance-for-range-copy,
performance-implicit-conversion-in-loop,
performance-inefficient-vector-operation,
performance-move-const-arg,
performance-move-constructor-init,
readability-braces-around-statements,
Expand Down
9 changes: 0 additions & 9 deletions .github/workflows/tidy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,6 @@ jobs:
fdb_c_generated \
fdb-java

# all flow actors, for generated headers
ACTORS=$(
ninja -t targets all | grep -v /build_output/ | grep '_actors:' | cut -d: -f1
)
ninja -v $ACTORS

# all protobuf headers
PB_HEADERS=$(
ninja -t targets all | grep -v /build_output/ | grep '\.pb\.h:' | cut -d: -f1
Expand All @@ -73,9 +67,6 @@ jobs:
if [[ $FILE == contrib/* ]]; then
continue # skip contrib sources
fi
if [[ $FILE == *.actor.* ]]; then
continue # actor syntax is not plain c++
fi
if [[ $FILE == flow/include/flow/CoroutinesImpl.h ]]; then
continue # internal implementation header, included only from Coroutines.h
fi
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ foundationdb.VC.db
foundationdb.VC.VC.opendb
ipch/
compile_commands.json
flow/actorcompiler/obj
flow/coveragetool/obj
*.code-workspace

Expand Down
17 changes: 7 additions & 10 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,28 +62,25 @@ Enable simulation tests in cmake: `-DENABLE_SIMULATION_TESTS=ON`

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: Flow Actors and C++ Coroutines
### Concurrency Model: C++ Coroutines

FDB uses cooperative single-threaded concurrency. Code is written using either:

- **Flow actors** (`.actor.cpp` / `.actor.h` files): A custom preprocessor (`actorcompiler`) translates `ACTOR`, `state`, `wait()`, `choose/when` syntax into generated C++ state machines. The `#include "flow/actorcompiler.h"` must be the **last** include in actor files.
- **C++ coroutines**: Newer code uses `co_await` and `co_return` instead of `wait()` and actor-style `return`. Coroutines can appear in regular `.cpp` files and in `.actor.cpp` files that still contain actorcompiler input; actors and coroutines can be mixed. New code should use coroutines; see `design/coroutines.md`.
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

- `wait()` / `waitNext()` cannot appear inside ternary expressions, function arguments, or other sub-expressions. Assign to a `state` variable first, or use a small gating actor.
- C++ coroutines: `co_await` is not allowed inside a `catch` handler. Capture the error, exit the catch, then `co_await` outside.
- `ACTOR` functions declared in headers must not be defined inside an anonymous namespace, or call sites get ambiguous-overload errors.
- Errors are integer codes (`flow/include/flow/error_definitions.h`), not exceptions with messages. When you `catch (Error& e)`, re-throw `actor_cancelled` (and never silently swallow `broken_promise`) — eating cancellation causes hangs and leaks. Transaction retry goes through `tr.onError(e)`, not a bare loop.
- `StringRef`/`KeyRef`/`ValueRef` are non-owning views into an `Arena`. Returning or storing one past its arena's lifetime is a dangling-reference bug; use `Standalone<>` (or `Key`/`Value`) when you need to own the bytes.

### Core Subsystems

- **`flow/`** — Async runtime, event loop, tracing, deterministic random, arenas
- **`fdbrpc/`** — Endpoint-addressed RPC, peer management, failure monitor, Sim2 (deterministic simulation network)
- **`fdbclient/`** — Transaction API (`NativeAPI.actor.cpp`), read-your-writes (`ReadYourWrites.actor.cpp`), location cache, multi-version client
- **`fdbclient/`** — Transaction API (`NativeAPI.cpp`), read-your-writes (`ReadYourWrites.cpp`), location cache, multi-version client
- **`fdbserver/`** — All server roles, organized by subdirectory:
- `clustercontroller/` — Leader election, role recruitment, ServerDBInfo broadcasting
- `coordinator/` — Paxos-based coordination state (generation registers)
Expand Down Expand Up @@ -134,11 +131,11 @@ Before changing a serialized type that persists on disk, inspect its `serializer

`clang-format` is used. Python code uses `black` and `flake8` (pre-commit hooks: `pip install pre-commit && pre-commit install`).

Edit `.actor.cpp` and `.actor.h` sources, not actorcompiler-generated output under the build directory.
Edit tracked `.cpp` and `.h` sources, not generated output under the build directory.

## Source File Headers

Every new `.cpp` / `.h` / `.actor.cpp` / `.actor.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.
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

Expand Down
11 changes: 3 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,9 @@ endif()

include(utils)

# First thing we need is the actor compiler
option(
WITH_CSHARP
"Prefer C# build tools (actor compiler, coverage tool, vexillographer) when a toolchain is available"
"Prefer C# build tools (coverage tool, vexillographer) when a toolchain is available"
ON)

set(FDB_USE_CSHARP_TOOLS_EXPLICIT FALSE)
Expand Down Expand Up @@ -227,8 +226,6 @@ if(FDB_USE_CSHARP_TOOLS_EXPLICIT AND FDB_USE_CSHARP_TOOLS
"FDB_USE_CSHARP_TOOLS is enabled, but CSHARP_TOOLCHAIN_FOUND is FALSE. Install .NET (dotnet) or Mono, or set WITH_CSHARP=OFF.")
endif()

include(CompileActorCompiler)

if(FDB_USE_CSHARP_TOOLS AND CSHARP_TOOLCHAIN_FOUND)
include(CompileCoverageTool)
set(COVERAGETOOL_AVAILABLE TRUE)
Expand All @@ -238,7 +235,6 @@ endif()
# Vexilographer generation is configured inside fdbclient
include(CompileVexillographer)

# with the actor compiler, we can now make the flow commands available
include(FlowCommands)

###############################################################################
Expand Down Expand Up @@ -346,7 +342,7 @@ if(CMAKE_EXPORT_COMPILE_COMMANDS AND WITH_PYTHON)
COMMAND
$<TARGET_FILE:Python3::Interpreter>
${CMAKE_CURRENT_SOURCE_DIR}/contrib/gen_compile_db.py ARGS -b
${CMAKE_CURRENT_BINARY_DIR} -s ${CMAKE_CURRENT_SOURCE_DIR} -o
${CMAKE_CURRENT_BINARY_DIR} -o
${CMAKE_CURRENT_SOURCE_DIR}/compile_commands.json -ninjatool
${CMAKE_MAKE_PROGRAM} ${CMAKE_CURRENT_BINARY_DIR}/compile_commands.json
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/contrib/gen_compile_db.py
Expand All @@ -357,8 +353,7 @@ if(CMAKE_EXPORT_COMPILE_COMMANDS AND WITH_PYTHON)
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/compile_commands.json
${CMAKE_CURRENT_BINARY_DIR}/compile_commands.json)

# A prebuild target ensures that all actors, Swift-generated headers, and
# Swift modules are built.
# A prebuild target ensures that Swift-generated headers and modules are built.
if(WITH_SWIFT)
add_custom_target(prebuild_for_ide ALL DEPENDS fdbserver_swift
processed_compile_commands)
Expand Down
28 changes: 14 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

![Build Status](https://codebuild.us-west-2.amazonaws.com/badges?uuid=eyJlbmNyeXB0ZWREYXRhIjoiVjVzb1RQNUZTaGxGNm9iUnk4OUZ1d09GdTMzZnVOT1YzaUU1RU1xR2o2TENRWFZjb3ZrTHJEcngrZVdnNE40bXJJVDErOGVwendIL3lFWFY3Y3oxQmdjPSIsIml2UGFyYW1ldGVyU3BlYyI6IlJUbWhnaUlJVXRORUNJTjQiLCJtYXRlcmlhbFNldFNlcmlhbCI6MX0%3D&branch=main)

FoundationDB is a distributed database designed to handle large volumes of structured data across clusters of commodity servers. It organizes data as an ordered key-value store and employs ACID transactions for all operations. It is especially well-suited for read/write workloads, but also has excellent performance for write-intensive workloads. Users interact with the database using API language binding.
FoundationDB is a distributed database designed to handle large volumes of structured data across clusters of commodity servers. It organizes data as an ordered key-value store and employs ACID transactions for all operations. It is especially well-suited for read/write workloads, but also has excellent performance for write-intensive workloads. Users interact with the database using API language bindings.

To learn more about FoundationDB, visit [foundationdb.org](https://www.foundationdb.org/)

Expand All @@ -12,17 +12,17 @@ Documentation can be found online at <https://apple.github.io/foundationdb/>. Th

## Forums

[The FoundationDB Forums](https://forums.foundationdb.org/) are the home for most of the discussion and communication about the FoundationDB project. We welcome your participation! We want FoundationDB to be a great project to be a part of, and as part of that, we have established a [Code of Conduct](CODE_OF_CONDUCT.md) to define what constitutes permissible modes of interaction.
[The FoundationDB Forums](https://forums.foundationdb.org/) are the home for most of the discussion and communication about the FoundationDB project. We welcome your participation! We want FoundationDB to be a great project to be a part of, and as part of that, we have established a [Code of Conduct](CODE_OF_CONDUCT.md) to define what constitutes permissible modes of interaction.

## Contributing

Contributing to FoundationDB can be in contributions to the codebase, sharing your experience and insights in the community on the Forums, or contributing to projects that make use of FoundationDB. Please see the [contributing guide](CONTRIBUTING.md) for more specifics.
Contributions to FoundationDB can include contributions to the codebase, sharing your experience and insights with the community on the Forums, or contributing to projects that make use of FoundationDB. Please see the [contributing guide](CONTRIBUTING.md) for more specifics.

## Getting Started

### Latest Stable Releases

The latest stable releases are (were) versions that are recommended for production use, which have been extensively validated via simulation and real cluster tests and used in our production environment.
The latest stable releases are versions that are recommended for production use, which have been extensively validated via simulation and real cluster tests and used in our production environment.

| Branch | Latest Production Release | Notes |
|:--------:|:-------------:|------:|
Expand Down Expand Up @@ -84,7 +84,7 @@ defined in `/root/.bashrc` in the container image.

To build outside of the official Docker image, you'll need at least these dependencies:

1. [CMake](https://cmake.org/) version 3.24.2 or higher
1. [CMake](https://cmake.org/) version 3.24.2 or higher
1. [Mono](https://www.mono-project.com/download/stable/)
1. [ninja](https://ninja-build.org/)

Expand Down Expand Up @@ -140,7 +140,7 @@ Building FoundationDB requires at least 8GB of memory. More memory is needed whe

### macOS

The build under macOS will work the same way as on Linux. [Homebrew](https://brew.sh/) can be used to install the `boost` library and the `ninja` build tool. Be careful, current main branch uses boost 1.86, do install this version or just let cmake download one. Also, if the Swift binding is not of interest, use -DBUILD_SWIFT_BINDING=OFF.
The build under macOS will work the same way as on Linux. [Homebrew](https://brew.sh/) can be used to install the `boost` library and the `ninja` build tool. Be careful: the current main branch uses Boost 1.86; install this version or let CMake download it. Also, if the Swift binding is not of interest, use `-DBUILD_SWIFT_BINDING=OFF`.

```sh
cmake -G Ninja <FDB_SOURCE_DIR> -B <BUILD_DIR>
Expand All @@ -156,10 +156,10 @@ To generate an installable package,

### Windows

Under Windows, only Visual Studio with ClangCl is supported
Under Windows, only Visual Studio with ClangCl is supported.

1. Install Visual Studio 2019 (IDE or Build Tools), and enable LLVM support
1. Install [CMake 3.24.2](https://cmake.org/download/) or higher
1. Install [CMake 3.24.2](https://cmake.org/download/) or higher
1. Download [Boost 1.86.0](https://archives.boost.io/release/1.86.0/source/boost_1_86_0.tar.bz2)
1. Unpack boost to C:\boost, or use `-DBOOST_ROOT=<PATH_TO_BOOST>` with `cmake` if unpacked elsewhere
1. Install [Python](https://www.python.org/downloads/) if it is not already installed by Visual Studio
Expand All @@ -169,7 +169,7 @@ Under Windows, only Visual Studio with ClangCl is supported
1. `mkdir build && cd build`
1. `cmake -G "Visual Studio 16 2019" -A x64 -T ClangCl <FDB_SOURCE_DIR>`
1. `msbuild /p:Configuration=Release foundationdb.sln`
1. To increase build performance, use `/p:UseMultiToolTask=true` and `/p:CL_MPCount=<NUMBER_OF_PARALLEL_JOBS>`
1. To increase build performance, use `/p:UseMultiToolTask=true` and `/p:CL_MPCount=<NUMBER_OF_PARALLEL_JOBS>`

### Language Bindings

Expand All @@ -180,21 +180,21 @@ Generally, CMake will build all language bindings for which it can find all nece

### Generating `compile_commands.json`

CMake can build a compilation database for you. However, the default generated one is not too useful as it operates on the generated files. When running `ninja`, the build system creates another `compile_commands.json` file in the source directory. This can then be used for tools such as [CCLS](https://github.com/MaskRay/ccls) and [CQuery](https://github.com/cquery-project/cquery), among others. This way, you can get code completion and code navigation in flow. It is not yet perfect (it will show a few errors), but we are continually working to improve the development experience.
CMake can generate a compilation database for code completion, navigation, and static analysis of the C++20 coroutine sources. Pass `-DCMAKE_EXPORT_COMPILE_COMMANDS=ON` when configuring a Ninja or Makefile build, then point your tooling at `compile_commands.json` in the build directory.

CMake will not produce a `compile_commands.json` by default; you must pass `-DCMAKE_EXPORT_COMPILE_COMMANDS=ON`. This also enables the target `processed_compile_commands`, which rewrites `compile_commands.json` to describe the actor compiler source file, not the post-processed output files, and places the output file in the source directory. This file should then be picked up automatically by any tooling.
When Python support is enabled, this option also enables the `processed_compile_commands` target, which writes a database to the source directory. With Ninja, it includes Swift compilation commands as well.

Note that if the building is done inside the `foundationdb/build` Docker image, the resulting paths will still be incorrect and require manual fixing. One will wish to re-run `cmake` with `-DCMAKE_EXPORT_COMPILE_COMMANDS=OFF` to prevent it from reverting the manual changes.
If the build runs inside a container, the database contains container paths. Run the tooling in the same environment or map those paths to the host checkout.

### Code Formatting and Static Analysis

`clang-format` and `clang-tidy` run as part of CI on every pull request. See the [clang-format](https://apple.github.io/foundationdb/clang-format.html) and [clang-tidy](https://apple.github.io/foundationdb/clang-tidy.html) guides for how to run them locally before pushing.

### Using IDEs

CMake provides built-in support for several popular IDEs. However, most FoundationDB files are written in the `flow` language, which is an extension of the C++ programming language, for coroutine support (Note that when FoundationDB was being developed, C++20 was not available). The `flow` language will be transpiled into C++ code using `actorcompiler`, while preventing most IDEs from recognizing `flow`-specific syntax.
CMake provides built-in support for several popular IDEs. FoundationDB's asynchronous code uses standard C++20 coroutines with the Flow runtime, so use an IDE or language server with C++20 support. See the [coroutine guide](design/coroutines.md) for the programming model.

It is possible to generate project files for editing `flow` with a supported IDE. There is a CMake option called `OPEN_FOR_IDE`, which creates a project that can be opened in an IDE for editing. This project cannot be built, but you will be able to edit the files and utilize most of the editing and navigation features that your IDE supports.
The CMake option `OPEN_FOR_IDE` creates an editing-only project for a supported IDE. This project cannot be built, but supports editing and navigation.

For example, if you want to use Xcode to make changes to FoundationDB, you can create an Xcode project with the following command:

Expand Down
2 changes: 0 additions & 2 deletions SWIFT_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ Then, you can then include the generated module in C++:
```cpp
// ...
#include "SwiftModules/FDBServer"

#include "flow/actorcompiler.h" // This must be the last #include.
```

## Swift Basics
Expand Down
4 changes: 1 addition & 3 deletions SWIFT_IDE_SETUP.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export FOUNDATIONDB_LLVM_TOOLCHAIN_ROOT=~/Downloads/clang+llvm-15.0.7-arm64-appl
```


For actor compiler: Download and install mono: [https://www.mono-project.com](https://www.mono-project.com/), e.g.
For the C# build tools, including option generation, install [Mono](https://www.mono-project.com/), e.g.

```bash
brew install mono
Expand Down Expand Up @@ -147,7 +147,5 @@ Setup:

## Known issues

* jump-to-definition fails to open actor header files.
* jump-to-definition from C++ to Swift does not work.
* Code completion for semantic responses in Swift can be slow sometimes especially in files that import both FDBServer and FDBClient

1 change: 1 addition & 0 deletions bindings/c/test/apitester/TesterTransactionExecutor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ class TransactionContextBase : public ITransactionContext {

std::vector<fdb::Error::CodeType> retriedErrorCodes() {
std::vector<fdb::Error::CodeType> retriedErrorCodes;
retriedErrorCodes.reserve(retriedErrors.size());
for (auto e : retriedErrors) {
retriedErrorCodes.push_back(e.code());
}
Expand Down
1 change: 1 addition & 0 deletions bindings/c/test/apitester/TesterWorkload.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@ void WorkloadManager::schedulePrintStatistics(int timeIntervalMs) {
std::vector<std::shared_ptr<IWorkload>> WorkloadManager::getActiveWorkloads() {
std::unique_lock<std::mutex> lock(mutex);
std::vector<std::shared_ptr<IWorkload>> res;
res.reserve(workloads.size());
for (const auto& iter : workloads) {
res.push_back(iter.second.ref);
}
Expand Down
1 change: 1 addition & 0 deletions bindings/c/test/client_memory_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ int main(int argc, char** argv) {
};
std::vector<std::thread> threads;
constexpr auto kThreadCount = 64;
threads.reserve(kThreadCount);
for (int i = 0; i < kThreadCount; ++i) {
threads.emplace_back(thread_func);
}
Expand Down
1 change: 1 addition & 0 deletions bindings/flow/fdb_flow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ Future<Void> _test() {
// for (int i = 0; i < 100000; i++) {
// Version v = wait( tr->getReadVersion() );
// }
versions.reserve(100000);
for (int i = 0; i < 100000; i++) {
versions.push_back(tr->getReadVersion());
}
Expand Down
Loading
Loading