SlideShare a Scribd company logo
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 121
Insert Picture Here
MySQL Cluster schema
management
Frazer Clement
MySQL Cluster Technical lead
frazer.clement@oracle.com
messagepassing.blogspot.com
November 2014
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.2
MySQLD
●
Each MySQLD maintains independent schema information in Data
Directory structure, and on disk .frm files
●
MySQLD stores SQL level schema information, actual creation of
tables, indices, storage is delegated to the storage engine (SE).
●
ha_ndbcluster the Ndb 'storage engine' layer uses a 'Global Schema
Lock' (GSL) and 'Schema distribution' via the mysql.ndb_schema table to
synchronise schemas across all MySQLDs in a cluster.
●
MySQLD has the concept of certain schema operations (DDL) being
'online' or 'in place' as opposed to 'offline' or 'copying'.
●
Generally any schema change can be done offline/copying, and only a
(growing) subset can be done online / inplace.
Schema management Offline / copying schema changes commonly
require at least 2*table storage to complete
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.3
MySQLD
For offline / copying changes :
●
Much of the work is done by MySQLD :
Create table sql#xxx with new schema, Scan old table copying and
reformatting rows, Rename table name to sql#yyy, sql#xxx to table
name, drop table sql#yyy.
●
MySQLD will take protective table locks on the MySQLD where the
DDL is running, but these have no effect on queries or DML from NdbApi
clients or other MySQLDs.
●
The scan/copy part of offline schema change is not consistent w.r.t.
ongoing updates, so they must be stopped during the schema change.
Schema management Offline / copying schema changes can be
effectively 'online' if they are performed at a
backup site, and replication is used.
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.4
MySQLD
●
For online/inplace changes most of the work is delegated to the SE as
it is usually very implementation specific.
●
Sometimes MySQLD takes more conservative locks than necessary
(e.g. table locks) while online schema operations are running. These
can lock out concurrent access on the MySQLD where the DDL is
running. This is confusing and limiting, but it is still possible to run
queries and DML via NdbApi and other MySQLDs.
Schema management
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.5
Ndb
●
Ndb has its own Data dictionary (see ndb_show_tables, ndb_desc
etc)
●
Data dictionary is distributed, transactional etc, independent of
MySQLD view of schema
●
Transactions (since 7.0) ensure clean rollback if participants fail or
resources are exhausted during a schema operation.
●
Ndb schema objects are versioned with a Major and Minor version.
Compatible (online) changes only increment the Minor part of the
version.
●
For tables, the Ndb data dictionary contains the table's .frm content as
a Blob. This allows the SE to 'create' the tables on newly started / re-
initialised MySQLD nodes.
Schema management
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.6
Currently supported Ndb online schema operations
●
Add index
●
Drop index
●
Add column (at end of row)
●
Reorganise partitions
Add index uses an Ndb-internal 'live copy' mechanism (similar to the
node recovery) to build an index while the indexed data is changing.
Add column makes use of 'Dynamic columns' inside LDM to add a
column by only changing table metadata- no need to scan/modify every
row.
Reorg uses triggers and special row markers.
Schema management
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.7
Issues in online schema change
●
Handling ongoing write activity
●
Minimising transient storage increase.
●
Amount of data involved if every row must be touched
●
Re-optimising storage if data is removed.
●
Compatible and non-compatible changes for existing clients
●
Dependencies between schema and clients
●
Replication
●
Backup and Restore
Schema management
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.8
Schema object versions + NdbApi
●
Visible via ndb_show_tables (and ndbinfo in 7.4+)
●
Online change (e.g. add column) increments minor version
●
Offline change (e.g. drop column) increments major version (or
changes schema object id)
●
NdbApi clients have a schema object cache, where each object is
versioned.
●
NdbApi operations carry the schema object versions they were defined
against.
●
If the data node's version differs only in the minor version, the operation
can proceed. If it differs in major version, it is rejected.
●
On schema object version error, clients will invalidate their local objects
and re-fetch.
Schema management
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.9
Schema object versions + NdbApi
●
This mechanism allows online schema upgrades where clients can
lazily update their schema object caches.
MySQLD approach
MySQLD is involved in all schema changes via schema distribution.
Schema changes are logically made to occur on epoch boundaries.
MySQLD controls (its) schema object invalidation.
MySQLD controls the schema used for Binlogging at any point in time,
Schema management
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.10
Replication
●
Replication supports a set of attribute (column) type promotions and
demotions, as well as different numbers of columns at Master + Slave.
●
This allows different schemas at Master and Slave
Backup + Restore
ndb_restore supports a set of column type promotions and demotions
designed to mirror those supported by replication. This allows B+R on a
slave with different cluster to be a schema change mechanism and
ensures that the worst-case recovery mechanism (B+R) works even
when schemas are misaligned between replicas.
Schema management

