Skip to content

fix: migrate ApeCloud MySQL binlog path on upgrade#32

Open
wallyxjh wants to merge 1 commit into
fix/v0.9.3from
fix/v0.9.3-binlog-path-migration
Open

fix: migrate ApeCloud MySQL binlog path on upgrade#32
wallyxjh wants to merge 1 commit into
fix/v0.9.3from
fix/v0.9.3-binlog-path-migration

Conversation

@wallyxjh

Copy link
Copy Markdown
Collaborator

Summary

  • inject a compatibility init container for existing ApeCloud MySQL workloads during component workload reconciliation
  • migrate legacy /data/mysql/data/mysql-bin.* entries into /data/mysql/binlog/ before mysqld starts
  • rewrite /data/mysql/binlog/mysql-bin.index to absolute paths and mark successful migration to avoid repeat rewrites

Why

ApeCloud MySQL clusters created by older KB/addon versions can keep real binlog files under /data/mysql/data/mysql-bin.*. Newer configuration points log-bin and log_bin_index at /data/mysql/binlog/mysql-bin. After upgrade or reconfigure, WeSQL can start from the new bootstrap mysql-bin.000001 index and fail recovery with consensus_init_last_index_of_term for recovery failed.

Safety

  • runs only for existing workloads, not brand-new workloads
  • targets ApeCloud MySQL by image/component signals and requires the /data/mysql data mount
  • no-ops when the legacy index is absent, when the migration marker exists, or when the new index is already beyond bootstrap
  • backs up old/new index files and only moves conflicting target binlogs

Verification

  • go generate ./pkg/testutil/k8s/mocks/...
  • go test ./controllers/apps -run 'TestInjectMySQLBinlogPathCompatInitContainer|TestMemberJoinEnabled|TestDetectPodsToMemberJoin'\n- git diff --check\n\nNote: direct push to labring/fix/v0.9.3 is blocked by repository rules, so this PR targets that branch.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant