Skip to content

K8SPXC-1737: fix panic in reconcileReplication#2406

Open
pooknull wants to merge 3 commits intomainfrom
K8SPXC-1737
Open

K8SPXC-1737: fix panic in reconcileReplication#2406
pooknull wants to merge 3 commits intomainfrom
K8SPXC-1737

Conversation

@pooknull
Copy link
Copy Markdown
Contributor

@pooknull pooknull commented Mar 19, 2026

https://perconadev.atlassian.net/browse/K8SPXC-1737

DESCRIPTION

Problem:
reconcileReplication() may panic when .status.pxc.version contains an invalid pxc version

Cause:
CompareMySQLVersion() does not validate .status.pxc.version before parsing it.

Solution:
Make CompareMySQLVersion() return an error when .status.pxc.version is empty or invalid. If .status.pxc.version is empty, compare against the version read from the primary pod. Otherwise compare against the .status.pxc.version. If it is invalid, return an error and continue reconcile.

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?
  • Are OpenShift compare files changed for E2E tests (compare/*-oc.yml)?

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 PXC version?
  • Does the change support oldest and newest supported Kubernetes version?

@pull-request-size pull-request-size bot added the size/M 30-99 lines label Mar 19, 2026
@pooknull pooknull marked this pull request as ready for review March 27, 2026 12:05
}
is840 = compare840 >= 0
} else {
is840 = version.Must(version.NewVersion(dbVer)).Compare(version.Must(version.NewVersion("8.4.0"))) >= 0
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.

maybe we can assign this to a var at line 163 and shorten this line?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@egegunes egegunes changed the title K8SPXC-1737: fix panic K8SPXC-1737: fix panic in reconcileReplication Apr 6, 2026
@JNKPercona
Copy link
Copy Markdown
Collaborator

Test Name Result Time
auto-tuning-8-0 passed 00:00:00
allocator-8-0 passed 00:00:00
allocator-8-4 passed 00:00:00
backup-storage-tls-8-0 passed 00:00:00
cross-site-8-0 passed 00:00:00
custom-users-8-0 passed 00:00:00
demand-backup-cloud-8-0 passed 00:00:00
demand-backup-cloud-8-4 passed 00:00:00
demand-backup-cloud-pxb-8-0 passed 00:00:00
demand-backup-encrypted-with-tls-5-7 passed 00:00:00
demand-backup-encrypted-with-tls-8-0 passed 00:00:00
demand-backup-encrypted-with-tls-8-4 passed 00:00:00
demand-backup-encrypted-with-tls-pxb-5-7 passed 00:00:00
demand-backup-encrypted-with-tls-pxb-8-0 passed 00:00:00
demand-backup-encrypted-with-tls-pxb-8-4 passed 00:00:00
demand-backup-8-0 passed 00:00:00
demand-backup-flow-control-8-0 passed 00:00:00
demand-backup-flow-control-8-4 passed 00:00:00
demand-backup-parallel-8-0 passed 00:00:00
demand-backup-parallel-8-4 passed 00:00:00
demand-backup-without-passwords-8-0 passed 00:00:00
demand-backup-without-passwords-8-4 passed 00:00:00
extra-pvc-8-0 passed 00:00:00
haproxy-5-7 passed 00:00:00
haproxy-8-0 passed 00:00:00
haproxy-8-4 passed 00:00:00
init-deploy-5-7 passed 00:00:00
init-deploy-8-0 passed 00:00:00
limits-8-0 passed 00:00:00
monitoring-2-0-8-0 passed 00:00:00
monitoring-pmm3-8-0 passed 00:00:00
monitoring-pmm3-8-4 passed 00:00:00
one-pod-5-7 passed 00:00:00
one-pod-8-0 passed 00:00:00
pitr-8-0 passed 00:00:00
pitr-8-4 passed 00:00:00
pitr-pxb-8-0 passed 00:00:00
pitr-pxb-8-4 passed 00:00:00
pitr-gap-errors-8-0 passed 00:00:00
pitr-gap-errors-8-4 passed 00:00:00
proxy-protocol-8-0 passed 00:00:00
proxy-switch-8-0 passed 00:00:00
proxysql-sidecar-res-limits-8-0 passed 00:00:00
proxysql-scheduler-8-0 passed 00:00:00
pvc-resize-5-7 passed 00:00:00
pvc-resize-8-0 passed 00:14:47
recreate-8-0 passed 00:00:00
restore-to-encrypted-cluster-8-0 passed 00:00:00
restore-to-encrypted-cluster-8-4 passed 00:00:00
restore-to-encrypted-cluster-pxb-8-0 passed 00:00:00
restore-to-encrypted-cluster-pxb-8-4 passed 00:00:00
scaling-proxysql-8-0 passed 00:00:00
scaling-8-0 passed 00:00:00
scheduled-backup-5-7 passed 00:00:00
scheduled-backup-8-0 passed 00:00:00
scheduled-backup-8-4 passed 00:00:00
security-context-8-0 passed 00:00:00
smart-update1-8-0 passed 00:00:00
smart-update1-8-4 passed 00:00:00
smart-update2-8-0 passed 00:00:00
smart-update2-8-4 passed 00:00:00
smart-update3-8-0 passed 00:00:00
storage-8-0 passed 00:00:00
tls-issue-cert-manager-ref-8-0 passed 00:00:00
tls-issue-cert-manager-8-0 passed 00:00:00
tls-issue-self-8-0 passed 00:00:00
upgrade-consistency-8-0 passed 00:00:00
upgrade-consistency-8-4 passed 00:00:00
upgrade-haproxy-5-7 passed 00:00:00
upgrade-haproxy-8-0 passed 00:00:00
upgrade-proxysql-5-7 passed 00:00:00
upgrade-proxysql-8-0 passed 00:00:00
users-5-7 passed 00:00:00
users-8-0 passed 00:00:00
users-scheduler-8-4 passed 00:00:00
validation-hook-8-0 passed 00:00:00
Summary Value
Tests Run 76/76
Job Duration 00:41:00
Total Test Time 00:14:47

commit: ccc095b
image: perconalab/percona-xtradb-cluster-operator:PR-2406-ccc095ba

@egegunes egegunes added this to the v1.20.0 milestone Apr 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/M 30-99 lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants