SlideShare ist ein Scribd-Unternehmen logo
1 von 11
Downloaden Sie, um offline zu lesen
Ivan	
  Zoratti	
  
GTIDs	
  Explained
MySQL 5.6, MariaDB 10, Galera 3
V1403.01
MySQL	
  5.6	
  Replication
2
M1
S1 S2 S3
GTID	
  in	
  MySQL	
  5.6
3
3E11FA47-71CA-11E1-9E33-C80AA9429562:23
Transaction	
  ID	
  
Sequence	
  number	
  determined	
  by	
  the	
  order	
  in	
  which	
  
the	
  transaction	
  was	
  committed	
  on	
  this	
  server	
  
!
Transaction	
  ID	
  =	
  =	
  Sequence
Source	
  ID

Identifies	
  the	
  originating	
  server

!
Source	
  ID	
  =	
  =	
  Server	
  UUID
GTID	
  in	
  MySQL	
  5.6
•Used	
  to	
  identify	
  a	
  transaction	
  in	
  a	
  MySQL	
  5.6	
  Cluster	
  
•Sets	
  are	
  also	
  allowed	
  to	
  identify	
  an	
  interval	
  of	
  transactions	
  
•Preserved	
  between	
  masters	
  and	
  slaves,	
  i.e.	
  they	
  identify	
  the	
  source	
  (origin)	
  of	
  a	
  transaction	
  
•Transactions	
  with	
  the	
  same	
  GTID	
  cannot	
  be	
  applied	
  more	
  than	
  once	
  
•Benefits	
  
•Simplified	
  failover	
  (with	
  CHANGE	
  MASTER	
  TO	
  and	
  MASTER_AUTO_POSITION=1)	
  
•Guarantees	
  slave	
  consistency	
  by	
  checking	
  Executed_Gtid_Set
4
Galera	
  Cluster
• Read	
  &	
  Write	
  access	
  to	
  any	
  node	
  
• Client	
  can	
  connect	
  to	
  any	
  node	
  
• There	
  can	
  be	
  several	
  nodes	
  
• Automatic	
  node	
  provisioning	
  
• Replication	
  is	
  synchronous
5
GTID	
  in	
  Galera	
  3
•Used	
  to	
  identify	
  a	
  state	
  change	
  
•i.e.	
  to	
  identify	
  write	
  operations	
  to	
  the	
  database	
  
•Used	
  to	
  identify	
  the	
  state	
  itself	
  
•i.e.	
  the	
  last	
  state	
  change
6
GTID	
  in	
  Galera	
  3
7
!
45eec521-2f34-11e0-0800-2a36050b826b:94530586304
An	
  ordinal	
  sequence	
  number	
  (seqno,	
  64-­‐bit	
  signed	
  
integer)	
  to	
  denote	
  the	
  position	
  of	
  the	
  change	
  in	
  the	
  
sequence	
  
!
Sequence	
  =	
  =	
  Change	
  in	
  the	
  Cluster
State	
  UUID

I	
  uniquely	
  identifies	
  the	
  state	
  and	
  the	
  sequence	
  of	
  changes	
  it	
  
undergoes	
  
!
UUID	
  =	
  =	
  Cluster	
  ID
GTID	
  in	
  Galera	
  3
•A	
  Galera	
  Cluster	
  acts	
  as	
  a	
  single	
  node	
  
•No	
  holes	
  in	
  the	
  sequence	
  
•Stored	
  in	
  grastate.dat	
  
•5ee99582-­‐bb8d-­‐11e2-­‐b8e3-­‐23de375c1d30:8204503945773	
  <<<	
  Typical	
  sequence	
  
•5ee99582-­‐bb8d-­‐11e2-­‐b8e3-­‐23de375c1d30:-­‐1	
  <<<	
  The	
  node	
  has	
  crashed	
  
•00000000-­‐0000-­‐0000-­‐0000-­‐000000000000:-­‐1	
  <<<	
  The	
  node	
  has	
  crashed	
  during	
  the	
  
execution	
  of	
  a	
  non	
  transactional	
  operations	
  (e.g.	
  a	
  DDL	
  op)	
  or	
  the	
  op	
  has	
  been	
  aborted
8
MariaDB	
  10	
  Replication
9
GTID	
  in	
  MariaDB	
  10
10
!
#131109 14:59:59 server id 1 end_log_pos 4151 GTID XXX-YYY-ZZZ
/*!100001 SET @@session.gtid_seq_no=ZZZ*//*!*/;
Sequence	
  Number	
  
64bit	
  unsigned	
  
It	
  increases	
  monotonically	
  at	
  each	
  commit	
  
It	
  is	
  applied	
  for	
  each	
  Event	
  Group,	
  i.e.,	
  for	
  each	
  BEGIN/COMMIT	
  or	
  
for	
  groups	
  that	
  have	
  no	
  BEGIN/COMMIT

(for	
  example	
  DDL	
  commands,	
  TRUNCATE	
  and	
  others)
Server	
  ID	
  
32bit	
  unsigned	
  
The	
  server_id	
  value	
  for	
  the	
  
MariaDB	
  instance
Domain	
  ID	
  
32bit	
  unsigned	
  
The	
  domain_id	
  value	
  for	
  the	
  
Replication	
  stream
GTID	
  in	
  MariaDB	
  10
•1	
  GTID	
  for	
  each	
  event	
  group	
  
•Groups	
  can	
  be	
  executed	
  in	
  parallel	
  
•Transaction	
  safe	
  (stored	
  in	
  an	
  InnoDB	
  table,

not	
  in	
  a	
  file)	
  
•MASTER_USE_GTID=gtid_slave_pos	
  -­‐	
  great	
  to	
  position/reposition	
  slave	
  nodes	
  
•Domain	
  ID	
  is	
  used	
  to	
  guarantee	
  that	
  this	
  works	
  with	
  multi-­‐source	
  replication
11

Weitere ähnliche Inhalte

Was ist angesagt?

Kernel Recipes 2018 - A year of fixing Coverity issues all over the Linux ker...
Kernel Recipes 2018 - A year of fixing Coverity issues all over the Linux ker...Kernel Recipes 2018 - A year of fixing Coverity issues all over the Linux ker...
Kernel Recipes 2018 - A year of fixing Coverity issues all over the Linux ker...Anne Nicolas
 
BlueHat v18 || Hardening hyper-v through offensive security research
BlueHat v18 || Hardening hyper-v through offensive security researchBlueHat v18 || Hardening hyper-v through offensive security research
BlueHat v18 || Hardening hyper-v through offensive security researchBlueHat Security Conference
 
Jumping into heaven’s gate
Jumping into heaven’s gateJumping into heaven’s gate
Jumping into heaven’s gateYarden Shafir
 
Kernel Recipes 2018 - 10 years of automated evolution in the Linux kernel - J...
Kernel Recipes 2018 - 10 years of automated evolution in the Linux kernel - J...Kernel Recipes 2018 - 10 years of automated evolution in the Linux kernel - J...
Kernel Recipes 2018 - 10 years of automated evolution in the Linux kernel - J...Anne Nicolas
 
LAS16-101: Efficient kernel backporting
LAS16-101: Efficient kernel backportingLAS16-101: Efficient kernel backporting
LAS16-101: Efficient kernel backportingLinaro
 
How to cook lettuce @Java casual
How to cook lettuce @Java casualHow to cook lettuce @Java casual
How to cook lettuce @Java casualGo Hagiwara
 

Was ist angesagt? (10)

Lock free programming- pro tips
Lock free programming- pro tipsLock free programming- pro tips
Lock free programming- pro tips
 
Kernel Recipes 2018 - A year of fixing Coverity issues all over the Linux ker...
Kernel Recipes 2018 - A year of fixing Coverity issues all over the Linux ker...Kernel Recipes 2018 - A year of fixing Coverity issues all over the Linux ker...
Kernel Recipes 2018 - A year of fixing Coverity issues all over the Linux ker...
 
Deep hooks
Deep hooksDeep hooks
Deep hooks
 
BlueHat v18 || Hardening hyper-v through offensive security research
BlueHat v18 || Hardening hyper-v through offensive security researchBlueHat v18 || Hardening hyper-v through offensive security research
BlueHat v18 || Hardening hyper-v through offensive security research
 
