Bug #112843 The mysql operator can't use snapshot, raise an error
Submitted: 26 Oct 2023 9:42 Modified: 31 Oct 2023 17:13
Reporter: Bing Ma (OCA) Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Operator Severity:S2 (Serious)
Version: OS:Ubuntu (on k8s )
Assigned to: CPU Architecture:x86

[26 Oct 2023 9:42] Bing Ma
Description:
when use snapshot backup, either in the ic resource or standalone mbk, always raise an error

How to repeat:
hava an ic resource

###
k get ic
NAME        STATUS   ONLINE   INSTANCES   ROUTERS   AGE
ic1026-03   ONLINE   1        1           1         7m42s

###
the mbk resource:
###

apiVersion: mysql.oracle.com/v2
kind: MySQLBackup
metadata:
  name: a-cool-one-off-snapshot
spec:
  clusterName: ic1026-03
#  backupProfileName: dump-instance-profile-pvc
#  backupProfileName: dump-instance-local-pvc
  backupProfile:
    name: snapshot-backup
    snapshot: # dumpInstance
      storage:
        s3:
          bucketName: mabing
          prefix: backup
#          config: aws
#          endpoint: https://s3.us-east-1.amazonaws.com
          config: s3-secret
          endpoint: http://172.30.47.0:30926

###
report an error
###
k get mbk
NAME                      CLUSTER     STATUS   OUTPUT                                    AGE
a-cool-one-off-snapshot   ic1026-03   Error    a-cool-one-off-snapshot-20231026-093312   7m39s

###
error logs of log
###
ls: cannot access '/.oci': No such file or directory
2023-10-26T09:33:52 - [INFO] [backup] backupdir=/mnt/storage
2023-10-26T09:33:52 - [INFO] [backup] Loading up MySQLBackup object oracle-mysql/a-cool-one-off-snapshot
2023-10-26T09:33:52 - [INFO] [backup] Starting backup of oracle-mysql/ic1026-03  profile=  backupdir=/mnt/storage
2023-10-26T09:33:53 - [INFO] [backup] Cluster status from ic1026-03-0 is OK_NO_TOLERANCE, member_status={"address": "ic1026-03-0.ic1026-03-instances.oracle-mysql.svc.cluster.local:3306", "applierWorkerThreads": 4, "fenceSysVars": [], "memberId": "86dd5543-73e2-11ee-b2aa-56e5e4bb9356", "memberRole": "PRIMARY", "memberState": "ONLINE", "mode": "R/W", "readReplicas": {}, "replicationLag": "applier_queue_applied", "role": "HA", "status": "ONLINE", "version": "8.1.0"} applier_queue_size=0
Traceback (most recent call last):
  File "/usr/lib/mysqlsh/python-packages/mysqloperator/backup_main.py", line 293, in command_do_create_backup
    backup.set_succeeded(job_name, start, utils.isotime(), info)
  File "/usr/lib/mysqlsh/python-packages/mysqloperator/controller/backup/backup_api.py", line 336, in set_succeeded
    patch["status"].update(info)
TypeError: 'NoneType' object is not iterable
2023-10-26T09:33:53 - [ERROR] [backup] Backup failed with an exception: 'NoneType' object is not iterable
2023-10-26T09:33:53 - [INFO] [backup] Command execute-backup finished with code False
[26 Oct 2023 10:01] Bing Ma
helm ls
NAME            NAMESPACE       REVISION        UPDATED                                 STATUS          CHART                           APP VERSION
ic1026-04       oracle-mysql    1               2023-10-26 17:49:19.666973783 +0800 CST deployed        mysql-innodbcluster-2.1.0       8.1.0      
operator        oracle-mysql    1               2023-10-23 10:33:08.889505079 +0800 CST deployed        mysql-operator-2.1.0            8.1.0-2.1.0

###
MySQLBackup is just the name of the custom resource and has nothing to do with whether it is a commercial version. My understanding is this
[26 Oct 2023 10:02] Bing Ma
helm ls
NAME            NAMESPACE       REVISION        UPDATED                                 STATUS          CHART                           APP VERSION
ic1026-04       oracle-mysql    1               2023-10-26 17:49:19.666973783 +0800 CST deployed        mysql-innodbcluster-2.1.0       8.1.0      
operator        oracle-mysql    1               2023-10-23 10:33:08.889505079 +0800 CST deployed        mysql-operator-2.1.0            8.1.0-2.1.0

###
MySQLBackup is just the name of the custom resource and has nothing to do with whether it is a commercial version. My understanding is this
[26 Oct 2023 12:36] MySQL Verification Team
Hi Bing Ma,

Apologies for previous note, my colleague...

Back to your report, can you tell me do you get same problem if you try to create snapshot locally and not to AWS ?

When I try examples from our documentation ( https://dev.mysql.com/doc/mysql-operator/en/mysql-operator-backups.html ) ti works ok.

Thanks
[26 Oct 2023 12:39] Bing Ma
it's locally, you can see I set endpoint to http://172.30.47.0:30926, it's minio's address
[26 Oct 2023 12:41] Bing Ma
the key point is "snapshot:", you misunderstanding what I mean, not backup
[26 Oct 2023 13:05] MySQL Verification Team
Hi,

Yes, but your storage is S3, you have S3 compatible API sitting on that url?

Anyhow, I need to test snapshot, it does work different from backup
[31 Oct 2023 17:13] MySQL Verification Team
Hi,

I verified the bug. Weird behavior with snapshot. Will see what the k8s team will say.