Skip to content

fix(scheduler): qualify SQL retry templates to fix multi-bean startup failure#1087

Open
bishnubista wants to merge 6 commits into
conductor-oss:mainfrom
bishnubista:fix/scheduler-retry-template
Open

fix(scheduler): qualify SQL retry templates to fix multi-bean startup failure#1087
bishnubista wants to merge 6 commits into
conductor-oss:mainfrom
bishnubista:fix/scheduler-retry-template

Conversation

@bishnubista

Copy link
Copy Markdown

Summary

When the scheduler Postgres or MySQL persistence module is loaded alongside the full Conductor server context, startup can fail because multiple RetryTemplate beans are present: core's onTransientErrorRetryTemplate and the DB-specific postgresRetryTemplate / mysqlRetryTemplate. The scheduler SchedulerDAO and SchedulerArchivalDAO constructors autowired RetryTemplate by type, which is ambiguous and can cause a NoUniqueBeanDefinitionException during context refresh.

This change qualifies the constructor parameters in both scheduler persistence modules so the correct DB-specific retry template is injected:

  • PostgresSchedulerConfiguration: schedulerDAO and schedulerArchivalDAO now require @Qualifier("postgresRetryTemplate").
  • MySQLSchedulerConfiguration: schedulerDAO and schedulerArchivalDAO now require @Qualifier("mysqlRetryTemplate").

The shared smoke-test fixture now reproduces the multi-bean context by registering core's onTransientErrorRetryTemplate plus each DB-specific retry template. The tests assert both SchedulerDAO and SchedulerArchivalDAO are created with the expected concrete classes and verify both DAOs hold the DB-specific RetryTemplate instance.

Testing

Fail-first verified before applying the production fix: both smoke tests failed with two RetryTemplate beans (onTransientErrorRetryTemplate plus postgresRetryTemplate / mysqlRetryTemplate). After the fix:

./gradlew :conductor-scheduler-postgres-persistence:test --tests '*PostgresSchedulerAutoConfigurationSmokeTest'
./gradlew :conductor-scheduler-mysql-persistence:test --tests '*MySQLSchedulerAutoConfigurationSmokeTest'
./gradlew :conductor-scheduler-postgres-persistence:test --tests '*PostgresSchedulerAutoConfigurationSmokeTest' \
          :conductor-scheduler-mysql-persistence:test --tests '*MySQLSchedulerAutoConfigurationSmokeTest'
./gradlew spotlessApply
git diff --check

Docker Compose validation with Postgres:

YARN_OPTS='--network-timeout 10000000' docker compose -f docker/docker-compose-postgres.yaml up -d --build
  • Docker build completed successfully.
  • conductor-server and conductor-postgres reached healthy state.
  • curl http://localhost:8000/health returned HTTP 200 with healthy=true.
  • Scheduler persistence auto-configuration was exercised: Postgres contained the scheduler, scheduler_execution, and scheduler_next_run tables, and flyway_schema_history_scheduler showed successful rows for the baseline plus migrations 1 and 2.
  • Note: /api/scheduler/schedules returned 404 in the vanilla compose setup, so Docker verification was scoped to the scheduler persistence auto-configuration path via migrations and tables rather than scheduler HTTP calls.
  • Teardown: docker compose -f docker/docker-compose-postgres.yaml down -v.

Fixes

Fixes #1084

@bishnubista bishnubista marked this pull request as ready for review May 13, 2026 20:20
@bishnubista bishnubista force-pushed the fix/scheduler-retry-template branch from 4f3f1d7 to b5dd80f Compare May 14, 2026 18:52
@bishnubista

Copy link
Copy Markdown
Author

@v1r3n Can you please review?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] scheduler module fails to start on a Postgres-backed Conductor — unqualified RetryTemplate autowire collides with two existing beans

2 participants