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 problem does this PR solve?
Fix a but that task information may be not totally cleanup, and blocks the replication.
When a new owner
throne
, it firstly cleans up existing stale task information. Because the new owner does not know the events occurs before, like processor deletion, it always tries to check task status to find stale task information. As for stale task information, there are three kinds of resource./tidb/cdc/capture/b64e38d7-1f11-441a-ab64-3fd11838c77d
/tidb/cdc/task/status/b64e38d7-1f11-441a-ab64-3fd11838c77d/27ce907f-4cb7-4775-a11e-8be6a34e9c91
/tidb/cdc/task/position/b64e38d7-1f11-441a-ab64-3fd11838c77d/27ce907f-4cb7-4775-a11e-8be6a34e9c91
If task status is deleted, but task position is stale, the
cleanUpStaleTasks
doesn't cleanup correctly.What is changed and how it works?
merge all
capture id
from bothtask status
andtask position
, and remove them at the same time. It is ok to remove a non-existent key from etcd, as it is a delete range operation.Check List
Tests