Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
Task Run Payload for HA Scheduler State
Problem
TaskRunSchedulerInfo is stored in-memory in Bus.sync.Map. This breaks HA:
- Lost on replica crash
- Not shared across replicas
- UI can't show why a task is waiting if the tracking replica dies
Solution
Add a payload JSONB column to task_run table, storing a TaskRunPayload proto that contains SchedulerInfo. Future fields can be added to the proto without schema changes.
Design
Proto
proto/store/store/task_run.proto:
message TaskRunPayload {
SchedulerInfo scheduler_info = 1;
// Future fields added here without schema changes
}
Schema
Migration backend/migrator/migration/3.14/0032##task_run_payload.sql:
ALTER TABLE task_run ADD COLUMN payload jsonb NOT NULL DEFAULT '{}';
Store Layer
backend/store/task_run.go:
- Add
PayloadProto *storepb.TaskRunPayloadtoTaskRunMessage - Read: Add
payloadto SELECT, unmarshal withprotojson - Write:
UpdateTaskRunPayload(ctx, taskRunID, payload)method
Scheduler
backend/runner/taskrun/pending_scheduler.go:
storeParallelLimitCause(): WriteTaskRunPayload{SchedulerInfo: ...}to DBpromoteTaskRun(): Write emptyTaskRunPayload{}to clear
API
backend/api/v1/rollout_service_converter.go:
- Remove
bus *bus.Busparameter - Read
SchedulerInfofromtaskRun.PayloadProto.SchedulerInfo
Cleanup
backend/component/bus/bus.go:
- Remove
TaskRunSchedulerInfo sync.Map
Files to Modify
proto/store/store/task_run.proto- AddTaskRunPayloadbackend/migrator/migration/3.14/0032##task_run_payload.sql- Newbackend/migrator/migration/LATEST.sql- Add columnbackend/migrator/migrator_test.go- Update versionbackend/store/task_run.go- Add field and methodsbackend/runner/taskrun/pending_scheduler.go- Use storebackend/api/v1/rollout_service_converter.go- Remove Busbackend/api/v1/rollout_service.go- Update converter callsbackend/component/bus/bus.go- Remove field