Skip to content

Add lifecycle_type backfill clock job and rake task#5196

Open
philippthun wants to merge 1 commit into
cloudfoundry:mainfrom
sap-contributions:lifecycle-type-backfill
Open

Add lifecycle_type backfill clock job and rake task#5196
philippthun wants to merge 1 commit into
cloudfoundry:mainfrom
sap-contributions:lifecycle-type-backfill

Conversation

@philippthun

@philippthun philippthun commented Jun 16, 2026

Copy link
Copy Markdown
Member

A one-off clock job that backfills the lifecycle_type column on apps, droplets, and builds for rows that pre-date the column's introduction. Once all installations have run it long enough to drain those rows, this job will be removed.

The job processes up to 1000 (BATCH_SIZE) * 10 (BATCHES_PER_RUN) rows per table in short transactions, idempotent and bounded. It is defensive against missing columns: schema(:table) is checked on each invocation, so it would be safe to be shipped together with the migration that introduces the column.

Operators can also run rake db:lifecycle_type_backfill[batch_size,batches_per_run] manually; passing -1 for batches_per_run drains until no NULL rows remain.

  • I have reviewed the contributing guide

  • I have viewed, signed, and submitted the Contributor License Agreement

  • I have made this pull request to the main branch

  • I have run all the unit tests using bundle exec rake

  • I have run CF Acceptance Tests

@johha johha left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It might be nice if operators have the option run the backfill as rake task manually.

A one-off clock job that backfills the lifecycle_type column on apps,
droplets, and builds for rows that pre-date the column's introduction.
Once all installations have run it long enough to drain those rows, this
job will be removed.

The job processes up to 1000 (BATCH_SIZE) * 10 (BATCHES_PER_RUN) rows
per table in short transactions, idempotent and bounded. It is defensive
against missing columns: schema(:table) is checked on each invocation,
so it would be safe to be shipped together with the migration that
introduces the column.

Operators can also run `rake db:lifecycle_type_backfill[batch_size,
batches_per_run]` manually; passing -1 for batches_per_run drains until
no NULL rows remain.
@philippthun philippthun force-pushed the lifecycle-type-backfill branch from a16ae37 to d309037 Compare June 26, 2026 12:48

@johha johha left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@philippthun philippthun changed the title Add lifecycle_type backfill clock job Add lifecycle_type backfill clock job and rake task Jun 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants