Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

owner: fix stale tasks cleanup #504

Merged
merged 4 commits into from
Apr 27, 2020

Conversation

amyangfei
Copy link
Contributor

@amyangfei amyangfei commented Apr 27, 2020

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.

  • capture info, which has a 3s session TTL
    /tidb/cdc/capture/b64e38d7-1f11-441a-ab64-3fd11838c77d
  • task status
    /tidb/cdc/task/status/b64e38d7-1f11-441a-ab64-3fd11838c77d/27ce907f-4cb7-4775-a11e-8be6a34e9c91
  • task position
    /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 both task status and task 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

  • Unit test
  • Integration test

@amyangfei amyangfei added the subject/ha Denotes an issue or pull request is related to high availability. label Apr 27, 2020
@amyangfei
Copy link
Contributor Author

/run-integration-tests

@amyangfei amyangfei added the status/ptal Could you please take a look? label Apr 27, 2020
@amyangfei amyangfei requested a review from zier-one April 27, 2020 08:55
Copy link
Contributor

@zier-one zier-one left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@zier-one zier-one added the LGT1 label Apr 27, 2020
@zier-one zier-one merged commit 477f3c6 into pingcap:master Apr 27, 2020
5kbpers pushed a commit to 5kbpers/ticdc that referenced this pull request Aug 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status/ptal Could you please take a look? subject/ha Denotes an issue or pull request is related to high availability.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants