Detect if migrations have been executed
A Graylog cluster only works correctly, if all MongoDB migrations have been executed. There are currently two options how migrations are run:
- The leader node of a cluster executes migrations in a dedicated startup phase
- Migrations are explicitly triggered by running the
graylog migratecommand prior to starting any node in the cluster
If a node is started without migrations being run, this is potentially dangerous. This applies to both a pristine Graylog setup or, more importantly after a version upgrade of a Graylog cluster.
There are a couple of scenarios how this could happen:
- A non-leader node is started as the first node.
- Automatic execution of migrations has been disabled (
run_migrations=false) but thegraylog migratecommand has not been executed prior to starting a node
We should detect this situation and handle it properly, e.g. by delaying node startup until migrations have been executed by a different node or the migration command. We might also abort node startup altogether.
As a detection mechanism we could keep track of the set of migrations that have been executed in MongoDB. Alternatively we could track the software version of the cluster in MongoDB and update it only after migrations have been run successfully. There might be other options.
Do I understand correctly that this work is a requirement to automatic leader election becoming on by default?
Do I understand correctly that this work is a requirement to automatic leader election becoming on by default?
@tellistone Yes - and it's the only blocker that I am aware of.