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

api: add initialized flag in cluster status #1555

Merged
merged 3 commits into from Jun 3, 2019
Merged

Conversation

@disksing
Copy link
Contributor

@disksing disksing commented May 31, 2019

Signed-off-by: disksing i@disksing.com

What problem does this PR solve?

When initializing the cluster, PD needs to spend some time to add replica to the first region. If tidb-server is started before finish adding replica, the data may be written to single replica.

What is changed and how it works?

PD adds an flag of whether the region is initialized or not. Later tidb-ansible need to check whether it needs to wait for a while before starting tidb.

Check List

Tests

  • Unit test
  • Manual test (add detailed scripts or steps below)
    start a cluster then check the output of curl http://127.0.0.1:2379/pd/api/v1/cluster/status

Code changes

  • Has HTTP API interfaces change

Side effects

  • Breaking backward compatibility: Before this, we allow to config max-replicas=3 and only start 1 tikv-server. It will be required to set max-replicas=1 to start the cluster.

Related changes

  • Need to cherry-pick to the release branch: cherry-pick to release-3.0
  • Need to update the tidb-ansible repository: ansible need to check the status before starting tidb-server
  • Need to be included in the release notes
Signed-off-by: disksing <i@disksing.com>
@disksing disksing requested review from overvenus, nolouch and rleungx May 31, 2019
server/cluster.go Outdated Show resolved Hide resolved
server/cluster.go Outdated Show resolved Hide resolved
Signed-off-by: disksing <i@disksing.com>
@disksing
Copy link
Contributor Author

@disksing disksing commented Jun 3, 2019

@gregwebs @rleungx comments addressed.

@nolouch
nolouch approved these changes Jun 3, 2019
server/cluster.go Show resolved Hide resolved
@rleungx
rleungx approved these changes Jun 3, 2019
@disksing disksing merged commit 4a451d2 into tikv:master Jun 3, 2019
5 checks passed
5 checks passed
ci/circleci Your tests passed on CircleCI!
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@sre-bot
idc-jenkins-ci/build Jenkins job succeeded.
Details
@sre-bot
idc-jenkins-ci/test Jenkins job succeeded.
Details
license/cla Contributor License Agreement is signed.
Details
@disksing disksing deleted the disksing:initialized branch Jun 3, 2019
disksing added a commit to disksing/pd that referenced this pull request Jun 13, 2019
* api: add initialized flag in cluster status

Signed-off-by: disksing <i@disksing.com>

* make loadBootstrapTime() better

Signed-off-by: disksing <i@disksing.com>
nolouch added a commit that referenced this pull request Jun 14, 2019
* api: add initialized flag in cluster status

Signed-off-by: disksing <i@disksing.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants