fix(dts): [173335400] pause running sync job before isolation on delete#4314
Open
Rajendraladkat1919 wants to merge 1 commit into
Open
Conversation
…tion on delete The Delete function called IsolateSyncJobs directly on running jobs, which Tencent rejects with UnsupportedOperation. Added a pre-isolation status check that pauses the job first if it is still running, then proceeds with isolation. Also fixed the Read function to return nil (not an error) when the job is not found, allowing Terraform to remove stale state entries gracefully instead of failing every subsequent plan. Fixes: UnsupportedOperation.UnsupportedOperationError on destroy Fixes: "resource syncJob sync-xxx does not exist" breaking plan after out-of-band deletion
Rajendraladkat1919
force-pushed
the
fix/dts-sync-job-delete-lifecycle
branch
from
July 16, 2026 07:02
7a6f8aa to
c591e52
Compare
Author
|
Im an external contributor and don't have access to an internal Tencent ticket ID required by the PR title format ([{9-digit-id}]). Could a maintainer assign one and update the title before merging? |
Rajendraladkat1919
force-pushed
the
fix/dts-sync-job-delete-lifecycle
branch
from
July 16, 2026 07:59
a867a6f to
c591e52
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Fix tencentcloud_dts_sync_job to pause a running job before attempting isolation on delete, and return nil instead of an error when the job is not found during Read.
Why
Delete bug: The Delete function calls IsolateSyncJobs directly regardless of the job's current state. Tencent rejects isolation on a running or syncing job with:
UnsupportedOperation.UnsupportedOperationError: Current job is temporarily unable to respond to isolation events
This makes it impossible to destroy a tencentcloud_dts_sync_job resource through Terraform while the job is actively syncing — which is the normal production state. Every terraform destroy or config removal requires manual console intervention to pause the job first.
Read bug: When a job is not found, the Read function calls d.SetId("") correctly but then returns fmt.Errorf(...) instead of nil. The error overrides the state ID clear, so Terraform fails every subsequent plan with resource syncJob sync-xxx does not exist rather than automatically removing the stale entry from state. This breaks pipelines whenever a job is deleted outside Terraform.
Type of change
Bug fix
Changes
resource_tc_dts_sync_job.go — Delete:
Added a pre-isolation status check. If the job is in a running/syncing state, PauseSyncJob is called first and the function waits for Paused status before proceeding with isolation. Jobs already in NotBilledByInternational or NotBilled trade status are treated as gone and return nil immediately.
resource_tc_dts_sync_job.go — Read:
Changed return fmt.Errorf(...) to return nil after d.SetId("") so Terraform gracefully removes missing resources from state instead of erroring.
service_tencentcloud_dts.go:
Added PauseDtsSyncJobById helper following the same pattern as the existing IsolateDtsSyncJobById.
Checklist
make build succeeds locally
make fmt produces no diff
make lint passes
make check-mux passes
Acceptance tests added or updated
Changelog entry added under .changelog/.txt
Notes for reviewers
The delete sequence is now: check status → pause if running → wait for Paused → isolate → wait for Isolated/NotBilled → destroy → wait for Offlined. This mirrors the manual steps required to delete a DTS sync job via the Tencent Cloud Console and follows the same polling pattern already used elsewhere in this file.
The NotBilledByInternational early-exit path (lines 329–331 in the original) is preserved — PostPay jobs that enter this state after isolation are auto-removed by Tencent and do not need an explicit destroy call.