SlideShare a Scribd company logo
Galera

Cluster

Schema Upgrades
Seppo Jaakola
Codership
Agenda
●

Schema Upgrades in Synchronous Cluster

●

DDL Classification

●

Schema Backwards Compatibility

●

Alternatives for Schema Upgrades
●
●
●
●
●

●

TOI
RSU / desync
wsrep_desync / wsrep_on method
Dropping Node for DDL
pt-online-schema-change

Summary
www.codership.com
2
Schema Upgrades
Applications have evolution, and there will be needs to
change database schema in new application revisions
With 24/7 online requirements, the schema upgrade must
happen while the system is online
Synchronous database cluster, requires that all active
nodes must have same data
–

Note that schema may differ, as long as data content is logically same

We need to figure out way(s) to roll schema upgrades in
online cluster with minimal disruption for the service

www.codership.com
3
What is DDL?
SQL statements can be classified in several classes:
DML Data Manipulation Language
–

Transactional data manipulations

–

SELECT, INSERT, UPDATE...

DDL Data Definition Language
–

CREATE..., DROP..., ALTER...

DCL Data Control Language
–

GRANT, REVOKE

TCL Transaction Control Language
…
http://en.wikibooks.org/wiki/MySQL/Language/Definitions:_what_are_DDL,_DML_and_DQL%3F
www.codership.com
4

Recommended for you

MariaDB MaxScale
MariaDB MaxScaleMariaDB MaxScale
MariaDB MaxScale

MariaDB MaxScale is a database proxy that provides scalability, high availability, and data streaming capabilities for MariaDB and MySQL databases. It acts as a load balancer and router to distribute queries across database servers. MaxScale supports services like read/write splitting, query caching, and security features like selective data masking. It can monitor replication lag and route queries accordingly. MaxScale uses a plugin architecture and its core remains stateless to provide flexibility and high performance.

mariadbmaxscaleopen source
PostgreSQL and RAM usage
PostgreSQL and RAM usagePostgreSQL and RAM usage
PostgreSQL and RAM usage

In 40 minutes the audience will learn a variety of ways to make postgresql database suddenly go out of memory on a box with half a terabyte of RAM. Developer's and DBA's best practices for preventing this will also be discussed, as well as a bit of Postgres and Linux memory management internals.

sqlprogrammingram
Tanel Poder - Troubleshooting Complex Oracle Performance Issues - Part 2
Tanel Poder - Troubleshooting Complex Oracle Performance Issues - Part 2Tanel Poder - Troubleshooting Complex Oracle Performance Issues - Part 2
Tanel Poder - Troubleshooting Complex Oracle Performance Issues - Part 2

This document summarizes a series of performance issues seen by the author in their work with Oracle Exadata systems. It describes random session hangs occurring across several minutes, with long transaction locks and I/O waits seen. Analysis of AWR reports and blocking trees revealed that many sessions were blocked waiting on I/O, though initial I/O metrics from the OS did not show issues. Further analysis using ASH activity breakdowns and OS tools like sar and vmstat found high apparent CPU usage in ASH that was not reflected in actual low CPU load on the system. This discrepancy was due to the way ASH attributes non-waiting time to CPU. The root cause remained unclear.

troubleshootingperformanceoracle
DML vs DDL
But the bottom line is division between transactional and nontransactional statements:

Transactional SQL
–

All DML on InnoDB

–

NON Transactional SQL

Can be rolled back

●

Not possible to rollback

–

●

DDL, DCL..., DML on non
transactional SE

–

●

–

Requires up-front locking

Galera uses optimistic concurrency control, and depends on possibility to rollback a
conflicting operation
Only transactional SQL can be replicated through Galera transactional replication
For others (DDL, DCL...), we either have to skip replication or use up-front locking
www.codership.com
5
DML vs DDL
Notes on some DDL:
TRUNCATE
–

is DDL!

–

Is fast to execute, but nevertheless has some impact

OPTIMIZE, REPAIR, ANALYZE
–

Table admin commands are now replicated

CREATE / DROP INDEX
–

Hold MDL on affected table, and can stall the
replication

www.codership.com
6
Schema Backward Compatibility
Backward Compatibility

App v1

MySQL
Schema v1

App v1

Schema
Upgrade

MySQL
Schema v2

App
Upgrade

App v2

MySQL
Schema v2

Old application version
must be able to use the
new schema
www.codership.com
9

Recommended for you

Linux and H/W optimizations for MySQL
Linux and H/W optimizations for MySQLLinux and H/W optimizations for MySQL
Linux and H/W optimizations for MySQL

This document summarizes optimizations for MySQL performance on Linux hardware. It covers SSD and memory performance impacts, file I/O, networking, and useful tools. The history of MySQL performance improvements is discussed from hardware upgrades like SSDs and more CPU cores to software optimizations like improved algorithms and concurrency. Optimizing per-server performance to reduce total servers needed is emphasized.

mysqllinux
My sql failover test using orchestrator
My sql failover test  using orchestratorMy sql failover test  using orchestrator
My sql failover test using orchestrator

Orchestrator allows for easy MySQL failover by monitoring the cluster and promoting a new master when failures occur. Two test cases were demonstrated: 1) using a VIP and scripts to redirect connections during failover and 2) integrating with Proxysql to separate reads and writes and automatically redirect write transactions during failover while keeping read queries distributed. Both cases resulted in failover occurring within 16 seconds while maintaining application availability.

#mysql#orchestrator#proxysql
PostgreSQL replication
PostgreSQL replicationPostgreSQL replication
PostgreSQL replication

This document discusses PostgreSQL replication. It provides an overview of replication, including its history and features. Replication allows data to be copied from a primary database to one or more standby databases. This allows for high availability, load balancing, and read scaling. The document describes asynchronous and synchronous replication modes.

nttデータreplicationnttdata
Backward Compatibility

App v1

MySQL
Schema v1

App
Upgrade

App v2

MySQL
Schema v1

App v2

Schema
Upgrade

MySQL
Schema v2

New application version
must be able to use the
old schema
www.codership.com
10
Backwards Compatibility
New/old application should be able to use both old and
new schema
Application should be backwards compatible
ROW replication between old and new schema should be
possible
Schema change should be backwards compatible

www.codership.com
11
App Backwards Compatibility
New/old application should be able to use both old and
new schema
–

New application can have compatibility mode to detect the version of
underlying database

–

If old app cannot use new schema, the old app must connect to one
node only, which will be the last to upgrade

Dropping tables or columns can be a problem
–

But drops can be done delayed: e.g. in v2 -> v3 upgrade, obsolete v1
elements can be dropped as neither v2 or v3 app will use them any
more

www.codership.com
12
ROW Replication Compatibility
MySQL guarantees ROW replication event compatibility
with some limitations
Newer MySQL versions tolerate more variation between
source and target tables, check out this page for latest
status:
http://dev.mysql.com/doc/refman/5.6/en/replication-features-differing-tables.html
●
●

Source and target can have different number of columns
But columns must be in same order

●

New columns in the end, and must have default values

●

Some data type conversions are also supported
www.codership.com
13

Recommended for you

MySQL Database Architectures - MySQL InnoDB ClusterSet 2021-11
MySQL Database Architectures - MySQL InnoDB ClusterSet 2021-11MySQL Database Architectures - MySQL InnoDB ClusterSet 2021-11
MySQL Database Architectures - MySQL InnoDB ClusterSet 2021-11

Oracle's MySQL solutions make it easy to setup various database architectures and achieve high availability with the introduction MySQL InnoDB Cluster and MySQL InnoDB ReplicaSet meeting various high availability requirements. MySQL InnoDB ClusterSet provides a popular disaster recovery solution. Completely built in-house and supported by Oracle, many enterprises large and small have adopted these solutions into business critical applications. In this presentation the various database architecture solutions for high availability and disaster recovery will be covered and help you choose the right solutions based on your business requirements.

mysqlgroup replicationinnodb cluster
Mastering PostgreSQL Administration
Mastering PostgreSQL AdministrationMastering PostgreSQL Administration
Mastering PostgreSQL Administration

This presentation covers all aspects of PostgreSQL administration, including installation, security, file structure, configuration, reporting, backup, daily maintenance, monitoring activity, disk space computations, and disaster recovery. It shows how to control host connectivity, configure the server, find the query being run by each session, and find the disk space used by each database.

 
by EDB
postgresql administrationopen source databasedatabase administration
Using galera replication to create geo distributed clusters on the wan
Using galera replication to create geo distributed clusters on the wanUsing galera replication to create geo distributed clusters on the wan
Using galera replication to create geo distributed clusters on the wan

We will show the advantages of having a geo-distributed database cluster and how to create one using Galera Cluster for MySQL. We will also discuss the configuration and status variables that are involved and how to deal with typical situations on the WAN such as slow, untrusted or unreliable links, latency and packet loss. We will demonstrate a multi-region cluster on Amazon EC2 and perform some throughput and latency measurements in real-time (video http://galeracluster.com/videos/using-galera-replication-to-create-geo-distributed-clusters-on-the-wan-webinar-video-3/)

wan clustergalera cloud clustergalera cluster
ROW Replication Compatibility

Insert into table-A(col-a,col-b) values (5,7)

col-a

col-b

col-a

Table A

col-b

col-c

Table A

www.codership.com
14
ROW Replication Compatibility

Insert into table-A(col-a,col-b) values (5,7)

col-a

col-b

col-a

col-b

col-c

5

7

5

7

def

Replication

Table A

Table A

www.codership.com
15
STATEMENT Replication
In STATEMENT format, schema compatibility is not an issue
Galera does not currently support STATEMENT replication,
but:
–

Enabling STATEMENT replication is minor task
Consistency is at risk
● Parallel applying must be limited (OFF, Database or Table level)
● STATEMENT replication, in general, is phasing out
Supporting STATEMENT replication for schema upgrades, is one
potential extension we are looking for
●

–

www.codership.com
16
Schema Upgrades in Galera Cluster

Recommended for you

MySQL Database Architectures - InnoDB ReplicaSet & Cluster
MySQL Database Architectures - InnoDB ReplicaSet & ClusterMySQL Database Architectures - InnoDB ReplicaSet & Cluster
MySQL Database Architectures - InnoDB ReplicaSet & Cluster

This document provides an overview and comparison of MySQL InnoDB Cluster and MySQL InnoDB ReplicaSet. It discusses the components, goals, and features of each solution. MySQL InnoDB Cluster uses Group Replication to provide high availability, automatic failover, and data consistency. MySQL InnoDB ReplicaSet uses asynchronous replication and provides availability and read scaling through manual primary/secondary configuration and failover. Both solutions integrate MySQL Shell, Router, and automatic member provisioning for easy management.

mysql
MySQL Administrator 2021 - 네오클로바
MySQL Administrator 2021 - 네오클로바MySQL Administrator 2021 - 네오클로바
MySQL Administrator 2021 - 네오클로바

MySQL Administrator Basic course - MySQL 개요 - MySQL 설치 / 설정 - MySQL 아키텍처 - MySQL 스토리지 엔진 - MySQL 관리 - MySQL 백업 / 복구 - MySQL 모니터링 Advanced course - MySQL Optimization - MariaDB / Percona - MySQL HA (High Availability) - MySQL troubleshooting 네오클로바 http://neoclova.co.kr/

mysqlmariadbpercona
MariaDB High Availability
MariaDB High AvailabilityMariaDB High Availability
MariaDB High Availability

This document discusses different approaches to achieving high availability with MariaDB databases, including replication, Galera clusters, and MaxScale load balancing. It describes asynchronous and semi-synchronous replication topologies that provide redundancy and enable failover. Synchronous replication with Galera clusters is discussed as another option that ensures all nodes remain in sync with no data loss. MaxScale is presented as a tool that can monitor MariaDB topologies and perform load balancing and failover across nodes.

mariadbhigh availabilitydatabase
Schema Upgrades in Galera
Galera Cluster has two inbuilt methods for DDL replication:
–

TOI – Total Order Isolation

–

RSU – Rolling Schema Upgrade

The method of choice is declared by variable:
wsrep_osu_method = TOI | RSU

Pt-online-schema-change is valid tool for upgrades, these
and other DDL replication alternatives are discussed in
following chapters.

www.codership.com
18
Total Order Isolation
TOI
Total oder Isolation (TOI) is the default DDL replication
method
●

●

●

●

wsrep_osu_method = TOI
“master node” detects DDL at parsing time and sends out replication event
for the SQL statement before even starting the DDL processing
DDL replication happens in STATEMENT format
Every node in the cluster will process the replicated DDL at the same “slot”
in the cluster transaction stream (Total Order)

www.codership.com
20
TOI Replication

ALTER TABLE t1...

Parser
Replication
MySQL

MySQL

Execution

a

Galera
Replication

WS

Seqno
STATEMENT event

G a l e r a R e p l i c a t io n
www.codership.com
21

Recommended for you

MySQL Database Architectures - High Availability and Disaster Recovery Solution
MySQL Database Architectures - High Availability and Disaster Recovery SolutionMySQL Database Architectures - High Availability and Disaster Recovery Solution
MySQL Database Architectures - High Availability and Disaster Recovery Solution

MySQL InnoDB ClusterSet brings multi-datacenter capabilities to our solutions and makes it very easy to set up a disaster recovery architecture. Think multiple MySQL InnoDB Clusters into one single database architecture, fully managed from MySQL Shell and with full MySQL Router integration to make it easy to access the entire architecture. This presentation covers the various solutions of MySQL for High Availability, Replication, and Disaster Recovery, with a special focus on InnoDB ClusterSet: - The various features of InnoDB Clusterset - How to setup MySQL InnoDB ClusterSet - Ways to migrate from an existing MySQL InnoDB Cluster into MySQL InnoDB ClusterSet - How to deal with various failures - The various features of router integration make the connection to the database architecture easy.

#mysql#ha#highavailability
Maxscale 소개 1.1.1
Maxscale 소개 1.1.1Maxscale 소개 1.1.1
Maxscale 소개 1.1.1

Maxscale을 간단히 이해하는데 도움이 됐으면 좋겠습니다.

Oracle sql high performance tuning
Oracle sql high performance tuningOracle sql high performance tuning
Oracle sql high performance tuning

This document discusses techniques for optimizing SQL performance in Oracle databases. It covers topics like optimizing the optimizer itself through configuration changes and statistics collection, detecting poorly performing SQL, and methods for improving plans such as indexing, partitioning, hints and baselines. The goal is to maximize the optimizer's accuracy and ability to handle edge cases, while also knowing how to intervene when needed to capture fugitive SQL and ensure acceptable performance.

sqlperformanceoracle
TOI Replication

ALTER TABLE t1...

Parser

apply

continue

Parser

MySQL

MySQL

Execution

Execution

a

Galera
Replication

WS
Seqno slot
reached
www.codership.com
22
TOI Replication
Pros
–

Strict consistency, all nodes will get same change

–

No worries about schema backwards compatibility

Cons
–

Strict commit order will make every transaction to wait until DDL is
over

Usable, when:
–

DDL is short term

–

Schema change will not be backwards compatible

–

And/or there is maintenance window

Some future work in road map:
–

TOI replication commit order can be relaxed

–

We are working on optimization based on this
www.codership.com
23
Rolling Schema Upgrade
RSU

➢

Rolling Schema Upgrade
wsrep_osu_method=RSU

➢

Will desynchronize the node from replication for the
duration of following DDL command

➢

Incoming replication is buffered

➢

Nothing will be replicated out of the node

➢

When DDL is over, the node will automatically join back
in cluster, and catch up missed transactions from the
buffer

www.codership.com
25

Recommended for you

The Full MySQL and MariaDB Parallel Replication Tutorial
The Full MySQL and MariaDB Parallel Replication TutorialThe Full MySQL and MariaDB Parallel Replication Tutorial
The Full MySQL and MariaDB Parallel Replication Tutorial

MariaDB 10.0 introduces domain-based parallel replication which allows transactions in different domains to execute concurrently on replicas. This can result in out-of-order transaction commit. MariaDB 10.1 adds optimistic parallel replication which maintains commit order. The document discusses various parallel replication techniques in MySQL and MariaDB including schema-based replication in MySQL 5.6 and logical clock replication in MySQL 5.7. It provides performance benchmarks of these techniques from Booking.com's database environments.

binlog serversbooking.commysql
PostgreSQL WAL for DBAs
PostgreSQL WAL for DBAs PostgreSQL WAL for DBAs
PostgreSQL WAL for DBAs

Devrim Gunduz gives a presentation on Write-Ahead Logging (WAL) in PostgreSQL. WAL logs all transactions to files called write-ahead logs (WAL files) before changes are written to data files. This allows for crash recovery by replaying WAL files. WAL files are used for replication, backup, and point-in-time recovery (PITR) by replaying WAL files to restore the database to a previous state. Checkpoints write all dirty shared buffers to disk and update the pg_control file with the checkpoint location.

transaction logpgday asiaacid
M|18 Battle of the Online Schema Change Methods
M|18 Battle of the Online Schema Change MethodsM|18 Battle of the Online Schema Change Methods
M|18 Battle of the Online Schema Change Methods

This document provides an overview and comparison of different methods for performing online schema changes in databases. It discusses native online DDL capabilities in MySQL/MariaDB and TokuDB, as well as alternative methods like rolling schema updates, downtime windows, and the pt-online-schema-change tool. The document outlines features, limitations, and special cases to consider for different workloads and replication scenarios.

RSU
SET GLOBAL
wsrep_osu_method=RSU
ALTER TABLE t1...

MySQL

MySQL

MySQL

G a l e r a R e p l i c a t io n

a

Galera Replication
www.codership.com
26
RSU

ALTER TABLE

MySQL
MySQL

WS

a

MySQL

WS

Slave queue

Galera Replication
www.codership.com
27
RSU

ALTER TABLE t1...

MySQL

WS

a

MySQL

MySQL

WS

Slave queue

Galera Replication
www.codership.com
28
RSU
Pros
–

DDL will not slow down cluster

–

Automatic re-sync after DDL is over

Cons
–
–

Schema change has to be backwards compatible

–

a

Has global effect, all sessions will be RSU'ed
Only one RSU operation at a time

–

Rolling over cluster is manual operation

www.codership.com
29

Recommended for you

Extreme Availability using Oracle 12c Features: Your very last system shutdown?
Extreme Availability using Oracle 12c Features: Your very last system shutdown?Extreme Availability using Oracle 12c Features: Your very last system shutdown?
Extreme Availability using Oracle 12c Features: Your very last system shutdown?

This document discusses various Oracle 12c features that can be used to achieve high availability and keep systems available even during planned and unplanned outages. It compares options for handling planned changes like hardware, OS, database upgrades including RAC, RAC One Node, and Data Guard. It also discusses disaster recovery options like storage mirroring, RAC extended clusters, Data Guard, and GoldenGate replication. New features in Oracle 12c like Far Sync instances and cascading standbys are also covered. The document provides a guide to deciphering the necessary components for high availability.

Oracle Database 12c "New features"
Oracle Database 12c "New features" Oracle Database 12c "New features"
Oracle Database 12c "New features"

Oracle Database 12c includes many new features across SQL, PL/SQL, database management, partitioning, patching, compression, Data Guard, and pluggable databases. Key features include increased datatype size limits, identity columns, implicit result sets in PL/SQL, adaptive plans, row pattern matching, pluggable databases that can be plugged into and unplugged from container databases, and many enhancements to compression, partitioning, Data Guard, and patching functionality.

The Apache Cassandra ecosystem
The Apache Cassandra ecosystemThe Apache Cassandra ecosystem
The Apache Cassandra ecosystem

Drivers connect applications to Cassandra clusters and maintain connections to nodes. They probe clusters to discover nodes, token ranges, and latency. Drivers are data-aware and can route queries to appropriate replicas or fail over if needed. Cassandra clusters can span multiple data centers for redundancy, workload separation, and geographic distribution of data and queries. Configuration files like cassandra.yaml and cassandra-env.sh are used to configure memory, data storage, caching, and other settings. Cassandra clusters should be provisioned on commodity servers using tools like cassandra-stress to test workloads and estimate needed nodes.

wsrep_desync
wsrep_desync
Node can be set to omit flow control by:
mysql> SET GLOBAL wsrep_desync=ON;

A session can be declared to not replicate anything by:
mysql> SET wsrep_on=OFF;
●

●

Running DDL in such a session, will result in local
schema change, and processing of the DDL will not
hold back cluster.
However, all cluster transactions will be replicated to
the node, and if there are conflicts, the DDL will be
aborted.
wsrep_desync+wsrep_on method is good only for
non-confliction operations
www.codership.com
31
wsrep_desync+wsrep_on
SET GLOBAL wsrep_desync=ON;
SET wsrep_on=OFF;
ALTER TABLE t1...

t1

t2

tn

MySQL

a

WS

WS

Slave queue

Galera Replication
www.codership.com
32
wsrep_desync
We are currently working on making better use of
desync mode. The goal is to protect local desynced
transactions from replication aborts.
This way, the DDL will succeed even if there are
conflicts with the cluster. However, cluster replication
will pause at first such conflict and wait until DDL is
complete.
But, this will be future extension, and available in some
of following 3.* release.

www.codership.com
33

Recommended for you

High-availability with Galera Cluster for MySQL
High-availability with Galera Cluster for MySQLHigh-availability with Galera Cluster for MySQL
High-availability with Galera Cluster for MySQL

High-availability with Galera Cluster for MySQL How to avoid downtime with MySQL and maintenance windows out of office time.

mysqlgaleragalera cluster
01 oracle architecture
01 oracle architecture01 oracle architecture
01 oracle architecture

Oracle Architecture in regards to writing better performing queries. Understand Oracle Architecture Database Buffer Cache Shared Pool Write better performing queries

oraclesqlpl/sql
MySQL Day Roma - MySQL Shell and Visual Studio Code Extension
MySQL Day Roma - MySQL Shell and Visual Studio Code ExtensionMySQL Day Roma - MySQL Shell and Visual Studio Code Extension
MySQL Day Roma - MySQL Shell and Visual Studio Code Extension

Discover the power of the new MySQL command line client and explore the new Visual Studio Code extension to work with MySQL

mysqlmysql shellvisual studio code
Drop a Node for DDL
Dropping Node for DDL
One way to do “manual RSU”, is to drop a node from
cluster and run DDL on the stand-alone node.
Joining the node back must happen through IST, as we
don't want SST to bring back the old schema.
Make sure to protect the node from any production
connections! Load balancers should be configured first to
isolate the node from unwanted connections.
Adjust your gcache size big enough to allow IST after the
DDL is over.

www.codership.com
35
Dropping Node for DDL

Load Balancer

1. configure LB
2. Drop node, e.g.
set global wsrep_cluster_address=gcomm://

MySQL

MySQL

Galera Replication
www.codership.com
36
Dropping Node for DDL

Load Balancer

3. ALTER TABLE t1...

MySQL

MySQL

Galera Replication
www.codership.com
37

Recommended for you

NoCOUG_201411_Patel_Managing_a_Large_OLTP_Database
NoCOUG_201411_Patel_Managing_a_Large_OLTP_DatabaseNoCOUG_201411_Patel_Managing_a_Large_OLTP_Database
NoCOUG_201411_Patel_Managing_a_Large_OLTP_Database

- The document discusses managing a large OLTP database at PayPal, including capacity management, planned maintenance, performance management, and troubleshooting. It provides details on monitoring the database infrastructure, conducting maintenance such as patching and switchovers, and optimizing performance for Oracle RAC environments. The goal is to support business needs and provide uninterrupted service through proactive management of the database tier.

Confoo 2021 -- MySQL New Features
Confoo 2021 -- MySQL New FeaturesConfoo 2021 -- MySQL New Features
Confoo 2021 -- MySQL New Features

Confoo.ca conference talk February 24th 2021 on MySQL new features found in version 8.0 including server and supporting utility updates for those who may have missed some really neat new features

mysqldatabasesql
OpenShift Multicluster
OpenShift MulticlusterOpenShift Multicluster
OpenShift Multicluster

The document discusses various high availability and disaster recovery options for deploying Kubernetes clusters across multiple data centers. It begins by covering HA layers at the application, node, control plane, and data levels for a single cluster. It then examines options for multi-data center deployments including a GitOps approach with two synchronized clusters, a stretched cluster spanning three data centers, a stretched cluster with two data centers and an arbiter node, and a stretched cluster with DR provided by IaaS VM migration. Key criteria for choosing an option include the number of available data centers, latency between sites, and data access requirements for applications. A three site stretched cluster is typically the preferred model when feasible.

devopsopenshiftk8s
Dropping Node for DDL

Load Balancer

4. Join back
set wsrep_cluster_address...

WS

MySQL

WS

IST

MySQL

Galera Replication
www.codership.com
38
Dropping Node for DDL

Load Balancer

5. configure LB

MySQL

MySQL

Galera Replication
www.codership.com
39
pt-online-schema-change
pt-online-schema-change
Tool in Percona Toolkit to run non blocking schema
changes
http://www.percona.com/doc/percona-toolkit/2.2/pt-online-schema-change.html
1. Creates a shadow copy of target table

2. Installs triggers in source table to forward updates to target table
3. Copies source table data in small chunks to target table
4. Renames target table to replace the source table

Pt-osc does not replicate schema changes, but makes it
possible to change schema without interfering with
replication
However, pt-osc requires TOI to be enabled, and TOI
replication will propagate the changes to whole cluster
www.codership.com
41

Recommended for you

[SSA] 03.newsql database (2014.02.05)
[SSA] 03.newsql database (2014.02.05)[SSA] 03.newsql database (2014.02.05)
[SSA] 03.newsql database (2014.02.05)

This document discusses NewSQL databases and provides examples of NewSQL products. It begins by explaining the limitations of traditional SQL databases and NoSQL databases in handling big data. It then introduces NewSQL as an approach that provides scalability like NoSQL with ACID transactions and SQL support like traditional databases. Example NewSQL databases discussed in detail include VoltDB, which uses an in-memory architecture, and Google Spanner, which provides a globally distributed SQL database. The document also briefly mentions MySQL Cluster as another NewSQL approach.

bigdatanewsqldatabase
Midwest PHP Presentation - New MSQL Features
Midwest PHP Presentation - New MSQL FeaturesMidwest PHP Presentation - New MSQL Features
Midwest PHP Presentation - New MSQL Features

22 April 2021 presentation for the MidWest PHP conference on New Features in MySQL 8.0 with updates on the newly released 8.0.24

mysqlphpmidwestdatabase
Production Grade Kubernetes Applications
Production Grade Kubernetes ApplicationsProduction Grade Kubernetes Applications
Production Grade Kubernetes Applications

Just because Containerized, Kubernetized and Cloudified doesnt mean you application is production grade and disruption free. You will have to utilize all the features provided by Kubernetes to really make it produciton ready. In these slides, I will try to explain what could be possible disruptions that can happen in your Kubernetes cluster that can impact your application or workloads. And then will try to explain features or configuration of Kubernetes that will help in making your application production grade.

kubernetesproductionproduction grade
pt-online-schema-change

updates

t1-new
t1

CREATE similar table
and ALTER

a
www.codership.com
42
pt-online-schema-change

updates

t1-new
t1

a

Install trigger to forward updates
to new table
www.codership.com
43
pt-online-schema-change

updates

t1-new
t1

Copy data in
chunks

a
www.codership.com
44
pt-online-schema-change

updates

t1

t1-new

Copy data in
chunks

a
www.codership.com
45

Recommended for you

How to Handle your Kubernetes Upgrades
How to Handle your Kubernetes UpgradesHow to Handle your Kubernetes Upgrades
How to Handle your Kubernetes Upgrades

Suvrojeet Ghosh, Software Engineer at Ribbon, presented 'How to Handle your Kubernetes Upgrades' at the Kubernetes + Cloud Native meetup in Ottawa in March, 2019. He shared his experiences upgrading HA clusters from v1.0 to v1.13 via kubeadm in multiple hops. He pointed out certain problems and errors to be aware of as well as resources that can help.

kubernetescloud nativekubernetes upgrade
Become a MySQL DBA - Webinars - Schema Changes for MySQL Replication & Galera...
Become a MySQL DBA - Webinars - Schema Changes for MySQL Replication & Galera...Become a MySQL DBA - Webinars - Schema Changes for MySQL Replication & Galera...
Become a MySQL DBA - Webinars - Schema Changes for MySQL Replication & Galera...

With the rise of agile development methodologies, more and more systems and applications are built in series of iterations. This is true for the database schema as well, as it has to evolve together with the application. Unfortunately, schema changes and databases do not play well together. Changes usually require plenty of advance scheduling, and can be disruptive to your operations. In this webinar, we discuss how to implement schema changes in the least impacting way to your operations and ensure availability of your database. We also cover some real-life examples and discuss how to handle them. AGENDA Different methods to perform schema changes on MySQL Replication and Galera rolling schema change online alters external tools, e.g., pt-online-schema-change Differences between MySQL 5.5 and 5.6 Differences between MySQL Replication vs Galera Example real-life scenarios with MySQL Replication and Galera setups

galera clustermysqlmysql replication
HA with Galera
HA with GaleraHA with Galera
HA with Galera

This document discusses high availability with Galera Cluster for MySQL. It provides an overview of Galera Cluster, including its advantages like active-active multi-master clusters and automatic node membership control. It also covers Galera Cluster installation, configuration, operations like initial cluster start and rolling restarts, load balancing, and online schema upgrades.

mysqlhigh availabilitygalera cluster
pt-online-schema-change

updates

t1

t1-old

Rename
tables

a
www.codership.com
46
pt-online-schema-change

updates

t1

Drop old table

a
www.codership.com
47
pt-online-schema-change
Some Caveats:
●

TOI requirement
–
–

●

Pt-osc changes will be run against whole cluster with one go
Could be relaxed, imo

Triggers not supported
–

●

Pt-osc installs new triggers in source table and does not allow any
other triggers to exists in the table

Foreign key support
–

a

Two methods for dealing with FKs

–

Rebuilding child table FK constraint may be needed

–

FK constraint name will be different

www.codership.com
48
Summary

Recommended for you

PoC: Using a Group Communication System to improve MySQL Replication HA
PoC: Using a Group Communication System to improve MySQL Replication HAPoC: Using a Group Communication System to improve MySQL Replication HA
PoC: Using a Group Communication System to improve MySQL Replication HA

High Availability solutions for MySQL Replication are either simple to use but introduce a single point of failure or free of pitfalls but complex and hard to use. The Proof-of-Concept sketches a way in the middle. For monitoring a group communication system is embedded into MySQL usng a MySQL plugin which eliminates the monitoring SPOF and is easy to use. Much emphasis is put of the often neglected client side. The PoC shows an architecture in which clients reconfigure themselves dynamically. No client deployment is required.

gcsisis2mysqlfailover
Pg chameleon, mysql to postgresql replica made easy
Pg chameleon, mysql to postgresql replica made easyPg chameleon, mysql to postgresql replica made easy
Pg chameleon, mysql to postgresql replica made easy

Federico Campoli developed pg_chameleon to replicate data from MySQL to PostgreSQL. He has been passionate about IT since 1982 and loves PostgreSQL. Pg_chameleon version 2.0 allows replication of multiple MySQL schemas to a PostgreSQL database. It uses two subprocesses to concurrently read from and replay data to MySQL. The presentation covered pg_chameleon's history, how it works as a replica, setup instructions, and a demo. Future development plans include parallelizing the initial load to speed it up and adding logical replication from PostgreSQL.

postgresqlmysqlpercona
Power-Efficient Programming Using Qualcomm Multicore Asynchronous Runtime Env...
Power-Efficient Programming Using Qualcomm Multicore Asynchronous Runtime Env...Power-Efficient Programming Using Qualcomm Multicore Asynchronous Runtime Env...
Power-Efficient Programming Using Qualcomm Multicore Asynchronous Runtime Env...

The need to support both today’s multicore performance and tomorrow’s heterogeneous computing has become increasingly important. Qualcomm® Multicore Asynchronous Runtime Environment (MARE) provides powerful and easy-to-use abstractions to write parallel software. This session will provide a deep dive into the concepts of power-efficient programming and how to use Qualcomm MARE APIs to get energy and thermal benefits for Android apps. Qualcomm Multicore Asynchronous Runtime Environment is a product of Qualcomm Technologies, Inc. Learn more about Qualcomm Multicore Asynchronous Runtime Environment: https://developer.qualcomm.com/MARE Watch this presentation on YouTube: https://www.youtube.com/watch?v=RI8yXhBb8Hg

parallel computingmulti-core processorqualcomm
Codership
Schema upgrades require careful planning
➢

Find out backwards compatibility both from application and from ROW
replication perspective

➢

Plan your upgrade process

➢

Rehearse with test cluster

Instant methods:
➢

TOI replication, pt-osc

➢

ROW replication backwards compatibility is not an issue

Rolling methods
➢

RSU, wsrep_desync/wsrep_on, node dropping

➢

Schema backwards compatibility required

www.codership.com
50
Questions?

Thank you for listening!
Happy Clustering :-)

