Skip to content

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

Merged
JaySon-Huang merged 6 commits intopingcap:release-5.0from
ti-srebot:release-5.0-8f8b729e5c95
Jun 23, 2021
Merged

Add time and thread_id for snapshot to check stale snapshots (#2229)#2239
JaySon-Huang merged 6 commits intopingcap:release-5.0from
ti-srebot:release-5.0-8f8b729e5c95

Conversation

@ti-srebot
Copy link
Collaborator

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

cherry-pick #2229 to release-5.0
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/2239

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

git push git@github.com:ti-srebot/tics.git pr/2239:release-5.0-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.0.3 milestone Jun 23, 2021
JaySon-Huang and others added 2 commits June 23, 2021 12:02
@JaySon-Huang
Copy link
Contributor

/run-all-tests

@JaySon-Huang JaySon-Huang changed the title Add time and thread_id for snapshot to check stale snapshots (#2229) [DNM] Add time and thread_id for snapshot to check stale snapshots (#2229) Jun 23, 2021
Signed-off-by: JaySon-Huang <jayson.hjs@gmail.com>
Signed-off-by: JaySon-Huang <jayson.hjs@gmail.com>
@JaySon-Huang JaySon-Huang changed the title [DNM] Add time and thread_id for snapshot to check stale snapshots (#2229) Add time and thread_id for snapshot to check stale snapshots (#2229) Jun 23, 2021
@JaySon-Huang
Copy link
Contributor

merge the changes from #2241

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

/run-all-tests

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 merged commit 6eab68e into pingcap:release-5.0 Jun 23, 2021
@JaySon-Huang JaySon-Huang deleted the release-5.0-8f8b729e5c95 branch June 23, 2021 11:50
JaySon-Huang added a commit to JaySon-Huang/tiflash that referenced this pull request Jun 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CHERRY-PICK cherry pick status/LGT1 Indicates that a PR has LGTM 1.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants