Upgrading MySQL Best Practices. Apr 11-14, 2011 MySQL Conference and Expo Santa Clara,CA by Peter Zaitsev, Percona Inc

Similar documents
InnoDB Scalability Limits. Peter Zaitsev, Vadim Tkachenko Percona Inc MySQL Users Conference 2008 April 14-17, 2008

Switching to Innodb from MyISAM. Matt Yonkovit Percona

MySQL Performance Improvements

MySQL High Availability

Choosing Hardware and Operating Systems for MySQL. Apr 15, 2009 O'Reilly MySQL Conference and Expo Santa Clara,CA by Peter Zaitsev, Percona Inc

Practical MySQL Performance Optimization. Peter Zaitsev, CEO, Percona July 02, 2015 Percona Technical Webinars

Migrating To MySQL The Live Database Upgrade Guide

Effective Testing for Live Applications. March, 29, 2018 Sveta Smirnova

1Z Oracle. MySQL 5 Database Administrator Certified Professional Part I

Mysql Performance Schema Has The Wrong Structure

Choosing a MySQL HA Solution Today. Choosing the best solution among a myriad of options

There And Back Again

What s new in Percona Xtradb Cluster 5.6. Jay Janssen Lead Consultant February 5th, 2014

Best Practices for MySQL Scalability. Peter Zaitsev, CEO, Percona Percona Technical Webinars May 1, 2013

Upgrading to MySQL 8.0+: a More Automated Upgrade Experience. Dmitry Lenev, Software Developer Oracle/MySQL, November 2018

MySQL HA Solutions. Keeping it simple, kinda! By: Chris Schneider MySQL Architect Ning.com

MySQL Performance Optimization and Troubleshooting with PMM. Peter Zaitsev, CEO, Percona

Migrating to Aurora MySQL and Monitoring with PMM. Percona Technical Webinars August 1, 2018

MySQL In the Cloud. Migration, Best Practices, High Availability, Scaling. Peter Zaitsev CEO Los Angeles MySQL Meetup June 12 th, 2017.

Mysql Cluster Could Not Acquire Global Schema Lock

How Percona Contributes to Open Source Database Ecosystem. Peter Zaitsev 5 October 2016

Improvements in MySQL 5.5 and 5.6. Peter Zaitsev Percona Live NYC May 26,2011

MySQL Replication Options. Peter Zaitsev, CEO, Percona Moscow MySQL User Meetup Moscow,Russia

Percona XtraDB Cluster powered by Galera. Peter Zaitsev CEO, Percona Slide Credits: Vadim Tkachenko Percona University, Washington,DC Sep 12,2013

To Shard or Not to Shard That is the question! Peter Zaitsev April 21, 2016

Use Cases for Partitioning. Bill Karwin Percona, Inc

Managing MySQL Version Upgrades. Operating Systems. About the Author OTN TOUR years with MySQL / 26 years with RDBMS

Sphinx full-text search engine

Migrating to XtraDB Cluster 2014 Edition

MySQL Cluster An Introduction

Why we re excited about MySQL 8

Running MySQL on AWS. Michael Coburn Wednesday, April 15th, 2015

What s New in MySQL and MongoDB Ecosystem Year 2017

Architecture and Design of MySQL Powered Applications. Peter Zaitsev CEO, Percona Highload Moscow, Russia 31 Oct 2014

What is the Future of PostgreSQL?

Percona XtraDB Cluster MySQL Scaling and High Availability with PXC 5.7 Tibor Korocz

MySQL Performance Optimization and Troubleshooting with PMM. Peter Zaitsev, CEO, Percona Percona Technical Webinars 9 May 2018

Accelerate MySQL for Demanding OLAP and OLTP Use Case with Apache Ignite December 7, 2016

Practical MySQL Performance Optimization. Peter Zaitsev, CEO, Percona July 20 th, 2016 Percona Technical Webinars

Tips from the Trenches Preventing downtime for the over extended DBA. Andrew Moore Senior Remote DBA Percona Managed Services

Performance improvements in MySQL 5.5

Could Not Fetch Schema Routine Status Mysql

