Skip to content

Commit 9c51aad

Browse files
committed
Remind operators to run the backfill again after the deploy
The seed migrations run at the start of a rolling deploy, while old API servers are still serving traffic. Their old cleanup code can still delete start events that the new code depends on. Only running 'rake db:was_running_backfill' once after the deploy finishes closes that window. Until now this instruction lived only in the docs and the rake task description. Now the last seed migration also logs it, so it shows up in the migration output that operators see during the deploy.
1 parent d3e0b9f commit 9c51aad

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

db/migrations/20260601120300_seed_was_running_task_usage_events.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,14 @@
1313
VCAP::WasRunningBackfill.with_advisory_lock(self, wait: true) do
1414
VCAP::WasRunningBackfill.seed_task_usage_events(self, logger)
1515
end
16+
# This is the last of the three seed migrations, so remind the operator
17+
# here. The migrations run at the start of a rolling deploy, while old
18+
# API servers are still serving traffic; their old cleanup code can
19+
# still delete start events that the new code depends on. The seed
20+
# cannot see the future, so the operator has to close that window by
21+
# running the backfill once more after the deploy finishes.
22+
logger.info("WAS_RUNNING usage event backfill complete. If old API servers were still serving traffic during this deploy, run 'rake db:was_running_backfill' " \
23+
'once after the deploy finishes to repair anything they changed in the meantime.')
1624
end
1725
end
1826

0 commit comments

Comments
 (0)