Skip to content

WPB-29579: migrate properties to PostGreSQL - #5643

Open
blackheaven wants to merge 4 commits into
developfrom
gdifolco/WPB-29579-migration-postgres-properties
Open

blackheaven wants to merge 4 commits into
developfrom
gdifolco/WPB-29579-migration-postgres-properties

Conversation

@blackheaven

Copy link
Copy Markdown
Contributor

https://wearezeta.atlassian.net/browse/WPB-29579

Checklist

  • Add a new entry in an appropriate subdirectory of changelog.d
  • Read and follow the PR guidelines

@blackheaven
blackheaven requested review from a team as code owners October 22, 2026 19:54
@zebot zebot added the ok-to-test Approved for running tests in CI, overrides not-ok-to-test if both labels exist label Oct 22, 2026
@blackheaven
blackheaven force-pushed the gdifolco/WPB-29579-migration-postgres-properties branch 2 times, most recently from 2943f13 to 95ef331 Compare October 29, 2026 18:50
@blackheaven
blackheaven force-pushed the gdifolco/WPB-29579-migration-postgres-properties branch from 0bc0310 to 2065634 Compare November 4, 2026 15:23
@blackheaven
blackheaven force-pushed the gdifolco/WPB-29579-migration-postgres-properties branch from 2065634 to 6b0ede9 Compare November 5, 2026 13:32
@VeryMilkyJoe
VeryMilkyJoe requested a balanced review from Copilot November 6, 2026 16:34

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The backfill can overwrite acknowledged updates or resurrect deleted properties, while overlapping backend phases cause the migration integration test to time out before exercising migration.

2 open issues
What changed in this PR

Adds PostgreSQL storage and a Cassandra-to-PostgreSQL migration path for user properties, integrated with Brig and the background worker.

Changes:

  • Adds the properties schema, PostgreSQL operations, serialization, and dual-write support.
  • Adds background migration execution, metrics, configuration, and operator documentation.
  • Adds serialization round-trip tests and an integration migration scenario.
File Description
services/​galley/​galley.integration.yaml Selects PostgreSQL for properties in integration configuration.
services/​brig/​src/​Brig/​CanonicalInterpreter.hs Selects the property-store interpreter by migration mode.
services/​brig/​brig.integration.yaml Enables PostgreSQL property storage for integration tests.
services/​background-worker/​test/​Test/​Wire/​Util.hs Adds the properties setting to test configuration.
services/​background-worker/​test/​Test/​Wire/​BackendNotificationPusherSpec.hs Updates migration-option test fixtures.
services/​background-worker/​src/​Wire/​PostgresMigrations.hs Starts property migration with metrics and cleanup.
services/​background-worker/​src/​Wire/​BackgroundWorker/​Options.hs Adds the property migration flag.
services/​background-worker/​src/​Wire/​BackgroundWorker.hs Wires migration startup and shutdown.
services/​background-worker/​background-worker.integration.yaml Adds property storage and migration settings.
postgres-schema.sql Records the properties table and primary key.
libs/​wire-subsystems/​wire-subsystems.cabal Exposes the new property-store modules.
libs/​wire-subsystems/​src/​Wire/​PropertyStore/​Postgres.hs Implements PostgreSQL property operations.
libs/​wire-subsystems/​src/​Wire/​PropertyStore/​Migration.hs Implements paginated Cassandra backfill.
libs/​wire-subsystems/​src/​Wire/​PropertyStore/​DualWrite.hs Mirrors mutations while retaining Cassandra reads.
libs/​wire-subsystems/​src/​Wire/​PropertyStore/​Cassandra.hs Exposes a full-table query for migration.
libs/​wire-subsystems/​src/​Wire/​PostgresMigrationOpts.hs Adds the properties storage selector.
libs/​wire-subsystems/​postgres-migrations/​20261022140000-properties.sql Creates the PostgreSQL properties table.
libs/​wire-api/​test/​unit/​Test/​Wire/​API/​Roundtrip/​PostgresMarshall.hs Adds property serialization round-trip tests.
libs/​wire-api/​src/​Wire/​API/​Properties.hs Adds PostgreSQL conversions and value generation for tests.
integration/​test/​Test/​Migration/​Properties.hs Adds a migration and cutover test scenario.
integration/​integration.cabal Registers the migration test module.
hack/​helm_vars/​wire-server/​values.yaml.gotmpl Passes the properties storage preference into Helm values.
hack/​helm_vars/​common.yaml.gotmpl Defines the properties storage preference.
docs/​src/​developer/​reference/​config-options.md Documents property migration settings and completion metrics.
charts/​wire-server/​values.yaml Adds default storage and migration settings.
charts/​wire-server/​templates/​background-worker/​configmap.yaml Renders the property migration flag.
changelog.d/​5-internal/​WPB-29579-migration-postgres-properties Announces the property-store migration support.

Review effort: Balanced

@blackheaven
blackheaven force-pushed the gdifolco/WPB-29579-migration-postgres-properties branch 2 times, most recently from 67fc87c to 75b2e93 Compare November 10, 2026 08:31
- Test/Migration/Properties.hs: run the three dynamic-backend phases
  sequentially (previous backend fully stopped before the next starts)
  instead of nesting the callbacks, which deadlocked on port acquisition.
- PropertyStore backfill: copy rows with insert-if-absent (ON CONFLICT DO
  NOTHING) so a stale Cassandra snapshot cannot clobber newer rows that
  dual-write already put in Postgres; accepted residual races documented
  in haddock on migratePropertiesRow per the in-code trade-off convention.
@blackheaven
blackheaven force-pushed the gdifolco/WPB-29579-migration-postgres-properties branch from 75b2e93 to 221299c Compare November 13, 2026 11:13

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

easy-to-review ok-to-test Approved for running tests in CI, overrides not-ok-to-test if both labels exist

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants