Use "dirty bit enqueuing" for changesets
Created by: mrnugget
Fixes https://github.com/sourcegraph/sourcegraph/issues/12827.
This splits up the previous changesets.reconciler_state
column into two.
Previously:
changesets.reconciler_state: 'queued' | 'processing' | 'errored' | 'completed'
With this change:
changesets.enqueued: true | false
changesets.reconciler_state: 'processing' | 'errored' | 'completed'
The enqueued
acts like a dirty bit that's cleared when a changeset is dequeued.
That allows us to mark a changeset as enqueud while it's being processed.
On a higher level that means users can apply a new campaign spec, while the old one is still being applied.
There's more to do (see https://github.com/sourcegraph/sourcegraph/issues/12827#issuecomment-684829489 and https://github.com/sourcegraph/sourcegraph/issues/12827#issuecomment-684834304), but this is the start.