Description:
Hi,
I was trying to change the schedule time of the backup
As is:
kubecle -n mysql get cronjobs
NAME SCHEDULE SUSPEND ACTIVE LAST SCHEDULE AGE
mysql-backup-schedule-cb */5 * * * * False 0 4m11s 18d
i changed the values from schedule: "*/5 * * * *" to schedule: "1 3 * * *" (under backupSchedules) which made the following exception in operator logs
[2023-07-18 13:53:28,718] 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 58, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/lib/mysqlsh/python-packages/mysqloperator/controller/innodbcluster/operator_cluster.py", line 453, 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 344, in update_schedules
diff = compare_schedules(spec, old, new, logger)
File "/usr/lib/mysqlsh/python-packages/mysqloperator/controller/backup/backup_objects.py", line 318, in compare_schedules
if old_schedule_obj == new_schedule_obj:
File "/usr/lib/mysqlsh/python-packages/mysqloperator/controller/backup/backup_api.py", line 168, in __eq__
self.backupProfile == other.backupProfile and \
File "/usr/lib/mysqlsh/python-packages/mysqloperator/controller/backup/backup_api.py", line 105, in __eq__
assert isinstance(other, BackupProfile)
AssertionError
The same applies if changes are made to enabled: true (under backupSchedules), changing any of those values also makes:
[2023-07-18 14:01:50,892] 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 58, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/lib/mysqlsh/python-packages/mysqloperator/controller/innodbcluster/operator_cluster.py", line 453, 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 344, in update_schedules
diff = compare_schedules(spec, old, new, logger)
File "/usr/lib/mysqlsh/python-packages/mysqloperator/controller/backup/backup_objects.py", line 318, in compare_schedules
if old_schedule_obj == new_schedule_obj:
File "/usr/lib/mysqlsh/python-packages/mysqloperator/controller/backup/backup_api.py", line 168, in __eq__
self.backupProfile == other.backupProfile and \
File "/usr/lib/mysqlsh/python-packages/mysqloperator/controller/backup/backup_api.py", line 105, in __eq__
assert isinstance(other, BackupProfile)
AssertionError
Basically its not possible to apply changes to existing backup, we need to comment-out the backupSchedules so it can be removed, only then we are to provide the new schedule.
Version:
community-operator:8.0.33-2.0.10
community-server:8.0.33
community-router:8.0.33
apiVersion: v2
appVersion: 8.0.33
description: MySQL InnoDB Cluster Helm Chart for deploying MySQL InnoDB Cluster in Kubernetes
icon: https://labs.mysql.com/common/themes/sakila/favicon.ico
name: mysql-innodbcluster
type: application
version: 2.0.10
Thanks,
Carlos
How to repeat:
Deploy the cluster with a backupbackupProfiles:
- name: backup-profile-pvc
dumpInstance:
# dumpOptions:
# excludeSchemas: ["excludeme"]
storage:
persistentVolumeClaim:
claimName: backup-volume-claim-1
backupSchedules:
- name: backup-schedule
schedule: "1 3 * * *"
#schedule: "*/5 * * * *"
deleteBackupData: false
backupProfileName: backup-profile-pvc
enabled: true
change the existing schedule or enabled field.
Operator will start to log errors, nothing is updated
If we remove the all block of config and add it again its added with the new values.
Suggested fix:
Changing the values should be reflected in the k8s objects.