Jumping into heaven’s gate
Jumping into heaven’s gateJumping into heaven’s gate
Jumping into heaven’s gate
 
Kernel Recipes 2018 - 10 years of automated evolution in the Linux kernel - J...
Kernel Recipes 2018 - 10 years of automated evolution in the Linux kernel - J...Kernel Recipes 2018 - 10 years of automated evolution in the Linux kernel - J...
Kernel Recipes 2018 - 10 years of automated evolution in the Linux kernel - J...
 
LAS16-101: Efficient kernel backporting
LAS16-101: Efficient kernel backportingLAS16-101: Efficient kernel backporting
LAS16-101: Efficient kernel backporting
 
How to cook lettuce @Java casual
How to cook lettuce @Java casualHow to cook lettuce @Java casual
How to cook lettuce @Java casual
 
Learning Nagios
Learning Nagios Learning Nagios
Learning Nagios
 
Transactional Memory
Transactional MemoryTransactional Memory
Transactional Memory
 

Ähnlich wie GTIDs Explained

Running gtid replication in production
Running gtid replication in productionRunning gtid replication in production
Running gtid replication in productionBalazs Pocze
 
MySQL Multi-Source Replication for PL2016
MySQL Multi-Source Replication for PL2016MySQL Multi-Source Replication for PL2016
MySQL Multi-Source Replication for PL2016Wagner Bianchi
 
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
 
Demystifying MySQL Replication Crash Safety
Demystifying MySQL Replication Crash SafetyDemystifying MySQL Replication Crash Safety
Demystifying MySQL Replication Crash SafetyJean-François Gagné
 
MySQL/MariaDB Parallel Replication: inventory, use-case and limitations
MySQL/MariaDB Parallel Replication: inventory, use-case and limitationsMySQL/MariaDB Parallel Replication: inventory, use-case and limitations
MySQL/MariaDB Parallel Replication: inventory, use-case and limitationsJean-François Gagné
 
Replication Troubleshooting in Classic VS GTID
Replication Troubleshooting in Classic VS GTIDReplication Troubleshooting in Classic VS GTID
Replication Troubleshooting in Classic VS GTIDMydbops
 
Demystifying MySQL Replication Crash Safety
Demystifying MySQL Replication Crash SafetyDemystifying MySQL Replication Crash Safety
Demystifying MySQL Replication Crash SafetyJean-François Gagné
 
Yahoo: Experiences with MySQL GTID and Multi Threaded Replication
Yahoo: Experiences with MySQL GTID and Multi Threaded ReplicationYahoo: Experiences with MySQL GTID and Multi Threaded Replication
Yahoo: Experiences with MySQL GTID and Multi Threaded ReplicationYashada Jadhav
 
MySQL Parallel Replication: inventory, use-cases and limitations
MySQL Parallel Replication: inventory, use-cases and limitationsMySQL Parallel Replication: inventory, use-cases and limitations
MySQL Parallel Replication: inventory, use-cases and limitationsJean-François Gagné
 
MySQL Parallel Replication: inventory, use-case and limitations
MySQL Parallel Replication: inventory, use-case and limitationsMySQL Parallel Replication: inventory, use-case and limitations
MySQL Parallel Replication: inventory, use-case and limitationsJean-François Gagné
 
Galera Replication Demystified: How Does It Work?
Galera Replication Demystified: How Does It Work?Galera Replication Demystified: How Does It Work?
Galera Replication Demystified: How Does It Work?Frederic Descamps
 
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 MethodsMariaDB plc
 
Webinar slides: Introducing Galera 3.0 - Now supporting MySQL 5.6
Webinar slides: Introducing Galera 3.0 - Now supporting MySQL 5.6Webinar slides: Introducing Galera 3.0 - Now supporting MySQL 5.6
Webinar slides: Introducing Galera 3.0 - Now supporting MySQL 5.6Severalnines
 
MySQL Parallel Replication (LOGICAL_CLOCK): all the 5.7 (and some of the 8.0)...
MySQL Parallel Replication (LOGICAL_CLOCK): all the 5.7 (and some of the 8.0)...MySQL Parallel Replication (LOGICAL_CLOCK): all the 5.7 (and some of the 8.0)...
MySQL Parallel Replication (LOGICAL_CLOCK): all the 5.7 (and some of the 8.0)...Jean-François Gagné
 
