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

server: Make gc_worker's service safepoint special #3146

Merged
merged 5 commits into from
Nov 11, 2020

Conversation

MyonKeminta
Copy link
Contributor

Signed-off-by: MyonKeminta [email protected]

What problem does this PR solve?

Fixes #3136

What is changed and how it works?

This PR makes service safepoint with gc_worker a special one:

  • It has an initial value 0
  • Its TTL must be math.MaxInt64 (which represents infinity)
  • It cannot be deleted

Therefore, gc_worker's service safepoint is no longer symmetrical to other services' safepoints.

By the way, this PR also disallowed registering service safepoint with empty ID.

I'm not sure if returning errors.New(...) is a proper way to report errors. If it's not, I need better suggestions.

cc @leoppro

Check List

Tests

  • Unit test

Code changes

-

Side effects

  • Increased code complexity

Related changes

  • Need to cherry-pick to the release branch
    • release-4.0

Release note

  • No release note.

@MyonKeminta MyonKeminta added the needs-cherry-pick-release-4.0 The PR needs to cherry pick to release-4.0 branch. label Nov 3, 2020
@MyonKeminta
Copy link
Contributor Author

/test

@MyonKeminta MyonKeminta added this to the v4.0.9 milestone Nov 3, 2020
Copy link
Member

@overvenus overvenus left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@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

@MyonKeminta
Copy link
Contributor Author

@rleungx PTAL. Can this be merged?

@@ -45,6 +45,8 @@ const (
componentPath = "component"
customScheduleConfigPath = "scheduler_config"
encryptionKeysPath = "encryption_keys"
// GCWorkerServiceSafePointID is the ID of GCWorker's service GC safe point.
GCWorkerServiceSafePointID = "gc_worker"
Copy link
Member

Choose a reason for hiding this comment

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

How about changing this name to make it private?

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's used in test in tests/client/client_test.go .

Copy link
Member

Choose a reason for hiding this comment

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

prefer to use "gc_worker" directly in tests

@MyonKeminta
Copy link
Contributor Author

@rleungx @disksing PTAL again thx

@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Nov 6, 2020
@ti-chi-bot ti-chi-bot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Nov 9, 2020
@disksing
Copy link
Contributor

disksing commented Nov 9, 2020

/rebase

@disksing
Copy link
Contributor

disksing commented Nov 9, 2020

/run-all-tests

@disksing
Copy link
Contributor

disksing commented Nov 9, 2020

/merge

@ti-chi-bot
Copy link
Member

@disksing: It seems you want to merge this PR, I will help you trigger all the tests:
/run-all-tests

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the tidb-community-bots/prow-config repository.

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Nov 9, 2020
@ti-chi-bot
Copy link
Member

Can merge label has been added.

Git tree hash: 46a717b

@MyonKeminta
Copy link
Contributor Author

/merge

@ti-chi-bot
Copy link
Member

@MyonKeminta: It seems you want to merge this PR, I will help you trigger all the tests:
/run-all-tests

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the tidb-community-bots/prow-config repository.

@ti-chi-bot
Copy link
Member

@MyonKeminta: you cannot merge your own PR.

In response to this:

/merge

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the tidb-community-bots/prow-config repository.

@disksing
Copy link
Contributor

disksing commented Nov 9, 2020

/run-integration-lightning-test

@MyonKeminta
Copy link
Contributor Author

CI failed on lightning's test because lightning sets empty string as serviceID, while this PR added non-empty check.

@disksing
Copy link
Contributor

disksing commented Nov 9, 2020

CI failed on lightning's test because lightning sets empty string as serviceID, while this PR added non-empty check.

sad story. Should we update the lightning test?

@MyonKeminta
Copy link
Contributor Author

CI failed on lightning's test because lightning sets empty string as serviceID, while this PR added non-empty check.

sad story. Should we update the lightning test?

I thin lightning should fix the bug that it didn't set service ID.

By the way it's lucky we used gc_worker as service ID for TiDB, instead of using empty to show its specialness.

@MyonKeminta
Copy link
Contributor Author

MyonKeminta commented Nov 9, 2020

… or perhaps another choice is to remove the empty check from this PR first to merge this PR quickly, and add the empty check in another PR...

Then people who tries to use old versions of lightning on new tidb cluster will get the unfriendly error...
I have no idea...

@HunDunDM
Copy link
Member

HunDunDM commented Nov 9, 2020

Do we need to add support in pd-recover?

@MyonKeminta
Copy link
Contributor Author

@HunDunDM Sorry I didn't get it. What to recover?

@zier-one
Copy link
Member

/merge

@ti-chi-bot
Copy link
Member

@leoppro: It seems you want to merge this PR, I will help you trigger all the tests:

/run-all-tests

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the tidb-community-bots/prow-config repository.

@ti-chi-bot
Copy link
Member

@leoppro: adding 'status/cam-merge' is restricted to committers in list.

In response to this:

/merge

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the tidb-community-bots/prow-config repository.

@zier-one
Copy link
Member

/run-all-tests

@MyonKeminta
Copy link
Contributor Author

/run-all-tests

@MyonKeminta
Copy link
Contributor Author

/run-integration-lightning-test tidb-lightning=pr/460

@glorv
Copy link
Contributor

glorv commented Nov 10, 2020

/run-all-tests

@glorv
Copy link
Contributor

glorv commented Nov 11, 2020

/run-integration-lightning-test

@ti-chi-bot ti-chi-bot merged commit a140b42 into tikv:master Nov 11, 2020
ti-srebot pushed a commit to ti-srebot/pd that referenced this pull request Nov 11, 2020
@ti-srebot
Copy link
Contributor

cherry pick to release-4.0 in PR #3173

@MyonKeminta MyonKeminta deleted the m/gcworker-service-safepoint branch November 11, 2020 04:06
MyonKeminta added a commit to ti-srebot/pd that referenced this pull request Nov 11, 2020
MyonKeminta added a commit to ti-srebot/pd that referenced this pull request Nov 12, 2020
* server: Make gc_worker's service safepoint special

Signed-off-by: MyonKeminta <[email protected]>

* Address comments

Signed-off-by: MyonKeminta <[email protected]>

Co-authored-by: MyonKeminta <[email protected]>
Signed-off-by: MyonKeminta <[email protected]>
ti-chi-bot pushed a commit that referenced this pull request Nov 12, 2020
* server: Make gc_worker's service safepoint special

Signed-off-by: MyonKeminta <[email protected]>

* Address comments

Signed-off-by: MyonKeminta <[email protected]>

Co-authored-by: MyonKeminta <[email protected]>
Signed-off-by: MyonKeminta <[email protected]>

Co-authored-by: MyonKeminta <[email protected]>
Co-authored-by: MyonKeminta <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-cherry-pick-release-4.0 The PR needs to cherry pick to release-4.0 branch. status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PD need to set an initial value for "gc_worker"'s service safepoint when the cluster bootstraps
9 participants