Skip to content

Commit

Permalink
Merge pull request #41 from doyoubi/AddMigrationLimitConfig
Browse files Browse the repository at this point in the history
Add migration_limit config in Undermoon CR
  • Loading branch information
doyoubi authored Dec 19, 2021
2 parents 25f9ede + 14c176c commit df1f639
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 1 deletion.
4 changes: 4 additions & 0 deletions api/v1alpha1/undermoon_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ type UndermoonSpec struct {
// COUNT arguments for SCAN command during migration.
// +kubebuilder:validation:Minimum=1
MigrationScanCount uint32 `json:"migrationScanCount"`
// Maximum concurrent migration shard number.
// This can't be updated.
// +kubebuilder:validation:Minimum=1
MigrationLimit uint32 `json:"migrationLimit"`
// Disable failover for server proxies.
DisableFailover bool `json:"disableFailover"`

Expand Down
1 change: 1 addition & 0 deletions config/cr/bases/undermoon_v1alpha1_undermoon.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ spec:
proxyThreads: 2
migrationScanInterval: 1000
migrationScanCount: 16
migrationLimit: 2
disableFailover: false
undermoonImage: localhost:5000/undermoon_test
undermoonImagePullPolicy: IfNotPresent
Expand Down
3 changes: 3 additions & 0 deletions config/cr/overlays/helm/replace_values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
- op: replace
path: /spec/migrationScanCount
value: "{{ .Values.cluster.migrationScanCount }}"
- op: replace
path: /spec/migrationLimit
value: "{{ .Values.cluster.migrationLimit }}"
- op: replace
path: /spec/disableFailover
value: "{{ .Values.cluster.disableFailover }}"
Expand Down
7 changes: 7 additions & 0 deletions config/crd/bases/undermoon.doyoubi.mydomain_undermoons.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -712,6 +712,12 @@ spec:
format: int32
minimum: 1
type: integer
migrationLimit:
description: Maximum concurrent migration shard number. This can't
be updated.
format: int32
minimum: 1
type: integer
migrationScanCount:
description: COUNT arguments for SCAN command during migration.
format: int32
Expand Down Expand Up @@ -2323,6 +2329,7 @@ spec:
- clusterName
- disableFailover
- maxMemory
- migrationLimit
- migrationScanCount
- migrationScanInterval
- port
Expand Down
6 changes: 5 additions & 1 deletion controllers/broker.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ func createBrokerStatefulSet(cr *undermoonv1alpha1.Undermoon) *appsv1.StatefulSe
},
{
Name: "UNDERMOON_MIGRATION_LIMIT",
Value: "2",
Value: fmt.Sprintf("%d", cr.Spec.MigrationLimit),
},
{
Name: "UNDERMOON_RECOVER_FROM_META_FILE",
Expand Down Expand Up @@ -242,6 +242,10 @@ func brokerStatefulSetChanged(reqLogger logr.Logger, cr *undermoonv1alpha1.Under
return true
}

// Since changing migration_limit for broker may result in
// inconsistent generated metadata for the same epoch in different brokers,
// we won't update migration_limit.

return false
}

Expand Down
1 change: 1 addition & 0 deletions helm/undermoon-cluster/templates/undermoon.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ spec:
disableFailover: {{ .Values.cluster.disableFailover }}
imagePullSecrets: {{- toYaml .Values.imagePullSecrets | nindent 4 }}
maxMemory: {{ .Values.cluster.maxMemory }}
migrationLimit: {{ .Values.cluster.migrationLimit }}
migrationScanCount: {{ .Values.cluster.migrationScanCount }}
migrationScanInterval: {{ .Values.cluster.migrationScanInterval }}
nodeSelector: {{- toYaml .Values.nodeSelector | nindent 4 }}
Expand Down
1 change: 1 addition & 0 deletions helm/undermoon-cluster/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ cluster:
proxyThreads: 4
migrationScanInterval: 1000
migrationScanCount: 16
migrationLimit: 2
disableFailover: false

image:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,11 @@ spec:
format: int32
minimum: 1
type: integer
migrationLimit:
description: Maximum concurrent migration shard number. This can't be updated.
format: int32
minimum: 1
type: integer
migrationScanCount:
description: COUNT arguments for SCAN command during migration.
format: int32
Expand Down Expand Up @@ -1548,6 +1553,7 @@ spec:
- clusterName
- disableFailover
- maxMemory
- migrationLimit
- migrationScanCount
- migrationScanInterval
- port
Expand Down

0 comments on commit df1f639

Please sign in to comment.