Bug #111831 MySQL Operator - initdb with PVC
Submitted: 20 Jul 2023 16:27 Modified: 24 Jul 2023 15:48
Reporter: Carlos Abrantes Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Operator Severity:S3 (Non-critical)
Version: OS:Any
Assigned to: CPU Architecture:Any

[20 Jul 2023 16:27] Carlos Abrantes
Description:

Hi MySQL,

Can you please confirm how initDB with PVC is suppose to work?

I have the values:
initDB:
  dump:
    name: restore
    path: mysql-backup-schedule230719030102
    persistentVolumeClaim:
        claimName: backup-volume-claim-1

the PVC uses a PV on /var/volumes/restore. Inside the dir mysql-backup-schedule230719030102 with the dump.

The logs of sidecar ends with an exception that they could not find the dump.

[2023-07-20 16:19:03,895] sidecar              [INFO    ] Instance configured
[2023-07-20 16:19:03,896] sidecar              [INFO    ] Populate with dump
[2023-07-20 16:19:03,896] sidecar              [INFO    ] Initializing mysql from a dump...
[2023-07-20 16:19:03,897] sidecar              [INFO    ] ::load_dump
[2023-07-20 16:19:03,897] sidecar              [INFO    ] Executing load_dump(None, {'progressFile': ''})
Traceback (most recent call last):
  File "/usr/lib/mysqlsh/python-packages/mysqloperator/sidecar_main.py", line 428, in bootstrap
    initialize(session, datadir, pod, pod.get_cluster(), logger)
  File "/usr/lib/mysqlsh/python-packages/mysqloperator/sidecar_main.py", line 347, in initialize
    session = populate_db(datadir, session, cluster, pod, logger)
  File "/usr/lib/mysqlsh/python-packages/mysqloperator/sidecar_main.py", line 229, in populate_db
    return populate_with_dump(datadir, session, cluster, cluster.parsed_spec.initDB.dump, pod, logger)
  File "/usr/lib/mysqlsh/python-packages/mysqloperator/sidecar_main.py", line 201, in populate_with_dump
    initdb.load_dump(session, cluster, pod, init_spec, logger)
  File "/usr/lib/mysqlsh/python-packages/mysqloperator/controller/innodbcluster/initdb.py", line 289, in load_dump
    assert path
AssertionError
[2023-07-20 16:19:03,899] sidecar              [CRITICAL] Unhandled exception while bootstrapping MySQL:
[2023-07-20 16:19:03,899] sidecar              [INFO    ] Bootstrap error -1

The documentations dont have much details on how this suppose to work, besides i was not have to find in mysql-0 where those logs are coming from (sidecar) the PVC.

The only PVC is :
  datadir:
    Type:       PersistentVolumeClaim (a reference to a PersistentVolumeClaim in the same namespace)
    ClaimName:  datadir-mysql-0
    ReadOnly:   false

for the data dir.

if there is no restore PVC here how can a container load the dump?

Thanks,
Carlos Abrantes

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

How to repeat:
1- deploy a cluster

2- create a database

3- configure backup policy/schedule

4- after having a dump destroy the cluster

5- bootstrap a new cluster with the initDB.

Suggested fix:

1-load dump should found the dir to load data from
2-Documentation should be improved
[24 Jul 2023 15:48] MySQL Verification Team
Thank you for the report