Skip to content

add improvements for async deployment - #1385

Draft
hors wants to merge 1 commit into
mainfrom
add-async-impr
Draft

add improvements for async deployment#1385
hors wants to merge 1 commit into
mainfrom
add-async-impr

Conversation

@hors

@hors hors commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator

CHANGE DESCRIPTION

Problem:
Short explanation of the problem.

Cause:
Short explanation of the root cause of the issue if applicable.

Solution:
Short explanation of the solution we are providing with this PR.

CHECKLIST

Jira

  • Is the Jira ticket created and referenced properly?
  • Does the Jira ticket have the proper statuses for documentation (Needs Doc) and QA (Needs QA)?
  • Does the Jira ticket link to the proper milestone (Fix Version field)?

Tests

  • Is an E2E test/test case added for the new feature/change?
  • Are unit tests added where appropriate?

Config/Logging/Testability

  • Are all needed new/changed options added to default YAML files?
  • Are all needed new/changed options added to the Helm Chart?
  • Did we add proper logging messages for operator actions?
  • Did we ensure compatibility with the previous version or cluster upgrade process?
  • Does the change support oldest and newest supported PS version?
  • Does the change support oldest and newest supported Kubernetes version?

Copilot AI review requested due to automatic review settings June 11, 2026 22:17
@pull-request-size pull-request-size Bot added the size/L 100-499 lines label Jun 11, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR improves async (Orchestrator-based) deployments by making rollouts less prone to deadlock, adding automated repair for certain broken replication channels after failover, and introducing a policy-driven way to handle errant GTIDs (including optional Orchestrator-assisted reconciliation).

Changes:

  • Propagate TLS topology-monitoring settings into the Orchestrator config and extend Orchestrator client support for replication thread state + errant GTIDs operations.
  • Improve StatefulSet smart update behavior by proactively deleting unready pods that are still on an outdated controller revision.
  • Add async replica repair logic (including configurable errant GTID handling), wire the new policy into CRDs/examples/defaults, and expand unit coverage around backup image validation.

Reviewed changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
pkg/orchestrator/orchestrator.go Adds TLS topology-monitoring settings into generated Orchestrator config when SSL secret is configured.
pkg/orchestrator/client.go Extends Orchestrator API model with replication thread states, errant GTID field, and adds gtid-errant-inject-empty endpoint wrapper.
pkg/db/replication.go Ensures replication channel is configured with GET_SOURCE_PUBLIC_KEY=1 during CHANGE REPLICATION SOURCE.
pkg/controller/ps/upgrade.go Avoids rollout deadlock by deleting pods that are unready and still on an outdated revision before waiting for full readiness.
pkg/controller/ps/controller.go Improves ordered deletion logging, adds broken-replica repair and errant GTID handling during replication reconciliation.
deploy/cw-bundle.yaml Updates bundled CRD schema to include errantTransactionsPolicy with default/enum.
deploy/crd.yaml Updates CRD schema to include errantTransactionsPolicy with default/enum.
deploy/cr.yaml Documents the new errantTransactionsPolicy field in the example CR.
deploy/bundle.yaml Updates bundled CRD schema to include errantTransactionsPolicy with default/enum.
config/crd/bases/ps.percona.com_perconaservermysqls.yaml Adds errantTransactionsPolicy to the base CRD schema with default/enum.
cmd/internal/db/db.go Adds GET_SOURCE_PUBLIC_KEY=1 to internal replication channel setup SQL.
cmd/example-gen/scripts/lib/ps.sh Excludes spec.mysql.errantTransactionsPolicy from generated example output.
cmd/example-gen/pkg/defaults/manual.go Sets default ErrantTransactionsPolicy for manual defaults generation.
cmd/bootstrap/async/async_replication.go Prevents cloning over a datadir that already executed GTIDs to avoid silent data loss after failover.
api/v1/perconaservermysql_types.go Introduces ErrantTransactionsPolicy API type and exposes it on MySQLSpec.
api/v1/perconaservermysql_types_test.go Adds coverage for backups-disabled scenarios regarding backup image requirement.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

log.Info("Ensuring oldest mysql node is the primary")
currentPrimary, err := orchestrator.ClusterPrimary(ctx, r.ClientCmd, orcPod, cr.ClusterHint())
if err != nil {
log.Info("Could not determine current primary from Orchestrator, skipping primary switch", "error", err)
Comment on lines +1138 to +1144
for _, instance := range clusterInstances {
if instance.Alias == primary.Alias {
continue
}
if instance.MasterKey.Hostname != primary.Key.Hostname {
continue
}
Comment on lines +164 to +168
log.Printf("Datadir has executed GTIDs (%s), skipping clone to preserve local data", gtidExecuted)
requireClone = false

if err := createCloneLock(cloneLock); err != nil {
return errors.Wrap(err, "create clone lock")
@JNKPercona

Copy link
Copy Markdown
Collaborator
Test Name Result Time
async-ignore-annotations-8-4 passed 00:06:18
async-global-metadata-8-4 passed 00:13:36
async-upgrade-8-0 failure 00:07:12
async-upgrade-8-4 failure 00:07:11
auto-config-8-4 passed 00:19:41
config-8-4 passed 00:16:01
config-router-8-0 passed 00:07:29
config-router-8-4 passed 00:07:29
demand-backup-8-0 passed 00:19:15
demand-backup-8-4 passed 00:19:49
gr-pitr-minio-8-4 passed 00:28:05
gr-pitr-one-pod-8-4 passed 00:10:59
async-pitr-minio-8-4 passed 00:25:24
demand-backup-cloud-8-4 passed 00:22:10
demand-backup-retry-8-4 passed 00:16:58
demand-backup-incremental-8-0 passed 00:33:41
demand-backup-incremental-8-4 passed 00:34:15
async-data-at-rest-encryption-8-0 passed 00:14:29
async-data-at-rest-encryption-8-4 passed 00:13:42
gr-cross-cluster-8-0 passed 00:15:52
gr-cross-cluster-8-4 passed 00:16:55
gr-global-metadata-8-4 passed 00:14:37
gr-data-at-rest-encryption-8-0 passed 00:15:25
gr-data-at-rest-encryption-8-4 passed 00:14:13
gr-demand-backup-8-4 passed 00:12:06
gr-demand-backup-cloud-8-4 passed 00:21:54
gr-demand-backup-haproxy-8-4 passed 00:09:59
gr-demand-backup-incremental-8-0 passed 00:51:17
gr-demand-backup-incremental-8-4 passed 00:53:11
gr-finalizer-8-4 passed 00:06:11
gr-haproxy-8-0 passed 00:04:25
gr-haproxy-8-4 passed 00:04:05
gr-ignore-annotations-8-4 passed 00:04:46
gr-init-deploy-8-0 passed 00:09:44
gr-init-deploy-8-4 passed 00:09:50
gr-one-pod-8-4 passed 00:05:32
gr-recreate-8-4 passed 00:18:01
gr-scaling-8-4 passed 00:08:03
gr-scheduled-backup-8-4 passed 00:15:26
gr-scheduled-backup-incremental-8-4 passed 00:21:55
gr-security-context-8-4 passed 00:09:35
gr-self-healing-8-4 passed 00:24:16
gr-tls-cert-manager-8-4 passed 00:10:10
gr-users-8-4 passed 00:06:31
gr-upgrade-8-0 passed 00:09:25
gr-upgrade-8-4 passed 00:10:21
haproxy-8-0 passed 00:08:00
haproxy-8-4 passed 00:08:05
init-deploy-8-0 failure 00:05:53
init-deploy-8-4 failure 00:05:38
limits-8-4 passed 00:06:31
monitoring-8-4 passed 00:13:26
one-pod-8-0 passed 00:06:35
one-pod-8-4 passed 00:05:51
operator-self-healing-8-4 passed 00:11:36
pvc-resize-8-4 passed 00:05:48
recreate-8-4 passed 00:11:59
scaling-8-4 passed 00:10:44
scheduled-backup-8-0 passed 00:15:23
scheduled-backup-8-4 passed 00:15:26
scheduled-backup-incremental-8-0 passed 00:21:50
scheduled-backup-incremental-8-4 passed 00:22:47
service-per-pod-8-4 passed 00:07:43
sidecars-8-4 passed 00:04:51
smart-update-8-4 passed 00:08:15
storage-8-4 passed 00:03:57
telemetry-8-4 passed 00:06:16
tls-cert-manager-8-4 passed 00:10:46
users-8-0 passed 00:07:46
users-8-4 passed 00:07:45
version-service-8-4 passed 00:19:53
Summary Value
Tests Run 71/71
Job Duration 02:31:43
Total Test Time 16:20:45

commit: 459ae65
image: perconalab/percona-server-mysql-operator:PR-1385-459ae657

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/L 100-499 lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants