1
in MariaDB 10.4
And a little bit in MySQL
Seppo Jaakola Codership
Galera 4
Galera 4 in MariaDB 10.4 And a little bit in MySQL Seppo Jaakola - - PowerPoint PPT Presentation
Galera 4 in MariaDB 10.4 And a little bit in MySQL Seppo Jaakola Codership 1 CEO Codership Developer role, 15 yrs with MySQL engineering Background: DBMS Engineering Data Security Seppo Jaakola www.galeracluster.com C o d e r s h i p
1
in MariaDB 10.4
And a little bit in MySQL
Seppo Jaakola Codership
Galera 4
www.galeracluster.com
Seppo Jaakola CEO Codership Developer role, 15 yrs with MySQL engineering Background:
DBMS Engineering Data Security
4 www.galeracluster.com
www.galeracluster.com
galera
database servers
DBMS (wsrep API project in github)
wsrep API version
6 www.galeracluster.com
API #26
7
Galera in MariaDB 10.4
8 www.galeracluster.com
9 www.galeracluster.com
10
Streaming Replication
11 www.galeracluster.com
transactions
until commit time
and is hard to handle
12 www.galeracluster.com
developed for Galera Replication 4 to enable running transaction of unlimited size in cluster
can still reject too large transactions
13 www.galeracluster.com
fragments, during transaction processing
fragments
preserving transaction’s state in all cluster nodes
14 www.galeracluster.com
Huge transaction
Galera Replication
Node A Node B
Update, update, update.... Begin
Trx
15 www.galeracluster.com
Huge transaction
Galera Replication
Node A Node B
WS
Update, update, update....
Trx SR Trx
16 www.galeracluster.com
Huge transaction
Galera Replication
Node A Node B
Update, update, update....
WS Trx SR Trx
17 www.galeracluster.com
Huge transaction
Galera Replication
Node A Node B commit
WS
C
Trx SR Trx
18 www.galeracluster.com
Huge transaction
Galera Replication
Node A Node B OK
19 www.galeracluster.com
SR transaction pool
SR#1 THD
WS SR trx :2 CF: 0
applier applier
certification
applier
apply
SR#2 THD SR#n THD
20 www.galeracluster.com
SR transaction pool
SR#1 THD SR#2 THD
WS SR trx :2 CF: 0
applier applier
certification
applier
SR#n THD
apply Pull THD
21 www.galeracluster.com
applier
SR transaction pool
SR#2 THD WS SR trx :2 CF: 0
ev→apply_event() … ev->apply_event()
wsrep_SR_store->append_frag_apply())
SR#1 THD SR#n THD
applier applier
WS SR trx :2 CF: 0
apply
22 www.galeracluster.com
SR transaction pool
SR#1 THD SR#2 THD
WS SR trx :2 CF: 0
applier applier applier
SR#n THD
OK Push THD
23 www.galeracluster.com
SR transaction pool
SR#1 THD SR#2 THD
WS SR trx :2 CF: 1
applier applier
certification
applier
SR#n THD
commit Pull THD
24 www.galeracluster.com
applier
SR#2 THD WS SR trx :2 CF: 1
trans_commit()
wsrep_SR_store->append_frag_commit())
SR transaction pool
SR#1 THD SR#n THD
applier applier
WS SR trx :2 CF: 1
commit
25 www.galeracluster.com
SR transaction pool
SR#1 THD
applier applier applier
SR#1nTHD
WS SR trx :2 CF: 1
OK
26 www.galeracluster.com
wsrep_trx_fragment_unit Unit metrics for fragmenting, options are:
wsrep_trx_fragment_size
replicated
Session variables and can be dynamically set
27 www.galeracluster.com
replication overhead, streaming replication will cause degraded transaction throughput rate
cutting large transactions
can be dynamically set
replication on/off on need basis
28
New Meta Data
29 www.galeracluster.com
MariaDB [(none)]> show tables in mysql like 'wsrep%'; +--------------------------+ | Tables_in_mysql (wsrep%) | +--------------------------+ | wsrep_cluster | | wsrep_cluster_members | | wsrep_streaming_log | +--------------------------+ 3 rows in set (0.005 sec)
30 www.galeracluster.com
MariaDB [(none)]> select * from mysql.wsrep_cluster\G *************************** 1. row *************************** cluster_uuid: 0be6f4d6-35da-11e9-b8a0-d6501fb08579 view_id: 2 view_seqno: 2 protocol_version: 4 capabilities: 184703 1 row in set (0.005 sec)
31 www.galeracluster.com
MariaDB [(none)]> select * from mysql.wsrep_cluster_members\G *************************** 1. row *************************** node_uuid: ea306990-35b0-11e9-9841-366f30fba24f cluster_uuid: ea317655-35b0-11e9-9ac4-9f27c3510851 node_name: labrador node_incoming_address: 127.0.0.1:16000 *************************** 2. row *************************** node_uuid: eb29a68c-35b0-11e9-ac23-e2418aae257d cluster_uuid: ea317655-35b0-11e9-9ac4-9f27c3510851 node_name: poodle node_incoming_address: 127.0.0.1:16001 *************************** 3. row *************************** node_uuid: eb29e56c-35b0-11e9-a328-fe229f8ae4cb cluster_uuid: ea317655-35b0-11e9-9ac4-9f27c3510851 node_name: rotweiler node_incoming_address: 127.0.0.1:16002 3 rows in set (0.006 sec)
32 www.galeracluster.com
MariaDB [(none)]> show create table mysql.wsrep_streaming_log\G *************************** 1. row *************************** Table: wsrep_streaming_log Create Table: CREATE TABLE `wsrep_streaming_log` ( `node_uuid` char(36) NOT NULL, `trx_id` bigint(20) NOT NULL, `seqno` bigint(20) NOT NULL, `flags` int(11) NOT NULL, `frag` longblob NOT NULL, PRIMARY KEY (`node_uuid`,`trx_id`,`seqno`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 1 row in set (0.004 sec)
33
Rolling Upgrade
34 www.galeracluster.com
Galera 3
Galera Replication
read & write
MariaDB 10.3
Galera 3
read & write
MariaDB 10.3
Galera 3
MariaDB 10.3
Wsrep-API 25
read & write
35 www.galeracluster.com
Galera 3
Galera Replication
read & write
MariaDB 10.3
Galera 3
read & write
MariaDB 10.3
Galera 3
MariaDB 10.3
Wsrep-API 25 Upgrade for 10.4 Shutdown server Install 10.4 Start with wsrep_provider mysql_upgrade Shutdown server Start without wsrep_provider Isolate node
Galera 4
MariaDB 10.4
Allow read only access
read only
36 www.galeracluster.com
Galera 3
Galera Replication
read & write
MariaDB 10.3
Galera 3
MariaDB 10.3
Wsrep-API 25
Galera 4
MariaDB 10.4
read only
Galera 4
MariaDB 10.4
read only
Upgrade for 10.4 Upgrade node 2
37 www.galeracluster.com
Galera Replication
Wsrep-API 25
Galera 4
MariaDB 10.4
read only
Galera 4
MariaDB 10.4
read only
Wsrep-API 26 Upgrade for 10.4 Shutdown node 1 Allow read-write Complete node1 upgrade
wsrep API #26 features now Enabled in replication
38 www.galeracluster.com
Galera Replication
read & write
Wsrep-API 25
Galera 4
MariaDB 10.4
Galera 4
MariaDB 10.4
Wsrep-API 26
read & write read & write
Galera 4
MariaDB 10.4
39 www.galeracluster.com
Galera Replication
read & write
Wsrep-API 25
Galera 4
MariaDB 10.4
Galera 4
MariaDB 10.4
Wsrep-API 26
read & write read & write
Galera 4
MariaDB 10.4
j
n
Galera 3
MariaDB 10.3
40
Galera 4 Road Map
41 www.galeracluster.com
MariaDB 10.4 beta 2 release and is now in the 10.4 RC and later releases
yet confirmed
42 www.galeracluster.com
43 www.galeracluster.com
R A M
Client thread Client thread Client thread Buffer pool gcache ibdata ibdata redo log redo log redo log binlog D I S K
44 www.galeracluster.com
R A M
Client thread Client thread Client thread Buffer pool gcache D I S K ibdata ibdata redo log redo log redo log binlog
45 www.galeracluster.com
R A M
Client thread Client thread Client thread Buffer pool gcache D I S K ibdata ibdata redo log redo log redo log binlog
46 www.galeracluster.com
47
XA Transactions In Galera 3
48 www.galeracluster.com
TM RM RM
XA start ‘foo’ XA start ‘bar’ foo bar Work on ‘foo’ Work on ‘bar’ XA prepare ‘foo’ XA prepare ‘bar’ XA commit ‘foo’ XA commit ‘bar’ foo bar
MariaDB
49 www.galeracluster.com
MariaDB 2PC prepare stage
anymore
50 www.galeracluster.com
XA Start
Node A Node B
smith smith XA trans
51 www.galeracluster.com
XA Insert into persons ‘’jones’
Node A Node B
smith smith
jones XA trans
52 www.galeracluster.com
XA Prepare
Node A Node B
smith smith
jones XA trans
53 www.galeracluster.com
XA Prepare
Node A Node B
smith smith
jones XA trans
WS
jones
54 www.galeracluster.com
XA Prepare
Node A Node B
smith smith jones
jones XA trans apply
55 www.galeracluster.com
OK
Node A Node B
smith smith jones
jones XA trans
56 www.galeracluster.com
XA Rollback
Node A Node B
smith smith jones jones XA trans
57 www.galeracluster.com
Node A Node B
smith smith jones
inconsistency
58 www.galeracluster.com
can commit
does honor XA transactions
59 www.galeracluster.com
XA Start
Node A Node B
smith smith XA trans
60 www.galeracluster.com
UPDATE smith=kit
Node A Node B
smith smith XA trans kit
61 www.galeracluster.com
Node A Node B
smith smith XA trans
WS
kit
UPDATE smith=hannibal
WS
hannibal
XA Prepare
kit
62 www.galeracluster.com
Node A Node B
hannibal hannibal XA trans
OK
63 www.galeracluster.com
Node A Node B
hannibal hannibal
XA Commit
64
XA by Streaming Replication
65 www.galeracluster.com
XA Start
Node A Node B
smith smith XA trans
66 www.galeracluster.com
XA Insert into persons ‘’jones’
Node A Node B
smith smith XA trans XA trans XA trans XA trans jones
67 www.galeracluster.com
XA Prepare
Node A Node B
smith smith XA trans SR trans
WS
jones jones
68 www.galeracluster.com
XA Rollback Node A Node B
smith smith XA trans SR trans
WS rollback
jones jones
69 www.galeracluster.com
Node A Node B
smith smith
70 www.galeracluster.com
Node A Node B
smith smith XA trans
UPDATE smith=hannibal XA Prepare
kit SR trans kit
71 www.galeracluster.com
72 www.galeracluster.com
with Galera 4 or new Galera 5
73 www.galeracluster.com
and 8.0 versions
released
74 www.galeracluster.com
Galera 4 features
protocol opening possibilities for many unforeseen replication features
later 10.4 and 10.5 releases
75
Happy Clustering :-) Thank you for listening!