Skip to content

Conversation

antiguru
Copy link
Member

@antiguru antiguru commented Oct 10, 2025

Implements a consensus backend to talk to FoundationDB. Very much untested and still panics sometimes.

Run: bin/environmentd --optimized --consensus foundationdb:

TODO to make this work everywhere:

  • Make building with FoundationDB optional. Currently, there is no easy way to get a libfdb_c on aarch64 Mac.
  • This change adds the fdb library to the base images, which isn't great if we don't want to use it.
  • The test infrastructure has different ways to distinguish metadata stores, sometimes a string, or a bool, to switch between the built-in postgres or external crdb. It'd be nice to change this to an enum of Internal, External-CRDB, External-FDB to allow easy switching between different implementations and targets.
    • Testdrive passes most tests, but the consistency and tombstone checks don't work as it assumes an incorrect store.
  • Initializing FDB requires a fdbcli call to create the database. Before that, we cannot establish a connection. If we just use the provided image, we need to slot that call somewhere outside of docker-compose itself. See https://github.com/apple/foundationdb/blob/main/packaging/docker/samples/local/start.bash for context.

@antiguru
Copy link
Member Author

Still losing data somewhere, it's getting closer though:

2025-10-10T15:18:10.342212Z  thread 'persist:001f' panicked at /home/moritz/dev/repos/materialize/src/persist-client/src/internal/state_versions.rs:771:9:
assertion `left == right` failed
  left: Some(SeqNo(254))
 right: Some(SeqNo(257))

@def-
Copy link
Contributor

def- commented Oct 13, 2025

Tell me if you want any help with setting up FoundationDB in mzcompose. I'm very interested to see benchmark results, as well as the limits test to find new limits (with its artificial limits because of things becoming too slow removed).

@antiguru
Copy link
Member Author

I added a testdrive variant that runs against FoundationDB, but it requires a bunch of changes to make Mz compile in docker. One issue is that the FoundationDB client library needs to be dynamically linked, which is a novel problem for us. At the moment, everything in Materialize is statically linked, so we need to make sure that our base images contain the right library for the compile and runtime to be happy.

@antiguru antiguru force-pushed the fdb branch 2 times, most recently from e10a2c3 to 6479090 Compare October 14, 2025 09:52
Implements a consensus backend to talk to FoundationDB. Very much untested
and still panics sometimes.

Signed-off-by: Moritz Hoffmann <[email protected]>
Signed-off-by: Moritz Hoffmann <[email protected]>
Signed-off-by: Moritz Hoffmann <[email protected]>
Signed-off-by: Moritz Hoffmann <[email protected]>
Signed-off-by: Moritz Hoffmann <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants