MariaDB restore workflow

The OpenStack database restore workflow includes the following phases:

  1. Restoration phase 1:

    The mariadb-phy-restore job launches the mariadb-phy-restore pod. This pod contains the main restore script, which is responsible for:

    • Scaling of the mariadb-server StatefulSet

    • Verifying of the mariadb-server pods statuses

    • Managing of the openstack-mariadb-phy-restore-runner pods


    During the restoration, the database is not available for OpenStack services that means a complete outage of all OpenStack services.

    During the first phase, the following actions are performed:

    1. Save the list of mariadb-server persistent volume claims (PVC).

    2. Scale the mariadb server StatefulSet to 0 replicas. At this point, the database becomes unavailable for OpenStack services.


  2. Restoration phase 2:

    1. The mariadb-phy-restore pod launches openstack-mariadb-phy-restore-runner with the first mariadb-server replica PVC mounted to the /var/lib/mysql folder and the backup PVC mounted to /var/backup. The openstack-mariadb-phy-restore-runner pod performs the following actions:

      1. Unarchives the database backup files to a temporary directory within /var/backup.

      2. Executes mariabackup --prepare on the unarchived data.

      3. Creates the .prepared file in the temporary directory in /var/backup.

      4. Restores the backup to /var/lib/mysql.

      5. Exits with 0.

    2. The script in the mariadb-phy-restore pod collects the logs from the openstack-mariadb-phy-restore-runner pod and removes the pod. Then, the script launches the next openstack-mariadb-phy-restore-runner pod for the next mariadb-server replica PVC. The openstack-mariadb-phy-restore-runner pod restores the backup to /var/lib/mysql and exits with 0.

      Step 2 is repeated for every mariadb-server replica PVC sequentially.

    3. When the last replica’s data is restored, the last openstack-mariadb-phy-restore-runner pod removes the .prepared file and the temporary folder with unachieved data from /var/backup.


  3. Restoration phase 3:

    1. The mariadb-phy-restore pod scales the mariadb-server StatefulSet back to the configured number of replicas.

    2. The mariadb-phy-restore pod waits until all mariadb-server replicas are ready.