ioDrive de benchmarking 2011 1209_zem_distribution
ioDrive de benchmarking 2011 1209_zem_distributionioDrive de benchmarking 2011 1209_zem_distribution
ioDrive de benchmarking 2011 1209_zem_distributionMasahito Zembutsu
 

Ähnlich wie GTIDs Explained (20)

MySQL 5.6 GTID in a nutshell
MySQL 5.6 GTID in a nutshellMySQL 5.6 GTID in a nutshell
MySQL 5.6 GTID in a nutshell
 
Running gtid replication in production
Running gtid replication in productionRunning gtid replication in production
Running gtid replication in production
 
Replication skeptic
Replication skepticReplication skeptic
Replication skeptic
 
MySQL Multi-Source Replication for PL2016
MySQL Multi-Source Replication for PL2016MySQL Multi-Source Replication for PL2016
MySQL Multi-Source Replication for PL2016
 
How to understand Galera Cluster - 2013
How to understand Galera Cluster - 2013How to understand Galera Cluster - 2013
How to understand Galera Cluster - 2013
 
MySQL GTID Concepts, Implementation and troubleshooting
MySQL GTID Concepts, Implementation and troubleshooting MySQL GTID Concepts, Implementation and troubleshooting
MySQL GTID Concepts, Implementation and troubleshooting
 
Demystifying MySQL Replication Crash Safety
Demystifying MySQL Replication Crash SafetyDemystifying MySQL Replication Crash Safety
Demystifying MySQL Replication Crash Safety
 
MySQL/MariaDB Parallel Replication: inventory, use-case and limitations
MySQL/MariaDB Parallel Replication: inventory, use-case and limitationsMySQL/MariaDB Parallel Replication: inventory, use-case and limitations
MySQL/MariaDB Parallel Replication: inventory, use-case and limitations
 
Galera Cluster 3.0 Features
Galera Cluster 3.0 FeaturesGalera Cluster 3.0 Features
Galera Cluster 3.0 Features
 
Introducing Galera 3.0
Introducing Galera 3.0Introducing Galera 3.0
Introducing Galera 3.0
 
Replication Troubleshooting in Classic VS GTID
Replication Troubleshooting in Classic VS GTIDReplication Troubleshooting in Classic VS GTID
Replication Troubleshooting in Classic VS GTID
 
Demystifying MySQL Replication Crash Safety
Demystifying MySQL Replication Crash SafetyDemystifying MySQL Replication Crash Safety
Demystifying MySQL Replication Crash Safety
 
Yahoo: Experiences with MySQL GTID and Multi Threaded Replication
Yahoo: Experiences with MySQL GTID and Multi Threaded ReplicationYahoo: Experiences with MySQL GTID and Multi Threaded Replication
Yahoo: Experiences with MySQL GTID and Multi Threaded Replication
 
MySQL Parallel Replication: inventory, use-cases and limitations
MySQL Parallel Replication: inventory, use-cases and limitationsMySQL Parallel Replication: inventory, use-cases and limitations
MySQL Parallel Replication: inventory, use-cases and limitations
 
MySQL Parallel Replication: inventory, use-case and limitations
MySQL Parallel Replication: inventory, use-case and limitationsMySQL Parallel Replication: inventory, use-case and limitations
MySQL Parallel Replication: inventory, use-case and limitations
 
Galera Replication Demystified: How Does It Work?
Galera Replication Demystified: How Does It Work?Galera Replication Demystified: How Does It Work?
Galera Replication Demystified: How Does It Work?
 
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
 
Webinar slides: Introducing Galera 3.0 - Now supporting MySQL 5.6
Webinar slides: Introducing Galera 3.0 - Now supporting MySQL 5.6Webinar slides: Introducing Galera 3.0 - Now supporting MySQL 5.6
Webinar slides: Introducing Galera 3.0 - Now supporting MySQL 5.6
 