More Related Content

What's hot (20)

PDF
2012 10 24_briefing room
NuoDB
 
PDF
MariaDB CONNECT Storage Engine
Serge Frezefond
 
PDF
The Future of Distributed Databases
NuoDB
 
PDF
"Advanced MySQL 5 Tuning" by Michael Monty Widenius @ eLiberatica 2007
eLiberatica
 
PDF
Architecture of exadata database machine – Part II
Paresh Nayak,OCP®,Prince2®
 
PDF
MySQL 5.5&5.6 new features summary
Louis liu
 
PDF
MySQL Cluster Local Checkpoint (LCP) evolution in 7.6 (2019)
Frazer Clement
 
PDF
Design Patterns for Distributed Non-Relational Databases
guestdfd1ec
 
PDF
NoSQL databases
Marin Dimitrov
 
PDF
Connector/J Beyond JDBC: the X DevAPI for Java and MySQL as a Document Store
Filipe Silva
 
PPT
6 Data Modeling for NoSQL 2/2
Fabio Fumarola
 
PDF
MySQL For Oracle Developers
Ronald Bradford
 
PDF
Triangle MySQL User Group MySQL Fabric Presentation Feb 12th, 2015
Dave Stokes
 
PDF
NoSQL and MySQL webinar - best of both worlds
Mat Keep
 
PDF
In-memory Database and MySQL Cluster
grandis_au
 
PPTX
IN-MEMORY DATABASE SYSTEMS FOR BIG DATA MANAGEMENT.SAP HANA DATABASE.
George Joseph
 
PDF
Scaling MySQl 1 to N Servers -- Los Angelese MySQL User Group Feb 2014
Dave Stokes
 
ODP
Mysql For Developers
Carol McDonald
 
PPT
Mysql database
Arshikhan08
 
PDF
NoSQL Databases
BADR
 
2012 10 24_briefing room
NuoDB
 
MariaDB CONNECT Storage Engine
Serge Frezefond
 
The Future of Distributed Databases
NuoDB
 
"Advanced MySQL 5 Tuning" by Michael Monty Widenius @ eLiberatica 2007
eLiberatica
 
Architecture of exadata database machine – Part II
Paresh Nayak,OCP®,Prince2®
 
MySQL 5.5&5.6 new features summary
Louis liu
 
MySQL Cluster Local Checkpoint (LCP) evolution in 7.6 (2019)
Frazer Clement
 
Design Patterns for Distributed Non-Relational Databases
guestdfd1ec
 
NoSQL databases
Marin Dimitrov
 
Connector/J Beyond JDBC: the X DevAPI for Java and MySQL as a Document Store
Filipe Silva
 
6 Data Modeling for NoSQL 2/2
Fabio Fumarola
 
MySQL For Oracle Developers
Ronald Bradford
 
Triangle MySQL User Group MySQL Fabric Presentation Feb 12th, 2015
Dave Stokes
 
NoSQL and MySQL webinar - best of both worlds
Mat Keep
 
In-memory Database and MySQL Cluster
grandis_au
 
IN-MEMORY DATABASE SYSTEMS FOR BIG DATA MANAGEMENT.SAP HANA DATABASE.
George Joseph
 
Scaling MySQl 1 to N Servers -- Los Angelese MySQL User Group Feb 2014
Dave Stokes
 
Mysql For Developers
Carol McDonald
 
Mysql database
Arshikhan08
 
NoSQL Databases
BADR
 

Similar to MySQL Cluster Schema management (2014) (20)

PDF
Metadata Synchronization in MySQL NDB Cluster 8.0
Arnab Ray
 
PDF
MySQL-InnoDB
Mayank Prasad
 
PDF
Introduction to MySQL Cluster
Abel Flórez
 
PDF
MySQL Day Paris 2016 - MySQL as a Document Store
Olivier DASINI
 
PPTX
A Step by Step Introduction to the MySQL Document Store
Dave Stokes
 
ODP
MySQL Cluster
Abel Flórez
 
PDF
MySQL Cluster 8.0 tutorial
Frazer Clement
 
PDF
MySQL NDB Cluster 8.0
Ted Wennmark
 
ODP
MySQL? Load? Clustering! Balancing! PECL/mysqlnd_ms 1.4
Ulf Wendel
 
PDF
MySQL Document Store
Mario Beck
 
PDF
MySQL For Linux Sysadmins
Morgan Tocker
 
PDF
Exploring mysql cluster 7.4
Ivan Ma
 
PDF
MySQL 8.0 Document Store - Discovery of a New World
Frederic Descamps
 
PDF
MySQL Document Store (Oracle Code Warsaw 2018)
Vittorio Cioe
 
PDF
Ndb cluster 80_tpc_h
mikaelronstrom
 
PDF
Ohio Linux Fest -- MySQL's NoSQL
Dave Stokes
 
PDF
NoSQL and MySQL
Ted Wennmark
 
PDF
Collaborate 2012 - Administering MySQL for Oracle DBAs
Nelson Calero
 
PDF
MySQL 5.7 New Features to Exploit -- PHPTek/Chicago MySQL User Group May 2014
Dave Stokes
 
PDF
MySQL Day Paris 2016 - MySQL HA: InnoDB Cluster and NDB Cluster
Olivier DASINI
 
Metadata Synchronization in MySQL NDB Cluster 8.0
Arnab Ray
 
MySQL-InnoDB
Mayank Prasad
 
Introduction to MySQL Cluster
Abel Flórez
 
MySQL Day Paris 2016 - MySQL as a Document Store
Olivier DASINI
 
A Step by Step Introduction to the MySQL Document Store
Dave Stokes
 
MySQL Cluster
Abel Flórez
 
MySQL Cluster 8.0 tutorial
Frazer Clement
 
MySQL NDB Cluster 8.0
Ted Wennmark
 
MySQL? Load? Clustering! Balancing! PECL/mysqlnd_ms 1.4
Ulf Wendel
 
MySQL Document Store
Mario Beck
 
MySQL For Linux Sysadmins
Morgan Tocker
 
Exploring mysql cluster 7.4
Ivan Ma
 
MySQL 8.0 Document Store - Discovery of a New World
Frederic Descamps
 
MySQL Document Store (Oracle Code Warsaw 2018)
Vittorio Cioe
 
Ndb cluster 80_tpc_h
mikaelronstrom
 
Ohio Linux Fest -- MySQL's NoSQL
Dave Stokes
 
NoSQL and MySQL
Ted Wennmark
 
Collaborate 2012 - Administering MySQL for Oracle DBAs
Nelson Calero
 
MySQL 5.7 New Features to Exploit -- PHPTek/Chicago MySQL User Group May 2014
Dave Stokes
 
MySQL Day Paris 2016 - MySQL HA: InnoDB Cluster and NDB Cluster
Olivier DASINI
 
Ad

Recently uploaded (20)

PPTX
AEM User Group: India Chapter Kickoff Meeting
jennaf3
 
PDF
The 5 Reasons for IT Maintenance - Arna Softech
Arna Softech
 
PDF
Unlock Efficiency with Insurance Policy Administration Systems
Insurance Tech Services
 
PDF
MiniTool Partition Wizard 12.8 Crack License Key LATEST
hashhshs786
 
PDF
Alarm in Android-Scheduling Timed Tasks Using AlarmManager in Android.pdf
Nabin Dhakal
 
