-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[db] long running migration for filling the organizationid in workspaces #16269
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
8255076
to
9751876
Compare
started the job as gitpod-build-se-migration-orgid-ws.2 because the annotations in the pull request description changed |
/werft run with-clean-slate-deployment 👍 started the job as gitpod-build-se-migration-orgid-ws.3 |
/hold |
components/gitpod-db/src/long-running-migration/long-running-migration.ts
Outdated
Show resolved
Hide resolved
d3b0ed9
to
4de3f40
Compare
9751876
to
4bf7d78
Compare
4bf7d78
to
da771a6
Compare
log.info(`Running long running migration '${migration.getName()}' ...`); | ||
const now = new Date(); | ||
try { | ||
const completed = await migration.runMigrationBatch(); | ||
log.info( | ||
`Long running migration ${migration.getName()} took ${new Date().getTime() - now.getTime()}ms`, | ||
{ completed }, | ||
); | ||
migrationMetaData.completed = completed; | ||
} catch (e) { | ||
log.error(`Long running migration ${migration.getName()} failed`, e); | ||
} | ||
allCompleted = allCompleted && migrationMetaData.completed; | ||
migrationMetaData.lastRun = new Date(); | ||
await repo.save(migrationMetaData); | ||
} | ||
return allCompleted; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As a follow-up, it would be nice to export a metric if the batch+job failed, or succeeded such that we can check, or setup alerting for these. This would be in particular useful for Dedicated, where we don't have access to logs.
/unhold |
Description
This PR introduces a long-running migration and small service that manages and executes it.
This relies on new workspaces getting an organizationId see #16261
Related Issue(s)
See #16177
How to test
Release Notes
Documentation
Build Options:
Experimental feature to run the build with GitHub Actions (and not in Werft).
leeway-target=components:all
Run Leeway with
--dont-test
Preview Environment Options:
If enabled this will build
install/preview
If enabled this will create the environment on GCE infra
Valid options are
all
,workspace
,webapp
,ide
,jetbrains
,vscode
,ssh