MySQL Parallel Replication (LOGICAL_CLOCK): all the 5.7 (and some of the 8.0)...
MySQL Parallel Replication (LOGICAL_CLOCK): all the 5.7 (and some of the 8.0)...MySQL Parallel Replication (LOGICAL_CLOCK): all the 5.7 (and some of the 8.0)...
MySQL Parallel Replication (LOGICAL_CLOCK): all the 5.7 (and some of the 8.0)...
 
ioDrive de benchmarking 2011 1209_zem_distribution
ioDrive de benchmarking 2011 1209_zem_distributionioDrive de benchmarking 2011 1209_zem_distribution
ioDrive de benchmarking 2011 1209_zem_distribution
 

Mehr von Ivan Zoratti

AI, ML and Graph Algorithms: Real Life Use Cases with Neo4j
AI, ML and Graph Algorithms: Real Life Use Cases with Neo4jAI, ML and Graph Algorithms: Real Life Use Cases with Neo4j
AI, ML and Graph Algorithms: Real Life Use Cases with Neo4jIvan Zoratti
 
Introducing the Open Edge Module
Introducing the Open Edge ModuleIntroducing the Open Edge Module
Introducing the Open Edge ModuleIvan Zoratti
 
MySQL Performance Tuning London Meetup June 2017
MySQL Performance Tuning London Meetup June 2017MySQL Performance Tuning London Meetup June 2017
MySQL Performance Tuning London Meetup June 2017Ivan Zoratti
 
NOSQL Meets Relational - The MySQL Ecosystem Gains More Flexibility
NOSQL Meets Relational - The MySQL Ecosystem Gains More FlexibilityNOSQL Meets Relational - The MySQL Ecosystem Gains More Flexibility
NOSQL Meets Relational - The MySQL Ecosystem Gains More FlexibilityIvan Zoratti
 
MariaDB ColumnStore - LONDON MySQL Meetup
MariaDB ColumnStore - LONDON MySQL MeetupMariaDB ColumnStore - LONDON MySQL Meetup
MariaDB ColumnStore - LONDON MySQL MeetupIvan Zoratti
 
ScaleDB Technical Presentation
ScaleDB Technical PresentationScaleDB Technical Presentation
ScaleDB Technical PresentationIvan Zoratti
 
Time Series From Collection To Analysis
Time Series From Collection To AnalysisTime Series From Collection To Analysis
Time Series From Collection To AnalysisIvan Zoratti
 
ScaleDB Technical Presentation
ScaleDB Technical PresentationScaleDB Technical Presentation
ScaleDB Technical PresentationIvan Zoratti
 
MySQL for Beginners - part 1
MySQL for Beginners - part 1MySQL for Beginners - part 1
MySQL for Beginners - part 1Ivan Zoratti
 
Anatomy of a Proxy Server - MaxScale Internals
Anatomy of a Proxy Server - MaxScale InternalsAnatomy of a Proxy Server - MaxScale Internals
Anatomy of a Proxy Server - MaxScale InternalsIvan Zoratti
 
Orchestrating MySQL
Orchestrating MySQLOrchestrating MySQL
Orchestrating MySQLIvan Zoratti
 
The Evolution of Open Source Databases
The Evolution of Open Source DatabasesThe Evolution of Open Source Databases
The Evolution of Open Source DatabasesIvan Zoratti
 
MaxScale for Effective MySQL Meetup NYC - 14.01.21
MaxScale for Effective MySQL Meetup NYC - 14.01.21MaxScale for Effective MySQL Meetup NYC - 14.01.21
MaxScale for Effective MySQL Meetup NYC - 14.01.21Ivan Zoratti
 
MariaDB 10 Tutorial - 13.11.11 - Percona Live London
MariaDB 10 Tutorial - 13.11.11 - Percona Live LondonMariaDB 10 Tutorial - 13.11.11 - Percona Live London
MariaDB 10 Tutorial - 13.11.11 - Percona Live LondonIvan Zoratti
 
SkySQL & MariaDB What's all the buzz?
SkySQL & MariaDB What's all the buzz?SkySQL & MariaDB What's all the buzz?
SkySQL & MariaDB What's all the buzz?Ivan Zoratti
 
