Description:
I installed MySQL InnoDB cluster helm chart with the following backup schedule.
```
backupProfiles:
- name: default-profile
dumpInstance:
storage:
persistentVolumeClaim:
claimName: backups
...
backupSchedules:
- name: default-profile
enabled: true
schedule: "0 * * * *"
backupProfileName: default-profile
```
After renaming the backup profile name, the operator starts throwing an error as below every minute.
```
[2022-12-15 09:41:07,990] kopf.objects [ERROR ] Handler 'on_innodbcluster_field_backup_schedules/spec.backupSchedules' failed with an exception. Will retry.
Traceback (most recent call last):
File "/usr/lib/mysqlsh/python-packages/kopf/_core/actions/execution.py", line 279, in execute_handler_once
result = await invoke_handler(
File "/usr/lib/mysqlsh/python-packages/kopf/_core/actions/execution.py", line 374, in invoke_handler
result = await invocation.invoke(
File "/usr/lib/mysqlsh/python-packages/kopf/_core/actions/invocation.py", line 139, in invoke
await asyncio.shield(future) # slightly expensive: creates tasks
File "/usr/lib64/python3.9/concurrent/futures/thread.py", line 52, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/lib/mysqlsh/python-packages/mysqloperator/controller/innodbcluster/operator_cluster.py", line 439, in on_innodbcluster_field_backup_schedules
backup_objects.update_schedules(cluster.parsed_spec, old, new, logger)
File "/usr/lib/mysqlsh/python-packages/mysqloperator/controller/backup/backup_objects.py", line 273, in update_schedules
diff = compare_schedules(spec, old, new, logger)
File "/usr/lib/mysqlsh/python-packages/mysqloperator/controller/backup/backup_objects.py", line 220, in compare_schedules
schedule.parse(old_object, "")
File "/usr/lib/mysqlsh/python-packages/mysqloperator/controller/backup/backup_api.py", line 139, in parse
print(f"Invalid backupProfileName '{self.backupProfileName}' in cluster {self.cluster_spec.namespace}/{self.cluster_spec.clusterName}")
AttributeError: 'InnoDBClusterSpec' object has no attribute 'clusterName'
```
How to repeat:
1. Install MySQL Operator helm chart
2. Install MySQL InnoDB Cluster helm chart with the following value.
```
backupProfiles:
- name: default-profile
dumpInstance:
storage:
persistentVolumeClaim:
claimName: backups
...
backupSchedules:
- name: default-profile
enabled: true
schedule: "0 * * * *"
backupProfileName: default-profile
```
3. Update MySQL InnoDB cluster with the following value.
```
backupProfiles:
- name: daily-backup
dumpInstance:
storage:
persistentVolumeClaim:
claimName: backups
...
backupSchedules:
- name: daily-backup
enabled: true
schedule: "0 * * * *"
backupProfileName: daily-backup
```
4. Check MySQL operator log
Suggested fix:
The error is from this line:
https://github.com/mysql/mysql-operator/blob/8.0.31-2.0.7/mysqloperator/controller/backup/...
And it's called from this line:
https://github.com/mysql/mysql-operator/blob/8.0.31-2.0.7/mysqloperator/controller/backup/...
To workaround, I put the original profile back and updated the MySQL InnoDB cluster.
After that, the operator removed the previous schedule and added a new, renamed schedule.
To fix it, if you cannot find the old schedule with the profile, then ti should be removed.