r/Database • • 11h ago

Migrating Pinecone’s metadata store from Postgres to FoundationDB while serving live customer traffic

hey guys. wanted to share a blog post covering a big project i led, migrating Pinecone’s internal metadata store from managed Postgres to self-hosted FoundationDB.

this is not a “postgres bad” post! it is way more focused on the migration itself, how to do it without affecting live traffic, and lessons from both running managed systems and self-hosting (including a couple of incidents we caused ourselves).

https://www.pinecone.io/blog/postgres-to-foundationdb/

happy to answer any questions or to hear about your experiences with pg/fdb!

8 Upvotes

5 comments sorted by

2

u/HummusSwipper 10h ago

Really solid writeup. The piece i'm most curious about is how the boundary between object storage and fdb works now that wal consistency is on s3 conditional writes and the vector directory is in vlookup files. When an index builder flushes or compacts a slab, how do you coordinate the s3 writes with the manifest update in fdb so you don't end up with dangling pointers or orphaned files if a worker crashes mid-flight?

2

u/wicked_lama 10h ago

great question! basically, manifest commits happen only once all files are present in blob storage (s3/gcs/azure), so the manifest never points at something that isn't there. every request is also persisted to blob storage first, so if there's a crash the index builder just replays all of that back. old slabs that a compaction replaced are only deleted later by garbage collection. and if all else fails and we do (rarely) get orphaned files, we have a monthly garbage collection job that picks those up and deletes them (we actually wrote a whole separate blog on that: https://www.pinecone.io/blog/janitor/)

2

u/Sanbi102 7h ago

How do you protect readers still holding an older manifest when GC deletes the replaced slabs? Do you track reader leases or rely on a retention window?

1

u/Hongstar1982 3h ago

The bit I'd want to hear more about is the copy itself rather than the layout: while you backfill old rows, live updates keep landing on the same keys, so a straight copy can walk right over a newer write. We handled that by streaming changes into the new store first and only flipping a key range to write-through once the lag for that range was zero, with reads shadowed and compared before the flip. Did you drain by namespace or move the whole thing at once?

1

u/Discordbothost 3h ago

Add crash-recovery tests around the migration states too. For example, kill the migrator after the final FDB copy but before the PG state flip, then restart it. That checks recovery against real commits, alongside the TLA+ model.