More Related Content

What's hot

MariaDB 마이그레이션 - 네오클로바
MariaDB 마이그레이션 - 네오클로바MariaDB 마이그레이션 - 네오클로바
MariaDB 마이그레이션 - 네오클로바
NeoClova
 
Automated master failover
Automated master failoverAutomated master failover
Automated master failover
Yoshinori Matsunobu
 
MySQL GTID Concepts, Implementation and troubleshooting
MySQL GTID Concepts, Implementation and troubleshooting MySQL GTID Concepts, Implementation and troubleshooting
MySQL GTID Concepts, Implementation and troubleshooting
Mydbops
 
MariaDB MaxScale
MariaDB MaxScaleMariaDB MaxScale
MariaDB MaxScale
MariaDB plc
 
PostgreSQL and RAM usage
PostgreSQL and RAM usagePostgreSQL and RAM usage
PostgreSQL and RAM usage
Alexey Bashtanov
 
Tanel Poder - Troubleshooting Complex Oracle Performance Issues - Part 2
Tanel Poder - Troubleshooting Complex Oracle Performance Issues - Part 2Tanel Poder - Troubleshooting Complex Oracle Performance Issues - Part 2
Tanel Poder - Troubleshooting Complex Oracle Performance Issues - Part 2
Tanel Poder
 
Linux and H/W optimizations for MySQL
Linux and H/W optimizations for MySQLLinux and H/W optimizations for MySQL
Linux and H/W optimizations for MySQL
Yoshinori Matsunobu
 
My sql failover test using orchestrator
My sql failover test  using orchestratorMy sql failover test  using orchestrator
My sql failover test using orchestrator
YoungHeon (Roy) Kim
 
PostgreSQL replication
PostgreSQL replicationPostgreSQL replication
PostgreSQL replication
NTT DATA OSS Professional Services
 
MySQL Database Architectures - MySQL InnoDB ClusterSet 2021-11
MySQL Database Architectures - MySQL InnoDB ClusterSet 2021-11MySQL Database Architectures - MySQL InnoDB ClusterSet 2021-11
MySQL Database Architectures - MySQL InnoDB ClusterSet 2021-11
Kenny Gryp
 
Mastering PostgreSQL Administration
Mastering PostgreSQL AdministrationMastering PostgreSQL Administration
Mastering PostgreSQL Administration
EDB
 
Using galera replication to create geo distributed clusters on the wan
Using galera replication to create geo distributed clusters on the wanUsing galera replication to create geo distributed clusters on the wan
Using galera replication to create geo distributed clusters on the wan
Codership Oy - Creators of Galera Cluster
 
MySQL Database Architectures - InnoDB ReplicaSet & Cluster
MySQL Database Architectures - InnoDB ReplicaSet & ClusterMySQL Database Architectures - InnoDB ReplicaSet & Cluster
MySQL Database Architectures - InnoDB ReplicaSet & Cluster
Kenny Gryp
 
MySQL Administrator 2021 - 네오클로바
MySQL Administrator 2021 - 네오클로바MySQL Administrator 2021 - 네오클로바
MySQL Administrator 2021 - 네오클로바
NeoClova
 
MariaDB High Availability
MariaDB High AvailabilityMariaDB High Availability
MariaDB High Availability
MariaDB plc
 
MySQL Database Architectures - High Availability and Disaster Recovery Solution
MySQL Database Architectures - High Availability and Disaster Recovery SolutionMySQL Database Architectures - High Availability and Disaster Recovery Solution
MySQL Database Architectures - High Availability and Disaster Recovery Solution
Miguel Araújo
 
Maxscale 소개 1.1.1
Maxscale 소개 1.1.1Maxscale 소개 1.1.1
Maxscale 소개 1.1.1
NeoClova
 
Oracle sql high performance tuning
Oracle sql high performance tuningOracle sql high performance tuning
Oracle sql high performance tuning
Guy Harrison
 
The Full MySQL and MariaDB Parallel Replication Tutorial
The Full MySQL and MariaDB Parallel Replication TutorialThe Full MySQL and MariaDB Parallel Replication Tutorial
The Full MySQL and MariaDB Parallel Replication Tutorial
Jean-François Gagné
 
PostgreSQL WAL for DBAs
PostgreSQL WAL for DBAs PostgreSQL WAL for DBAs
PostgreSQL WAL for DBAs
PGConf APAC
 

What's hot (20)

MariaDB 마이그레이션 - 네오클로바
MariaDB 마이그레이션 - 네오클로바MariaDB 마이그레이션 - 네오클로바
MariaDB 마이그레이션 - 네오클로바
 
Automated master failover
Automated master failoverAutomated master failover
Automated master failover
 
MySQL GTID Concepts, Implementation and troubleshooting
MySQL GTID Concepts, Implementation and troubleshooting MySQL GTID Concepts, Implementation and troubleshooting
MySQL GTID Concepts, Implementation and troubleshooting
 
MariaDB MaxScale
MariaDB MaxScaleMariaDB MaxScale
MariaDB MaxScale
 
PostgreSQL and RAM usage
PostgreSQL and RAM usagePostgreSQL and RAM usage
PostgreSQL and RAM usage
 
Tanel Poder - Troubleshooting Complex Oracle Performance Issues - Part 2
Tanel Poder - Troubleshooting Complex Oracle Performance Issues - Part 2Tanel Poder - Troubleshooting Complex Oracle Performance Issues - Part 2
Tanel Poder - Troubleshooting Complex Oracle Performance Issues - Part 2
 
Linux and H/W optimizations for MySQL
Linux and H/W optimizations for MySQLLinux and H/W optimizations for MySQL
Linux and H/W optimizations for MySQL
 
My sql failover test using orchestrator
My sql failover test  using orchestratorMy sql failover test  using orchestrator
My sql failover test using orchestrator
 
PostgreSQL replication
PostgreSQL replicationPostgreSQL replication
PostgreSQL replication
 
MySQL Database Architectures - MySQL InnoDB ClusterSet 2021-11
MySQL Database Architectures - MySQL InnoDB ClusterSet 2021-11MySQL Database Architectures - MySQL InnoDB ClusterSet 2021-11
MySQL Database Architectures - MySQL InnoDB ClusterSet 2021-11
 
Mastering PostgreSQL Administration
Mastering PostgreSQL AdministrationMastering PostgreSQL Administration
Mastering PostgreSQL Administration
 
Using galera replication to create geo distributed clusters on the wan
Using galera replication to create geo distributed clusters on the wanUsing galera replication to create geo distributed clusters on the wan
Using galera replication to create geo distributed clusters on the wan
 
MySQL Database Architectures - InnoDB ReplicaSet & Cluster
MySQL Database Architectures - InnoDB ReplicaSet & ClusterMySQL Database Architectures - InnoDB ReplicaSet & Cluster
MySQL Database Architectures - InnoDB ReplicaSet & Cluster
 
MySQL Administrator 2021 - 네오클로바
MySQL Administrator 2021 - 네오클로바MySQL Administrator 2021 - 네오클로바
MySQL Administrator 2021 - 네오클로바
 
MariaDB High Availability
MariaDB High AvailabilityMariaDB High Availability
MariaDB High Availability
 
MySQL Database Architectures - High Availability and Disaster Recovery Solution
MySQL Database Architectures - High Availability and Disaster Recovery SolutionMySQL Database Architectures - High Availability and Disaster Recovery Solution
MySQL Database Architectures - High Availability and Disaster Recovery Solution
 
Maxscale 소개 1.1.1
Maxscale 소개 1.1.1Maxscale 소개 1.1.1
Maxscale 소개 1.1.1
 
Oracle sql high performance tuning
Oracle sql high performance tuningOracle sql high performance tuning
Oracle sql high performance tuning
 
The Full MySQL and MariaDB Parallel Replication Tutorial
The Full MySQL and MariaDB Parallel Replication TutorialThe Full MySQL and MariaDB Parallel Replication Tutorial
The Full MySQL and MariaDB Parallel Replication Tutorial
 
PostgreSQL WAL for DBAs
PostgreSQL WAL for DBAs PostgreSQL WAL for DBAs
PostgreSQL WAL for DBAs
 

Similar to Zero Downtime Schema Changes - Galera Cluster - Best Practices

M|18 Battle of the Online Schema Change Methods
M|18 Battle of the Online Schema Change MethodsM|18 Battle of the Online Schema Change Methods
M|18 Battle of the Online Schema Change Methods
MariaDB plc
 
Extreme Availability using Oracle 12c Features: Your very last system shutdown?
Extreme Availability using Oracle 12c Features: Your very last system shutdown?Extreme Availability using Oracle 12c Features: Your very last system shutdown?
Extreme Availability using Oracle 12c Features: Your very last system shutdown?
Toronto-Oracle-Users-Group
 
Oracle Database 12c "New features"
Oracle Database 12c "New features" Oracle Database 12c "New features"
Oracle Database 12c "New features"
Anar Godjaev
 
The Apache Cassandra ecosystem
The Apache Cassandra ecosystemThe Apache Cassandra ecosystem
The Apache Cassandra ecosystem
Alex Thompson
 
High-availability with Galera Cluster for MySQL
High-availability with Galera Cluster for MySQLHigh-availability with Galera Cluster for MySQL
High-availability with Galera Cluster for MySQL
FromDual GmbH
 
01 oracle architecture
01 oracle architecture01 oracle architecture
01 oracle architecture
Smitha Padmanabhan
 
MySQL Day Roma - MySQL Shell and Visual Studio Code Extension
MySQL Day Roma - MySQL Shell and Visual Studio Code ExtensionMySQL Day Roma - MySQL Shell and Visual Studio Code Extension
MySQL Day Roma - MySQL Shell and Visual Studio Code Extension
Frederic Descamps
 
NoCOUG_201411_Patel_Managing_a_Large_OLTP_Database
NoCOUG_201411_Patel_Managing_a_Large_OLTP_DatabaseNoCOUG_201411_Patel_Managing_a_Large_OLTP_Database
NoCOUG_201411_Patel_Managing_a_Large_OLTP_Database
Paresh Patel
 
Confoo 2021 -- MySQL New Features
Confoo 2021 -- MySQL New FeaturesConfoo 2021 -- MySQL New Features
Confoo 2021 -- MySQL New Features
Dave Stokes
 
OpenShift Multicluster
OpenShift MulticlusterOpenShift Multicluster
OpenShift Multicluster
Juan Vicente Herrera Ruiz de Alejo
 
[SSA] 03.newsql database (2014.02.05)
[SSA] 03.newsql database (2014.02.05)[SSA] 03.newsql database (2014.02.05)
[SSA] 03.newsql database (2014.02.05)
Steve Min
 
Midwest PHP Presentation - New MSQL Features
Midwest PHP Presentation - New MSQL FeaturesMidwest PHP Presentation - New MSQL Features
Midwest PHP Presentation - New MSQL Features
Dave Stokes
 
Production Grade Kubernetes Applications
Production Grade Kubernetes ApplicationsProduction Grade Kubernetes Applications
Production Grade Kubernetes Applications
Narayanan Krishnamurthy
 
How to Handle your Kubernetes Upgrades
How to Handle your Kubernetes UpgradesHow to Handle your Kubernetes Upgrades
How to Handle your Kubernetes Upgrades
CloudOps2005
 
Become a MySQL DBA - Webinars - Schema Changes for MySQL Replication & Galera...
Become a MySQL DBA - Webinars - Schema Changes for MySQL Replication & Galera...Become a MySQL DBA - Webinars - Schema Changes for MySQL Replication & Galera...
Become a MySQL DBA - Webinars - Schema Changes for MySQL Replication & Galera...
Severalnines
 
HA with Galera
HA with GaleraHA with Galera
HA with Galera
FromDual GmbH
 
PoC: Using a Group Communication System to improve MySQL Replication HA
PoC: Using a Group Communication System to improve MySQL Replication HAPoC: Using a Group Communication System to improve MySQL Replication HA
PoC: Using a Group Communication System to improve MySQL Replication HA
Ulf Wendel
 
Pg chameleon, mysql to postgresql replica made easy
Pg chameleon, mysql to postgresql replica made easyPg chameleon, mysql to postgresql replica made easy
Pg chameleon, mysql to postgresql replica made easy
Federico Campoli
 
Power-Efficient Programming Using Qualcomm Multicore Asynchronous Runtime Env...
Power-Efficient Programming Using Qualcomm Multicore Asynchronous Runtime Env...Power-Efficient Programming Using Qualcomm Multicore Asynchronous Runtime Env...
Power-Efficient Programming Using Qualcomm Multicore Asynchronous Runtime Env...
Qualcomm Developer Network
 
CDC patterns in Apache Kafka®
CDC patterns in Apache Kafka®CDC patterns in Apache Kafka®
CDC patterns in Apache Kafka®
confluent
 

Similar to Zero Downtime Schema Changes - Galera Cluster - Best Practices (20)

M|18 Battle of the Online Schema Change Methods
M|18 Battle of the Online Schema Change MethodsM|18 Battle of the Online Schema Change Methods
M|18 Battle of the Online Schema Change Methods
 
Extreme Availability using Oracle 12c Features: Your very last system shutdown?
Extreme Availability using Oracle 12c Features: Your very last system shutdown?Extreme Availability using Oracle 12c Features: Your very last system shutdown?
Extreme Availability using Oracle 12c Features: Your very last system shutdown?
 
Oracle Database 12c "New features"
Oracle Database 12c "New features" Oracle Database 12c "New features"
Oracle Database 12c "New features"
 
The Apache Cassandra ecosystem
The Apache Cassandra ecosystemThe Apache Cassandra ecosystem
The Apache Cassandra ecosystem
 
High-availability with Galera Cluster for MySQL
High-availability with Galera Cluster for MySQLHigh-availability with Galera Cluster for MySQL
High-availability with Galera Cluster for MySQL
 
01 oracle architecture
01 oracle architecture01 oracle architecture
01 oracle architecture
 
MySQL Day Roma - MySQL Shell and Visual Studio Code Extension
MySQL Day Roma - MySQL Shell and Visual Studio Code ExtensionMySQL Day Roma - MySQL Shell and Visual Studio Code Extension
MySQL Day Roma - MySQL Shell and Visual Studio Code Extension
 
NoCOUG_201411_Patel_Managing_a_Large_OLTP_Database
NoCOUG_201411_Patel_Managing_a_Large_OLTP_DatabaseNoCOUG_201411_Patel_Managing_a_Large_OLTP_Database
NoCOUG_201411_Patel_Managing_a_Large_OLTP_Database
 
Confoo 2021 -- MySQL New Features
Confoo 2021 -- MySQL New FeaturesConfoo 2021 -- MySQL New Features
Confoo 2021 -- MySQL New Features
 
OpenShift Multicluster
OpenShift MulticlusterOpenShift Multicluster
OpenShift Multicluster
 
[SSA] 03.newsql database (2014.02.05)
[SSA] 03.newsql database (2014.02.05)[SSA] 03.newsql database (2014.02.05)
[SSA] 03.newsql database (2014.02.05)
 
Midwest PHP Presentation - New MSQL Features
Midwest PHP Presentation - New MSQL FeaturesMidwest PHP Presentation - New MSQL Features
Midwest PHP Presentation - New MSQL Features
 
Production Grade Kubernetes Applications
Production Grade Kubernetes ApplicationsProduction Grade Kubernetes Applications
Production Grade Kubernetes Applications
 
How to Handle your Kubernetes Upgrades
How to Handle your Kubernetes UpgradesHow to Handle your Kubernetes Upgrades
How to Handle your Kubernetes Upgrades
 
Become a MySQL DBA - Webinars - Schema Changes for MySQL Replication & Galera...
Become a MySQL DBA - Webinars - Schema Changes for MySQL Replication & Galera...Become a MySQL DBA - Webinars - Schema Changes for MySQL Replication & Galera...
Become a MySQL DBA - Webinars - Schema Changes for MySQL Replication & Galera...
 
HA with Galera
HA with GaleraHA with Galera
HA with Galera
 
PoC: Using a Group Communication System to improve MySQL Replication HA
PoC: Using a Group Communication System to improve MySQL Replication HAPoC: Using a Group Communication System to improve MySQL Replication HA
PoC: Using a Group Communication System to improve MySQL Replication HA
 
Pg chameleon, mysql to postgresql replica made easy
Pg chameleon, mysql to postgresql replica made easyPg chameleon, mysql to postgresql replica made easy
Pg chameleon, mysql to postgresql replica made easy
 
Power-Efficient Programming Using Qualcomm Multicore Asynchronous Runtime Env...
Power-Efficient Programming Using Qualcomm Multicore Asynchronous Runtime Env...Power-Efficient Programming Using Qualcomm Multicore Asynchronous Runtime Env...
Power-Efficient Programming Using Qualcomm Multicore Asynchronous Runtime Env...
 
CDC patterns in Apache Kafka®
CDC patterns in Apache Kafka®CDC patterns in Apache Kafka®
CDC patterns in Apache Kafka®
 

More from Severalnines

WEBINAR SLIDES: CCX for Cloud Service Providers
WEBINAR SLIDES: CCX for Cloud Service ProvidersWEBINAR SLIDES: CCX for Cloud Service Providers
WEBINAR SLIDES: CCX for Cloud Service Providers
Severalnines
 
LIVE DEMO: CCX for CSPs, a drop-in DBaaS solution
LIVE DEMO: CCX for CSPs, a drop-in DBaaS solutionLIVE DEMO: CCX for CSPs, a drop-in DBaaS solution
LIVE DEMO: CCX for CSPs, a drop-in DBaaS solution
Severalnines
 
Kubernetes at Scale: Going Multi-Cluster with Istio
Kubernetes at Scale:  Going Multi-Cluster  with IstioKubernetes at Scale:  Going Multi-Cluster  with Istio
Kubernetes at Scale: Going Multi-Cluster with Istio
Severalnines
 
DIY DBaaS: A guide to building your own full-featured DBaaS
DIY DBaaS: A guide to building your own full-featured DBaaSDIY DBaaS: A guide to building your own full-featured DBaaS
DIY DBaaS: A guide to building your own full-featured DBaaS
Severalnines
 
