migrator -noop-privileged requires extra steps to run to completion
Created by: mike-r-mclaughlin
- Sourcegraph version: 3.42.0
- Platform information: AWS EKS, AWS Aurora Postgres DB
- Reported by: https://github.com/sourcegraph/accounts/issues/3
Description
When using the -noop-privileged
flag on the migrator
service we see this error:
failed to run migration for schema "codeinsights": refusing to apply a privileged migration: apply the following SQL and re-run with the added flag `-privileged-hash=Cj//46D7u5a/FcFwVUMHZuXUFMk=` to continue.
failed to run migration for schema "frontend": refusing to apply a privileged migration: apply the following SQL and re-run with the added flag `-privileged-hash=OIS9O2bWymbhwZP2fpXIYRVDGWQ=` to continue.
failed to run migration for schema "codeintel": refusing to apply a privileged migration: apply the following SQL and re-run with the added flag `-privileged-hash=svYbJIyJvvFs5A5cGdcG/lWjx5E=` to continue.
The extensions were installed on the database prior to starting the migrator. The migrator is started with:
migrator up -noop-privileged
We tried to re-run migrator with the flags provided:
Example: migrator up –noop-privileged --privileged-hash=svYbJIyJvvFs5A5cGdcG/lWjx5E=
After that, we received this error:
{"SeverityText":"ERROR","Timestamp":1662528318994625372,"InstrumentationScope":"runner","Caller":"runner/run.go:289","Function":"[github.com/sourcegraph/sourcegraph/internal/database/migration/runner](http://github.com/sourcegraph/sourcegraph/internal/database/migration/runner).(*Runner).checkPrivilegedState","Body":"Unexpected value provided for -privileged-hash for this operation. This value is likely left over from an invocation of privileged migrations during a previous upgrade.","Resource":{"service.name":"migrator","service.version":"3.42.0","[service.instance.id](http://service.instance.id/)":"sourcegraph-frontend-74554c45bb-wn6c7"},"Attributes":{"schema":"codeintel","given":"Cj//46D7u5a/FcFwVUMHZuXUFMk=","expected":"svYbJIyJvvFs5A5cGdcG/lWjx5E="}}
Then, we ran: migrator up –noop-privileged --privileged-hash=svYbJIyJvvFs5A5cGdcG/lWjx5E= --ignore-single-dirty-log
which got the schema installation completed.
Questions
- Did we miss a step somewhere?
- We need to fully automate this. How do we go about that?
/cc @sourcegraph/delivery