Percona XtraDB Cluster 5.7 Enhancements Performance, Security, and More

Percona Software & Services Update

MyRocks deployment at Facebook and Roadmaps. Yoshinori Matsunobu Production Engineer / MySQL Tech Lead, Facebook Feb/2018, #FOSDEM #mysqldevroom

MariaDB 10.3 vs MySQL 8.0. Tyler Duzan, Product Manager Percona

Backup & Restore. Maximiliano Bubenick Sr Remote DBA

MySQL Indexing. Best Practices. Peter Zaitsev, CEO Percona Inc August 15, 2012

MySQL usage of web applications from 1 user to 100 million. Peter Boros RAMP conference 2013

Choosing a MySQL HA Solution Today

MySQL 5.6: Advantages in a Nutshell. Peter Zaitsev, CEO, Percona Percona Technical Webinars March 6, 2013

G a l e r a C l u s t e r Schema Upgrades

3 Continuous Integration 3. Automated system finding bugs is better than people

10 Percona Toolkit tools every MySQL DBA should know about

Covering indexes. Stéphane Combaudon - SQLI

Choosing Storage for MySQL. Peter Zaitsev CEO, Percona Inc Percona Live, Washington,DC 11 January 2012

Scaling Applications with Caching Sharding and Replication

MyRocks in MariaDB. Sergei Petrunia MariaDB Tampere Meetup June 2018

Practical MySQL indexing guidelines

MySQL HA vs. HA. DOAG Konferenz 2016, Nürnberg. Oli Sennhauser. Senior MySQL Consultant, FromDual GmbH.

<Insert Picture Here> MySQL Web Reference Architectures Building Massively Scalable Web Infrastructure

Aurora, RDS, or On-Prem, Which is right for you

Various MySQL High Availability (HA) Solutions

Upgrading Databases. without losing your data, your performance or your mind. Charity

Run your own Open source. (MMS) to avoid vendor lock-in. David Murphy MongoDB Practice Manager, Percona

MongoDB and Mysql: Which one is a better fit for me? Room 204-2:20PM-3:10PM

Amazon AWS and RDS, moving towards it. Dimitri Vanoverbeke Solution Percona

MySQL 5.7 For Operational DBAs an Introduction. Peter Zaitsev, CEO, Percona February 16, 2016 Percona Technical Webinars

Scaling. Marty Weiner Grayskull, Eternia. Yashh Nelapati Gotham City

What is MariaDB 5.5? w: e: Daniel Bartholomew Oct 2012

Percona Software & Services Update

CO MySQL for Database Administrators

Mysql Manually Set Auto Increment To 1000

Why Choose Percona Server For MySQL? Tyler Duzan

Optimizing BOINC project databases

Creating a Best-in-Class Backup and Recovery System for Your MySQL Environment. Akshay Suryawanshi DBA Team Manager,

MySQL Database Scalability

Charity

DATABASE SCALE WITHOUT LIMITS ON AWS

Using MySQL for Distributed Database Architectures

Chapter01.fm Page 1 Monday, August 23, :52 PM. Part I of Change. The Mechanics. of Change

Let Robots Manage Your Schema Without Killing All Humans. Jenni

Amazon s Database Migration Service, a magical wand for moving from closed source solutions? Dimitri Vanoverbeke Solution Percona

mysql Certified MySQL 5.0 DBA Part I

HA solution with PXC-5.7 with ProxySQL. Ramesh Sivaraman Krunal Bauskar

MySQL vs MongoDB. Choosing right technology for your application. Peter Zaitsev CEO, Percona All Things Open, Raleigh,NC October 23 rd, 2017

MySQL: Scaling & High Availability

Manage MySQL like a devops sysadmin. Frédéric Descamps

MySQL and Virtualization Guide

MySQL 101. Designing effective schema for InnoDB. Yves Trudeau April 2015

MySQL Database Administrator Training NIIT, Gurgaon India 31 August-10 September 2015

MySQL Replication Advanced Features In 20 minutes

Chapter 8: Working With Databases & Tables

