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

WIP: Do not set --capacity to tikv-server if resources.limits.storage is absent #951

Closed
wants to merge 1 commit into from

Conversation

cofyc
Copy link
Contributor

@cofyc cofyc commented Sep 25, 2019

What problem does this PR solve?

fixes #944

This makes it possible for users to set capacity in TiKV configuration.

What is changed and how does it work?

Do not set --capacity to tikv-server if resources.limits.storage is absent.

Check List

Tests

  • Unit test
  • E2E test
  • Manual test (add detailed scripts or steps below)

Code changes

  • Has Helm charts change
  • Has Go code change
  • Has CI related scripts change
  • Has documents change

Side effects

  • Breaking backward compatibility

Related changes

  • Need to cherry-pick to the release branch
  • Need to update the documentation

Does this PR introduce a user-facing change?:

Fix a bug that `raftstore.capacity` is ignored even if  `limits.storage` is absent.

@cofyc
Copy link
Contributor Author

cofyc commented Sep 25, 2019

/run-e2e-in-kind

1 similar comment
@cofyc
Copy link
Contributor Author

cofyc commented Sep 26, 2019

/run-e2e-in-kind

@cofyc cofyc force-pushed the fix944 branch 2 times, most recently from 86b8b62 to 0acb5c6 Compare September 26, 2019 05:10
@cofyc
Copy link
Contributor Author

cofyc commented Sep 26, 2019

/run-e2e-in-kind

given.
This makes it possible for users to set capacity in TiKV
configuration.
@cofyc
Copy link
Contributor Author

cofyc commented Sep 26, 2019

/run-e2e-in-kind

@tennix
Copy link
Member

tennix commented Sep 26, 2019

The 0 capacity means unlimited for TiKV, this is the same meaning that users do not set the limit of the storage. So I don't think it's necessary to do this change. Besides, when users upgrade tidb-operator to this version, the existing clusters maybe rolling upgrade due to pod spec changes which is unexpected behavior.

@cofyc
Copy link
Contributor Author

cofyc commented Sep 26, 2019

The 0 capacity means unlimited for TiKV, this is the same meaning that users do not set the limit of the storage.

The problem is users cannot specify capacity via raftstore.capacity configuration because it will be overridden by the --capacity 0 even if they didn't specify resources.limits.storage.

@cofyc
Copy link
Contributor Author

cofyc commented Sep 26, 2019

/run-e2e-in-kind

@tennix
Copy link
Member

tennix commented Sep 26, 2019

The 0 capacity means unlimited for TiKV, this is the same meaning that users do not set the limit of the storage.

The problem is users cannot specify capacity via raftstore.capacity configuration because it will be overridden by the --capacity 0 even if they didn't specify resources.limits.storage.

In this case, if users want to set raftstore.capacity, can we guide users to configure the storage limit? Since semantically this two should have the same meaning.

@cofyc
Copy link
Contributor Author

cofyc commented Sep 26, 2019

You mean we disable raftstore.capacity configuration and ask users to configure resources.limits.storage?

I don't think it's a good idea, it might confuse users that part of configuration does not take effect. It will be convenient to view all TiKV configuration in one place, especially we plan to manage component configurations via CRDs.

@cofyc
Copy link
Contributor Author

cofyc commented Sep 27, 2019

@weekface @aylei @onlymellb
What do you think?

@onlymellb
Copy link
Contributor

onlymellb commented Sep 29, 2019

I think this modification is reasonable, but introduce this PR will lead to the existing clusters rolling upgrade. So in order to avoid this problem, we should not modify the sts's pod spec but make a judgment in the tikv startup script, If CAPACITY is "-1" we do not specify the --capacity for tikv command-line arguments, otherwise specify --capacity =${CAPACITY} command-line arguments
as before. This is a compatible modification, what do you think?
@cofyc @weekface @tennix @aylei @xiaojingchen

@cofyc
Copy link
Contributor Author

cofyc commented Sep 29, 2019

you're right, it's an incompatible change.

but I don't like using a special -1 because it requires users to act if they want to use raftstore.capacity in TiKV configuration.

A general solution is to fix this kind of bugs in the next version of TiDBCluster CRD. When the user upgrades tidb-operator, it will set CAPACITY environment for the old version of TiDBCluster but don't for the new version of TiDBCluster (the meaning of tikv.resources.limit.storage does not change, except raftstore.capacity will not be overridden).

This can extend to other incompatible changes. We can hold this until we are going to release the next version of TiDBCluster, e.g. v1alpha2.

@onlymellb
Copy link
Contributor

If users want to use raftstore.capacity in TiKV configuration, they just don't set tikv.resources.limits.storage, if users want to specify command-line arguments just need to set
tikv.resources.limits.storage. Set CAPACITY to "-1"(of course, you can use any special tag to distinguish whether the user wants to use TiKV configuration or TiKV command-line.) is automatically by tidb-operator based on the user's behavior and is transparent to the user.

@cofyc
Copy link
Contributor Author

cofyc commented Sep 29, 2019

IIUC, the problem exists when the tidb-operator is upgraded, desired StatefulSet spec from the same CRD may change (if tikv.resources.limits.storage is absent). The original value for CAPACITY is 0, so setting CAPACITY to -1 automatically is the same as skipping it.

@onlymellb
Copy link
Contributor

Yes, this is what I think.

Copy link
Contributor

@DanielZhangQD DanielZhangQD left a comment

Choose a reason for hiding this comment

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

LGTM

@cofyc cofyc changed the title Do not set --capacity to tikv-server if resources.limits.storage is absent WIP: Do not set --capacity to tikv-server if resources.limits.storage is absent Sep 30, 2019
@tennix tennix added the status/WIP Issue/PR is being worked on label Oct 11, 2019
@cofyc cofyc closed this Dec 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status/WIP Issue/PR is being worked on
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Do not set --capacity to tikv-server if resources.limits.storage is not given
4 participants