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

wait leaders transfer back after a tikv upgrade #4863

Merged
merged 12 commits into from
Feb 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 31 additions & 1 deletion docs/api-references/docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -21193,7 +21193,23 @@ string
<td>
<em>(Optional)</em>
<p>EvictLeaderTimeout indicates the timeout to evict tikv leader, in the format of Go Duration.
Defaults to 10m</p>
Defaults to 1500min</p>
</td>
</tr>
<tr>
<td>
<code>waitLeaderTransferBackTimeout</code></br>
<em>
<a href="https://godoc.org/k8s.io/apimachinery/pkg/apis/meta/v1#Duration">
Kubernetes meta/v1.Duration
</a>
</em>
</td>
<td>
<em>(Optional)</em>
<p>WaitLeaderTransferBackTimeout indicates the timeout to wait for leader transfer back before
the next tikv upgrade.</p>
<p>Defaults to 400s</p>
</td>
</tr>
<tr>
Expand Down Expand Up @@ -21332,6 +21348,7 @@ map[string]github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TiKVStore
</em>
</td>
<td>
<p>key: store id</p>
</td>
</tr>
<tr>
Expand Down Expand Up @@ -21720,6 +21737,19 @@ Kubernetes meta/v1.Time
TODO: remove nullable, <a href="https://github.com/kubernetes/kubernetes/issues/86811">https://github.com/kubernetes/kubernetes/issues/86811</a></p>
</td>
</tr>
<tr>
<td>
<code>leaderCountBeforeUpgrade</code></br>
<em>
int32
</em>
</td>
<td>
<p>LeaderCountBeforeUpgrade records the leader count before upgrade.</p>
<p>It is set when evicting leader and used to wait for most leaders to transfer back after upgrade.
It is unset after leader transfer is completed.</p>
</td>
</tr>
</tbody>
</table>
<h3 id="tikvtitancfconfig">TiKVTitanCfConfig</h3>
Expand Down
20 changes: 20 additions & 0 deletions manifests/crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30590,6 +30590,8 @@ spec:
x-kubernetes-list-type: map
version:
type: string
waitLeaderTransferBackTimeout:
type: string
required:
- replicas
type: object
Expand Down Expand Up @@ -33784,6 +33786,9 @@ spec:
leaderCount:
format: int32
type: integer
leaderCountBeforeUpgrade:
format: int32
type: integer
podName:
type: string
state:
Expand Down Expand Up @@ -33858,6 +33863,9 @@ spec:
leaderCount:
format: int32
type: integer
leaderCountBeforeUpgrade:
format: int32
type: integer
podName:
type: string
state:
Expand Down Expand Up @@ -33886,6 +33894,9 @@ spec:
leaderCount:
format: int32
type: integer
leaderCountBeforeUpgrade:
format: int32
type: integer
podName:
type: string
state:
Expand Down Expand Up @@ -34031,6 +34042,9 @@ spec:
leaderCount:
format: int32
type: integer
leaderCountBeforeUpgrade:
format: int32
type: integer
podName:
type: string
state:
Expand Down Expand Up @@ -34105,6 +34119,9 @@ spec:
leaderCount:
format: int32
type: integer
leaderCountBeforeUpgrade:
format: int32
type: integer
podName:
type: string
state:
Expand Down Expand Up @@ -34133,6 +34150,9 @@ spec:
leaderCount:
format: int32
type: integer
leaderCountBeforeUpgrade:
format: int32
type: integer
podName:
type: string
state:
Expand Down
20 changes: 20 additions & 0 deletions manifests/crd/v1/pingcap.com_tidbclusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17335,6 +17335,8 @@ spec:
x-kubernetes-list-type: map
version:
type: string
waitLeaderTransferBackTimeout:
type: string
required:
- replicas
type: object
Expand Down Expand Up @@ -20529,6 +20531,9 @@ spec:
leaderCount:
format: int32
type: integer
leaderCountBeforeUpgrade:
format: int32
type: integer
podName:
type: string
state:
Expand Down Expand Up @@ -20603,6 +20608,9 @@ spec:
leaderCount:
format: int32
type: integer
leaderCountBeforeUpgrade:
format: int32
type: integer
podName:
type: string
state:
Expand Down Expand Up @@ -20631,6 +20639,9 @@ spec:
leaderCount:
format: int32
type: integer
leaderCountBeforeUpgrade:
format: int32
type: integer
podName:
type: string
state:
Expand Down Expand Up @@ -20776,6 +20787,9 @@ spec:
leaderCount:
format: int32
type: integer
leaderCountBeforeUpgrade:
format: int32
type: integer
podName:
type: string
state:
Expand Down Expand Up @@ -20850,6 +20864,9 @@ spec:
leaderCount:
format: int32
type: integer
leaderCountBeforeUpgrade:
format: int32
type: integer
podName:
type: string
state:
Expand Down Expand Up @@ -20878,6 +20895,9 @@ spec:
leaderCount:
format: int32
type: integer
leaderCountBeforeUpgrade:
format: int32
type: integer
podName:
type: string
state:
Expand Down
20 changes: 20 additions & 0 deletions manifests/crd/v1beta1/pingcap.com_tidbclusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17308,6 +17308,8 @@ spec:
x-kubernetes-list-type: map
version:
type: string
waitLeaderTransferBackTimeout:
type: string
required:
- replicas
type: object
Expand Down Expand Up @@ -20499,6 +20501,9 @@ spec:
leaderCount:
format: int32
type: integer
leaderCountBeforeUpgrade:
format: int32
type: integer
podName:
type: string
state:
Expand Down Expand Up @@ -20573,6 +20578,9 @@ spec:
leaderCount:
format: int32
type: integer
leaderCountBeforeUpgrade:
format: int32
type: integer
podName:
type: string
state:
Expand Down Expand Up @@ -20601,6 +20609,9 @@ spec:
leaderCount:
format: int32
type: integer
leaderCountBeforeUpgrade:
format: int32
type: integer
podName:
type: string
state:
Expand Down Expand Up @@ -20746,6 +20757,9 @@ spec:
leaderCount:
format: int32
type: integer
leaderCountBeforeUpgrade:
format: int32
type: integer
podName:
type: string
state:
Expand Down Expand Up @@ -20820,6 +20834,9 @@ spec:
leaderCount:
format: int32
type: integer
leaderCountBeforeUpgrade:
format: int32
type: integer
podName:
type: string
state:
Expand Down Expand Up @@ -20848,6 +20865,9 @@ spec:
leaderCount:
format: int32
type: integer
leaderCountBeforeUpgrade:
format: int32
type: integer
podName:
type: string
state:
Expand Down
20 changes: 20 additions & 0 deletions manifests/crd_v1beta1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30558,6 +30558,8 @@ spec:
x-kubernetes-list-type: map
version:
type: string
waitLeaderTransferBackTimeout:
type: string
required:
- replicas
type: object
Expand Down Expand Up @@ -33749,6 +33751,9 @@ spec:
leaderCount:
format: int32
type: integer
leaderCountBeforeUpgrade:
format: int32
type: integer
podName:
type: string
state:
Expand Down Expand Up @@ -33823,6 +33828,9 @@ spec:
leaderCount:
format: int32
type: integer
leaderCountBeforeUpgrade:
format: int32
type: integer
podName:
type: string
state:
Expand Down Expand Up @@ -33851,6 +33859,9 @@ spec:
leaderCount:
format: int32
type: integer
leaderCountBeforeUpgrade:
format: int32
type: integer
podName:
type: string
state:
Expand Down Expand Up @@ -33996,6 +34007,9 @@ spec:
leaderCount:
format: int32
type: integer
leaderCountBeforeUpgrade:
format: int32
type: integer
podName:
type: string
state:
Expand Down Expand Up @@ -34070,6 +34084,9 @@ spec:
leaderCount:
format: int32
type: integer
leaderCountBeforeUpgrade:
format: int32
type: integer
podName:
type: string
state:
Expand Down Expand Up @@ -34098,6 +34115,9 @@ spec:
leaderCount:
format: int32
type: integer
leaderCountBeforeUpgrade:
format: int32
type: integer
podName:
type: string
state:
Expand Down
10 changes: 8 additions & 2 deletions pkg/apis/pingcap/v1alpha1/openapi_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 9 additions & 1 deletion pkg/apis/pingcap/v1alpha1/tidbcluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ const (
defaultSeparateRaftLog = false
defaultEnablePVReclaim = false
// defaultEvictLeaderTimeout is the timeout limit of evict leader
defaultEvictLeaderTimeout = 1500 * time.Minute
defaultEvictLeaderTimeout = 1500 * time.Minute
defaultWaitLeaderTransferBackTimeout = 400 * time.Second
// defaultTiCDCGracefulShutdownTimeout is the timeout limit of graceful
// shutdown a TiCDC pod.
defaultTiCDCGracefulShutdownTimeout = 10 * time.Minute
Expand Down Expand Up @@ -147,6 +148,13 @@ func (tc *TidbCluster) TiKVEvictLeaderTimeout() time.Duration {
return defaultEvictLeaderTimeout
}

func (tc *TidbCluster) TiKVWaitLeaderTransferBackTimeout() time.Duration {
if tc.Spec.TiKV != nil && tc.Spec.TiKV.WaitLeaderTransferBackTimeout != nil {
return tc.Spec.TiKV.WaitLeaderTransferBackTimeout.Duration
}
return defaultWaitLeaderTransferBackTimeout
}

// TiFlashImage return the image used by TiFlash.
//
// If TiFlash isn't specified, return empty string.
Expand Down
Loading