CISC 7610 Lecture 5 Distributed multimedia databases. Topics: Scaling up vs out Replication Partitioning CAP Theorem NoSQL NewSQL

Which technology to choose in AWS?

Performance comparisons and trade-offs for various MySQL replication schemes

Oracle 1Z MySQL 5.6 Database Administrator. Download Full Version :

Percona XtraDB Cluster

MySQL Indexing. Best Practices for MySQL 5.6. Peter Zaitsev CEO, Percona MySQL Connect Sep 22, 2013 San Francisco,CA

Database Architectures

Transcription:

Upgrading MySQL Best Practices Apr 11-14, 2011 MySQL Conference and Expo Santa Clara,CA by Peter Zaitsev, Percona Inc

MySQL Upgrade How many of you have performed MySQL upgrade? Home many of you have done 1 major version transition? Two? More? How many of you have surprises during minor upgrades? Major upgrades?

Why Upgrade? Old MySQL Versions have bugs Old MySQL Versions have Security Issues New MySQL Versions have more features, scalability, performance And new bugs added by your friends at development team Hard to find talent familiar with legacy versions Is it harder to find COBOL or PHP developer? Support becomes limited Issues your run into may not be fixed in the same major release

Why NOT to Upgrade? Every upgrade has risks Do not fix what is not broken? Major upgrades (such as 5.0 to 5.1) has more risks Jumping over many minor versions have more risks 5.1.20->5.1.55 more risky than 5.1.52->5.1.55 Upgrades from Pre-GA version are more risky As they tend to have more aggressive changes Skipping major MySQL Version is risky 4.1->5.1 is not tested as well as 5.0->51 May be good idea still with good testing

Reasons for Upgrade Running into current bug or performance issue Concern with bug which can potentially affect system Bug mentioned in changelog which looks relevant Security Concern Moving away from very old version

How frequently to upgrade? Depends on the complexity of upgrade process Some companies need man years worth of effort just to go from one minor release to another When serious issues are discovered in your release Hard to name exact frequency in time Stay with current or previous GA version. Now MySQL 5.5 is out it is time to consider upgrade Even if you do not have many problems with it. Note: there are people still running MySQL 3.23 out there which are just doing fine.

Minor upgrade vs Major upgrade Minor Upgrade Upgrading to same major MySQL version with small minor number change 5.1.53->5.1.55 Relatively low risk Major upgrade Upgrading to different major MySQL Version, or large minor number change (over 1 year between releases) 5.1->5.5 or 5.1.20->5.1.55 Higher risk due to higher amount of changes Upgrades to MySQL Forks such as Percona Server or MariaDB should be considered Major upgrades

Issues to Consider On Disk format changes Query Syntax and Result format Query Result Query Performance Ability to Store given data Scalability Resource Usage Replication

On Disk Format Changes MySQL has pretty good track record for on disk format support for MyISAM and Innodb Number of edge case changes over the years Many related to fixing sort order for edge cases New disk format may be available in new version Solutions Mysqldump and reload best for small databases Can be combined with Replication (as explained later) mysql_upgrade Tool to identify most of potentially incompatible tables and fix them Manual ALTER TABLE required for Innodb Tables

Query Syntax and Result Format Reserved keywords are added in new versions Parser changes may make it more strict MySQL 5.0 changing how JOIN conditions are interpreted broke a lot of queries MySQL 4.1 - new TIMESTAMP format required changing a lot of applications No such massively problematic issues after MySQL 5.0 Still some applications require changes on upgrade

Query Result Queries may start returning different result Query Meaning may become different Non Deterministic queries may be executed differently Can be caused by changes in sort order, comparison etc

Query Performance Most Common Upgrade Regression Issue Can be caused by Execution plan changes Changes in the software Many improvements come at cost There may be bugs/unintended consequences

Solving these problems Mk-upgrade to check query result set, execution plan and performance http://www.maatkit.org/doc/mk-upgrade.html Set up 2 servers with old and new version Get the relevant query sample Query log or tcpdump Use the tool to run them on 2 servers and watch for differences

