Skip to content

feat: clean up AuthDB refresh tokens by dropping partitions#929

Open
chrisburr wants to merge 1 commit into
DIRACGrid:mainfrom
chrisburr:feat/authdb-partition-maintenance
Open

feat: clean up AuthDB refresh tokens by dropping partitions#929
chrisburr wants to merge 1 commit into
DIRACGrid:mainfrom
chrisburr:feat/authdb-partition-maintenance

Conversation

@chrisburr
Copy link
Copy Markdown
Member

Replace the row-level DELETE sweeps for the RefreshTokens table with maintenance of its monthly JTI range-partitions: drop partitions whose whole month is older than the retention horizon, and add partitions ahead of time so the p_future catch-all never fills. Dropping a partition is an O(1) metadata operation and avoids the row-lock and lock-memory cost of large DELETEs.

Retention is now expressed in calendar months via the new DIRACX_SERVICE_AUTH_REFRESH_TOKEN_RETENTION_MONTHS setting (default 6), replacing revoked_refresh_token_retention_minutes. Partition maintenance is implemented for MySQL only and raises NotImplementedError for other dialects. The unpartitioned flow tables keep their existing DELETE-based cleanup.

Fixes #928

Replace the row-level DELETE sweeps for the RefreshTokens table with maintenance of its monthly JTI range-partitions: drop partitions whose whole month is older than the retention horizon, and add partitions ahead of time so the p_future catch-all never fills. Dropping a partition is an O(1) metadata operation and avoids the row-lock and lock-memory cost of large DELETEs.

Retention is now expressed in calendar months via the new DIRACX_SERVICE_AUTH_REFRESH_TOKEN_RETENTION_MONTHS setting (default 6), replacing revoked_refresh_token_retention_minutes. Partition maintenance is implemented for MySQL only and raises NotImplementedError for other dialects. The unpartitioned flow tables keep their existing DELETE-based cleanup.
@read-the-docs-community
Copy link
Copy Markdown

Documentation build overview

📚 diracx | 🛠️ Build #32953269 | 📁 Comparing 4edbe5c against latest (32a8e73)

  🔍 Preview build  

1 file changed
± admin/reference/env-variables/index.html

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG]: Refresh tokens cleaned up too slowly

1 participant