dolphinscheduler icon indicating copy to clipboard operation
dolphinscheduler copied to clipboard

[Improvement-17928][API] Add worker group id to environment relation

Open qiuyanjun888 opened this issue 5 months ago • 1 comments

Was this PR generated or assisted by AI?

YES. This pull request was assisted by Hermes Agent / OpenAI Codex for code changes, focused tests, and local verification. The scope and final submission were directed by the contributor.

Purpose of the pull request

Closes #17928.

This pull request adds a stable worker group id to EnvironmentWorkerGroupRelation while keeping the existing worker group name field for compatibility.

Brief change log

  • Add workerGroupId / worker_group_id to EnvironmentWorkerGroupRelation, MyBatis mapping, base schema SQL, and upgrade SQL.
  • Backfill existing worker_group_id values in MySQL/PostgreSQL upgrade SQL by joining the legacy worker group name to t_ds_worker_group.
  • Persist workerGroupId when creating or updating environment-worker-group relations.
  • Use worker_group_id when checking environment dependencies before deleting worker groups, with legacy-name fallback only for rows whose worker_group_id is NULL.
  • Add focused DAO/API tests for persistence, create/update flows, and worker group delete dependency checks.

Verify this pull request

This change added tests and can be verified as follows:

  • git diff --check
  • ./mvnw -pl dolphinscheduler-dao,dolphinscheduler-api spotless:check -DskipTests -DskipITs -Djacoco.skip=true
  • ./mvnw -pl dolphinscheduler-dao,dolphinscheduler-api test -Dtest=EnvironmentWorkerGroupRelationMapperTest,EnvironmentServiceTest,WorkerGroupServiceTest -DskipITs -Dspotless.check.skip=true -Dcheckstyle.skip=true -Djacoco.skip=true

The focused Maven test run passed with 24 tests, 0 failures, 0 errors, and 0 skipped.

Pull Request Notice

Pull Request Notice

qiuyanjun888 avatar Jun 14 '26 13:06 qiuyanjun888

Thanks for the review. I have addressed this in the latest commit: the upgrade DDL now only adds the worker_group_id column, and the existing data backfill has been moved into the matching DML upgrade scripts for both MySQL and PostgreSQL.

qiuyanjun888 avatar Jun 15 '26 01:06 qiuyanjun888