Skip to content

Conversation

AlexTMjugador
Copy link
Member

@AlexTMjugador AlexTMjugador commented Sep 6, 2025

Overview

This PR supersedes #4167 and implements the approach I outlined in #4167 (review) to handle our disk space usage problems in the staging environment in a better way.

Specifically, Labrinth now checks whether it is initializing a staging Clickhouse database, identified by the staging_analytics name. If so, it creates Clickhouse tables with a 1-day TTL, ensuring that old data rows are automatically discarded. The existing Clickhouse tables in the staging environment have already been manually migrated to use this TTL.

Since data in the staging environment is not expected to be long-lived, especially that living on Clickhouse, setting a short TTL for these tables represents a balanced tradeoff between environment parity, data persistence, and storage costs.

Testing

I have tested that these changes had the expected effect on a local environment.

@AlexTMjugador AlexTMjugador added enhancement New feature or request backend Relates to Modrinth Backend or API labels Sep 6, 2025
Copy link
Contributor

@fetchfern fetchfern left a comment

Choose a reason for hiding this comment

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

lgtm

@AlexTMjugador AlexTMjugador added this pull request to the merge queue Sep 6, 2025
Merged via the queue into main with commit e2f07a7 Sep 6, 2025
3 checks passed
@AlexTMjugador AlexTMjugador deleted the alex/staging-clickhouse-ttl branch September 6, 2025 15:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend Relates to Modrinth Backend or API enhancement New feature or request
Development

Successfully merging this pull request may close these issues.

2 participants