MySQL & MariaDB - Innovation Happens Here
MySQL & MariaDB - Innovation Happens HereMySQL & MariaDB - Innovation Happens Here
MySQL & MariaDB - Innovation Happens HereIvan Zoratti
 
What can we learn from NoSQL technologies?
What can we learn from NoSQL technologies?What can we learn from NoSQL technologies?
What can we learn from NoSQL technologies?Ivan Zoratti
 
Big Data with MySQL
Big Data with MySQLBig Data with MySQL
Big Data with MySQLIvan Zoratti
 
The sky's the limit
The sky's the limitThe sky's the limit
The sky's the limitIvan Zoratti
 

Mehr von Ivan Zoratti (20)

AI, ML and Graph Algorithms: Real Life Use Cases with Neo4j
AI, ML and Graph Algorithms: Real Life Use Cases with Neo4jAI, ML and Graph Algorithms: Real Life Use Cases with Neo4j
AI, ML and Graph Algorithms: Real Life Use Cases with Neo4j
 
Introducing the Open Edge Module
Introducing the Open Edge ModuleIntroducing the Open Edge Module
Introducing the Open Edge Module
 
MySQL Performance Tuning London Meetup June 2017
MySQL Performance Tuning London Meetup June 2017MySQL Performance Tuning London Meetup June 2017
MySQL Performance Tuning London Meetup June 2017
 
NOSQL Meets Relational - The MySQL Ecosystem Gains More Flexibility
NOSQL Meets Relational - The MySQL Ecosystem Gains More FlexibilityNOSQL Meets Relational - The MySQL Ecosystem Gains More Flexibility
NOSQL Meets Relational - The MySQL Ecosystem Gains More Flexibility
 
MariaDB ColumnStore - LONDON MySQL Meetup
MariaDB ColumnStore - LONDON MySQL MeetupMariaDB ColumnStore - LONDON MySQL Meetup
MariaDB ColumnStore - LONDON MySQL Meetup
 
ScaleDB Technical Presentation
ScaleDB Technical PresentationScaleDB Technical Presentation
ScaleDB Technical Presentation
 
Time Series From Collection To Analysis
Time Series From Collection To AnalysisTime Series From Collection To Analysis
Time Series From Collection To Analysis
 
ScaleDB Technical Presentation
ScaleDB Technical PresentationScaleDB Technical Presentation
ScaleDB Technical Presentation
 
MySQL for Beginners - part 1
MySQL for Beginners - part 1MySQL for Beginners - part 1
MySQL for Beginners - part 1
 
Anatomy of a Proxy Server - MaxScale Internals
Anatomy of a Proxy Server - MaxScale InternalsAnatomy of a Proxy Server - MaxScale Internals
Anatomy of a Proxy Server - MaxScale Internals
 
Orchestrating MySQL
Orchestrating MySQLOrchestrating MySQL
Orchestrating MySQL
 
The Evolution of Open Source Databases
The Evolution of Open Source DatabasesThe Evolution of Open Source Databases
The Evolution of Open Source Databases
 
MaxScale for Effective MySQL Meetup NYC - 14.01.21
MaxScale for Effective MySQL Meetup NYC - 14.01.21MaxScale for Effective MySQL Meetup NYC - 14.01.21
MaxScale for Effective MySQL Meetup NYC - 14.01.21
 
MariaDB 10 Tutorial - 13.11.11 - Percona Live London
MariaDB 10 Tutorial - 13.11.11 - Percona Live LondonMariaDB 10 Tutorial - 13.11.11 - Percona Live London
MariaDB 10 Tutorial - 13.11.11 - Percona Live London
 
SkySQL & MariaDB What's all the buzz?
SkySQL & MariaDB What's all the buzz?SkySQL & MariaDB What's all the buzz?
SkySQL & MariaDB What's all the buzz?
 
MySQL & MariaDB - Innovation Happens Here
MySQL & MariaDB - Innovation Happens HereMySQL & MariaDB - Innovation Happens Here
MySQL & MariaDB - Innovation Happens Here
 
What can we learn from NoSQL technologies?
What can we learn from NoSQL technologies?What can we learn from NoSQL technologies?
What can we learn from NoSQL technologies?
 
Big Data with MySQL
Big Data with MySQLBig Data with MySQL
Big Data with MySQL
 
