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

ddl: Remove expired keys on PD #10406

Merged
merged 17 commits into from
Jun 20, 2019
Merged

ddl: Remove expired keys on PD #10406

merged 17 commits into from
Jun 20, 2019

Conversation

zimulala
Copy link
Contributor

@zimulala zimulala commented May 9, 2019

What problem does this PR solve?

We encounter the problem of etcd-io/etcd#9935. And @nolouch pull a PR to fix it.
Just in case, let's do a protective function.

What is changed and how it works?

Regularly deleted expired paths on etcd.

Check List

Tests

  • Unit test

Related changes

  • Need to cherry-pick to the release branch

@zhouqiang-cl
Copy link
Contributor

/run-all-tests

ddl/ddl_worker.go Outdated Show resolved Hide resolved
ddl/syncer.go Outdated Show resolved Hide resolved
ddl/syncer.go Outdated Show resolved Hide resolved
ddl/syncer.go Outdated Show resolved Hide resolved
ddl/syncer.go Outdated Show resolved Hide resolved
ddl/syncer.go Show resolved Hide resolved
@codecov
Copy link

codecov bot commented May 30, 2019

Codecov Report

Merging #10406 into master will decrease coverage by 0.4101%.
The diff coverage is 8.4337%.

@@               Coverage Diff                @@
##             master     #10406        +/-   ##
================================================
- Coverage   78.1549%   77.7447%   -0.4102%     
================================================
  Files           413        410         -3     
  Lines         87498      84443      -3055     
================================================
- Hits          68384      65650      -2734     
+ Misses        13971      13886        -85     
+ Partials       5143       4907       -236

@zimulala
Copy link
Contributor Author

PTAL @bb7133 @winkyao

ddl/syncer.go Outdated Show resolved Hide resolved

select {
case <-s.notifyCleanExpiredPathsCh:
for i := 0; i < opDefaultRetryCnt; i++ {
Copy link
Contributor

Choose a reason for hiding this comment

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

We can extract these codes into a func, to make it more readable.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it's OK. Here only get leases and do doCleanExpirePaths.

Copy link
Contributor

Choose a reason for hiding this comment

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

but the break in line 433 is not very obvious.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It does a retry, I think it's OK.

ddl/syncer.go Outdated Show resolved Hide resolved
@zimulala
Copy link
Contributor Author

PTAL @winkyao @bb7133 @crazycs520

@codecov
Copy link

codecov bot commented May 31, 2019

Codecov Report

Merging #10406 into master will increase coverage by 0.0365%.
The diff coverage is 78.6516%.

@@               Coverage Diff                @@
##             master     #10406        +/-   ##
================================================
+ Coverage   80.8732%   80.9097%   +0.0365%     
================================================
  Files           419        419                
  Lines         88661      88684        +23     
================================================
+ Hits          71703      71754        +51     
+ Misses        11731      11700        -31     
- Partials       5227       5230         +3

ddl/syncer.go Outdated Show resolved Hide resolved
Copy link
Contributor

@winkyao winkyao left a comment

Choose a reason for hiding this comment

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

rest LGTM

@winkyao
Copy link
Contributor

winkyao commented Jun 4, 2019

@zimulala Please address comments

Copy link
Contributor

@crazycs520 crazycs520 left a comment

Choose a reason for hiding this comment

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

LGTM

@crazycs520
Copy link
Contributor

/run-all-tests

@crazycs520 crazycs520 added the status/LGT1 Indicates that a PR has LGTM 1. label Jun 18, 2019
Copy link
Contributor

@winkyao winkyao left a comment

Choose a reason for hiding this comment

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

LGTM

@winkyao winkyao added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Jun 18, 2019
ddl/ddl.go Show resolved Hide resolved
// WaitTimeWhenErrorOccured is waiting interval when processing DDL jobs encounter errors.
WaitTimeWhenErrorOccured = 1 * time.Second
// ddlLogCtx uses for log.
ddlLogCtx = context.Background()
Copy link
Contributor

Choose a reason for hiding this comment

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

Lots of logutil.Logger(context.Background()) code snippets exist in this repo, I think we can provide a utility function logutil.BgLogger() to improve it.

Copy link
Contributor

Choose a reason for hiding this comment

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

We can refactor it in other PR.

Copy link
Contributor

Choose a reason for hiding this comment

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

OK

ddl/util/syncer.go Outdated Show resolved Hide resolved
@zimulala
Copy link
Contributor Author

PTAL @lonng

Copy link
Contributor

@lonng lonng left a comment

Choose a reason for hiding this comment

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

LGTM

@zimulala
Copy link
Contributor Author

/run-unit-test

@zimulala zimulala added status/LGT3 The PR has already had 3 LGTM. and removed status/LGT2 Indicates that a PR has LGTM 2. labels Jun 20, 2019
@zimulala
Copy link
Contributor Author

/run-integration-ddl-test tidb-test=pr/835

@zimulala
Copy link
Contributor Author

/run-common-test tidb-test=pr/835

@zimulala zimulala merged commit d23b894 into pingcap:master Jun 20, 2019
@zimulala zimulala deleted the rm-etcd-keys branch June 20, 2019 05:48
zimulala added a commit to zimulala/tidb that referenced this pull request Jun 28, 2019
zimulala added a commit to zimulala/tidb that referenced this pull request Jul 2, 2019
@you06 you06 added the sig/sql-infra SIG: SQL Infra label Mar 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sig/sql-infra SIG: SQL Infra status/LGT3 The PR has already had 3 LGTM.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants