Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explicitly support mariadb upgrade from 10.1 to 10.2 #1160

Merged
merged 13 commits into from Oct 9, 2018

Conversation

rfay
Copy link
Member

@rfay rfay commented Oct 6, 2018

The Problem/Issue/Bug:

We incidentally upgraded mariadb from 10.1 to 10.2 when upgrading the container in #1123

However, you need to run mysql_upgrade when you do that. So we need to run mysql_upgrade on existing databases when they come up.

How this PR Solves The Problem:

  • Test to find out the expected mariadb version of the existing database. A new file is added to /var/lib/mysql to suggest this. If not found, it's assumed the version is/was 10.1
  • If we have a different mariadb version, run mysql_upgrade

Manual Testing Instructions:

  • Create a database/project using ddev v1.2.0 (or with drud/ddev-dbserver:v1.2.0 in config.yaml; it seems to be compatible.
  • ddev rm
  • Bring up the db with this version of ddev or with dbimage: drud/ddev-dbserver:20181006_mariadb_upgrade in config.yaml
  • ddev logs should show no errors, and you should see in there "Running mysql_upgrade" and a successful run.
  • Snapshot your new db.
  • ddev rm
  • ddev start
  • Inspect the db logs with ddev logs -s db. You should not see the mysql_upgrade, and should not see errors.
  • Restore your snapshot and then inspect with ddev logs -s db. You should not see the "Running mysql_upgrade"

Test bind-migration workflow:

  • Use a project with a bind-mounted (old) db or just mkdir ~/.ddev//mysql
  • ddev start
  • You should get an error explaining what to do.

Consider testing restore-snapshot with old snapshot

  • Create a snapshot with v1.2
  • Try to restore it with v1.3
  • You should get a comprehensible error and a link to docs to workaround.

Automated Testing Overview:

  • I added a test in containers/ddev-dbserver that loads a 10.1 database, runs our container with it, checks for the upgrade happening, then rm's the container and restarts it and checks that the upgrade doesn't happen (since it's already 10.2).

Related Issue Link(s):

The mariadb upgrade happened in #1123

Release/Deployment notes:

SUPER IMPORTANT: Unfortunately,

  • Since old snapshots are not compatible with this version, we can't migrate bind-mounted databases any more. The code detects this and tells people what to do.
  • mariadb/mariabackup 10.1 snapshots are not compatible with mariabackup 10.2. This means that people who have pre-ddev-1.3 snapshots will not be able to use them easily in ddev v1.3+ - but there is a workaround:
  1. Set webimage: drud/ddev-dbserver:v1.2.0 in .ddev/config.yaml
  2. ddev start
  3. ddev restore-snapshot <name>
  4. ddev rm
  5. Remove or comment out the webimage line
  6. ddev start

This PR links people to what to do.

@rfay rfay added this to the v1.3.0 milestone Oct 6, 2018
@rfay rfay self-assigned this Oct 6, 2018
@rfay rfay requested a review from andrewfrench October 6, 2018 23:08
Copy link
Contributor

@andrewfrench andrewfrench left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just ran through the manual steps, everything looks good:

(with ddev version 1.2.0)

  • ddev start
  • Install site to populate database
  • ddev rm

(with ddev v1.2.0-37-g22bb278c)

  • ddev start
  • ddev logs -s db contains "Running mysql_upgrade"
  • ddev snapshot
  • ddev rm
  • ddev start
  • ddev logs -s db does not contain "Running mysql_upgrade"
  • ddev restore-snapshot <snapshot>
  • ddev logs -s db does not contain "Running mysql_upgrade"

@rfay
Copy link
Member Author

rfay commented Oct 9, 2018

Thanks for the review @andrewfrench . I'm going to do one more little bit with this, detect when we can't restore a snapshot and give them a link to the workaround.

@rfay rfay merged commit 16d72e4 into ddev:master Oct 9, 2018
@rfay rfay deleted the 20181006_mariadb_upgrade branch October 9, 2018 20:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants