diff --git a/addons/tidb/dataprotection/restore.sh b/addons/tidb/dataprotection/restore.sh index 5452367b8..60f93b40c 100644 --- a/addons/tidb/dataprotection/restore.sh +++ b/addons/tidb/dataprotection/restore.sh @@ -3,4 +3,4 @@ setStorageVar # shellcheck disable=SC2086 -/br restore full --pd "$PD_ADDRESS" --storage "s3://$BUCKET$DP_BACKUP_BASE_PATH?access-key=$ACCESS_KEY_ID&secret-access-key=$SECRET_ACCESS_KEY" --s3.endpoint "$ENDPOINT" $BR_EXTRA_ARGS +/br restore full --pd "$PD_ADDRESS" --storage "s3://$BUCKET$DP_BACKUP_BASE_PATH?access-key=$ACCESS_KEY_ID&secret-access-key=$SECRET_ACCESS_KEY" --s3.endpoint "$ENDPOINT" $BR_EXTRA_ARGS --with-sys-table diff --git a/addons/tidb/scripts/pd_memberleave.sh b/addons/tidb/scripts/pd_memberleave.sh index 8f4bc09e0..6f268e370 100644 --- a/addons/tidb/scripts/pd_memberleave.sh +++ b/addons/tidb/scripts/pd_memberleave.sh @@ -6,6 +6,13 @@ echo "$KB_LEAVE_MEMBER_POD_NAME" res=$(/pd-ctl member delete name "$KB_LEAVE_MEMBER_POD_NAME") echo "$res" not_found_pattern="Failed to delete member.*not found" -if [[ $res != "Success!" && ! $res =~ $not_found_pattern ]]; then +# this redirect_not_leader_pattern is a workaround when scaling in multiple pd instances, +# pd cluster may fail to create a new leader until the deleted members' pod is stopped. +# See: https://github.com/apecloud/apecloud/issues/13893#issuecomment-3574029284 +# In the future, when scale in is implemented in instanceset controller, we can have a better +# solution that does memberLeave one by one. +redirect_not_leader_pattern="redirect to not leader" +if [[ $res != "Success!" && ! $res =~ $not_found_pattern && ! $res =~ $redirect_not_leader_pattern ]]; then exit 1 fi +echo "member leave success" diff --git a/addons/tidb/templates/cmpd-tidb.yaml b/addons/tidb/templates/cmpd-tidb.yaml index ea0c4dc31..0bd4f0de9 100644 --- a/addons/tidb/templates/cmpd-tidb.yaml +++ b/addons/tidb/templates/cmpd-tidb.yaml @@ -11,6 +11,7 @@ spec: description: tidb's SQL layer serviceKind: MySQL updateStrategy: BestEffortParallel + podManagementPolicy: Parallel vars: - name: CLUSTER_NAMESPACE valueFrom: diff --git a/addons/tidb/templates/cmpd-tikv.yaml b/addons/tidb/templates/cmpd-tikv.yaml index f6106da0f..7663ba293 100644 --- a/addons/tidb/templates/cmpd-tikv.yaml +++ b/addons/tidb/templates/cmpd-tikv.yaml @@ -10,6 +10,7 @@ spec: provider: kubeblocks description: a distributed transactional key-value database updateStrategy: BestEffortParallel + podManagementPolicy: Parallel vars: - name: CLUSTER_NAMESPACE valueFrom: