Skip to content

Add time and thread_id for snapshot to check stale snapshots (#2229)#2240

Merged
ti-srebot merged 7 commits intopingcap:release-5.1from
ti-srebot:release-5.1-8f8b729e5c95
Jun 28, 2021
Merged

Add time and thread_id for snapshot to check stale snapshots (#2229)#2240
ti-srebot merged 7 commits intopingcap:release-5.1from
ti-srebot:release-5.1-8f8b729e5c95

Conversation

@ti-srebot
Copy link
Collaborator

@ti-srebot ti-srebot commented Jun 23, 2021

cherry-pick #2229 to release-5.1
You can switch your code base to this Pull Request by using git-extras:

# In tics repo:
git pr https://github.com/pingcap/tics/pull/2240

After apply modifications, you can push your change to this PR via:

git push git@github.com:ti-srebot/tics.git pr/2240:release-5.1-8f8b729e5c95

What problem does this PR solve?

Issue Number: related to #2199

Problem Summary: Suspicious that some tasks hold snapshot for a long time, prevent PageStorage from GCing old PageFiles

What is changed and how it works?

Add create_time and thread_id when creating snapshots. After PageStorage::gc, log the oldest snapshot living time and its thread_id.
We can trace to thread_id to know whether the snapshot is created for reading / background task.
When the create_time and thread_id and the period of logging files, we can know exactly which task holds the snapshot for a long time.

Related changes

Check List

Tests

  • Manual test (add detailed scripts or steps below)
    • Deploy a TiFlash with these changes to check the logging

Side effects

  • Performance regression
    • Consumes more CPU
    • Consumes more MEM

Release note

  • No release note

Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
@ti-srebot ti-srebot added CHERRY-PICK cherry pick status/LGT1 Indicates that a PR has LGTM 1. labels Jun 23, 2021
@ti-srebot ti-srebot requested a review from flowbehappy June 23, 2021 02:57
@ti-srebot ti-srebot added this to the v5.1.0 milestone Jun 23, 2021
Signed-off-by: JaySon-Huang <jayson.hjs@gmail.com>
Signed-off-by: JaySon-Huang <jayson.hjs@gmail.com>
@JaySon-Huang
Copy link
Contributor

merge the changes from #2241

Signed-off-by: JaySon-Huang <jayson.hjs@gmail.com>
Signed-off-by: JaySon-Huang <jayson.hjs@gmail.com>
Copy link
Contributor

@flowbehappy flowbehappy left a comment

Choose a reason for hiding this comment

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

LGTM

@JaySon-Huang JaySon-Huang modified the milestones: v5.1.0, v5.1.1 Jun 24, 2021
@JaySon-Huang
Copy link
Contributor

/merge

@ti-srebot ti-srebot added the status/can-merge Indicates a PR has been approved by a committer. label Jun 28, 2021
@ti-srebot
Copy link
Collaborator Author

/run-all-tests

@ti-srebot
Copy link
Collaborator Author

/run-all-tests

@ti-srebot ti-srebot merged commit 64120d2 into pingcap:release-5.1 Jun 28, 2021
@JaySon-Huang JaySon-Huang deleted the release-5.1-8f8b729e5c95 branch June 28, 2021 10:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CHERRY-PICK cherry pick status/can-merge Indicates a PR has been approved by a committer. status/LGT1 Indicates that a PR has LGTM 1.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants