Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
SlideShare a Scribd company logo
1 / 147
2 / 147
3 / 147
MySQL HA so easy ? That's insane !
MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for
MySQL
 
 
Frédéric Descamps - MySQL Community Manager - Oracle
4 / 147
Save the date !
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
5 / 147
 
Safe Harbor Statement
The following is intended to outline our general product direction. It is intended for
information purpose only, and may not be incorporated into any contract. It is not a
commitment to deliver any material, code, or functionality, and should not be relied up in
making purchasing decisions. The development, release and timing of any features or
functionality described for Oracle´s product remains at the sole discretion of Oracle.
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
6 / 147
about me - http://about.me/lefred
Who am I ?
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
7 / 147
Frédéric Descamps
@lefred
MySQL Evangelist
Hacking MySQL since 3.23
devops believer
living in Belgium 🇧🇪
http://lefred.be
 
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
8 / 147
MySQL InnoDB Cluster: vision
  "A single product - MySQL - with high availability and scaling features baked in;
providing an integrated end-to-end solution that is easy to use."
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
9 / 147
MySQL InnoDB Cluster: vision
  "A single product - MySQL - with high availability and scaling features baked in;
providing an integrated end-to-end solution that is easy to use."
InnoDB
cluster
Ease-of-Use
Extreme Scale-Out
Out-of-Box Solution
Built-in HA
High Performance
Everything Integrated
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
10 / 147
One Product: MySQL
All components created together
Tested together
Packaged together
Easy to Use
One client: MySQL Shell
Easy packaging
Integrated orchestration
Homogenous servers
Flexible and Modern
SQL and NoSQL together
Protocol Buffers
Asynchronous API
Developer friendly
Support Read/Write Scale Out
Shared clusters
Federated system of N replica sets
supporting cross shard
operations
Each replica set manages a shard
MySQL InnoDB Cluster: goals
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
11 / 147
MySQL InnoDB Cluster Architecture
Application
MySQL Connector
MySQL Router
MySQL Shell
InnoDB
cluster
Application
MySQL Connector
MySQL Router
Mp
M
M
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
12 / 147
Let's start with the demo, shall we ?
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
13 / 147
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
14 / 147
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
15 / 147
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
16 / 147
Group Replication: heart of MySQL InnoDB
Cluster
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
17 / 147
Group Replication: heart of MySQL InnoDB
Cluster
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
18 / 147
MySQL Group Replication
but what is it ?!?
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
19 / 147
MySQL Group Replication
but what is it ?!?
GR is a plugin for MySQL, made by MySQL and packaged with MySQL
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
20 / 147
MySQL Group Replication
but what is it ?!?
GR is a plugin for MySQL, made by MySQL and packaged with MySQL
GR is an implementation of Replicated Database State Machine theory
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
21 / 147
MySQL Group Replication
but what is it ?!?
GR is a plugin for MySQL, made by MySQL and packaged with MySQL
GR is an implementation of Replicated Database State Machine theory
GR allows to write on all Group Members (cluster nodes) simultaneously while
retaining consistency
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
22 / 147
MySQL Group Replication
but what is it ?!?
GR is a plugin for MySQL, made by MySQL and packaged with MySQL
GR is an implementation of Replicated Database State Machine theory
GR allows to write on all Group Members (cluster nodes) simultaneously while
retaining consistency
GR implements conflict detection and resolution
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
23 / 147
MySQL Group Replication
but what is it ?!?
GR is a plugin for MySQL, made by MySQL and packaged with MySQL
GR is an implementation of Replicated Database State Machine theory
GR allows to write on all Group Members (cluster nodes) simultaneously while
retaining consistency
GR implements conflict detection and resolution
GR allows automatic distributed recovery
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
24 / 147
MySQL Group Replication
but what is it ?!?
GR is a plugin for MySQL, made by MySQL and packaged with MySQL
GR is an implementation of Replicated Database State Machine theory
GR allows to write on all Group Members (cluster nodes) simultaneously while
retaining consistency
GR implements conflict detection and resolution
GR allows automatic distributed recovery
Supported on all MySQL platforms !!
Linux, Windows, Solaris, OSX, FreeBSD
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
25 / 147
And what does it means for users ?
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
26 / 147
And what does it means for users ?
no longer necessary to handle server fail-over manually or with a complicated script
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
27 / 147
And what does it means for users ?
no longer necessary to handle server fail-over manually or with a complicated script
GR provides fault tolerance
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
28 / 147
And what does it means for users ?
no longer necessary to handle server fail-over manually or with a complicated script
GR provides fault tolerance
GR enables update-everywhere setups
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
29 / 147
And what does it means for users ?
no longer necessary to handle server fail-over manually or with a complicated script
GR provides fault tolerance
GR enables update-everywhere setups
GR handles crashes, failures, re-connetcs automatically
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
30 / 147
And what does it means for users ?
no longer necessary to handle server fail-over manually or with a complicated script
GR provides fault tolerance
GR enables update-everywhere setups
GR handles crashes, failures, re-connetcs automatically
Allows an easy setup of a MySQL service high available !
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
31 / 147
Default = Single Primary Mode
By default, MySQL InnoDB Cluster runs in Single Primary Mode.
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
32 / 147
Default = Single Primary Mode
By default, MySQL InnoDB Cluster runs in Single Primary Mode.
mysql> show global variables like 'group_replication_single_primary_mode';
+---------------------------------------+-------+
| Variable_name | Value |
+---------------------------------------+-------+
| group_replication_single_primary_mode | ON |
+---------------------------------------+-------+
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
33 / 147
Default = Single Primary Mode
By default, MySQL InnoDB Cluster runs in Single Primary Mode.
mysql> show global variables like 'group_replication_single_primary_mode';
+---------------------------------------+-------+
| Variable_name | Value |
+---------------------------------------+-------+
| group_replication_single_primary_mode | ON |
+---------------------------------------+-------+
In Single Primary Mode, a single member acts as the writable master (PRIMARY) and
the rest of the members act as hot-standbys (SECONDARY).
The group itself coordinates and configures itself automatically to determine which
member will act as the PRIMARY, through a leader election mechanism.
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
34 / 147
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
35 / 147
MySQL Router
MySQL Router is lightweight middleware that provides transparent routing between your
application and backend MySQL Servers. It can be used for a wide variety of use cases,
such as providing high availability and scalability by effectively routing database traffic
to appropriate backend MySQL Servers.
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
36 / 147
MySQL Router
MySQL Router is lightweight middleware that provides transparent routing between your
application and backend MySQL Servers. It can be used for a wide variety of use cases,
such as providing high availability and scalability by effectively routing database traffic
to appropriate backend MySQL Servers.
MySQL Router doesn´t require any specific configuration. It configures itself
automatically (bootstrap) using MySQL InnoDB Cluster´s metadata.
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
37 / 147
ProxySQL has native support for Group
Replication which makes it a good choice
for advanced users.
ProxySQL
If you need some specific features that are not yet available in MySQL Router, like
transparent R/W splitting, then you can use your software of choice.
We are also collaborating with ProxySQL.
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
38 / 147
MySQL Shell
The MySQL Shell is an interactive Javascript, Python, or SQL interface supporting
development and administration for the MySQL Server and is a component of the MySQL
Server. You can use the MySQL Shell to perform data queries and updates as well as
various administration operations.
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
39 / 147
MySQL Shell (2)
The MySQL Shell provides:
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
40 / 147
MySQL Shell (2)
The MySQL Shell provides:
Both Interactive and Batch operations
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
41 / 147
MySQL Shell (2)
The MySQL Shell provides:
Both Interactive and Batch operations
Document and Relational Models
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
42 / 147
MySQL Shell (2)
The MySQL Shell provides:
Both Interactive and Batch operations
Document and Relational Models
CRUD Document and Relational APIs via scripting
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
43 / 147
MySQL Shell (2)
The MySQL Shell provides:
Both Interactive and Batch operations
Document and Relational Models
CRUD Document and Relational APIs via scripting
Traditional Table, JSON, Tab Separated output results formats
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
44 / 147
MySQL Shell (2)
The MySQL Shell provides:
Both Interactive and Batch operations
Document and Relational Models
CRUD Document and Relational APIs via scripting
Traditional Table, JSON, Tab Separated output results formats
MySQL Standard and X Protocols
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
45 / 147
MySQL Shell (2)
The MySQL Shell provides:
Both Interactive and Batch operations
Document and Relational Models
CRUD Document and Relational APIs via scripting
Traditional Table, JSON, Tab Separated output results formats
MySQL Standard and X Protocols
and more...
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
46 / 147
New since MySQL 8.0.11
The Shell improved a lot and uses all the enhancements part of MySQL 8:
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
47 / 147
New since MySQL 8.0.11
The Shell improved a lot and uses all the enhancements part of MySQL 8:
set persists
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
48 / 147
New since MySQL 8.0.11
The Shell improved a lot and uses all the enhancements part of MySQL 8:
set persists
restart
This makes the remote administration very easy and cloud friendly.
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
49 / 147
don´t forget, this is a HA solution !
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
50 / 147
Thank you !
Any Questions ?
share your 💕 for MySQL on social media using @MySQL #DataOpsBarcelona
more at http://lefred.be/content/category/mysql/group-replication/
http://mysqlhighavailability.com/
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
51 / 147
want to know more?
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
52 / 147
GR is nice, but how does it work ?
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
53 / 147
GR is nice, but how does it work ?
it´s just ...
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
54 / 147
GR is nice, but how does it work ?
it´s just ...
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
55 / 147
GR is nice, but how does it work ?
it´s just ...
... no, in fact the writesets replication is synchronous and then certification and apply of
the changes are local to each nodes and asynchronous.
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
56 / 147
GR is nice, but how does it work ?
it´s just ...
... no, in fact the writesets replication is synchronous and then certification and apply of
the changes are local to each nodes and asynchronous.
not that easy to understand... right ? As a picture is worth a 1000 words, let´s illustrate
this...
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
57 / 147
MySQL Group Replication
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
58 / 147
MySQL Group Replication
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
59 / 147
MySQL Group Replication
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
60 / 147
MySQL Group Replication
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
61 / 147
MySQL Group Replication
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
62 / 147
MySQL Group Replication
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
63 / 147
MySQL Group Replication
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
64 / 147
MySQL Group Replication
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
65 / 147
MySQL Group Replication
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
66 / 147
MySQL Group Replication
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
67 / 147
MySQL Group Replication
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
68 / 147
MySQL Group Replication
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
69 / 147
MySQL Group Replication (full transaction)
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
70 / 147
MySQL Group Replication (full transaction)
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
71 / 147
MySQL Group Replication (full transaction)
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
72 / 147
MySQL Group Replication (full transaction)
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
73 / 147
MySQL Group Replication (full transaction)
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
74 / 147
MySQL Group Replication (full transaction)
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
75 / 147
MySQL Group Replication (full transaction)
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
76 / 147
MySQL Group Replication (full transaction)
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
77 / 147
MySQL Group Replication (full transaction)
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
78 / 147
MySQL Group Communication System (GCS)
MySQL Xcom protocol
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
79 / 147
MySQL Group Communication System (GCS)
MySQL Xcom protocol
Replicated Database State Machine
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
80 / 147
MySQL Group Communication System (GCS)
MySQL Xcom protocol
Replicated Database State Machine
Paxos based protocol
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
81 / 147
MySQL Group Communication System (GCS)
MySQL Xcom protocol
Replicated Database State Machine
Paxos based protocol
its task: deliver messages across the distributed system:
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
82 / 147
MySQL Group Communication System (GCS)
MySQL Xcom protocol
Replicated Database State Machine
Paxos based protocol
its task: deliver messages across the distributed system:
atomically
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
83 / 147
MySQL Group Communication System (GCS)
MySQL Xcom protocol
Replicated Database State Machine
Paxos based protocol
its task: deliver messages across the distributed system:
atomically
in Total Order
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
84 / 147
MySQL Group Communication System (GCS)
MySQL Xcom protocol
Replicated Database State Machine
Paxos based protocol
its task: deliver messages across the distributed system:
atomically
in Total Order
MySQL Group Replication receives the Ordered 'tickets' from this GCS subsystem.
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
85 / 147
Group Replication : Total Order Delivery - GTID
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
86 / 147
Group Replication : Total Order Delivery - GTID
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
87 / 147
Group Replication : Total Order Delivery - GTID
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
88 / 147
Group Replication : Total Order Delivery - GTID
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
89 / 147
Group Replication : Total Order Delivery - GTID
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
90 / 147
Group Replication : Total Order Delivery - GTID
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
91 / 147
Group Replication : Total Order Delivery - GTID
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
92 / 147
Group Replication : Total Order Delivery - GTID
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
93 / 147
Group Replication : Total Order Delivery - GTID
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
94 / 147
Group Replication : Total Order Delivery - GTID
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
95 / 147
Group Replication : Total Order Delivery - GTID
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
96 / 147
Group Replication : Total Order Delivery - GTID
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
97 / 147
Group Replication : Total Order Delivery - GTID
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
98 / 147
Group Replication : Total Order Delivery - GTID
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
99 / 147
Group Replication : Total Order Delivery - GTID
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
100 / 147
Group Replication : Total Order Delivery - GTID
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
101 / 147
Group Replication : Total Order Delivery - GTID
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
102 / 147
Group Replication : Total Order Delivery - GTID
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
103 / 147
Group Replication : Total Order Delivery - GTID
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
104 / 147
Group Replication: return commit
Asynchronous Replication:
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
105 / 147
Group Replication: return from commit (2)
Semi-Sync Replication:
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
106 / 147
Group Replication: return from commit (3)
Group Replication:
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
107 / 147
Does this mean we can have a distant node and
always let it ack later ?
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
108 / 147
Does this mean we can have a distant node and
always let it ack later ?
NO!
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
109 / 147
Does this mean we can have a distant node and
always let it ack later ?
NO!
There will be always a penalty to pay. For example if you have 3 members, every 3rd write
the system will be affected by the lartency... why ?
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
110 / 147
Does this mean we can have a distant node and
always let it ack later ?
NO!
There will be always a penalty to pay. For example if you have 3 members, every 3rd write
the system will be affected by the lartency... why ?
That´s because the system has to wait for the noop (single skip message) from the
“distant” node.
More info: http://lefred.be/content/mysql-group-replication-about-ack-from-majority/
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
111 / 147
Group Replication : Optimistic Locking
Group Replication uses optimistic locking
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
112 / 147
Group Replication : Optimistic Locking
Group Replication uses optimistic locking
during a transaction, local (InnoDB) locking happens
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
113 / 147
Group Replication : Optimistic Locking
Group Replication uses optimistic locking
during a transaction, local (InnoDB) locking happens
optimistically assumes there will be no conflicts across nodes
(no communication between nodes necessary)
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
114 / 147
Group Replication : Optimistic Locking
Group Replication uses optimistic locking
during a transaction, local (InnoDB) locking happens
optimistically assumes there will be no conflicts across nodes
(no communication between nodes necessary)
cluster-wide conflict resolution happens only at COMMIT, during certification
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
115 / 147
Group Replication : Optimistic Locking
Group Replication uses optimistic locking
during a transaction, local (InnoDB) locking happens
optimistically assumes there will be no conflicts across nodes
(no communication between nodes necessary)
cluster-wide conflict resolution happens only at COMMIT, during certification
Let´s first have a look at the traditional locking to compare.
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
116 / 147
Traditional locking
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
117 / 147
Traditional locking
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
118 / 147
Traditional locking
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
119 / 147
Traditional locking
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
120 / 147
Traditional locking
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
121 / 147
Traditional locking
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
122 / 147
Optimistic Locking
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
123 / 147
Optimistic Locking
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
124 / 147
Optimistic Locking
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
125 / 147
Optimistic Locking
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
126 / 147
Optimistic Locking
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
127 / 147
Optimistic Locking
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
128 / 147
Optimistic Locking
The system returns error 149 as certification failed:
ERROR 1180 (HY000): Got error 149 during COMMIT
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
129 / 147
Such conflicts happen only when using multi-
primary group !
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
130 / 147
Certification
Certification is the process that only needs to answer the following unique question:
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
131 / 147
Certification
Certification is the process that only needs to answer the following unique question:
can the write (transaction) be applied ?
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
132 / 147
Certification
Certification is the process that only needs to answer the following unique question:
can the write (transaction) be applied ?
based on unapplied earlier transactions
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
133 / 147
Certification
Certification is the process that only needs to answer the following unique question:
can the write (transaction) be applied ?
based on unapplied earlier transactions
such conflicts must come for other members/nodes
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
134 / 147
Certification
Certification is the process that only needs to answer the following unique question:
can the write (transaction) be applied ?
based on unapplied earlier transactions
such conflicts must come for other members/nodes
happens on every member/node
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
135 / 147
Certification
Certification is the process that only needs to answer the following unique question:
can the write (transaction) be applied ?
based on unapplied earlier transactions
such conflicts must come for other members/nodes
happens on every member/node
should be deterministic on every node
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
136 / 147
Certification
Certification is the process that only needs to answer the following unique question:
can the write (transaction) be applied ?
based on unapplied earlier transactions
such conflicts must come for other members/nodes
happens on every member/node
should be deterministic on every node
results are not reported to the group
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
137 / 147
Certification
Certification is the process that only needs to answer the following unique question:
can the write (transaction) be applied ?
based on unapplied earlier transactions
such conflicts must come for other members/nodes
happens on every member/node
should be deterministic on every node
results are not reported to the group
pass: enter in the apply queue
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
138 / 147
Certification
Certification is the process that only needs to answer the following unique question:
can the write (transaction) be applied ?
based on unapplied earlier transactions
such conflicts must come for other members/nodes
happens on every member/node
should be deterministic on every node
results are not reported to the group
pass: enter in the apply queue
fail: drop the transaction
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
139 / 147
Certification
Certification is the process that only needs to answer the following unique question:
can the write (transaction) be applied ?
based on unapplied earlier transactions
such conflicts must come for other members/nodes
happens on every member/node
should be deterministic on every node
results are not reported to the group
pass: enter in the apply queue
fail: drop the transaction
serialized by the total order in GCS/XCOM + GTID
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
140 / 147
Certification
Certification is the process that only needs to answer the following unique question:
can the write (transaction) be applied ?
based on unapplied earlier transactions
such conflicts must come for other members/nodes
happens on every member/node
should be deterministic on every node
results are not reported to the group
pass: enter in the apply queue
fail: drop the transaction
serialized by the total order in GCS/XCOM + GTID
cost is based on trx size (# rows & # keys)
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
141 / 147
Certification
Certification is the process that only needs to answer the following unique question:
can the write (transaction) be applied ?
based on unapplied earlier transactions
such conflicts must come for other members/nodes
happens on every member/node
should be deterministic on every node
results are not reported to the group
pass: enter in the apply queue
fail: drop the transaction
serialized by the total order in GCS/XCOM + GTID
cost is based on trx size (# rows & # keys)
first committer (and ack from majority) wins rule
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
142 / 147
Drawbacks of optimistic locking
having a first-committer-wins system means conflicts will more likely happen when
writing on multiple members with:
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
143 / 147
Drawbacks of optimistic locking
having a first-committer-wins system means conflicts will more likely happen when
writing on multiple members with:
large transactions
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
144 / 147
Drawbacks of optimistic locking
having a first-committer-wins system means conflicts will more likely happen when
writing on multiple members with:
large transactions
long running transactions
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
145 / 147
Drawbacks of optimistic locking
having a first-committer-wins system means conflicts will more likely happen when
writing on multiple members with:
large transactions
long running transactions
hotspot records
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
146 / 147
Thank you !
Any Questions ?
share your 💕 for MySQL on social media using @MySQL #DataOpsBarcelona
more at http://lefred.be/content/category/mysql/group-replication/
http://mysqlhighavailability.com/
Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.
147 / 147

More Related Content

DataOps Barcelona - MySQL HA so easy... that's insane !

  • 4. MySQL HA so easy ? That's insane ! MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL     Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147
  • 5. Save the date ! Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 5 / 147
  • 6.   Safe Harbor Statement The following is intended to outline our general product direction. It is intended for information purpose only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied up in making purchasing decisions. The development, release and timing of any features or functionality described for Oracle´s product remains at the sole discretion of Oracle. Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 6 / 147
  • 7. about me - http://about.me/lefred Who am I ? Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 7 / 147
  • 8. Frédéric Descamps @lefred MySQL Evangelist Hacking MySQL since 3.23 devops believer living in Belgium 🇧🇪 http://lefred.be   Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 8 / 147
  • 9. MySQL InnoDB Cluster: vision   "A single product - MySQL - with high availability and scaling features baked in; providing an integrated end-to-end solution that is easy to use." Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 9 / 147
  • 10. MySQL InnoDB Cluster: vision   "A single product - MySQL - with high availability and scaling features baked in; providing an integrated end-to-end solution that is easy to use." InnoDB cluster Ease-of-Use Extreme Scale-Out Out-of-Box Solution Built-in HA High Performance Everything Integrated Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 10 / 147
  • 11. One Product: MySQL All components created together Tested together Packaged together Easy to Use One client: MySQL Shell Easy packaging Integrated orchestration Homogenous servers Flexible and Modern SQL and NoSQL together Protocol Buffers Asynchronous API Developer friendly Support Read/Write Scale Out Shared clusters Federated system of N replica sets supporting cross shard operations Each replica set manages a shard MySQL InnoDB Cluster: goals Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 11 / 147
  • 12. MySQL InnoDB Cluster Architecture Application MySQL Connector MySQL Router MySQL Shell InnoDB cluster Application MySQL Connector MySQL Router Mp M M Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 12 / 147
  • 13. Let's start with the demo, shall we ? Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 13 / 147
  • 14. Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 14 / 147
  • 15. Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 15 / 147
  • 16. Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 16 / 147
  • 17. Group Replication: heart of MySQL InnoDB Cluster Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 17 / 147
  • 18. Group Replication: heart of MySQL InnoDB Cluster Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 18 / 147
  • 19. MySQL Group Replication but what is it ?!? Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 19 / 147
  • 20. MySQL Group Replication but what is it ?!? GR is a plugin for MySQL, made by MySQL and packaged with MySQL Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 20 / 147
  • 21. MySQL Group Replication but what is it ?!? GR is a plugin for MySQL, made by MySQL and packaged with MySQL GR is an implementation of Replicated Database State Machine theory Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 21 / 147
  • 22. MySQL Group Replication but what is it ?!? GR is a plugin for MySQL, made by MySQL and packaged with MySQL GR is an implementation of Replicated Database State Machine theory GR allows to write on all Group Members (cluster nodes) simultaneously while retaining consistency Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 22 / 147
  • 23. MySQL Group Replication but what is it ?!? GR is a plugin for MySQL, made by MySQL and packaged with MySQL GR is an implementation of Replicated Database State Machine theory GR allows to write on all Group Members (cluster nodes) simultaneously while retaining consistency GR implements conflict detection and resolution Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 23 / 147
  • 24. MySQL Group Replication but what is it ?!? GR is a plugin for MySQL, made by MySQL and packaged with MySQL GR is an implementation of Replicated Database State Machine theory GR allows to write on all Group Members (cluster nodes) simultaneously while retaining consistency GR implements conflict detection and resolution GR allows automatic distributed recovery Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 24 / 147
  • 25. MySQL Group Replication but what is it ?!? GR is a plugin for MySQL, made by MySQL and packaged with MySQL GR is an implementation of Replicated Database State Machine theory GR allows to write on all Group Members (cluster nodes) simultaneously while retaining consistency GR implements conflict detection and resolution GR allows automatic distributed recovery Supported on all MySQL platforms !! Linux, Windows, Solaris, OSX, FreeBSD Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 25 / 147
  • 26. And what does it means for users ? Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 26 / 147
  • 27. And what does it means for users ? no longer necessary to handle server fail-over manually or with a complicated script Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 27 / 147
  • 28. And what does it means for users ? no longer necessary to handle server fail-over manually or with a complicated script GR provides fault tolerance Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 28 / 147
  • 29. And what does it means for users ? no longer necessary to handle server fail-over manually or with a complicated script GR provides fault tolerance GR enables update-everywhere setups Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 29 / 147
  • 30. And what does it means for users ? no longer necessary to handle server fail-over manually or with a complicated script GR provides fault tolerance GR enables update-everywhere setups GR handles crashes, failures, re-connetcs automatically Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 30 / 147
  • 31. And what does it means for users ? no longer necessary to handle server fail-over manually or with a complicated script GR provides fault tolerance GR enables update-everywhere setups GR handles crashes, failures, re-connetcs automatically Allows an easy setup of a MySQL service high available ! Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 31 / 147
  • 32. Default = Single Primary Mode By default, MySQL InnoDB Cluster runs in Single Primary Mode. Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 32 / 147
  • 33. Default = Single Primary Mode By default, MySQL InnoDB Cluster runs in Single Primary Mode. mysql> show global variables like 'group_replication_single_primary_mode'; +---------------------------------------+-------+ | Variable_name | Value | +---------------------------------------+-------+ | group_replication_single_primary_mode | ON | +---------------------------------------+-------+ Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 33 / 147
  • 34. Default = Single Primary Mode By default, MySQL InnoDB Cluster runs in Single Primary Mode. mysql> show global variables like 'group_replication_single_primary_mode'; +---------------------------------------+-------+ | Variable_name | Value | +---------------------------------------+-------+ | group_replication_single_primary_mode | ON | +---------------------------------------+-------+ In Single Primary Mode, a single member acts as the writable master (PRIMARY) and the rest of the members act as hot-standbys (SECONDARY). The group itself coordinates and configures itself automatically to determine which member will act as the PRIMARY, through a leader election mechanism. Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 34 / 147
  • 35. Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 35 / 147
  • 36. MySQL Router MySQL Router is lightweight middleware that provides transparent routing between your application and backend MySQL Servers. It can be used for a wide variety of use cases, such as providing high availability and scalability by effectively routing database traffic to appropriate backend MySQL Servers. Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 36 / 147
  • 37. MySQL Router MySQL Router is lightweight middleware that provides transparent routing between your application and backend MySQL Servers. It can be used for a wide variety of use cases, such as providing high availability and scalability by effectively routing database traffic to appropriate backend MySQL Servers. MySQL Router doesn´t require any specific configuration. It configures itself automatically (bootstrap) using MySQL InnoDB Cluster´s metadata. Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 37 / 147
  • 38. ProxySQL has native support for Group Replication which makes it a good choice for advanced users. ProxySQL If you need some specific features that are not yet available in MySQL Router, like transparent R/W splitting, then you can use your software of choice. We are also collaborating with ProxySQL. Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 38 / 147
  • 39. MySQL Shell The MySQL Shell is an interactive Javascript, Python, or SQL interface supporting development and administration for the MySQL Server and is a component of the MySQL Server. You can use the MySQL Shell to perform data queries and updates as well as various administration operations. Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 39 / 147
  • 40. MySQL Shell (2) The MySQL Shell provides: Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 40 / 147
  • 41. MySQL Shell (2) The MySQL Shell provides: Both Interactive and Batch operations Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 41 / 147
  • 42. MySQL Shell (2) The MySQL Shell provides: Both Interactive and Batch operations Document and Relational Models Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 42 / 147
  • 43. MySQL Shell (2) The MySQL Shell provides: Both Interactive and Batch operations Document and Relational Models CRUD Document and Relational APIs via scripting Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 43 / 147
  • 44. MySQL Shell (2) The MySQL Shell provides: Both Interactive and Batch operations Document and Relational Models CRUD Document and Relational APIs via scripting Traditional Table, JSON, Tab Separated output results formats Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 44 / 147
  • 45. MySQL Shell (2) The MySQL Shell provides: Both Interactive and Batch operations Document and Relational Models CRUD Document and Relational APIs via scripting Traditional Table, JSON, Tab Separated output results formats MySQL Standard and X Protocols Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 45 / 147
  • 46. MySQL Shell (2) The MySQL Shell provides: Both Interactive and Batch operations Document and Relational Models CRUD Document and Relational APIs via scripting Traditional Table, JSON, Tab Separated output results formats MySQL Standard and X Protocols and more... Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 46 / 147
  • 47. New since MySQL 8.0.11 The Shell improved a lot and uses all the enhancements part of MySQL 8: Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 47 / 147
  • 48. New since MySQL 8.0.11 The Shell improved a lot and uses all the enhancements part of MySQL 8: set persists Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 48 / 147
  • 49. New since MySQL 8.0.11 The Shell improved a lot and uses all the enhancements part of MySQL 8: set persists restart This makes the remote administration very easy and cloud friendly. Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 49 / 147
  • 50. don´t forget, this is a HA solution ! Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 50 / 147
  • 51. Thank you ! Any Questions ? share your 💕 for MySQL on social media using @MySQL #DataOpsBarcelona more at http://lefred.be/content/category/mysql/group-replication/ http://mysqlhighavailability.com/ Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 51 / 147
  • 52. want to know more? Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 52 / 147
  • 53. GR is nice, but how does it work ? Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 53 / 147
  • 54. GR is nice, but how does it work ? it´s just ... Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 54 / 147
  • 55. GR is nice, but how does it work ? it´s just ... Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 55 / 147
  • 56. GR is nice, but how does it work ? it´s just ... ... no, in fact the writesets replication is synchronous and then certification and apply of the changes are local to each nodes and asynchronous. Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 56 / 147
  • 57. GR is nice, but how does it work ? it´s just ... ... no, in fact the writesets replication is synchronous and then certification and apply of the changes are local to each nodes and asynchronous. not that easy to understand... right ? As a picture is worth a 1000 words, let´s illustrate this... Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 57 / 147
  • 58. MySQL Group Replication Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 58 / 147
  • 59. MySQL Group Replication Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 59 / 147
  • 60. MySQL Group Replication Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 60 / 147
  • 61. MySQL Group Replication Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 61 / 147
  • 62. MySQL Group Replication Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 62 / 147
  • 63. MySQL Group Replication Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 63 / 147
  • 64. MySQL Group Replication Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 64 / 147
  • 65. MySQL Group Replication Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 65 / 147
  • 66. MySQL Group Replication Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 66 / 147
  • 67. MySQL Group Replication Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 67 / 147
  • 68. MySQL Group Replication Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 68 / 147
  • 69. MySQL Group Replication Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 69 / 147
  • 70. MySQL Group Replication (full transaction) Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 70 / 147
  • 71. MySQL Group Replication (full transaction) Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 71 / 147
  • 72. MySQL Group Replication (full transaction) Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 72 / 147
  • 73. MySQL Group Replication (full transaction) Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 73 / 147
  • 74. MySQL Group Replication (full transaction) Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 74 / 147
  • 75. MySQL Group Replication (full transaction) Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 75 / 147
  • 76. MySQL Group Replication (full transaction) Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 76 / 147
  • 77. MySQL Group Replication (full transaction) Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 77 / 147
  • 78. MySQL Group Replication (full transaction) Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 78 / 147
  • 79. MySQL Group Communication System (GCS) MySQL Xcom protocol Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 79 / 147
  • 80. MySQL Group Communication System (GCS) MySQL Xcom protocol Replicated Database State Machine Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 80 / 147
  • 81. MySQL Group Communication System (GCS) MySQL Xcom protocol Replicated Database State Machine Paxos based protocol Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 81 / 147
  • 82. MySQL Group Communication System (GCS) MySQL Xcom protocol Replicated Database State Machine Paxos based protocol its task: deliver messages across the distributed system: Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 82 / 147
  • 83. MySQL Group Communication System (GCS) MySQL Xcom protocol Replicated Database State Machine Paxos based protocol its task: deliver messages across the distributed system: atomically Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 83 / 147
  • 84. MySQL Group Communication System (GCS) MySQL Xcom protocol Replicated Database State Machine Paxos based protocol its task: deliver messages across the distributed system: atomically in Total Order Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 84 / 147
  • 85. MySQL Group Communication System (GCS) MySQL Xcom protocol Replicated Database State Machine Paxos based protocol its task: deliver messages across the distributed system: atomically in Total Order MySQL Group Replication receives the Ordered 'tickets' from this GCS subsystem. Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 85 / 147
  • 86. Group Replication : Total Order Delivery - GTID Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 86 / 147
  • 87. Group Replication : Total Order Delivery - GTID Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 87 / 147
  • 88. Group Replication : Total Order Delivery - GTID Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 88 / 147
  • 89. Group Replication : Total Order Delivery - GTID Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 89 / 147
  • 90. Group Replication : Total Order Delivery - GTID Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 90 / 147
  • 91. Group Replication : Total Order Delivery - GTID Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 91 / 147
  • 92. Group Replication : Total Order Delivery - GTID Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 92 / 147
  • 93. Group Replication : Total Order Delivery - GTID Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 93 / 147
  • 94. Group Replication : Total Order Delivery - GTID Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 94 / 147
  • 95. Group Replication : Total Order Delivery - GTID Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 95 / 147
  • 96. Group Replication : Total Order Delivery - GTID Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 96 / 147
  • 97. Group Replication : Total Order Delivery - GTID Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 97 / 147
  • 98. Group Replication : Total Order Delivery - GTID Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 98 / 147
  • 99. Group Replication : Total Order Delivery - GTID Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 99 / 147
  • 100. Group Replication : Total Order Delivery - GTID Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 100 / 147
  • 101. Group Replication : Total Order Delivery - GTID Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 101 / 147
  • 102. Group Replication : Total Order Delivery - GTID Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 102 / 147
  • 103. Group Replication : Total Order Delivery - GTID Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 103 / 147
  • 104. Group Replication : Total Order Delivery - GTID Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 104 / 147
  • 105. Group Replication: return commit Asynchronous Replication: Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 105 / 147
  • 106. Group Replication: return from commit (2) Semi-Sync Replication: Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 106 / 147
  • 107. Group Replication: return from commit (3) Group Replication: Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 107 / 147
  • 108. Does this mean we can have a distant node and always let it ack later ? Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 108 / 147
  • 109. Does this mean we can have a distant node and always let it ack later ? NO! Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 109 / 147
  • 110. Does this mean we can have a distant node and always let it ack later ? NO! There will be always a penalty to pay. For example if you have 3 members, every 3rd write the system will be affected by the lartency... why ? Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 110 / 147
  • 111. Does this mean we can have a distant node and always let it ack later ? NO! There will be always a penalty to pay. For example if you have 3 members, every 3rd write the system will be affected by the lartency... why ? That´s because the system has to wait for the noop (single skip message) from the “distant” node. More info: http://lefred.be/content/mysql-group-replication-about-ack-from-majority/ Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 111 / 147
  • 112. Group Replication : Optimistic Locking Group Replication uses optimistic locking Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 112 / 147
  • 113. Group Replication : Optimistic Locking Group Replication uses optimistic locking during a transaction, local (InnoDB) locking happens Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 113 / 147
  • 114. Group Replication : Optimistic Locking Group Replication uses optimistic locking during a transaction, local (InnoDB) locking happens optimistically assumes there will be no conflicts across nodes (no communication between nodes necessary) Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 114 / 147
  • 115. Group Replication : Optimistic Locking Group Replication uses optimistic locking during a transaction, local (InnoDB) locking happens optimistically assumes there will be no conflicts across nodes (no communication between nodes necessary) cluster-wide conflict resolution happens only at COMMIT, during certification Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 115 / 147
  • 116. Group Replication : Optimistic Locking Group Replication uses optimistic locking during a transaction, local (InnoDB) locking happens optimistically assumes there will be no conflicts across nodes (no communication between nodes necessary) cluster-wide conflict resolution happens only at COMMIT, during certification Let´s first have a look at the traditional locking to compare. Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 116 / 147
  • 117. Traditional locking Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 117 / 147
  • 118. Traditional locking Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 118 / 147
  • 119. Traditional locking Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 119 / 147
  • 120. Traditional locking Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 120 / 147
  • 121. Traditional locking Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 121 / 147
  • 122. Traditional locking Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 122 / 147
  • 123. Optimistic Locking Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 123 / 147
  • 124. Optimistic Locking Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 124 / 147
  • 125. Optimistic Locking Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 125 / 147
  • 126. Optimistic Locking Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 126 / 147
  • 127. Optimistic Locking Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 127 / 147
  • 128. Optimistic Locking Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 128 / 147
  • 129. Optimistic Locking The system returns error 149 as certification failed: ERROR 1180 (HY000): Got error 149 during COMMIT Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 129 / 147
  • 130. Such conflicts happen only when using multi- primary group ! Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 130 / 147
  • 131. Certification Certification is the process that only needs to answer the following unique question: Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 131 / 147
  • 132. Certification Certification is the process that only needs to answer the following unique question: can the write (transaction) be applied ? Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 132 / 147
  • 133. Certification Certification is the process that only needs to answer the following unique question: can the write (transaction) be applied ? based on unapplied earlier transactions Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 133 / 147
  • 134. Certification Certification is the process that only needs to answer the following unique question: can the write (transaction) be applied ? based on unapplied earlier transactions such conflicts must come for other members/nodes Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 134 / 147
  • 135. Certification Certification is the process that only needs to answer the following unique question: can the write (transaction) be applied ? based on unapplied earlier transactions such conflicts must come for other members/nodes happens on every member/node Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 135 / 147
  • 136. Certification Certification is the process that only needs to answer the following unique question: can the write (transaction) be applied ? based on unapplied earlier transactions such conflicts must come for other members/nodes happens on every member/node should be deterministic on every node Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 136 / 147
  • 137. Certification Certification is the process that only needs to answer the following unique question: can the write (transaction) be applied ? based on unapplied earlier transactions such conflicts must come for other members/nodes happens on every member/node should be deterministic on every node results are not reported to the group Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 137 / 147
  • 138. Certification Certification is the process that only needs to answer the following unique question: can the write (transaction) be applied ? based on unapplied earlier transactions such conflicts must come for other members/nodes happens on every member/node should be deterministic on every node results are not reported to the group pass: enter in the apply queue Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 138 / 147
  • 139. Certification Certification is the process that only needs to answer the following unique question: can the write (transaction) be applied ? based on unapplied earlier transactions such conflicts must come for other members/nodes happens on every member/node should be deterministic on every node results are not reported to the group pass: enter in the apply queue fail: drop the transaction Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 139 / 147
  • 140. Certification Certification is the process that only needs to answer the following unique question: can the write (transaction) be applied ? based on unapplied earlier transactions such conflicts must come for other members/nodes happens on every member/node should be deterministic on every node results are not reported to the group pass: enter in the apply queue fail: drop the transaction serialized by the total order in GCS/XCOM + GTID Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 140 / 147
  • 141. Certification Certification is the process that only needs to answer the following unique question: can the write (transaction) be applied ? based on unapplied earlier transactions such conflicts must come for other members/nodes happens on every member/node should be deterministic on every node results are not reported to the group pass: enter in the apply queue fail: drop the transaction serialized by the total order in GCS/XCOM + GTID cost is based on trx size (# rows & # keys) Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 141 / 147
  • 142. Certification Certification is the process that only needs to answer the following unique question: can the write (transaction) be applied ? based on unapplied earlier transactions such conflicts must come for other members/nodes happens on every member/node should be deterministic on every node results are not reported to the group pass: enter in the apply queue fail: drop the transaction serialized by the total order in GCS/XCOM + GTID cost is based on trx size (# rows & # keys) first committer (and ack from majority) wins rule Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 142 / 147
  • 143. Drawbacks of optimistic locking having a first-committer-wins system means conflicts will more likely happen when writing on multiple members with: Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 143 / 147
  • 144. Drawbacks of optimistic locking having a first-committer-wins system means conflicts will more likely happen when writing on multiple members with: large transactions Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 144 / 147
  • 145. Drawbacks of optimistic locking having a first-committer-wins system means conflicts will more likely happen when writing on multiple members with: large transactions long running transactions Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 145 / 147
  • 146. Drawbacks of optimistic locking having a first-committer-wins system means conflicts will more likely happen when writing on multiple members with: large transactions long running transactions hotspot records Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 146 / 147
  • 147. Thank you ! Any Questions ? share your 💕 for MySQL on social media using @MySQL #DataOpsBarcelona more at http://lefred.be/content/category/mysql/group-replication/ http://mysqlhighavailability.com/ Copyright @ 2018 Oracle and/or its affiliates. All rights reserved. 147 / 147