Cloud's future runs through Sovereign DBaaS
Cloud's future runs through Sovereign DBaaSCloud's future runs through Sovereign DBaaS
Cloud's future runs through Sovereign DBaaS
Severalnines
 
Tips to drive maria db cluster performance for nextcloud
Tips to drive maria db cluster performance for nextcloudTips to drive maria db cluster performance for nextcloud
Tips to drive maria db cluster performance for nextcloud
Severalnines
 
Working with the Moodle Database: The Basics
Working with the Moodle Database: The BasicsWorking with the Moodle Database: The Basics
Working with the Moodle Database: The Basics
Severalnines
 
SysAdmin Working from Home? Tips to Automate MySQL, MariaDB, Postgres & MongoDB
SysAdmin Working from Home? Tips to Automate MySQL, MariaDB, Postgres & MongoDBSysAdmin Working from Home? Tips to Automate MySQL, MariaDB, Postgres & MongoDB
SysAdmin Working from Home? Tips to Automate MySQL, MariaDB, Postgres & MongoDB
Severalnines
 
(slides) Polyglot persistence: utilizing open source databases as a Swiss poc...
(slides) Polyglot persistence: utilizing open source databases as a Swiss poc...(slides) Polyglot persistence: utilizing open source databases as a Swiss poc...
(slides) Polyglot persistence: utilizing open source databases as a Swiss poc...
Severalnines
 
Webinar slides: How to Migrate from Oracle DB to MariaDB
Webinar slides: How to Migrate from Oracle DB to MariaDBWebinar slides: How to Migrate from Oracle DB to MariaDB
Webinar slides: How to Migrate from Oracle DB to MariaDB
Severalnines
 
Webinar slides: How to Automate & Manage PostgreSQL with ClusterControl
Webinar slides: How to Automate & Manage PostgreSQL with ClusterControlWebinar slides: How to Automate & Manage PostgreSQL with ClusterControl
Webinar slides: How to Automate & Manage PostgreSQL with ClusterControl
Severalnines
 
Webinar slides: How to Manage Replication Failover Processes for MySQL, Maria...
Webinar slides: How to Manage Replication Failover Processes for MySQL, Maria...Webinar slides: How to Manage Replication Failover Processes for MySQL, Maria...
Webinar slides: How to Manage Replication Failover Processes for MySQL, Maria...
Severalnines
 
Webinar slides: Backup Management for MySQL, MariaDB, PostgreSQL & MongoDB wi...
Webinar slides: Backup Management for MySQL, MariaDB, PostgreSQL & MongoDB wi...Webinar slides: Backup Management for MySQL, MariaDB, PostgreSQL & MongoDB wi...
Webinar slides: Backup Management for MySQL, MariaDB, PostgreSQL & MongoDB wi...
Severalnines
 
Disaster Recovery Planning for MySQL & MariaDB
Disaster Recovery Planning for MySQL & MariaDBDisaster Recovery Planning for MySQL & MariaDB
Disaster Recovery Planning for MySQL & MariaDB
Severalnines
 
MariaDB Performance Tuning Crash Course
MariaDB Performance Tuning Crash CourseMariaDB Performance Tuning Crash Course
MariaDB Performance Tuning Crash Course
Severalnines
 
Performance Tuning Cheat Sheet for MongoDB
Performance Tuning Cheat Sheet for MongoDBPerformance Tuning Cheat Sheet for MongoDB
Performance Tuning Cheat Sheet for MongoDB
Severalnines
 
Advanced MySql Data-at-Rest Encryption in Percona Server
Advanced MySql Data-at-Rest Encryption in Percona ServerAdvanced MySql Data-at-Rest Encryption in Percona Server
Advanced MySql Data-at-Rest Encryption in Percona Server
Severalnines
 
Polyglot Persistence Utilizing Open Source Databases as a Swiss Pocket Knife
Polyglot Persistence Utilizing Open Source Databases as a Swiss Pocket KnifePolyglot Persistence Utilizing Open Source Databases as a Swiss Pocket Knife
Polyglot Persistence Utilizing Open Source Databases as a Swiss Pocket Knife
Severalnines
 
Webinar slides: Free Monitoring (on Steroids) for MySQL, MariaDB, PostgreSQL ...
Webinar slides: Free Monitoring (on Steroids) for MySQL, MariaDB, PostgreSQL ...Webinar slides: Free Monitoring (on Steroids) for MySQL, MariaDB, PostgreSQL ...
Webinar slides: Free Monitoring (on Steroids) for MySQL, MariaDB, PostgreSQL ...
Severalnines
 
Webinar slides: An Introduction to Performance Monitoring for PostgreSQL
Webinar slides: An Introduction to Performance Monitoring for PostgreSQLWebinar slides: An Introduction to Performance Monitoring for PostgreSQL
Webinar slides: An Introduction to Performance Monitoring for PostgreSQL
Severalnines
 

More from Severalnines (20)

WEBINAR SLIDES: CCX for Cloud Service Providers
WEBINAR SLIDES: CCX for Cloud Service ProvidersWEBINAR SLIDES: CCX for Cloud Service Providers
WEBINAR SLIDES: CCX for Cloud Service Providers
 
LIVE DEMO: CCX for CSPs, a drop-in DBaaS solution
LIVE DEMO: CCX for CSPs, a drop-in DBaaS solutionLIVE DEMO: CCX for CSPs, a drop-in DBaaS solution
LIVE DEMO: CCX for CSPs, a drop-in DBaaS solution
 
Kubernetes at Scale: Going Multi-Cluster with Istio
Kubernetes at Scale:  Going Multi-Cluster  with IstioKubernetes at Scale:  Going Multi-Cluster  with Istio
Kubernetes at Scale: Going Multi-Cluster with Istio
 
DIY DBaaS: A guide to building your own full-featured DBaaS
DIY DBaaS: A guide to building your own full-featured DBaaSDIY DBaaS: A guide to building your own full-featured DBaaS
DIY DBaaS: A guide to building your own full-featured DBaaS
 
Cloud's future runs through Sovereign DBaaS
Cloud's future runs through Sovereign DBaaSCloud's future runs through Sovereign DBaaS
Cloud's future runs through Sovereign DBaaS
 
Tips to drive maria db cluster performance for nextcloud
Tips to drive maria db cluster performance for nextcloudTips to drive maria db cluster performance for nextcloud
Tips to drive maria db cluster performance for nextcloud
 
Working with the Moodle Database: The Basics
Working with the Moodle Database: The BasicsWorking with the Moodle Database: The Basics
Working with the Moodle Database: The Basics
 
SysAdmin Working from Home? Tips to Automate MySQL, MariaDB, Postgres & MongoDB
SysAdmin Working from Home? Tips to Automate MySQL, MariaDB, Postgres & MongoDBSysAdmin Working from Home? Tips to Automate MySQL, MariaDB, Postgres & MongoDB
SysAdmin Working from Home? Tips to Automate MySQL, MariaDB, Postgres & MongoDB
 
(slides) Polyglot persistence: utilizing open source databases as a Swiss poc...
(slides) Polyglot persistence: utilizing open source databases as a Swiss poc...(slides) Polyglot persistence: utilizing open source databases as a Swiss poc...
(slides) Polyglot persistence: utilizing open source databases as a Swiss poc...
 
Webinar slides: How to Migrate from Oracle DB to MariaDB
Webinar slides: How to Migrate from Oracle DB to MariaDBWebinar slides: How to Migrate from Oracle DB to MariaDB
Webinar slides: How to Migrate from Oracle DB to MariaDB
 
Webinar slides: How to Automate & Manage PostgreSQL with ClusterControl
Webinar slides: How to Automate & Manage PostgreSQL with ClusterControlWebinar slides: How to Automate & Manage PostgreSQL with ClusterControl
Webinar slides: How to Automate & Manage PostgreSQL with ClusterControl
 
Webinar slides: How to Manage Replication Failover Processes for MySQL, Maria...
Webinar slides: How to Manage Replication Failover Processes for MySQL, Maria...Webinar slides: How to Manage Replication Failover Processes for MySQL, Maria...
Webinar slides: How to Manage Replication Failover Processes for MySQL, Maria...
 
Webinar slides: Backup Management for MySQL, MariaDB, PostgreSQL & MongoDB wi...
Webinar slides: Backup Management for MySQL, MariaDB, PostgreSQL & MongoDB wi...Webinar slides: Backup Management for MySQL, MariaDB, PostgreSQL & MongoDB wi...
Webinar slides: Backup Management for MySQL, MariaDB, PostgreSQL & MongoDB wi...
 
Disaster Recovery Planning for MySQL & MariaDB
Disaster Recovery Planning for MySQL & MariaDBDisaster Recovery Planning for MySQL & MariaDB
Disaster Recovery Planning for MySQL & MariaDB
 
MariaDB Performance Tuning Crash Course
MariaDB Performance Tuning Crash CourseMariaDB Performance Tuning Crash Course
MariaDB Performance Tuning Crash Course
 
Performance Tuning Cheat Sheet for MongoDB
Performance Tuning Cheat Sheet for MongoDBPerformance Tuning Cheat Sheet for MongoDB
Performance Tuning Cheat Sheet for MongoDB
 
Advanced MySql Data-at-Rest Encryption in Percona Server
Advanced MySql Data-at-Rest Encryption in Percona ServerAdvanced MySql Data-at-Rest Encryption in Percona Server
Advanced MySql Data-at-Rest Encryption in Percona Server
 
Polyglot Persistence Utilizing Open Source Databases as a Swiss Pocket Knife
Polyglot Persistence Utilizing Open Source Databases as a Swiss Pocket KnifePolyglot Persistence Utilizing Open Source Databases as a Swiss Pocket Knife
Polyglot Persistence Utilizing Open Source Databases as a Swiss Pocket Knife
 
Webinar slides: Free Monitoring (on Steroids) for MySQL, MariaDB, PostgreSQL ...
Webinar slides: Free Monitoring (on Steroids) for MySQL, MariaDB, PostgreSQL ...Webinar slides: Free Monitoring (on Steroids) for MySQL, MariaDB, PostgreSQL ...
Webinar slides: Free Monitoring (on Steroids) for MySQL, MariaDB, PostgreSQL ...
 
Webinar slides: An Introduction to Performance Monitoring for PostgreSQL
Webinar slides: An Introduction to Performance Monitoring for PostgreSQLWebinar slides: An Introduction to Performance Monitoring for PostgreSQL
Webinar slides: An Introduction to Performance Monitoring for PostgreSQL
 

Recently uploaded

Choose our Linux Web Hosting for a seamless and successful online presence
Choose our Linux Web Hosting for a seamless and successful online presenceChoose our Linux Web Hosting for a seamless and successful online presence
Choose our Linux Web Hosting for a seamless and successful online presence
rajancomputerfbd
 
Measuring the Impact of Network Latency at Twitter
Measuring the Impact of Network Latency at TwitterMeasuring the Impact of Network Latency at Twitter
Measuring the Impact of Network Latency at Twitter
ScyllaDB
 
Details of description part II: Describing images in practice - Tech Forum 2024
Details of description part II: Describing images in practice - Tech Forum 2024Details of description part II: Describing images in practice - Tech Forum 2024
Details of description part II: Describing images in practice - Tech Forum 2024
BookNet Canada
 
Quality Patents: Patents That Stand the Test of Time
Quality Patents: Patents That Stand the Test of TimeQuality Patents: Patents That Stand the Test of Time
Quality Patents: Patents That Stand the Test of Time
Aurora Consulting
 
Best Programming Language for Civil Engineers
Best Programming Language for Civil EngineersBest Programming Language for Civil Engineers
Best Programming Language for Civil Engineers
Awais Yaseen
 
Coordinate Systems in FME 101 - Webinar Slides
Coordinate Systems in FME 101 - Webinar SlidesCoordinate Systems in FME 101 - Webinar Slides
Coordinate Systems in FME 101 - Webinar Slides
Safe Software
 
BLOCKCHAIN FOR DUMMIES: GUIDEBOOK FOR ALL
BLOCKCHAIN FOR DUMMIES: GUIDEBOOK FOR ALLBLOCKCHAIN FOR DUMMIES: GUIDEBOOK FOR ALL
BLOCKCHAIN FOR DUMMIES: GUIDEBOOK FOR ALL
Liveplex
 
What's New in Copilot for Microsoft365 May 2024.pptx
What's New in Copilot for Microsoft365 May 2024.pptxWhat's New in Copilot for Microsoft365 May 2024.pptx
What's New in Copilot for Microsoft365 May 2024.pptx
Stephanie Beckett
 
7 Most Powerful Solar Storms in the History of Earth.pdf
7 Most Powerful Solar Storms in the History of Earth.pdf7 Most Powerful Solar Storms in the History of Earth.pdf
7 Most Powerful Solar Storms in the History of Earth.pdf
Enterprise Wired
 
INDIAN AIR FORCE FIGHTER PLANES LIST.pdf
INDIAN AIR FORCE FIGHTER PLANES LIST.pdfINDIAN AIR FORCE FIGHTER PLANES LIST.pdf
INDIAN AIR FORCE FIGHTER PLANES LIST.pdf
jackson110191
 
Best Practices for Effectively Running dbt in Airflow.pdf
Best Practices for Effectively Running dbt in Airflow.pdfBest Practices for Effectively Running dbt in Airflow.pdf
Best Practices for Effectively Running dbt in Airflow.pdf
Tatiana Al-Chueyr
 
Observability For You and Me with OpenTelemetry
Observability For You and Me with OpenTelemetryObservability For You and Me with OpenTelemetry
Observability For You and Me with OpenTelemetry
Eric D. Schabell
 
BT & Neo4j: Knowledge Graphs for Critical Enterprise Systems.pptx.pdf
BT & Neo4j: Knowledge Graphs for Critical Enterprise Systems.pptx.pdfBT & Neo4j: Knowledge Graphs for Critical Enterprise Systems.pptx.pdf
BT & Neo4j: Knowledge Graphs for Critical Enterprise Systems.pptx.pdf
Neo4j
 
Implementations of Fused Deposition Modeling in real world
Implementations of Fused Deposition Modeling  in real worldImplementations of Fused Deposition Modeling  in real world
Implementations of Fused Deposition Modeling in real world
Emerging Tech
 
Research Directions for Cross Reality Interfaces
Research Directions for Cross Reality InterfacesResearch Directions for Cross Reality Interfaces
Research Directions for Cross Reality Interfaces
Mark Billinghurst
 
Advanced Techniques for Cyber Security Analysis and Anomaly Detection
Advanced Techniques for Cyber Security Analysis and Anomaly DetectionAdvanced Techniques for Cyber Security Analysis and Anomaly Detection
Advanced Techniques for Cyber Security Analysis and Anomaly Detection
Bert Blevins
 
Pigging Solutions Sustainability brochure.pdf
Pigging Solutions Sustainability brochure.pdfPigging Solutions Sustainability brochure.pdf
Pigging Solutions Sustainability brochure.pdf
Pigging Solutions
 
The Rise of Supernetwork Data Intensive Computing
The Rise of Supernetwork Data Intensive ComputingThe Rise of Supernetwork Data Intensive Computing
The Rise of Supernetwork Data Intensive Computing
Larry Smarr
 
Fluttercon 2024: Showing that you care about security - OpenSSF Scorecards fo...
Fluttercon 2024: Showing that you care about security - OpenSSF Scorecards fo...Fluttercon 2024: Showing that you care about security - OpenSSF Scorecards fo...
Fluttercon 2024: Showing that you care about security - OpenSSF Scorecards fo...
Chris Swan
 
Manual | Product | Research Presentation
Manual | Product | Research PresentationManual | Product | Research Presentation
Manual | Product | Research Presentation
welrejdoall
 

Recently uploaded (20)

Choose our Linux Web Hosting for a seamless and successful online presence
Choose our Linux Web Hosting for a seamless and successful online presenceChoose our Linux Web Hosting for a seamless and successful online presence
Choose our Linux Web Hosting for a seamless and successful online presence
 
Measuring the Impact of Network Latency at Twitter
Measuring the Impact of Network Latency at TwitterMeasuring the Impact of Network Latency at Twitter
Measuring the Impact of Network Latency at Twitter
 
Details of description part II: Describing images in practice - Tech Forum 2024
Details of description part II: Describing images in practice - Tech Forum 2024Details of description part II: Describing images in practice - Tech Forum 2024
Details of description part II: Describing images in practice - Tech Forum 2024
 
Quality Patents: Patents That Stand the Test of Time
Quality Patents: Patents That Stand the Test of TimeQuality Patents: Patents That Stand the Test of Time
Quality Patents: Patents That Stand the Test of Time
 
Best Programming Language for Civil Engineers
Best Programming Language for Civil EngineersBest Programming Language for Civil Engineers
Best Programming Language for Civil Engineers
 
Coordinate Systems in FME 101 - Webinar Slides
Coordinate Systems in FME 101 - Webinar SlidesCoordinate Systems in FME 101 - Webinar Slides
Coordinate Systems in FME 101 - Webinar Slides
 
BLOCKCHAIN FOR DUMMIES: GUIDEBOOK FOR ALL
BLOCKCHAIN FOR DUMMIES: GUIDEBOOK FOR ALLBLOCKCHAIN FOR DUMMIES: GUIDEBOOK FOR ALL
BLOCKCHAIN FOR DUMMIES: GUIDEBOOK FOR ALL
 
What's New in Copilot for Microsoft365 May 2024.pptx
What's New in Copilot for Microsoft365 May 2024.pptxWhat's New in Copilot for Microsoft365 May 2024.pptx
What's New in Copilot for Microsoft365 May 2024.pptx
 
7 Most Powerful Solar Storms in the History of Earth.pdf
7 Most Powerful Solar Storms in the History of Earth.pdf7 Most Powerful Solar Storms in the History of Earth.pdf
7 Most Powerful Solar Storms in the History of Earth.pdf
 
INDIAN AIR FORCE FIGHTER PLANES LIST.pdf
INDIAN AIR FORCE FIGHTER PLANES LIST.pdfINDIAN AIR FORCE FIGHTER PLANES LIST.pdf
INDIAN AIR FORCE FIGHTER PLANES LIST.pdf
 
Best Practices for Effectively Running dbt in Airflow.pdf
Best Practices for Effectively Running dbt in Airflow.pdfBest Practices for Effectively Running dbt in Airflow.pdf
Best Practices for Effectively Running dbt in Airflow.pdf
 
Observability For You and Me with OpenTelemetry
Observability For You and Me with OpenTelemetryObservability For You and Me with OpenTelemetry
Observability For You and Me with OpenTelemetry
 
BT & Neo4j: Knowledge Graphs for Critical Enterprise Systems.pptx.pdf
BT & Neo4j: Knowledge Graphs for Critical Enterprise Systems.pptx.pdfBT & Neo4j: Knowledge Graphs for Critical Enterprise Systems.pptx.pdf
BT & Neo4j: Knowledge Graphs for Critical Enterprise Systems.pptx.pdf
 
Implementations of Fused Deposition Modeling in real world
Implementations of Fused Deposition Modeling  in real worldImplementations of Fused Deposition Modeling  in real world
Implementations of Fused Deposition Modeling in real world
 
Research Directions for Cross Reality Interfaces
Research Directions for Cross Reality InterfacesResearch Directions for Cross Reality Interfaces
Research Directions for Cross Reality Interfaces
 
Advanced Techniques for Cyber Security Analysis and Anomaly Detection
Advanced Techniques for Cyber Security Analysis and Anomaly DetectionAdvanced Techniques for Cyber Security Analysis and Anomaly Detection
Advanced Techniques for Cyber Security Analysis and Anomaly Detection
 
Pigging Solutions Sustainability brochure.pdf
Pigging Solutions Sustainability brochure.pdfPigging Solutions Sustainability brochure.pdf
Pigging Solutions Sustainability brochure.pdf
 
The Rise of Supernetwork Data Intensive Computing
The Rise of Supernetwork Data Intensive ComputingThe Rise of Supernetwork Data Intensive Computing
The Rise of Supernetwork Data Intensive Computing
 
Fluttercon 2024: Showing that you care about security - OpenSSF Scorecards fo...
Fluttercon 2024: Showing that you care about security - OpenSSF Scorecards fo...Fluttercon 2024: Showing that you care about security - OpenSSF Scorecards fo...
Fluttercon 2024: Showing that you care about security - OpenSSF Scorecards fo...
 
Manual | Product | Research Presentation
Manual | Product | Research PresentationManual | Product | Research Presentation
Manual | Product | Research Presentation
 

