WPB-22954: migrate mls-commit-locks to PostGreSQL - #5415
Conversation
akshaymankar
left a comment
There was a problem hiding this comment.
Why do we need to migrate these locks? Can we not just use some pg advisory locks instead of creating a table?
|
Agreed — no table needed. This is now a direct cutover to pg advisory locks (cc03ef9), reusing the same session-scoped advisory-lock mechanism as the domain-registration/team-feature dual-writes ( |
Migrate the MLS commit-lock store (galley) from Cassandra to PostgreSQL using the dual-write + background-worker pattern, following the CodeStore recipe. The Postgres acquire replicates Cassandra's IF NOT EXISTS USING TTL via INSERT ... ON CONFLICT DO UPDATE WHERE expires_at < now() RETURNING, honoring both CAS mutual exclusion and TTL expiry (a pure DO NOTHING would leave an expired lock blocking its (group_id, epoch) forever, since Postgres has no TTL reaper). Adds Postgres/DualWrite/Migration interpreters, a migration flag + metrics, helm/config/docs wiring, schema migration, and an integration test.
Replaces the mls_commit_locks table + dual-write + backfill migration from the previous commit with a direct cutover to session-scoped pg advisory locks (Wire.MigrationLock try-lock). Contention answers stale-message immediately; crash safety comes from the holding connection dying instead of the 10-minute TTL. Deletes the MLSCommitLockStore.DualWrite/Migration modules, the background-worker migration job, the 20260804143320 SQL migration and all mlsCommitLocks/migrateMLSCommitLocks config knobs. The cassandra mls_commit_locks table becomes unread; dropping it (and galley schema V68) is a follow-up.
cc03ef9 to
abc0f6f
Compare
A rebase onto develop with bad conflict resolutions silently reverted newer upstream work: cannon.configuratorImage in the wire-server chart values (broke the kube-integration CI helm render at cannon/statefulset.yaml:146), the background-worker user-migration wiring (migrateUsers), meetings time-setting values/docs, and a separator line in postgres-schema.sql. Restore all of these from origin/develop; the MLS advisory-lock cutover needs none of the reverted content.
randomUser users are not connected, so galley rejects the commit bundle with 403 not-connected. Use createAndConnectUsers, matching the old testCommitLock and the other integration-package MLS tests.
https://wearezeta.atlassian.net/browse/WPB-22954
Checklist
changelog.d