Repository navigation
replace remaining pg_cron TTL cleanups with Arbiter jobs - #5773
Open
blackheaven wants to merge 3 commits into
Open
blackheaven wants to merge 3 commits into
blackheaven wants to merge 3 commits into
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Expired
oauth_auth_codeanduser_cookiesrows were deleted by pg_cron jobs that the migrations20261127110318-oauth-auth-code-ttl-cleanup.sqland20261110121000-user-cookies-ttl-cleanup.sqlscheduled only if the operator had installed pg_cron. Without pg_cron (the default for most installations) these tables grew without bound. pg_cron also needsshared_preload_libraries, superuser setup and a separate place to monitor it. Background-worker already runs Arbiter with recurring cron jobs, so this PR moves both cleanups there.Changes
expirationswith payloadExpirationsJobPayload(ExpireOAuthAuthCode,ExpireUserCookies). The queue,Wire.ExpirationsCleanupWorkerand the worker-pool wiring inWorkers.hsare kept identical to the activation-keys PR (WPB-22970), so merging the two only combines constructors.expire-oauth-auth-code(daily at 04:00 UTC) andexpire-user-cookies(hourly at minute 5) keep the schedules of the pg_cron jobs they replace.DELETE ... LIMIT ... FOR UPDATE SKIP LOCKEDstatements in the Postgres stores:deleteExpiredOAuthAuthCodesanddeleteExpiredCookies. Each batch is its own short transaction, and a run loops until a batch comes back short. On failure the job rethrows, so Arbiter retries it.20261203120000-drop-pg-cron-ttl-cleanups.sqlunschedules the old pg_cron jobs that the migrating role owns. Without pg_cron it does nothing. If unscheduling fails it only warns: a leftover job just repeats the same idempotent delete. The applied migrations are not edited.postgres-schema.sqlnow includes the Arbiterexpirationstables. Golden and roundtrip tests cover the new payload, and a unit test covers the batching loop.config-options.mdand the changelog are updated.Every read path already ignores expired rows, so the cleanup only reclaims space and has no effect on authentication behaviour.