Zero Downtime Schema Changes - Galera Cluster - Best Practices

  • 2. Agenda ● Schema Upgrades in Synchronous Cluster ● DDL Classification ● Schema Backwards Compatibility ● Alternatives for Schema Upgrades ● ● ● ● ● ● TOI RSU / desync wsrep_desync / wsrep_on method Dropping Node for DDL pt-online-schema-change Summary www.codership.com 2
  • 3. Schema Upgrades Applications have evolution, and there will be needs to change database schema in new application revisions With 24/7 online requirements, the schema upgrade must happen while the system is online Synchronous database cluster, requires that all active nodes must have same data – Note that schema may differ, as long as data content is logically same We need to figure out way(s) to roll schema upgrades in online cluster with minimal disruption for the service www.codership.com 3
  • 4. What is DDL? SQL statements can be classified in several classes: DML Data Manipulation Language – Transactional data manipulations – SELECT, INSERT, UPDATE... DDL Data Definition Language – CREATE..., DROP..., ALTER... DCL Data Control Language – GRANT, REVOKE TCL Transaction Control Language … http://en.wikibooks.org/wiki/MySQL/Language/Definitions:_what_are_DDL,_DML_and_DQL%3F www.codership.com 4
  • 5. DML vs DDL But the bottom line is division between transactional and nontransactional statements: Transactional SQL – All DML on InnoDB – NON Transactional SQL Can be rolled back ● Not possible to rollback – ● DDL, DCL..., DML on non transactional SE – ● – Requires up-front locking Galera uses optimistic concurrency control, and depends on possibility to rollback a conflicting operation Only transactional SQL can be replicated through Galera transactional replication For others (DDL, DCL...), we either have to skip replication or use up-front locking www.codership.com 5
  • 6. DML vs DDL Notes on some DDL: TRUNCATE – is DDL! – Is fast to execute, but nevertheless has some impact OPTIMIZE, REPAIR, ANALYZE – Table admin commands are now replicated CREATE / DROP INDEX – Hold MDL on affected table, and can stall the replication www.codership.com 6
  • 8. Backward Compatibility App v1 MySQL Schema v1 App v1 Schema Upgrade MySQL Schema v2 App Upgrade App v2 MySQL Schema v2 Old application version must be able to use the new schema www.codership.com 9
  • 9. Backward Compatibility App v1 MySQL Schema v1 App Upgrade App v2 MySQL Schema v1 App v2 Schema Upgrade MySQL Schema v2 New application version must be able to use the old schema www.codership.com 10
  • 10. Backwards Compatibility New/old application should be able to use both old and new schema Application should be backwards compatible ROW replication between old and new schema should be possible Schema change should be backwards compatible www.codership.com 11
  • 11. App Backwards Compatibility New/old application should be able to use both old and new schema – New application can have compatibility mode to detect the version of underlying database – If old app cannot use new schema, the old app must connect to one node only, which will be the last to upgrade Dropping tables or columns can be a problem – But drops can be done delayed: e.g. in v2 -> v3 upgrade, obsolete v1 elements can be dropped as neither v2 or v3 app will use them any more www.codership.com 12
  • 12. ROW Replication Compatibility MySQL guarantees ROW replication event compatibility with some limitations Newer MySQL versions tolerate more variation between source and target tables, check out this page for latest status: http://dev.mysql.com/doc/refman/5.6/en/replication-features-differing-tables.html ● ● Source and target can have different number of columns But columns must be in same order ● New columns in the end, and must have default values ● Some data type conversions are also supported www.codership.com 13
  • 13. ROW Replication Compatibility Insert into table-A(col-a,col-b) values (5,7) col-a col-b col-a Table A col-b col-c Table A www.codership.com 14
  • 14. ROW Replication Compatibility Insert into table-A(col-a,col-b) values (5,7) col-a col-b col-a col-b col-c 5 7 5 7 def Replication Table A Table A www.codership.com 15
  • 15. STATEMENT Replication In STATEMENT format, schema compatibility is not an issue Galera does not currently support STATEMENT replication, but: – Enabling STATEMENT replication is minor task Consistency is at risk ● Parallel applying must be limited (OFF, Database or Table level) ● STATEMENT replication, in general, is phasing out Supporting STATEMENT replication for schema upgrades, is one potential extension we are looking for ● – www.codership.com 16
  • 16. Schema Upgrades in Galera Cluster
  • 17. Schema Upgrades in Galera Galera Cluster has two inbuilt methods for DDL replication: – TOI – Total Order Isolation – RSU – Rolling Schema Upgrade The method of choice is declared by variable: wsrep_osu_method = TOI | RSU Pt-online-schema-change is valid tool for upgrades, these and other DDL replication alternatives are discussed in following chapters. www.codership.com 18
  • 19. TOI Total oder Isolation (TOI) is the default DDL replication method ● ● ● ● wsrep_osu_method = TOI “master node” detects DDL at parsing time and sends out replication event for the SQL statement before even starting the DDL processing DDL replication happens in STATEMENT format Every node in the cluster will process the replicated DDL at the same “slot” in the cluster transaction stream (Total Order) www.codership.com 20
  • 20. TOI Replication ALTER TABLE t1... Parser Replication MySQL MySQL Execution a Galera Replication WS Seqno STATEMENT event G a l e r a R e p l i c a t io n www.codership.com 21
  • 21. TOI Replication ALTER TABLE t1... Parser apply continue Parser MySQL MySQL Execution Execution a Galera Replication WS Seqno slot reached www.codership.com 22
  • 22. TOI Replication Pros – Strict consistency, all nodes will get same change – No worries about schema backwards compatibility Cons – Strict commit order will make every transaction to wait until DDL is over Usable, when: – DDL is short term – Schema change will not be backwards compatible – And/or there is maintenance window Some future work in road map: – TOI replication commit order can be relaxed – We are working on optimization based on this www.codership.com 23
  • 24. RSU ➢ Rolling Schema Upgrade wsrep_osu_method=RSU ➢ Will desynchronize the node from replication for the duration of following DDL command ➢ Incoming replication is buffered ➢ Nothing will be replicated out of the node ➢ When DDL is over, the node will automatically join back in cluster, and catch up missed transactions from the buffer www.codership.com 25
  • 25. RSU SET GLOBAL wsrep_osu_method=RSU ALTER TABLE t1... MySQL MySQL MySQL G a l e r a R e p l i c a t io n a Galera Replication www.codership.com 26
  • 27. RSU ALTER TABLE t1... MySQL WS a MySQL MySQL WS Slave queue Galera Replication www.codership.com 28
  • 28. RSU Pros – DDL will not slow down cluster – Automatic re-sync after DDL is over Cons – – Schema change has to be backwards compatible – a Has global effect, all sessions will be RSU'ed Only one RSU operation at a time – Rolling over cluster is manual operation www.codership.com 29
  • 30. wsrep_desync Node can be set to omit flow control by: mysql> SET GLOBAL wsrep_desync=ON; A session can be declared to not replicate anything by: mysql> SET wsrep_on=OFF; ● ● Running DDL in such a session, will result in local schema change, and processing of the DDL will not hold back cluster. However, all cluster transactions will be replicated to the node, and if there are conflicts, the DDL will be aborted. wsrep_desync+wsrep_on method is good only for non-confliction operations www.codership.com 31
  • 31. wsrep_desync+wsrep_on SET GLOBAL wsrep_desync=ON; SET wsrep_on=OFF; ALTER TABLE t1... t1 t2 tn MySQL a WS WS Slave queue Galera Replication www.codership.com 32
  • 32. wsrep_desync We are currently working on making better use of desync mode. The goal is to protect local desynced transactions from replication aborts. This way, the DDL will succeed even if there are conflicts with the cluster. However, cluster replication will pause at first such conflict and wait until DDL is complete. But, this will be future extension, and available in some of following 3.* release. www.codership.com 33
  • 33. Drop a Node for DDL
  • 34. Dropping Node for DDL One way to do “manual RSU”, is to drop a node from cluster and run DDL on the stand-alone node. Joining the node back must happen through IST, as we don't want SST to bring back the old schema. Make sure to protect the node from any production connections! Load balancers should be configured first to isolate the node from unwanted connections. Adjust your gcache size big enough to allow IST after the DDL is over. www.codership.com 35
  • 35. Dropping Node for DDL Load Balancer 1. configure LB 2. Drop node, e.g. set global wsrep_cluster_address=gcomm:// MySQL MySQL Galera Replication www.codership.com 36
  • 36. Dropping Node for DDL Load Balancer 3. ALTER TABLE t1... MySQL MySQL Galera Replication www.codership.com 37
  • 37. Dropping Node for DDL Load Balancer 4. Join back set wsrep_cluster_address... WS MySQL WS IST MySQL Galera Replication www.codership.com 38
  • 38. Dropping Node for DDL Load Balancer 5. configure LB MySQL MySQL Galera Replication www.codership.com 39
  • 40. pt-online-schema-change Tool in Percona Toolkit to run non blocking schema changes http://www.percona.com/doc/percona-toolkit/2.2/pt-online-schema-change.html 1. Creates a shadow copy of target table 2. Installs triggers in source table to forward updates to target table 3. Copies source table data in small chunks to target table 4. Renames target table to replace the source table Pt-osc does not replicate schema changes, but makes it possible to change schema without interfering with replication However, pt-osc requires TOI to be enabled, and TOI replication will propagate the changes to whole cluster www.codership.com 41
  • 42. pt-online-schema-change updates t1-new t1 a Install trigger to forward updates to new table www.codership.com 43
  • 47. pt-online-schema-change Some Caveats: ● TOI requirement – – ● Pt-osc changes will be run against whole cluster with one go Could be relaxed, imo Triggers not supported – ● Pt-osc installs new triggers in source table and does not allow any other triggers to exists in the table Foreign key support – a Two methods for dealing with FKs – Rebuilding child table FK constraint may be needed – FK constraint name will be different www.codership.com 48
  • 49. Codership Schema upgrades require careful planning ➢ Find out backwards compatibility both from application and from ROW replication perspective ➢ Plan your upgrade process ➢ Rehearse with test cluster Instant methods: ➢ TOI replication, pt-osc ➢ ROW replication backwards compatibility is not an issue Rolling methods ➢ RSU, wsrep_desync/wsrep_on, node dropping ➢ Schema backwards compatibility required www.codership.com 50
  • 50. Questions? Thank you for listening! Happy Clustering :-)