Skip to content

WPB-22970: migrate activation-keys to PostGreSQL - #5417

Open
blackheaven wants to merge 4 commits into
developfrom
gdifolco/WPB-22970-migration-postgres-activation-keys
Open

blackheaven wants to merge 4 commits into
developfrom
gdifolco/WPB-22970-migration-postgres-activation-keys

Conversation

@blackheaven

Copy link
Copy Markdown
Contributor

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

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 August 4, 2026 18:10

@akshaymankar akshaymankar left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do the expired codes somehow automatically get cleaned up from postgres? I couldn't see anything like that. Perhaps we should run a scheduled job to clean them up nightly or something.

@blackheaven
blackheaven force-pushed the gdifolco/WPB-22970-migration-postgres-activation-keys branch from a8abee9 to b065da8 Compare August 27, 2026 14:05
@zebot zebot added the ok-to-test Approved for running tests in CI, overrides not-ok-to-test if both labels exist label Aug 27, 2026
@blackheaven
blackheaven force-pushed the gdifolco/WPB-22970-migration-postgres-activation-keys branch 3 times, most recently from ad3611f to 9169072 Compare August 27, 2026 17:10
@blackheaven
blackheaven force-pushed the gdifolco/WPB-22970-migration-postgres-activation-keys branch from 9169072 to af1c784 Compare September 11, 2026 17:20
@blackheaven
blackheaven force-pushed the gdifolco/WPB-22970-migration-postgres-activation-keys branch from af1c784 to cb02426 Compare September 11, 2026 18:23
@blackheaven
blackheaven force-pushed the gdifolco/WPB-22970-migration-postgres-activation-keys branch from cb02426 to 693e0da Compare September 24, 2026 07:21
@blackheaven
blackheaven force-pushed the gdifolco/WPB-22970-migration-postgres-activation-keys branch from 693e0da to f16d1ad Compare October 20, 2026 17:29
@blackheaven
blackheaven force-pushed the gdifolco/WPB-22970-migration-postgres-activation-keys branch 3 times, most recently from 93d7c04 to 5e8ee21 Compare November 5, 2026 13:09
@blackheaven

Copy link
Copy Markdown
Contributor Author

Expired activation keys are cleaned by the background-worker nightly job (background-worker.config.activationKeysCleanup.schedule, default 0 3 * * *). Rebased onto current develop.

@blackheaven
blackheaven force-pushed the gdifolco/WPB-22970-migration-postgres-activation-keys branch 3 times, most recently from 0f84ff2 to c9013b5 Compare November 16, 2026 22:47
@blackheaven
blackheaven force-pushed the gdifolco/WPB-22970-migration-postgres-activation-keys branch from c9013b5 to fa92d9a Compare November 17, 2026 14:06
@blackheaven
blackheaven force-pushed the gdifolco/WPB-22970-migration-postgres-activation-keys branch from fa92d9a to 1eae9a8 Compare November 27, 2026 21:01
@blackheaven

Copy link
Copy Markdown
Contributor Author

@akshaymankar FYI, data migration have been removed to speed up the support of PostGreSQL, feel free to have a look at it when you have some time, thanks in advance.

@blackheaven
blackheaven force-pushed the gdifolco/WPB-22970-migration-postgres-activation-keys branch 2 times, most recently from 288d4a3 to 4483750 Compare December 2, 2026 11:26
@blackheaven

Copy link
Copy Markdown
Contributor Author

@akshaymankar correction to my comment above: the activation-keys cleanup is no longer a background-worker job. Migration 20261130100101-activation-keys-ttl-cleanup.sql schedules the pg_cron job expire-activation-keys (every 5 min, batched ctid delete on expires_at, backed by activation_keys_expires_at_idx), per ADR-0005; the ActivationKeysCleanupWorker and its config are gone.

@blackheaven
blackheaven force-pushed the gdifolco/WPB-22970-migration-postgres-activation-keys branch from 8f1db12 to cc9ee94 Compare December 3, 2026 14:29
Squashed onto develop. Expired activation keys are deleted by the
expire-activation-keys Arbiter cron job (expirations queue) in
background-worker instead of pg_cron.
@blackheaven
blackheaven force-pushed the gdifolco/WPB-22970-migration-postgres-activation-keys branch from cc9ee94 to ee66b92 Compare December 3, 2026 14:56
Run the batch loop in a single interpreter, give the tag enum its own
schema name and re-check expiry in the outer DELETE.
… failure

Log and fail the Arbiter job with a short category (connection error,
session error with its SQLSTATE, pool acquisition timeout) instead of the
rendered hasql UsageError, which carries the host, port, user and database
name. The job is failed with throwRetryable so Arbiter still retries it.
Move the pool usage error redaction (CleanupFailure, classifyUsageError,
renderCleanupFailure, cleanupFailedMessage) into Wire.UsageErrorRedaction
and use it where background-worker turned a UsageError into text: the
effect runner of adminless, background and meetings cleanup jobs no
longer embeds `show` of the error, and the meetings cleanup log no
longer shows the text again.

Extract runCleanupWith from runExpirationsCleanup and test that it logs
and throws only the redacted category, test the effect runner's mapping,
and make the redaction property assert that rendering ignores the
error's free-form text.

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

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