PPTX
Home Care Tools: Benefits, features and more
Third Rock Techkno
 
PDF
Driver Easy Pro 6.1.1 Crack Licensce key 2025 FREE
utfefguu
 
PDF
유니티에서 Burst Compiler+ThreadedJobs+SIMD 적용사례
Seongdae Kim
 
PDF
Alexander Marshalov - How to use AI Assistants with your Monitoring system Q2...
VictoriaMetrics
 
PPTX
Help for Correlations in IBM SPSS Statistics.pptx
Version 1 Analytics
 
PDF
Odoo CRM vs Zoho CRM: Honest Comparison 2025
Odiware Technologies Private Limited
 
PDF
AI + DevOps = Smart Automation with devseccops.ai.pdf
Devseccops.ai
 
PPTX
Migrating Millions of Users with Debezium, Apache Kafka, and an Acyclic Synch...
MD Sayem Ahmed
 
PPTX
Empowering Asian Contributions: The Rise of Regional User Groups in Open Sour...
Shane Coughlan
 
PPTX
Human Resources Information System (HRIS)
Amity University, Patna
 
PDF
HiHelloHR – Simplify HR Operations for Modern Workplaces
HiHelloHR
 
PDF
Download Canva Pro 2025 PC Crack Full Latest Version
bashirkhan333g
 
PDF
SciPy 2025 - Packaging a Scientific Python Project
Henry Schreiner
 
PDF
Top Agile Project Management Tools for Teams in 2025
Orangescrum
 
PPTX
Agentic Automation Journey Series Day 2 – Prompt Engineering for UiPath Agents
klpathrudu
 
AEM User Group: India Chapter Kickoff Meeting
jennaf3
 
The 5 Reasons for IT Maintenance - Arna Softech
Arna Softech
 
Unlock Efficiency with Insurance Policy Administration Systems
Insurance Tech Services
 
MiniTool Partition Wizard 12.8 Crack License Key LATEST
hashhshs786
 
Alarm in Android-Scheduling Timed Tasks Using AlarmManager in Android.pdf
Nabin Dhakal
 
Home Care Tools: Benefits, features and more
Third Rock Techkno
 
Driver Easy Pro 6.1.1 Crack Licensce key 2025 FREE
utfefguu
 
유니티에서 Burst Compiler+ThreadedJobs+SIMD 적용사례
Seongdae Kim
 
Alexander Marshalov - How to use AI Assistants with your Monitoring system Q2...
VictoriaMetrics
 
Help for Correlations in IBM SPSS Statistics.pptx
Version 1 Analytics
 
Odoo CRM vs Zoho CRM: Honest Comparison 2025
Odiware Technologies Private Limited
 
AI + DevOps = Smart Automation with devseccops.ai.pdf
Devseccops.ai
 
Migrating Millions of Users with Debezium, Apache Kafka, and an Acyclic Synch...
MD Sayem Ahmed
 
Empowering Asian Contributions: The Rise of Regional User Groups in Open Sour...
Shane Coughlan
 
Human Resources Information System (HRIS)
Amity University, Patna
 
HiHelloHR – Simplify HR Operations for Modern Workplaces
HiHelloHR
 
Download Canva Pro 2025 PC Crack Full Latest Version
bashirkhan333g
 
SciPy 2025 - Packaging a Scientific Python Project
Henry Schreiner
 
Top Agile Project Management Tools for Teams in 2025
Orangescrum
 
Agentic Automation Journey Series Day 2 – Prompt Engineering for UiPath Agents
klpathrudu
 
Ad

