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

gcworker: skip GC if the safe point isn't changed #22482

Merged
merged 3 commits into from
Jan 25, 2021

Conversation

youjiali1995
Copy link
Contributor

Signed-off-by: youjiali1995 zlwgx1023@gmail.com

What problem does this PR solve?

Issue Number: close #15007 #16602

Problem Summary:

skip GC if the safe point isn't changed

What is changed and how it works?

What's Changed:

skip GC if the safe point isn't changed

Related changes

Check List

Tests

  • Unit test

Release note

  • No release note

Signed-off-by: youjiali1995 <zlwgx1023@gmail.com>
Copy link
Contributor

@MyonKeminta MyonKeminta left a comment

Choose a reason for hiding this comment

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

LGTM, but actually I hope if there's a way to make the lastSafePoint field in mysql.tidb able to store the ts value as well as displaying the time format.

@ti-srebot ti-srebot added the status/LGT1 Indicates that a PR has LGTM 1. label Jan 22, 2021
Copy link
Member

@jackysp jackysp left a comment

Choose a reason for hiding this comment

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

LGTM

@ti-srebot ti-srebot removed the status/LGT1 Indicates that a PR has LGTM 1. label Jan 25, 2021
@ti-srebot ti-srebot added the status/LGT2 Indicates that a PR has LGTM 2. label Jan 25, 2021
@jackysp
Copy link
Member

jackysp commented Jan 25, 2021

/merge

@ti-srebot ti-srebot added the status/can-merge Indicates a PR has been approved by a committer. label Jan 25, 2021
@ti-srebot
Copy link
Contributor

/run-all-tests

@ti-srebot
Copy link
Contributor

/run-all-tests

@ti-srebot ti-srebot merged commit f3688eb into pingcap:master Jan 25, 2021
@@ -324,7 +324,7 @@ func (w *GCWorker) checkPrepare(ctx context.Context) (bool, uint64, error) {
if err != nil || !ok {
return false, 0, errors.Trace(err)
}
newSafePoint, newSafePointValue, err := w.calculateNewSafePoint(ctx, now)
newSafePoint, newSafePointValue, err := w.calcNewSafePoint(ctx, now)
Copy link
Contributor

Choose a reason for hiding this comment

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

This new safe point is saved before locks are resolved. Then, if we fail to resolve locks and we don't advance the global min start ts, GC will not retry.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

How about saving it after GC is done?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think it ok.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/GC sig/transaction SIG:Transaction status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2. type/bugfix This PR fixes a bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

GC doesn't skip when safe point is equal to the previous safe point
5 participants