Ability to Store given Data Yes... your data may no longer be stored in the database Sometimes it is bug fixes Storing 0 in AUTO_INCREMENT column It can also be storage engine changes Innodb Plugin has different restrictions than Innodb built in MySQL 5.1 Other changes done during upgrade Such as character set may affect it

Scalability Problems with concurrent workload execution Can't spot this with mk-upgrade But benchmark with mk-log-player can help Relatively rate case, commonly scalability gets better MySQL 5.0->5.1->5.1plugin->5.5 But there are reported edge cases

Replication Replication during upgrade You may need cross version replication during upgrade Replication working right in version you're upgrading to Performance Consistency Mk-table-checksum can be used to check replication for consistency Remember: Slaves should be upgraded first!

Doing many changes at once Changing hardware Moving to different storage engine Changing character set Major configuration changes Application architecture changes Benefit Just need to test everything once Drawbacks Do not know exactly where gains/losses come from Many moving parts, risk if something goes wrong

Reckless or Paranoid? There is wide range of Reckless to Paranoid upgrade processes You should ask yourself How many times have you done upgrade? Did you ever encourage any problems in this type of upgrade? How complicated your application? How much are you concerned about downtime or date corruption?

Extra Resources during upgrade Do you have extra servers during upgrade? Having them makes it easier,safer, less downtime This is there Cloud is really helpful Using Replication as part of upgrade process is helpful even for single server

General Upgrade Process Take a backup (as with any significant change) Setup the slave (S1)which will be target for upgrade With target MySQL version Setup slave S2 which with old MySQL data and same data as S1 Do mysql_upgrade on S1 Or mysqlcheck -A --check-upgrade Alternatively do mysqldump and reload on S1 Do mysqldump before upgrading MySQL server version Check S1=S2 Loaded/Altered data may not be the same

General Upgrade Process 2 Check S1=S2 mk-table-checksum s1 s2 mk-checksum-filter May need to use algorithm=bit_xor Checksum table can give false positives sometimes Run mk-upgrade comparing S1 to S2 Check for read queries regressions, wrong results, different plans Setup replication M->S1, M->S2 let it run for 24h+ Run mk-table-checkum replicate Check cross-version replication is working fine Also checks write queries work the same on both versions

General Upgrade Process 3 Validate replication performance Enable log-slow-slave-statements=1 for statement based replication Set long_query_time=0 Run mk-query-digest on S1 and S2 slow query log You should not see highly different time taken by same statement Alternatively Stop replication on S1 and S2 at the same position, Wait couple of hours Start replication and time how long it takes to catch up

General Upgrade 4 Setup S2 as slave off S1 Repeat replication consistency check Ensure same version replication works fine Especially makes sense if you're switching to ROW level replication as part of upgrade. Do Stress Test on S2 We will not need that database any more so you can change its data Mk-log-player can be helpful Or use your own stress tool

General Upgrade Process 5 Check Replication works in reverse Load old MySQL version & data on S2 Check replication S1->S2 is working or consistent You may have to run STATEMENT based replication until you're ready to give up quick roll back to 5.0 It is not an option at all for some MySQL version upgrades, and it is not officially supported.

General Upgrade 6 Promote S1 to the master and move traffic to it Depends on your replication topology a lot MMM (http://mysql-mmm.org/) can be great tool to assist Keep S2 with old version as it slave Validate your application is working with new master

Upgrade Tips If upgrading in sharded environment you can do full testing only on one/few shards If you have master+many slaves Upgrade one slave. Validate its working fine Upgrade all slaves Upgrade master last Note master often have different kind of read queries Always have rollback plan Test Schema migration on smaller schema Test all process on development environment

Upgrading Envinronments What If you have Development, Staging, Production? Consider separate Dev environment for upgrade Developing on different version can be dangerous Keep Staging close to production Minimize time when environments have different versions Most problems appear if development is forgotten to be upgraded for years or runs much newer version.

Who is helping you? Upgrades are different MySQL 4.0 4.1 upgrade had different set of issues than 5.0 5.1 Team often has limited experience doing same upgrade External help and advice is often an option We at Percona can help

The End Thank you! Send your feedback to pz@percona.com Percona Does MySQL Support, Consulting, Training We're creators of