MySQL Cluster Schema management (2014)

  • 1. Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 121 Insert Picture Here MySQL Cluster schema management Frazer Clement MySQL Cluster Technical lead [email protected] messagepassing.blogspot.com November 2014
  • 2. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.2 MySQLD ● Each MySQLD maintains independent schema information in Data Directory structure, and on disk .frm files ● MySQLD stores SQL level schema information, actual creation of tables, indices, storage is delegated to the storage engine (SE). ● ha_ndbcluster the Ndb 'storage engine' layer uses a 'Global Schema Lock' (GSL) and 'Schema distribution' via the mysql.ndb_schema table to synchronise schemas across all MySQLDs in a cluster. ● MySQLD has the concept of certain schema operations (DDL) being 'online' or 'in place' as opposed to 'offline' or 'copying'. ● Generally any schema change can be done offline/copying, and only a (growing) subset can be done online / inplace. Schema management Offline / copying schema changes commonly require at least 2*table storage to complete
  • 3. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.3 MySQLD For offline / copying changes : ● Much of the work is done by MySQLD : Create table sql#xxx with new schema, Scan old table copying and reformatting rows, Rename table name to sql#yyy, sql#xxx to table name, drop table sql#yyy. ● MySQLD will take protective table locks on the MySQLD where the DDL is running, but these have no effect on queries or DML from NdbApi clients or other MySQLDs. ● The scan/copy part of offline schema change is not consistent w.r.t. ongoing updates, so they must be stopped during the schema change. Schema management Offline / copying schema changes can be effectively 'online' if they are performed at a backup site, and replication is used.
  • 4. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.4 MySQLD ● For online/inplace changes most of the work is delegated to the SE as it is usually very implementation specific. ● Sometimes MySQLD takes more conservative locks than necessary (e.g. table locks) while online schema operations are running. These can lock out concurrent access on the MySQLD where the DDL is running. This is confusing and limiting, but it is still possible to run queries and DML via NdbApi and other MySQLDs. Schema management
  • 5. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.5 Ndb ● Ndb has its own Data dictionary (see ndb_show_tables, ndb_desc etc) ● Data dictionary is distributed, transactional etc, independent of MySQLD view of schema ● Transactions (since 7.0) ensure clean rollback if participants fail or resources are exhausted during a schema operation. ● Ndb schema objects are versioned with a Major and Minor version. Compatible (online) changes only increment the Minor part of the version. ● For tables, the Ndb data dictionary contains the table's .frm content as a Blob. This allows the SE to 'create' the tables on newly started / re- initialised MySQLD nodes. Schema management
  • 6. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.6 Currently supported Ndb online schema operations ● Add index ● Drop index ● Add column (at end of row) ● Reorganise partitions Add index uses an Ndb-internal 'live copy' mechanism (similar to the node recovery) to build an index while the indexed data is changing. Add column makes use of 'Dynamic columns' inside LDM to add a column by only changing table metadata- no need to scan/modify every row. Reorg uses triggers and special row markers. Schema management
  • 7. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.7 Issues in online schema change ● Handling ongoing write activity ● Minimising transient storage increase. ● Amount of data involved if every row must be touched ● Re-optimising storage if data is removed. ● Compatible and non-compatible changes for existing clients ● Dependencies between schema and clients ● Replication ● Backup and Restore Schema management
  • 8. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.8 Schema object versions + NdbApi ● Visible via ndb_show_tables (and ndbinfo in 7.4+) ● Online change (e.g. add column) increments minor version ● Offline change (e.g. drop column) increments major version (or changes schema object id) ● NdbApi clients have a schema object cache, where each object is versioned. ● NdbApi operations carry the schema object versions they were defined against. ● If the data node's version differs only in the minor version, the operation can proceed. If it differs in major version, it is rejected. ● On schema object version error, clients will invalidate their local objects and re-fetch. Schema management
  • 9. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.9 Schema object versions + NdbApi ● This mechanism allows online schema upgrades where clients can lazily update their schema object caches. MySQLD approach MySQLD is involved in all schema changes via schema distribution. Schema changes are logically made to occur on epoch boundaries. MySQLD controls (its) schema object invalidation. MySQLD controls the schema used for Binlogging at any point in time, Schema management
  • 10. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.10 Replication ● Replication supports a set of attribute (column) type promotions and demotions, as well as different numbers of columns at Master + Slave. ● This allows different schemas at Master and Slave Backup + Restore ndb_restore supports a set of column type promotions and demotions designed to mirror those supported by replication. This allows B+R on a slave with different cluster to be a schema change mechanism and ensures that the worst-case recovery mechanism (B+R) works even when schemas are misaligned between replicas. Schema management