Sky Is The limit
Sky Is The limitSky Is The limit
Sky Is The limit
 
The sky's the limit
The sky's the limitThe sky's the limit
The sky's the limit
 

GTIDs Explained

  • 1. Ivan  Zoratti   GTIDs  Explained MySQL 5.6, MariaDB 10, Galera 3 V1403.01
  • 3. GTID  in  MySQL  5.6 3 3E11FA47-71CA-11E1-9E33-C80AA9429562:23 Transaction  ID   Sequence  number  determined  by  the  order  in  which   the  transaction  was  committed  on  this  server   ! Transaction  ID  =  =  Sequence Source  ID
 Identifies  the  originating  server
 ! Source  ID  =  =  Server  UUID
  • 4. GTID  in  MySQL  5.6 •Used  to  identify  a  transaction  in  a  MySQL  5.6  Cluster   •Sets  are  also  allowed  to  identify  an  interval  of  transactions   •Preserved  between  masters  and  slaves,  i.e.  they  identify  the  source  (origin)  of  a  transaction   •Transactions  with  the  same  GTID  cannot  be  applied  more  than  once   •Benefits   •Simplified  failover  (with  CHANGE  MASTER  TO  and  MASTER_AUTO_POSITION=1)   •Guarantees  slave  consistency  by  checking  Executed_Gtid_Set 4
  • 5. Galera  Cluster • Read  &  Write  access  to  any  node   • Client  can  connect  to  any  node   • There  can  be  several  nodes   • Automatic  node  provisioning   • Replication  is  synchronous 5
  • 6. GTID  in  Galera  3 •Used  to  identify  a  state  change   •i.e.  to  identify  write  operations  to  the  database   •Used  to  identify  the  state  itself   •i.e.  the  last  state  change 6
  • 7. GTID  in  Galera  3 7 ! 45eec521-2f34-11e0-0800-2a36050b826b:94530586304 An  ordinal  sequence  number  (seqno,  64-­‐bit  signed   integer)  to  denote  the  position  of  the  change  in  the   sequence   ! Sequence  =  =  Change  in  the  Cluster State  UUID
 I  uniquely  identifies  the  state  and  the  sequence  of  changes  it   undergoes   ! UUID  =  =  Cluster  ID
  • 8. GTID  in  Galera  3 •A  Galera  Cluster  acts  as  a  single  node   •No  holes  in  the  sequence   •Stored  in  grastate.dat   •5ee99582-­‐bb8d-­‐11e2-­‐b8e3-­‐23de375c1d30:8204503945773  <<<  Typical  sequence   •5ee99582-­‐bb8d-­‐11e2-­‐b8e3-­‐23de375c1d30:-­‐1  <<<  The  node  has  crashed   •00000000-­‐0000-­‐0000-­‐0000-­‐000000000000:-­‐1  <<<  The  node  has  crashed  during  the   execution  of  a  non  transactional  operations  (e.g.  a  DDL  op)  or  the  op  has  been  aborted 8
  • 10. GTID  in  MariaDB  10 10 ! #131109 14:59:59 server id 1 end_log_pos 4151 GTID XXX-YYY-ZZZ /*!100001 SET @@session.gtid_seq_no=ZZZ*//*!*/; Sequence  Number   64bit  unsigned   It  increases  monotonically  at  each  commit   It  is  applied  for  each  Event  Group,  i.e.,  for  each  BEGIN/COMMIT  or   for  groups  that  have  no  BEGIN/COMMIT
 (for  example  DDL  commands,  TRUNCATE  and  others) Server  ID   32bit  unsigned   The  server_id  value  for  the   MariaDB  instance Domain  ID   32bit  unsigned   The  domain_id  value  for  the   Replication  stream
  • 11. GTID  in  MariaDB  10 •1  GTID  for  each  event  group   •Groups  can  be  executed  in  parallel   •Transaction  safe  (stored  in  an  InnoDB  table,
 not  in  a  file)   •MASTER_USE_GTID=gtid_slave_pos  -­‐  great  to  position/reposition  slave  nodes   •Domain  ID  is  used  to  guarantee  that  this  works  with  multi-­‐source  replication 11