SlideShare une entreprise Scribd logo
1  sur  57
Télécharger pour lire hors ligne
Copyright	
  ©	
  2015	
  Oracle	
  and/or	
  its	
  affiliates.	
  All	
  rights	
  reserved.	
  	
  |
Using	
  MySQL	
  in	
  
Automated	
  Testing
Morgan	
  Tocker	
  
MySQL	
  Community	
  Manager	
  
February	
  2015
Copyright	
  ©	
  2014	
  Oracle	
  and/or	
  its	
  affiliates.	
  All	
  rights	
  reserved.	
  	
  |
Safe	
  Harbor	
  Statement
The	
  following	
  is	
  intended	
  to	
  outline	
  our	
  general	
  product	
  direction.	
  
It	
  is	
  intended	
  for	
  information	
  purposes	
  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	
  upon	
  
in	
  making	
  purchasing	
  decisions.	
  The	
  development,	
  release,	
  and	
  
timing	
  of	
  any	
  features	
  or	
  functionality	
  described	
  for	
  Oracle’s	
  
products	
  remains	
  at	
  the	
  sole	
  discretion	
  of	
  Oracle.
3
Copyright	
  ©	
  2015	
  Oracle	
  and/or	
  its	
  affiliates.	
  All	
  rights	
  reserved.	
  	
  |
4
Today’s	
  Agenda
Introduction	
  
Tools	
  
Bootstrapping	
  
Pushing	
  Database	
  Changes	
  
Metrics	
  to	
  Capture
1
2
3
4
5
Copyright	
  ©	
  2015	
  Oracle	
  and/or	
  its	
  affiliates.	
  All	
  rights	
  reserved.	
  	
  |
Introduction
• Database	
  are	
  not	
  an	
  outlier	
  
• Can	
  be	
  automated	
  /	
  scripted	
  /	
  managed	
  as	
  part	
  of	
  a	
  
deployment	
  
• Many	
  good	
  tools	
  exist
5
Copyright	
  ©	
  2015	
  Oracle	
  and/or	
  its	
  affiliates.	
  All	
  rights	
  reserved.	
  	
  |
History	
  of	
  MySQL	
  specific	
  versions
• MySQL	
  5.1	
  and	
  below:	
  
• No	
  Online	
  DDL	
  
• Adding	
  indexes	
  to	
  InnoDB	
  tables	
  causes	
  rebuild	
  
• Supports	
  triggers	
  from	
  5.0	
  (!)
6
Copyright	
  ©	
  2015	
  Oracle	
  and/or	
  its	
  affiliates.	
  All	
  rights	
  reserved.	
  	
  |
History	
  of	
  MySQL	
  specific	
  versions	
  (cont.)
• MySQL	
  5.5	
  (2010):	
  
• InnoDB	
  as	
  default	
  
• Fast	
  ALTER	
  TABLE
7
Copyright	
  ©	
  2015	
  Oracle	
  and/or	
  its	
  affiliates.	
  All	
  rights	
  reserved.	
  	
  |
History	
  of	
  MySQL	
  specific	
  versions	
  (cont.)
• MySQL	
  5.6	
  (2013):	
  
• Online	
  DDL	
  
• Performance	
  Schema	
  by	
  default
8
Copyright	
  ©	
  2015	
  Oracle	
  and/or	
  its	
  affiliates.	
  All	
  rights	
  reserved.	
  	
  |
History	
  of	
  MySQL	
  specific	
  versions	
  (cont.)
• MySQL	
  5.7	
  (In	
  Development):	
  
• Multiple	
  triggers	
  per	
  table
9
Copyright	
  ©	
  2015	
  Oracle	
  and/or	
  its	
  affiliates.	
  All	
  rights	
  reserved.	
  	
  |
Online	
  DDL	
  (MySQL	
  5.6+)
• Can	
  add	
  indexes,	
  many	
  other	
  changes	
  without	
  blocking	
  
READS	
  or	
  WRITES:	
  
• http://dev.mysql.com/doc/refman/5.6/en/innodb-­‐
create-­‐index-­‐overview.html	
  
• Still	
  requires	
  application	
  to	
  handle	
  two	
  versions	
  of	
  
schema.	
  
• Does	
  not	
  facilitate	
  READ/WRITE	
  split	
  with	
  slaves.
10
Copyright	
  ©	
  2015	
  Oracle	
  and/or	
  its	
  affiliates.	
  All	
  rights	
  reserved.	
  	
  | 11
In-Place? Copies Table? Allows Concurrent
DML?
Allows Concurrent
Query?
CREATE INDEX,ADD INDEX Yes* No* Yes Yes
ADD FULLTEXT INDEX Yes No* No Yes
DROP INDEX Yes No Yes Yes
OPTIMIZE TABLE Yes Yes Yes Yes
Set default value for a column Yes No Yes Yes
Change auto-increment value for a column Yes No Yes Yes
Add a foreign key constraint Yes* No* Yes Yes
Drop a foreign key constraint Yes No Yes Yes
Rename a column Yes* No* Yes* Yes
Add a column Yes Yes Yes* Yes
Drop a column Yes Yes Yes Yes
Reorder columns Yes Yes Yes Yes
Change ROW_FORMAT property Yes Yes Yes Yes
Change KEY_BLOCK_SIZE property Yes Yes Yes Yes
Make column NULL Yes Yes Yes Yes
Make column NOT NULL Yes* Yes Yes Yes
Change data type of column No Yes No Yes
Add primary key Yes* Yes Yes Yes
Drop primary key and add another Yes Yes Yes Yes
Drop primary key No Yes No Yes
Convert character set No Yes No Yes
Specify character set No Yes No Yes
Rebuild with FORCE option No Yes No Yes
Copyright	
  ©	
  2015	
  Oracle	
  and/or	
  its	
  affiliates.	
  All	
  rights	
  reserved.	
  	
  |
12
Today’s	
  Agenda
Introduction	
  	
  
Tools	
  
Bootstrapping	
  
Pushing	
  Database	
  Changes	
  
Metrics	
  to	
  Capture
2
3
4
2
1
5
Copyright	
  ©	
  2015	
  Oracle	
  and/or	
  its	
  affiliates.	
  All	
  rights	
  reserved.	
  	
  |
Worth	
  Considering
• pt-­‐online-­‐schema-­‐change	
  
• MySQL	
  Sandbox	
  
• SYS	
  
• Outbrain	
  Propagator	
  
• Liquibase	
  
• ORM	
  specific	
  migrations	
  
• libeatmydata
13
Copyright	
  ©	
  2015	
  Oracle	
  and/or	
  its	
  affiliates.	
  All	
  rights	
  reserved.	
  	
  |
pt-­‐online-­‐schema-­‐change
• Part	
  of	
  “Percona	
  Toolkit”.	
  
• Simulates	
  Online	
  DDL	
  by	
  creating	
  a	
  shadow	
  table	
  and	
  
adding	
  triggers	
  to	
  the	
  original	
  table.	
  
• Later	
  performs	
  a	
  hot	
  switchover.	
  
• Useful	
  for	
  statements	
  that	
  do	
  not	
  support	
  Online	
  DDL.	
  
• Required	
  in	
  substitution	
  of	
  Online	
  DDL	
  in	
  the	
  case	
  slaves	
  
are	
  required	
  for	
  active	
  use.
14
Copyright	
  ©	
  2015	
  Oracle	
  and/or	
  its	
  affiliates.	
  All	
  rights	
  reserved.	
  	
  |
MySQL	
  Sandbox
• Allows	
  you	
  to	
  run	
  multiple	
  copies	
  at	
  once,	
  each	
  self	
  
contained.	
  
• Can	
  bootstrap	
  a	
  fresh	
  install	
  from	
  a	
  .tar.gz	
  of	
  MySQL.	
  
• Can	
  bootstrap	
  common	
  topologies.	
  
• i.e.	
  Master	
  with	
  a	
  slave
15
Copyright	
  ©	
  2015	
  Oracle	
  and/or	
  its	
  affiliates.	
  All	
  rights	
  reserved.	
  	
  |
SYS
• Common	
  set	
  of	
  views	
  on	
  MySQL’s	
  Performance	
  Schema.	
  
• Entirely	
  SQL	
  view	
  of	
  all	
  of	
  MySQL’s	
  Performance.	
  
• Could	
  potentially	
  problematic	
  queries	
  in	
  QA	
  during	
  test	
  
suite	
  execution,	
  etc…
16
Copyright	
  ©	
  2015	
  Oracle	
  and/or	
  its	
  affiliates.	
  All	
  rights	
  reserved.	
  	
  |
Outbrain	
  Propagator
• Based	
  on	
  SQL	
  Scripts	
  
• Concept	
  of	
  Environments
17
Copyright	
  ©	
  2015	
  Oracle	
  and/or	
  its	
  affiliates.	
  All	
  rights	
  reserved.	
  	
  | 18
Copyright	
  ©	
  2015	
  Oracle	
  and/or	
  its	
  affiliates.	
  All	
  rights	
  reserved.	
  	
  |
Liquibase
• Specify	
  change	
  in	
  XML/Yaml/JSON/SQL
19
Copyright	
  ©	
  2015	
  Oracle	
  and/or	
  its	
  affiliates.	
  All	
  rights	
  reserved.	
  	
  |
ORM	
  Specific
• Rails	
  Migrations	
  
• Django	
  Migrations	
  (1.7+)
20
Copyright	
  ©	
  2015	
  Oracle	
  and/or	
  its	
  affiliates.	
  All	
  rights	
  reserved.	
  	
  |
libeatmydata
• Disables	
  fsyncs	
  and	
  related	
  functions	
  
• Packaged	
  in	
  Ubuntu	
  
• apt-­‐get	
  install	
  eatmydata
21
root@mysqldb:/usr/local/mysql# eatmydata ./bin/
mysqld —user=mysql
Copyright	
  ©	
  2015	
  Oracle	
  and/or	
  its	
  affiliates.	
  All	
  rights	
  reserved.	
  	
  |
22
Today’s	
  Agenda
Introduction	
  
Tools	
  
Bootstrapping	
  
Pushing	
  Database	
  Changes	
  
Metrics	
  to	
  Capture
2
3
4
1
5
3
Copyright	
  ©	
  2015	
  Oracle	
  and/or	
  its	
  affiliates.	
  All	
  rights	
  reserved.	
  	
  |
Building	
  a	
  new	
  QA	
  Environment
• Recommend	
  starting	
  with	
  either	
  MySQL::Sandbox	
  or	
  
official	
  repos.	
  
• Can	
  restore	
  data	
  from	
  mysqldump,	
  or	
  copying	
  data	
  data	
  
directory	
  in	
  place.
23
Copyright	
  ©	
  2015	
  Oracle	
  and/or	
  its	
  affiliates.	
  All	
  rights	
  reserved.	
  	
  |
Official	
  Repos
24
sudo yum localinstall http://dev.mysql.com/get/
mysql-community-release-el6-5.noarch.rpm
yum install mysql-community-server
• More	
  Information:	
  
• http://dev.mysql.com/downloads/repo/yum/	
  
• http://dev.mysql.com/downloads/repo/apt/	
  
• http://dev.mysql.com/downloads/repo/suse/
Copyright	
  ©	
  2015	
  Oracle	
  and/or	
  its	
  affiliates.	
  All	
  rights	
  reserved.	
  	
  |
MySQL::Sandbox
25
$ make_sandbox mysql-5.6.23-osx10.9-x86_64.tar.gz
unpacking /Users/morgo/Downloads/mysql-5.6.23-osx10.9-x86_64.tar.gz
Executing low_level_make_sandbox --basedir=/Users/morgo/Downloads/
5.6.23 
--sandbox_directory=msb_5_6_23 
--install_version=5.6 
--sandbox_port=5623 
--no_ver_after_name 
--my_clause=log-error=msandbox.err
The MySQL Sandbox, version 3.0.47
(C) 2006-2013 Giuseppe Maxia
installing with the following parameters:
upper_directory = /Users/morgo/sandboxes
sandbox_directory = msb_5_6_23
sandbox_port = 5623
..
do you agree? ([Y],n) Y
loading grants
.. sandbox server started
Your sandbox server was installed in $HOME/sandboxes/msb_5_6_23
Copyright	
  ©	
  2015	
  Oracle	
  and/or	
  its	
  affiliates.	
  All	
  rights	
  reserved.	
  	
  |
My	
  Local	
  Sandboxes
26
morgo@Rbook:~/sandboxes$ ls
clear_all msb_5_5_40 msb_5_6_15 msb_5_6_22
msb_5_7_3 msb_5_7_5.bak sandbox_action status_all
msb_5_5_32 msb_5_6_12 msb_5_6_16 msb_5_6_23
msb_5_7_4 plugin.conf send_kill_all stop_all
msb_5_5_36 msb_5_6_13 msb_5_6_17 msb_5_7_1
msb_5_7_5 restart_all start_all use_all
morgo@Rbook:~/sandboxes$ cd msb_5_6_23
morgo@Rbook:~/sandboxes/msb_5_6_23$ ./use
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 3
Server version: 5.6.23 MySQL Community Server (GPL)
..
Type 'help;' or 'h' for help. Type 'c' to clear the current input
statement.
mysql [localhost] {msandbox} ((none)) >
Version	
  5.6.23	
  
=	
  Port	
  5623
Copyright	
  ©	
  2015	
  Oracle	
  and/or	
  its	
  affiliates.	
  All	
  rights	
  reserved.	
  	
  |
Restoring	
  Data
• Some	
  testing	
  environments	
  (i.e.	
  staging)	
  may	
  have	
  a	
  
snapshot	
  of	
  actual	
  data.	
  
• This	
  is	
  actually	
  a	
  very	
  good	
  practice	
  if	
  your	
  data	
  
security	
  policy	
  allows	
  for	
  it.	
  
• Ensures	
  highest	
  chance	
  of	
  same	
  performance	
  
characteristics	
  as	
  production.
27
Copyright	
  ©	
  2015	
  Oracle	
  and/or	
  its	
  affiliates.	
  All	
  rights	
  reserved.	
  	
  |
Restoring	
  Data	
  (cont.)
• mysqldump	
  can	
  be	
  very	
  slow	
  to	
  load	
  data	
  into	
  your	
  
newly	
  setup	
  environment.	
  
• Consider	
  copying	
  data	
  directory	
  in	
  raw	
  format	
  instead.
28
Copyright	
  ©	
  2015	
  Oracle	
  and/or	
  its	
  affiliates.	
  All	
  rights	
  reserved.	
  	
  |
How	
  to	
  Configure	
  MySQL	
  in	
  QA?
• It’s	
  up	
  to	
  you!	
  
• For	
  CI	
  rule	
  of	
  thumb	
  says	
  that	
  the	
  test	
  suite	
  should	
  
execute	
  in	
  less	
  than	
  5	
  minutes.
29
Copyright	
  ©	
  2015	
  Oracle	
  and/or	
  its	
  affiliates.	
  All	
  rights	
  reserved.	
  	
  |
Alternative	
  #1	
  -­‐	
  mysql-­‐reckless.cnf
• Disable	
  MySQL’s	
  durability:	
  
• Warning:	
  Not	
  100%	
  a	
  best	
  practice.
30
sync_frm=0
sync_binlog=0
innodb-flush-log-at-trx-commit=0
innodb-doublewrite=0
innodb_support_xa=0
innodb_checksum_algorithm=none
innodb_adaptive_flushing=OFF
Source:	
  https://github.com/morgo/mysql-­‐compatibility-­‐config/blob/master/mysql-­‐56/mysql-­‐56-­‐reckless.cnf	
  
Copyright	
  ©	
  2015	
  Oracle	
  and/or	
  its	
  affiliates.	
  All	
  rights	
  reserved.	
  	
  |
Alternative	
  #2	
  -­‐	
  Disable	
  fsync	
  and	
  friends
• At	
  a	
  lower	
  level,	
  kill	
  durability.	
  
• Keeps	
  MySQL	
  functionality	
  consistent	
  between	
  QA	
  and	
  
Production.	
  
• Possibly	
  requires	
  Linux.
31
root@mysqldb:/usr/local/mysql# eatmydata ./bin/
mysqld —user=mysql
Copyright	
  ©	
  2015	
  Oracle	
  and/or	
  its	
  affiliates.	
  All	
  rights	
  reserved.	
  	
  |
32
Today’s	
  Agenda
Introduction	
  
Tools	
  
Bootstrapping	
  
Pushing	
  Database	
  Changes	
  
Metrics	
  to	
  Capture
2
3
4
1
5
4
Copyright	
  ©	
  2015	
  Oracle	
  and/or	
  its	
  affiliates.	
  All	
  rights	
  reserved.	
  	
  |
Two	
  Categories	
  of	
  Change
• Data	
  Definition	
  Language	
  
• aka	
  DDL	
  
• Adding/Dropping	
  Indexes	
  
• Adding/Dropping	
  Columns	
  
• ..	
  
• Data	
  manipulation	
  language	
  
• aka	
  DML	
  
• One	
  off	
  tasks	
  to	
  modify	
  
data	
  	
  
• Repairing	
  incorrect	
  values	
  
• ..
33
Copyright	
  ©	
  2015	
  Oracle	
  and/or	
  its	
  affiliates.	
  All	
  rights	
  reserved.	
  	
  |
DDL	
  Considerations
• DDL	
  does	
  not	
  support	
  transactions	
  
• Is	
  still	
  atomic	
  on	
  a	
  per-­‐table	
  basis	
  
• Grouping	
  multiple	
  tables	
  may	
  complicate	
  deployment:
34
ALTER TABLE t1 ADD INDEX (a);
ALTER TABLE t2 ADD INDEX (a); // t2 fails
ALTER TABLE t3 ADD INDEX (a);
Copyright	
  ©	
  2015	
  Oracle	
  and/or	
  its	
  affiliates.	
  All	
  rights	
  reserved.	
  	
  |
DDL	
  Considerations	
  (cont.)
• Good	
  practice	
  to	
  group	
  all	
  changes	
  for	
  one	
  table	
  to	
  
single	
  chained	
  ALTER	
  command.	
  
• Saves	
  on	
  table	
  rebuilds	
  where	
  required:
35
ALTER TABLE my_table ADD my_column1 VARCHAR(255),
ADD my_column2 VARCHAR(255);
Copyright	
  ©	
  2015	
  Oracle	
  and/or	
  its	
  affiliates.	
  All	
  rights	
  reserved.	
  	
  |
DDL	
  Considerations	
  (cont.)
• Don’t	
  play	
  a	
  guessing	
  game	
  with	
  Online	
  DDL.	
  
• ALTER	
  TABLE	
  supports	
  LOCK=NONE	
  extension:
36
CREATE TABLE acdc (a int);
ALTER TABLE acdc ADD PRIMARY KEY (a), LOCK=NONE;
Query OK, 0 rows affected (0.29 sec)
Records: 0 Duplicates: 0 Warnings: 0
ALTER TABLE acdc DROP PRIMARY KEY, LOCK=NONE;
ERROR 1846 (0A000): LOCK=NONE is not supported. Reason:
Dropping a primary key is not allowed without also
adding a new primary key. Try LOCK=SHARED.
Copyright	
  ©	
  2015	
  Oracle	
  and/or	
  its	
  affiliates.	
  All	
  rights	
  reserved.	
  	
  |
DDL	
  Considerations	
  (cont.)
• Any	
  time	
  you	
  change	
  indexes:	
  
• Existing	
  query	
  plans	
  can	
  change	
  
• Diligent	
  DBAs	
  watch	
  for	
  regressions	
  :)
37
Copyright	
  ©	
  2015	
  Oracle	
  and/or	
  its	
  affiliates.	
  All	
  rights	
  reserved.	
  	
  |
DML	
  Example
• Added	
  a	
  new	
  column	
  called	
  is_paying_user	
  on	
  users	
  
table.	
  
• New	
  code	
  correctly	
  sets	
  is_paying_user	
  to	
  0	
  or	
  1.	
  
• All	
  5M	
  existing	
  users	
  will	
  need	
  the	
  is_paying_user	
  
property	
  set.
38
Copyright	
  ©	
  2015	
  Oracle	
  and/or	
  its	
  affiliates.	
  All	
  rights	
  reserved.	
  	
  |
DML	
  Considerations
• SQL	
  is	
  not	
  guaranteed	
  idempotent	
  
• Best	
  to	
  make	
  sure	
  that	
  any	
  script	
  fails	
  or	
  does	
  nothing	
  if	
  
executed	
  twice.
39
UPDATE t SET a = a+1; // potentially bad.
UPDATE t SET a = 11; // better
UPDATE t SET a = 11 WHERE a = 10; // safest
Copyright	
  ©	
  2015	
  Oracle	
  and/or	
  its	
  affiliates.	
  All	
  rights	
  reserved.	
  	
  |
DML	
  Considerations	
  (cont.)
• Modifications	
  via	
  temporary	
  tables	
  are	
  unsafe	
  for	
  
Statement-­‐based	
  replication:
40
CREATE TEMPORARY TABLE tmp_user_payments AS
SELECT DISTINCT(user_id) as user_id FROM payments
WHERE payment_total > 0;
/* Slave can disconnect here and lose tmp table */
UPDATE users, tmp_user_payments SET
is_paying_user=1 WHERE user
tmp_user_payments.user_id=users.user_id;
Copyright	
  ©	
  2015	
  Oracle	
  and/or	
  its	
  affiliates.	
  All	
  rights	
  reserved.	
  	
  |
Suggested	
  Fixes:
• Use	
  Row-­‐Based	
  replication	
  (proposed	
  default	
  in	
  5.7)	
  
• Use	
  base	
  table	
  instead	
  of	
  temporary	
  table.	
  
• Perform	
  change	
  in	
  single	
  step,	
  such	
  as	
  via	
  sub	
  query	
  
(really	
  requires	
  5.6+)
41
Copyright	
  ©	
  2015	
  Oracle	
  and/or	
  its	
  affiliates.	
  All	
  rights	
  reserved.	
  	
  |
DML	
  Considerations	
  (cont.)
• Locks	
  are	
  held	
  for	
  the	
  duration	
  of	
  a	
  transaction	
  
• Scripts	
  that	
  appear	
  safe	
  in	
  QA	
  may	
  still	
  create	
  
production	
  problems	
  
• Common	
  practice	
  to	
  chunk-­‐split	
  batch	
  operations	
  to	
  
yield	
  locks	
  (i.e.	
  10K	
  row	
  modifications	
  per	
  transaction.)	
  
• Not	
  strictly	
  ACID	
  :)
42
Copyright	
  ©	
  2015	
  Oracle	
  and/or	
  its	
  affiliates.	
  All	
  rights	
  reserved.	
  	
  |
Distributed	
  Systems
• i.e.	
  Sharded	
  of	
  Functional	
  Partitioned	
  Deployments	
  
• Presents	
  special	
  challenges	
  
• Application	
  typically	
  must	
  talk	
  to	
  two	
  versions	
  of	
  a	
  
schema	
  at	
  once.	
  
• Requirement	
  still	
  true	
  for	
  non	
  distributed	
  systems…
43
Copyright	
  ©	
  2015	
  Oracle	
  and/or	
  its	
  affiliates.	
  All	
  rights	
  reserved.	
  	
  |
Why	
  two	
  versions	
  of	
  a	
  Schema?
• Even	
  when	
  DDL	
  is	
  online,	
  can’t	
  control	
  when	
  it	
  finishes	
  
and	
  new	
  schema	
  is	
  immediately	
  visible	
  to	
  application.	
  
• Guaranteed	
  safe	
  way:	
  
• Stop	
  old	
  version	
  of	
  Application	
  
• Apply	
  Database	
  Changes	
  
• Start	
  new	
  version	
  of	
  Application
44
	
  Painful
Copyright	
  ©	
  2015	
  Oracle	
  and/or	
  its	
  affiliates.	
  All	
  rights	
  reserved.	
  	
  |
Examples	
  of	
  Incompatibilities
• Renaming	
  a	
  column	
  
• $row[4];	
  //	
  Using	
  nth	
  column.	
  	
  Can’t	
  guarantee	
  new	
  column	
  preserves	
  order.	
  
• INSERT	
  into	
  my_table	
  VALUES	
  (1,2,3);	
  //	
  Non-­‐full	
  inserts	
  if	
  column	
  
count	
  changes	
  
• SELECT	
  *	
  FROM	
  a	
  UNION	
  SELECT	
  *	
  FROM	
  b;	
  //	
  Column	
  count	
  
mismatch	
  if	
  a	
  adds	
  a	
  column	
  
• INSERT	
  INTO	
  a	
  SELECT	
  *	
  FROM	
  b	
  //	
  Column	
  count	
  mismatch	
  if	
  a	
  adds	
  
a	
  column
45
Copyright	
  ©	
  2015	
  Oracle	
  and/or	
  its	
  affiliates.	
  All	
  rights	
  reserved.	
  	
  |
How	
  to	
  make	
  an	
  application	
  speak	
  two	
  
schemas?
• Introduce	
  Social	
  Change	
  
• Developers	
  will	
  not	
  always	
  consider	
  deployment	
  
issues	
  
• Easy	
  way	
  to	
  force	
  them	
  is	
  to	
  make	
  database	
  changes	
  
separate	
  from	
  other	
  changes
46
Copyright	
  ©	
  2015	
  Oracle	
  and/or	
  its	
  affiliates.	
  All	
  rights	
  reserved.	
  	
  |
When	
  to	
  add	
  that	
  column?
• Make	
  the	
  change	
  happen	
  in	
  the	
  release	
  before.	
  
• If	
  it’s	
  easier	
  to	
  explain,	
  have	
  two	
  types	
  of	
  software	
  
releases:	
  
• Database	
  Changes	
  
• Code	
  Changes
47
Copyright	
  ©	
  2015	
  Oracle	
  and/or	
  its	
  affiliates.	
  All	
  rights	
  reserved.	
  	
  |
When	
  to	
  add	
  that	
  column?	
  (cont.)
• Can	
  also	
  be	
  handled	
  as	
  push	
  prerequisites	
  or	
  post-­‐
requisites.	
  
• Adds	
  to	
  complexity.	
  
• Release	
  steps	
  should	
  not	
  boil	
  the	
  ocean	
  -­‐	
  hard	
  to	
  keep	
  
simple	
  and	
  automated.
48
Copyright	
  ©	
  2015	
  Oracle	
  and/or	
  its	
  affiliates.	
  All	
  rights	
  reserved.	
  	
  |
Out	
  of	
  Scope	
  Today
• Almost	
  starts	
  discussion	
  on	
  
how	
  to	
  refactor	
  databases	
  
• This	
  is	
  a	
  good	
  book	
  
• Not	
  MySQL	
  specific
49
Copyright	
  ©	
  2015	
  Oracle	
  and/or	
  its	
  affiliates.	
  All	
  rights	
  reserved.	
  	
  |
50
Today’s	
  Agenda
Introduction	
  
Tools	
  
Bootstrapping	
  
Pushing	
  Database	
  Changes	
  
Metrics	
  to	
  Capture
2
3
4
1
55
Copyright	
  ©	
  2015	
  Oracle	
  and/or	
  its	
  affiliates.	
  All	
  rights	
  reserved.	
  	
  |
“Bad”	
  Things
• Not	
  always	
  likely	
  to	
  catch	
  slow	
  queries	
  in	
  QA	
  while	
  tests	
  
execute.	
  
• Data	
  set	
  can	
  not	
  always	
  reflect	
  production.	
  
• May	
  be	
  able	
  to	
  catch	
  symptoms.
51
Copyright	
  ©	
  2015	
  Oracle	
  and/or	
  its	
  affiliates.	
  All	
  rights	
  reserved.	
  	
  |
Symptoms
• SHOW	
  GLOBAL	
  STATUS	
  LIKE	
  'Select_full_join';	
  
• Slow	
  queries	
  
• Unhandled	
  errors	
  or	
  warnings	
  
• In	
  non-­‐strict	
  versions	
  of	
  MySQL	
  “warnings”	
  are	
  
probably	
  “bugs”.	
  
• Not	
  recommended	
  to	
  use	
  deprecated	
  features	
  from	
  
Day	
  #1.
52
Copyright	
  ©	
  2015	
  Oracle	
  and/or	
  its	
  affiliates.	
  All	
  rights	
  reserved.	
  	
  |
Test	
  suite	
  execution	
  stats
• SYS	
  schema	
  with	
  MySQL	
  is	
  very	
  useful.	
  
• SQL	
  Interface	
  to	
  fetch	
  runtime	
  data	
  directly.
53
Copyright	
  ©	
  2015	
  Oracle	
  and/or	
  its	
  affiliates.	
  All	
  rights	
  reserved.	
  	
  |
Slow	
  Queries
54
mysql> select * from statement_analysisG

*************************** 1. row ***************************

query: SELECT `sys` . `format_stateme ... cy` , `sys` . `format_time` (

db: sys

full_scan: *

exec_count: 4

err_count: 0

warn_count: 0

total_latency: 100.45 ms

max_latency: 30.83 ms

avg_latency: 25.11 ms

lock_latency: 1.59 ms

rows_sent: 683

rows_sent_avg: 171

rows_examined: 1367

rows_examined_avg: 342

rows_affected: 0

rows_affected_avg: 0

tmp_tables: 0

tmp_disk_tables: 0

rows_sorted: 683

sort_merge_passes: 0

digest: 0efbdc5d2727eea1b943011cde39e375

first_seen: 2015-02-20 07:53:52

last_seen: 2015-02-20 07:54:10
Copyright	
  ©	
  2015	
  Oracle	
  and/or	
  its	
  affiliates.	
  All	
  rights	
  reserved.	
  	
  |
Runtime	
  Stats
mysql> select * from wait_classes_global_by_latency;

+-------------------+--------------+---------------+-------------+-------------+-------------+

| event_class | total_events | total_latency | min_latency | avg_latency | max_latency |

+-------------------+--------------+---------------+-------------+-------------+-------------+

| wait/io/file | 550470 | 46.01 s | 19.44 ns | 83.58 µs | 4.21 s |

| wait/io/socket | 228833 | 2.71 s | 0 ps | 11.86 µs | 29.93 ms |

| wait/io/table | 64063 | 1.89 s | 99.79 ns | 29.43 µs | 68.07 ms |

| wait/lock/table | 76029 | 47.19 ms | 65.45 ns | 620.74 ns | 969.88 µs |

| wait/synch/mutex | 635925 | 34.93 ms | 19.44 ns | 54.93 ns | 107.70 µs |

| wait/synch/rwlock | 61287 | 7.62 ms | 21.38 ns | 124.37 ns | 34.65 µs |

+-------------------+--------------+---------------+-------------+-------------+-------------+
55
Copyright	
  ©	
  2015	
  Oracle	
  and/or	
  its	
  affiliates.	
  All	
  rights	
  reserved.	
  	
  |
56
Using MySQL in Automated Testing

Contenu connexe

Tendances

MySQL Cloud Service Deep Dive
MySQL Cloud Service Deep DiveMySQL Cloud Service Deep Dive
MySQL Cloud Service Deep DiveMorgan Tocker
 
20171104 hk-py con-mysql-documentstore_v1
20171104 hk-py con-mysql-documentstore_v120171104 hk-py con-mysql-documentstore_v1
20171104 hk-py con-mysql-documentstore_v1Ivan Ma
 
Proxysql use case scenarios fosdem17
Proxysql use case scenarios    fosdem17Proxysql use case scenarios    fosdem17
Proxysql use case scenarios fosdem17Alkin Tezuysal
 
Mysql 57-upcoming-changes
Mysql 57-upcoming-changesMysql 57-upcoming-changes
Mysql 57-upcoming-changesMorgan Tocker
 
MySQL High Availability Solutions
MySQL High Availability SolutionsMySQL High Availability Solutions
MySQL High Availability SolutionsMydbops
 
Scaling MySQL using Fabric
Scaling MySQL using FabricScaling MySQL using Fabric
Scaling MySQL using FabricKarthik .P.R
 
Tips to drive maria db cluster performance for nextcloud
Tips to drive maria db cluster performance for nextcloudTips to drive maria db cluster performance for nextcloud
Tips to drive maria db cluster performance for nextcloudSeveralnines
 
The InnoDB Storage Engine for MySQL
The InnoDB Storage Engine for MySQLThe InnoDB Storage Engine for MySQL
The InnoDB Storage Engine for MySQLMorgan Tocker
 
Modern MySQL Monitoring and Dashboards.
Modern MySQL Monitoring and Dashboards.Modern MySQL Monitoring and Dashboards.
Modern MySQL Monitoring and Dashboards.Mydbops
 
How to upgrade like a boss to MySQL 8.0 - PLE19
How to upgrade like a boss to MySQL 8.0 -  PLE19How to upgrade like a boss to MySQL 8.0 -  PLE19
How to upgrade like a boss to MySQL 8.0 - PLE19Alkin Tezuysal
 
Mysql User Camp : 20-June-14 : Mysql Fabric
Mysql User Camp : 20-June-14 : Mysql FabricMysql User Camp : 20-June-14 : Mysql Fabric
Mysql User Camp : 20-June-14 : Mysql FabricMysql User Camp
 
Upgrade to MySQL 5.6 without downtime
Upgrade to MySQL 5.6 without downtimeUpgrade to MySQL 5.6 without downtime
Upgrade to MySQL 5.6 without downtimeOlivier DASINI
 
Upgrade to MySQL 5.7 and latest news planned for MySQL 8
Upgrade to MySQL 5.7 and latest news planned for MySQL 8Upgrade to MySQL 5.7 and latest news planned for MySQL 8
Upgrade to MySQL 5.7 and latest news planned for MySQL 8Ted Wennmark
 
How to upgrade like a boss to my sql 8.0?
How to upgrade like a boss to my sql 8.0?How to upgrade like a boss to my sql 8.0?
How to upgrade like a boss to my sql 8.0?Alkin Tezuysal
 
MariaDB Galera Cluster
MariaDB Galera ClusterMariaDB Galera Cluster
MariaDB Galera ClusterAbdul Manaf
 
InnoDB Tablespace Encryption
InnoDB Tablespace Encryption InnoDB Tablespace Encryption
InnoDB Tablespace Encryption Satya Bodapati
 
MySQL High Availability Solutions
MySQL High Availability SolutionsMySQL High Availability Solutions
MySQL High Availability SolutionsLenz Grimmer
 
Mysql User Camp : 20th June - Mysql New Features
Mysql User Camp : 20th June - Mysql New FeaturesMysql User Camp : 20th June - Mysql New Features
Mysql User Camp : 20th June - Mysql New FeaturesTarique Saleem
 
MySQL 5.7 NEW FEATURES, BETTER PERFORMANCE, AND THINGS THAT WILL BREAK -- Mid...
MySQL 5.7 NEW FEATURES, BETTER PERFORMANCE, AND THINGS THAT WILL BREAK -- Mid...MySQL 5.7 NEW FEATURES, BETTER PERFORMANCE, AND THINGS THAT WILL BREAK -- Mid...
MySQL 5.7 NEW FEATURES, BETTER PERFORMANCE, AND THINGS THAT WILL BREAK -- Mid...Dave Stokes
 
MySQL Performance Tuning at COSCUP 2014
MySQL Performance Tuning at COSCUP 2014MySQL Performance Tuning at COSCUP 2014
MySQL Performance Tuning at COSCUP 2014Ryusuke Kajiyama
 

Tendances (20)

MySQL Cloud Service Deep Dive
MySQL Cloud Service Deep DiveMySQL Cloud Service Deep Dive
MySQL Cloud Service Deep Dive
 
20171104 hk-py con-mysql-documentstore_v1
20171104 hk-py con-mysql-documentstore_v120171104 hk-py con-mysql-documentstore_v1
20171104 hk-py con-mysql-documentstore_v1
 
Proxysql use case scenarios fosdem17
Proxysql use case scenarios    fosdem17Proxysql use case scenarios    fosdem17
Proxysql use case scenarios fosdem17
 
Mysql 57-upcoming-changes
Mysql 57-upcoming-changesMysql 57-upcoming-changes
Mysql 57-upcoming-changes
 
MySQL High Availability Solutions
MySQL High Availability SolutionsMySQL High Availability Solutions
MySQL High Availability Solutions
 
Scaling MySQL using Fabric
Scaling MySQL using FabricScaling MySQL using Fabric
Scaling MySQL using Fabric
 
Tips to drive maria db cluster performance for nextcloud
Tips to drive maria db cluster performance for nextcloudTips to drive maria db cluster performance for nextcloud
Tips to drive maria db cluster performance for nextcloud
 
The InnoDB Storage Engine for MySQL
The InnoDB Storage Engine for MySQLThe InnoDB Storage Engine for MySQL
The InnoDB Storage Engine for MySQL
 
Modern MySQL Monitoring and Dashboards.
Modern MySQL Monitoring and Dashboards.Modern MySQL Monitoring and Dashboards.
Modern MySQL Monitoring and Dashboards.
 
How to upgrade like a boss to MySQL 8.0 - PLE19
How to upgrade like a boss to MySQL 8.0 -  PLE19How to upgrade like a boss to MySQL 8.0 -  PLE19
How to upgrade like a boss to MySQL 8.0 - PLE19
 
Mysql User Camp : 20-June-14 : Mysql Fabric
Mysql User Camp : 20-June-14 : Mysql FabricMysql User Camp : 20-June-14 : Mysql Fabric
Mysql User Camp : 20-June-14 : Mysql Fabric
 
Upgrade to MySQL 5.6 without downtime
Upgrade to MySQL 5.6 without downtimeUpgrade to MySQL 5.6 without downtime
Upgrade to MySQL 5.6 without downtime
 
Upgrade to MySQL 5.7 and latest news planned for MySQL 8
Upgrade to MySQL 5.7 and latest news planned for MySQL 8Upgrade to MySQL 5.7 and latest news planned for MySQL 8
Upgrade to MySQL 5.7 and latest news planned for MySQL 8
 
How to upgrade like a boss to my sql 8.0?
How to upgrade like a boss to my sql 8.0?How to upgrade like a boss to my sql 8.0?
How to upgrade like a boss to my sql 8.0?
 
MariaDB Galera Cluster
MariaDB Galera ClusterMariaDB Galera Cluster
MariaDB Galera Cluster
 
InnoDB Tablespace Encryption
InnoDB Tablespace Encryption InnoDB Tablespace Encryption
InnoDB Tablespace Encryption
 
MySQL High Availability Solutions
MySQL High Availability SolutionsMySQL High Availability Solutions
MySQL High Availability Solutions
 
Mysql User Camp : 20th June - Mysql New Features
Mysql User Camp : 20th June - Mysql New FeaturesMysql User Camp : 20th June - Mysql New Features
Mysql User Camp : 20th June - Mysql New Features
 
MySQL 5.7 NEW FEATURES, BETTER PERFORMANCE, AND THINGS THAT WILL BREAK -- Mid...
MySQL 5.7 NEW FEATURES, BETTER PERFORMANCE, AND THINGS THAT WILL BREAK -- Mid...MySQL 5.7 NEW FEATURES, BETTER PERFORMANCE, AND THINGS THAT WILL BREAK -- Mid...
MySQL 5.7 NEW FEATURES, BETTER PERFORMANCE, AND THINGS THAT WILL BREAK -- Mid...
 
MySQL Performance Tuning at COSCUP 2014
MySQL Performance Tuning at COSCUP 2014MySQL Performance Tuning at COSCUP 2014
MySQL Performance Tuning at COSCUP 2014
 

En vedette

MySQL Server Defaults
MySQL Server DefaultsMySQL Server Defaults
MySQL Server DefaultsMorgan Tocker
 
My sql 5.7-upcoming-changes-v2
My sql 5.7-upcoming-changes-v2My sql 5.7-upcoming-changes-v2
My sql 5.7-upcoming-changes-v2Morgan Tocker
 
Application Diagnosis with Zend Server Tracing
Application Diagnosis with Zend Server TracingApplication Diagnosis with Zend Server Tracing
Application Diagnosis with Zend Server TracingZendCon
 
Framework Shootout
Framework ShootoutFramework Shootout
Framework ShootoutZendCon
 
PHP and Platform Independance in the Cloud
PHP and Platform Independance in the CloudPHP and Platform Independance in the Cloud
PHP and Platform Independance in the CloudZendCon
 
MySQL Tech Tour 2015 - 5.7 Connector/J/Net
MySQL Tech Tour 2015 - 5.7 Connector/J/NetMySQL Tech Tour 2015 - 5.7 Connector/J/Net
MySQL Tech Tour 2015 - 5.7 Connector/J/NetMark Swarbrick
 
MySQL Optimizer Overview
MySQL Optimizer OverviewMySQL Optimizer Overview
MySQL Optimizer OverviewOlav Sandstå
 
Solving the C20K problem: Raising the bar in PHP Performance and Scalability
Solving the C20K problem: Raising the bar in PHP Performance and ScalabilitySolving the C20K problem: Raising the bar in PHP Performance and Scalability
Solving the C20K problem: Raising the bar in PHP Performance and ScalabilityZendCon
 
A Storage Story #ChefConf2013
A Storage Story #ChefConf2013A Storage Story #ChefConf2013
A Storage Story #ChefConf2013Kyle Bader
 
Zend_Tool: Practical use and Extending
Zend_Tool: Practical use and ExtendingZend_Tool: Practical use and Extending
Zend_Tool: Practical use and ExtendingZendCon
 
PHP on Windows - What's New
PHP on Windows - What's NewPHP on Windows - What's New
PHP on Windows - What's NewZendCon
 
Why MySQL High Availability Matters
Why MySQL High Availability MattersWhy MySQL High Availability Matters
Why MySQL High Availability MattersMark Swarbrick
 
MySQL Manchester TT - Replication Features
MySQL Manchester TT  - Replication FeaturesMySQL Manchester TT  - Replication Features
MySQL Manchester TT - Replication FeaturesMark Swarbrick
 
Tiery Eyed
Tiery EyedTiery Eyed
Tiery EyedZendCon
 
MySQL Manchester TT - 5.7 Whats new
MySQL Manchester TT - 5.7 Whats newMySQL Manchester TT - 5.7 Whats new
MySQL Manchester TT - 5.7 Whats newMark Swarbrick
 
Zend Core on IBM i - Security Considerations
Zend Core on IBM i - Security ConsiderationsZend Core on IBM i - Security Considerations
Zend Core on IBM i - Security ConsiderationsZendCon
 
Oracle cloud 使用云市场快速搭建小型电商网站
Oracle cloud 使用云市场快速搭建小型电商网站Oracle cloud 使用云市场快速搭建小型电商网站
Oracle cloud 使用云市场快速搭建小型电商网站Zhaoyang Wang
 

En vedette (20)

MySQL 5.7 + JSON
MySQL 5.7 + JSONMySQL 5.7 + JSON
MySQL 5.7 + JSON
 
MySQL Server Defaults
MySQL Server DefaultsMySQL Server Defaults
MySQL Server Defaults
 
Optimizing MySQL
Optimizing MySQLOptimizing MySQL
Optimizing MySQL
 
My sql 5.7-upcoming-changes-v2
My sql 5.7-upcoming-changes-v2My sql 5.7-upcoming-changes-v2
My sql 5.7-upcoming-changes-v2
 
Application Diagnosis with Zend Server Tracing
Application Diagnosis with Zend Server TracingApplication Diagnosis with Zend Server Tracing
Application Diagnosis with Zend Server Tracing
 
Framework Shootout
Framework ShootoutFramework Shootout
Framework Shootout
 
PHP and Platform Independance in the Cloud
PHP and Platform Independance in the CloudPHP and Platform Independance in the Cloud
PHP and Platform Independance in the Cloud
 
Script it
Script itScript it
Script it
 
MySQL Tech Tour 2015 - 5.7 Connector/J/Net
MySQL Tech Tour 2015 - 5.7 Connector/J/NetMySQL Tech Tour 2015 - 5.7 Connector/J/Net
MySQL Tech Tour 2015 - 5.7 Connector/J/Net
 
MySQL Optimizer Overview
MySQL Optimizer OverviewMySQL Optimizer Overview
MySQL Optimizer Overview
 
Solving the C20K problem: Raising the bar in PHP Performance and Scalability
Solving the C20K problem: Raising the bar in PHP Performance and ScalabilitySolving the C20K problem: Raising the bar in PHP Performance and Scalability
Solving the C20K problem: Raising the bar in PHP Performance and Scalability
 
A Storage Story #ChefConf2013
A Storage Story #ChefConf2013A Storage Story #ChefConf2013
A Storage Story #ChefConf2013
 
Zend_Tool: Practical use and Extending
Zend_Tool: Practical use and ExtendingZend_Tool: Practical use and Extending
Zend_Tool: Practical use and Extending
 
PHP on Windows - What's New
PHP on Windows - What's NewPHP on Windows - What's New
PHP on Windows - What's New
 
Why MySQL High Availability Matters
Why MySQL High Availability MattersWhy MySQL High Availability Matters
Why MySQL High Availability Matters
 
MySQL Manchester TT - Replication Features
MySQL Manchester TT  - Replication FeaturesMySQL Manchester TT  - Replication Features
MySQL Manchester TT - Replication Features
 
Tiery Eyed
Tiery EyedTiery Eyed
Tiery Eyed
 
MySQL Manchester TT - 5.7 Whats new
MySQL Manchester TT - 5.7 Whats newMySQL Manchester TT - 5.7 Whats new
MySQL Manchester TT - 5.7 Whats new
 
Zend Core on IBM i - Security Considerations
Zend Core on IBM i - Security ConsiderationsZend Core on IBM i - Security Considerations
Zend Core on IBM i - Security Considerations
 
Oracle cloud 使用云市场快速搭建小型电商网站
Oracle cloud 使用云市场快速搭建小型电商网站Oracle cloud 使用云市场快速搭建小型电商网站
Oracle cloud 使用云市场快速搭建小型电商网站
 

Similaire à Using MySQL in Automated Testing

Oracle OpenWorld - Getting started with MySQL Cluster
Oracle OpenWorld - Getting started with MySQL ClusterOracle OpenWorld - Getting started with MySQL Cluster
Oracle OpenWorld - Getting started with MySQL ClusterBenedita Paúl Vasconcelos
 
Openfest15 MySQL Plugin Development
Openfest15 MySQL Plugin DevelopmentOpenfest15 MySQL Plugin Development
Openfest15 MySQL Plugin DevelopmentGeorgi Kodinov
 
MySQL 5.7 -- SCaLE Feb 2014
MySQL 5.7 -- SCaLE Feb 2014MySQL 5.7 -- SCaLE Feb 2014
MySQL 5.7 -- SCaLE Feb 2014Dave Stokes
 
MySQL Manchester TT - Performance Tuning
MySQL Manchester TT  - Performance TuningMySQL Manchester TT  - Performance Tuning
MySQL Manchester TT - Performance TuningMark Swarbrick
 
MySQL for Oracle DBAs
MySQL for Oracle DBAsMySQL for Oracle DBAs
MySQL for Oracle DBAsBen Krug
 
Oracle Enterprise Manager for MySQL
Oracle Enterprise Manager for MySQLOracle Enterprise Manager for MySQL
Oracle Enterprise Manager for MySQLMario Beck
 
MySQL Day Paris 2018 - Upgrade from MySQL 5.7 to MySQL 8.0
MySQL Day Paris 2018 - Upgrade from MySQL 5.7 to MySQL 8.0MySQL Day Paris 2018 - Upgrade from MySQL 5.7 to MySQL 8.0
MySQL Day Paris 2018 - Upgrade from MySQL 5.7 to MySQL 8.0Olivier DASINI
 
01 demystifying mysq-lfororacledbaanddeveloperv1
01 demystifying mysq-lfororacledbaanddeveloperv101 demystifying mysq-lfororacledbaanddeveloperv1
01 demystifying mysq-lfororacledbaanddeveloperv1Ivan Ma
 
Upgrading to my sql 8.0
Upgrading to my sql 8.0Upgrading to my sql 8.0
Upgrading to my sql 8.0Ståle Deraas
 
20150110 my sql-performanceschema
20150110 my sql-performanceschema20150110 my sql-performanceschema
20150110 my sql-performanceschemaIvan Ma
 
5 razões estratégicas para usar MySQL
5 razões estratégicas para usar MySQL5 razões estratégicas para usar MySQL
5 razões estratégicas para usar MySQLMySQL Brasil
 
MySQL 5.6, news in 5.7 and our HA options
MySQL 5.6, news in 5.7 and our HA optionsMySQL 5.6, news in 5.7 and our HA options
MySQL 5.6, news in 5.7 and our HA optionsTed Wennmark
 
MySQL Enterprise Portfolio
MySQL Enterprise PortfolioMySQL Enterprise Portfolio
MySQL Enterprise PortfolioAbel Flórez
 
Introduction to MySQL
Introduction to MySQLIntroduction to MySQL
Introduction to MySQLTed Wennmark
 
MySQL The State of the Dolphin - jun15
MySQL The State of the Dolphin - jun15MySQL The State of the Dolphin - jun15
MySQL The State of the Dolphin - jun15MySQL Brasil
 
10 Razões para Usar MySQL em Startups
10 Razões para Usar MySQL em Startups10 Razões para Usar MySQL em Startups
10 Razões para Usar MySQL em StartupsMySQL Brasil
 
OpenSuse 2015: Secure Deployment Changes Coming in MySQL 5.7
OpenSuse 2015: Secure Deployment Changes Coming in MySQL 5.7OpenSuse 2015: Secure Deployment Changes Coming in MySQL 5.7
OpenSuse 2015: Secure Deployment Changes Coming in MySQL 5.7Georgi Kodinov
 
MySQL 5.7: What's New, Nov. 2015
MySQL 5.7: What's New, Nov. 2015MySQL 5.7: What's New, Nov. 2015
MySQL 5.7: What's New, Nov. 2015Mario Beck
 
[db tech showcase Tokyo 2016] E34: Oracle SE - RAC, HA and Standby are Still ...
[db tech showcase Tokyo 2016] E34: Oracle SE - RAC, HA and Standby are Still ...[db tech showcase Tokyo 2016] E34: Oracle SE - RAC, HA and Standby are Still ...
[db tech showcase Tokyo 2016] E34: Oracle SE - RAC, HA and Standby are Still ...Insight Technology, Inc.
 
Alta Disponibilidade no MySQL 5.7
Alta Disponibilidade no MySQL 5.7Alta Disponibilidade no MySQL 5.7
Alta Disponibilidade no MySQL 5.7MySQL Brasil
 

Similaire à Using MySQL in Automated Testing (20)

Oracle OpenWorld - Getting started with MySQL Cluster
Oracle OpenWorld - Getting started with MySQL ClusterOracle OpenWorld - Getting started with MySQL Cluster
Oracle OpenWorld - Getting started with MySQL Cluster
 
Openfest15 MySQL Plugin Development
Openfest15 MySQL Plugin DevelopmentOpenfest15 MySQL Plugin Development
Openfest15 MySQL Plugin Development
 
MySQL 5.7 -- SCaLE Feb 2014
MySQL 5.7 -- SCaLE Feb 2014MySQL 5.7 -- SCaLE Feb 2014
MySQL 5.7 -- SCaLE Feb 2014
 
MySQL Manchester TT - Performance Tuning
MySQL Manchester TT  - Performance TuningMySQL Manchester TT  - Performance Tuning
MySQL Manchester TT - Performance Tuning
 
MySQL for Oracle DBAs
MySQL for Oracle DBAsMySQL for Oracle DBAs
MySQL for Oracle DBAs
 
Oracle Enterprise Manager for MySQL
Oracle Enterprise Manager for MySQLOracle Enterprise Manager for MySQL
Oracle Enterprise Manager for MySQL
 
MySQL Day Paris 2018 - Upgrade from MySQL 5.7 to MySQL 8.0
MySQL Day Paris 2018 - Upgrade from MySQL 5.7 to MySQL 8.0MySQL Day Paris 2018 - Upgrade from MySQL 5.7 to MySQL 8.0
MySQL Day Paris 2018 - Upgrade from MySQL 5.7 to MySQL 8.0
 
01 demystifying mysq-lfororacledbaanddeveloperv1
01 demystifying mysq-lfororacledbaanddeveloperv101 demystifying mysq-lfororacledbaanddeveloperv1
01 demystifying mysq-lfororacledbaanddeveloperv1
 
Upgrading to my sql 8.0
Upgrading to my sql 8.0Upgrading to my sql 8.0
Upgrading to my sql 8.0
 
20150110 my sql-performanceschema
20150110 my sql-performanceschema20150110 my sql-performanceschema
20150110 my sql-performanceschema
 
5 razões estratégicas para usar MySQL
5 razões estratégicas para usar MySQL5 razões estratégicas para usar MySQL
5 razões estratégicas para usar MySQL
 
MySQL 5.6, news in 5.7 and our HA options
MySQL 5.6, news in 5.7 and our HA optionsMySQL 5.6, news in 5.7 and our HA options
MySQL 5.6, news in 5.7 and our HA options
 
MySQL Enterprise Portfolio
MySQL Enterprise PortfolioMySQL Enterprise Portfolio
MySQL Enterprise Portfolio
 
Introduction to MySQL
Introduction to MySQLIntroduction to MySQL
Introduction to MySQL
 
MySQL The State of the Dolphin - jun15
MySQL The State of the Dolphin - jun15MySQL The State of the Dolphin - jun15
MySQL The State of the Dolphin - jun15
 
10 Razões para Usar MySQL em Startups
10 Razões para Usar MySQL em Startups10 Razões para Usar MySQL em Startups
10 Razões para Usar MySQL em Startups
 
OpenSuse 2015: Secure Deployment Changes Coming in MySQL 5.7
OpenSuse 2015: Secure Deployment Changes Coming in MySQL 5.7OpenSuse 2015: Secure Deployment Changes Coming in MySQL 5.7
OpenSuse 2015: Secure Deployment Changes Coming in MySQL 5.7
 
MySQL 5.7: What's New, Nov. 2015
MySQL 5.7: What's New, Nov. 2015MySQL 5.7: What's New, Nov. 2015
MySQL 5.7: What's New, Nov. 2015
 
[db tech showcase Tokyo 2016] E34: Oracle SE - RAC, HA and Standby are Still ...
[db tech showcase Tokyo 2016] E34: Oracle SE - RAC, HA and Standby are Still ...[db tech showcase Tokyo 2016] E34: Oracle SE - RAC, HA and Standby are Still ...
[db tech showcase Tokyo 2016] E34: Oracle SE - RAC, HA and Standby are Still ...
 
Alta Disponibilidade no MySQL 5.7
Alta Disponibilidade no MySQL 5.7Alta Disponibilidade no MySQL 5.7
Alta Disponibilidade no MySQL 5.7
 

Plus de Morgan Tocker

Introducing Spirit - Online Schema Change
Introducing Spirit - Online Schema ChangeIntroducing Spirit - Online Schema Change
Introducing Spirit - Online Schema ChangeMorgan Tocker
 
FOSDEM MySQL and Friends Devroom
FOSDEM MySQL and Friends DevroomFOSDEM MySQL and Friends Devroom
FOSDEM MySQL and Friends DevroomMorgan Tocker
 
Introducing TiDB - Percona Live Frankfurt
Introducing TiDB - Percona Live FrankfurtIntroducing TiDB - Percona Live Frankfurt
Introducing TiDB - Percona Live FrankfurtMorgan Tocker
 
TiDB Introduction - Boston MySQL Meetup Group
TiDB Introduction - Boston MySQL Meetup GroupTiDB Introduction - Boston MySQL Meetup Group
TiDB Introduction - Boston MySQL Meetup GroupMorgan Tocker
 
TiDB Introduction - San Francisco MySQL Meetup
TiDB Introduction - San Francisco MySQL MeetupTiDB Introduction - San Francisco MySQL Meetup
TiDB Introduction - San Francisco MySQL MeetupMorgan Tocker
 
MySQL 8.0 Optimizer Guide
MySQL 8.0 Optimizer GuideMySQL 8.0 Optimizer Guide
MySQL 8.0 Optimizer GuideMorgan Tocker
 
MySQL Query Optimization
MySQL Query OptimizationMySQL Query Optimization
MySQL Query OptimizationMorgan Tocker
 
MySQL For Linux Sysadmins
MySQL For Linux SysadminsMySQL For Linux Sysadmins
MySQL For Linux SysadminsMorgan Tocker
 
MySQL 5.7: Core Server Changes
MySQL 5.7: Core Server ChangesMySQL 5.7: Core Server Changes
MySQL 5.7: Core Server ChangesMorgan Tocker
 
Locking and Concurrency Control
Locking and Concurrency ControlLocking and Concurrency Control
Locking and Concurrency ControlMorgan Tocker
 

Plus de Morgan Tocker (11)

Introducing Spirit - Online Schema Change
Introducing Spirit - Online Schema ChangeIntroducing Spirit - Online Schema Change
Introducing Spirit - Online Schema Change
 
FOSDEM MySQL and Friends Devroom
FOSDEM MySQL and Friends DevroomFOSDEM MySQL and Friends Devroom
FOSDEM MySQL and Friends Devroom
 
Introducing TiDB - Percona Live Frankfurt
Introducing TiDB - Percona Live FrankfurtIntroducing TiDB - Percona Live Frankfurt
Introducing TiDB - Percona Live Frankfurt
 
TiDB Introduction - Boston MySQL Meetup Group
TiDB Introduction - Boston MySQL Meetup GroupTiDB Introduction - Boston MySQL Meetup Group
TiDB Introduction - Boston MySQL Meetup Group
 
TiDB Introduction - San Francisco MySQL Meetup
TiDB Introduction - San Francisco MySQL MeetupTiDB Introduction - San Francisco MySQL Meetup
TiDB Introduction - San Francisco MySQL Meetup
 
TiDB Introduction
TiDB IntroductionTiDB Introduction
TiDB Introduction
 
MySQL 8.0 Optimizer Guide
MySQL 8.0 Optimizer GuideMySQL 8.0 Optimizer Guide
MySQL 8.0 Optimizer Guide
 
MySQL Query Optimization
MySQL Query OptimizationMySQL Query Optimization
MySQL Query Optimization
 
MySQL For Linux Sysadmins
MySQL For Linux SysadminsMySQL For Linux Sysadmins
MySQL For Linux Sysadmins
 
MySQL 5.7: Core Server Changes
MySQL 5.7: Core Server ChangesMySQL 5.7: Core Server Changes
MySQL 5.7: Core Server Changes
 
Locking and Concurrency Control
Locking and Concurrency ControlLocking and Concurrency Control
Locking and Concurrency Control
 

Dernier

5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️anilsa9823
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 

Dernier (20)

5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 

Using MySQL in Automated Testing

  • 1.
  • 2. Copyright  ©  2015  Oracle  and/or  its  affiliates.  All  rights  reserved.    | Using  MySQL  in   Automated  Testing Morgan  Tocker   MySQL  Community  Manager   February  2015
  • 3. Copyright  ©  2014  Oracle  and/or  its  affiliates.  All  rights  reserved.    | Safe  Harbor  Statement The  following  is  intended  to  outline  our  general  product  direction.   It  is  intended  for  information  purposes  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  upon   in  making  purchasing  decisions.  The  development,  release,  and   timing  of  any  features  or  functionality  described  for  Oracle’s   products  remains  at  the  sole  discretion  of  Oracle. 3
  • 4. Copyright  ©  2015  Oracle  and/or  its  affiliates.  All  rights  reserved.    | 4 Today’s  Agenda Introduction   Tools   Bootstrapping   Pushing  Database  Changes   Metrics  to  Capture 1 2 3 4 5
  • 5. Copyright  ©  2015  Oracle  and/or  its  affiliates.  All  rights  reserved.    | Introduction • Database  are  not  an  outlier   • Can  be  automated  /  scripted  /  managed  as  part  of  a   deployment   • Many  good  tools  exist 5
  • 6. Copyright  ©  2015  Oracle  and/or  its  affiliates.  All  rights  reserved.    | History  of  MySQL  specific  versions • MySQL  5.1  and  below:   • No  Online  DDL   • Adding  indexes  to  InnoDB  tables  causes  rebuild   • Supports  triggers  from  5.0  (!) 6
  • 7. Copyright  ©  2015  Oracle  and/or  its  affiliates.  All  rights  reserved.    | History  of  MySQL  specific  versions  (cont.) • MySQL  5.5  (2010):   • InnoDB  as  default   • Fast  ALTER  TABLE 7
  • 8. Copyright  ©  2015  Oracle  and/or  its  affiliates.  All  rights  reserved.    | History  of  MySQL  specific  versions  (cont.) • MySQL  5.6  (2013):   • Online  DDL   • Performance  Schema  by  default 8
  • 9. Copyright  ©  2015  Oracle  and/or  its  affiliates.  All  rights  reserved.    | History  of  MySQL  specific  versions  (cont.) • MySQL  5.7  (In  Development):   • Multiple  triggers  per  table 9
  • 10. Copyright  ©  2015  Oracle  and/or  its  affiliates.  All  rights  reserved.    | Online  DDL  (MySQL  5.6+) • Can  add  indexes,  many  other  changes  without  blocking   READS  or  WRITES:   • http://dev.mysql.com/doc/refman/5.6/en/innodb-­‐ create-­‐index-­‐overview.html   • Still  requires  application  to  handle  two  versions  of   schema.   • Does  not  facilitate  READ/WRITE  split  with  slaves. 10
  • 11. Copyright  ©  2015  Oracle  and/or  its  affiliates.  All  rights  reserved.    | 11 In-Place? Copies Table? Allows Concurrent DML? Allows Concurrent Query? CREATE INDEX,ADD INDEX Yes* No* Yes Yes ADD FULLTEXT INDEX Yes No* No Yes DROP INDEX Yes No Yes Yes OPTIMIZE TABLE Yes Yes Yes Yes Set default value for a column Yes No Yes Yes Change auto-increment value for a column Yes No Yes Yes Add a foreign key constraint Yes* No* Yes Yes Drop a foreign key constraint Yes No Yes Yes Rename a column Yes* No* Yes* Yes Add a column Yes Yes Yes* Yes Drop a column Yes Yes Yes Yes Reorder columns Yes Yes Yes Yes Change ROW_FORMAT property Yes Yes Yes Yes Change KEY_BLOCK_SIZE property Yes Yes Yes Yes Make column NULL Yes Yes Yes Yes Make column NOT NULL Yes* Yes Yes Yes Change data type of column No Yes No Yes Add primary key Yes* Yes Yes Yes Drop primary key and add another Yes Yes Yes Yes Drop primary key No Yes No Yes Convert character set No Yes No Yes Specify character set No Yes No Yes Rebuild with FORCE option No Yes No Yes
  • 12. Copyright  ©  2015  Oracle  and/or  its  affiliates.  All  rights  reserved.    | 12 Today’s  Agenda Introduction     Tools   Bootstrapping   Pushing  Database  Changes   Metrics  to  Capture 2 3 4 2 1 5
  • 13. Copyright  ©  2015  Oracle  and/or  its  affiliates.  All  rights  reserved.    | Worth  Considering • pt-­‐online-­‐schema-­‐change   • MySQL  Sandbox   • SYS   • Outbrain  Propagator   • Liquibase   • ORM  specific  migrations   • libeatmydata 13
  • 14. Copyright  ©  2015  Oracle  and/or  its  affiliates.  All  rights  reserved.    | pt-­‐online-­‐schema-­‐change • Part  of  “Percona  Toolkit”.   • Simulates  Online  DDL  by  creating  a  shadow  table  and   adding  triggers  to  the  original  table.   • Later  performs  a  hot  switchover.   • Useful  for  statements  that  do  not  support  Online  DDL.   • Required  in  substitution  of  Online  DDL  in  the  case  slaves   are  required  for  active  use. 14
  • 15. Copyright  ©  2015  Oracle  and/or  its  affiliates.  All  rights  reserved.    | MySQL  Sandbox • Allows  you  to  run  multiple  copies  at  once,  each  self   contained.   • Can  bootstrap  a  fresh  install  from  a  .tar.gz  of  MySQL.   • Can  bootstrap  common  topologies.   • i.e.  Master  with  a  slave 15
  • 16. Copyright  ©  2015  Oracle  and/or  its  affiliates.  All  rights  reserved.    | SYS • Common  set  of  views  on  MySQL’s  Performance  Schema.   • Entirely  SQL  view  of  all  of  MySQL’s  Performance.   • Could  potentially  problematic  queries  in  QA  during  test   suite  execution,  etc… 16
  • 17. Copyright  ©  2015  Oracle  and/or  its  affiliates.  All  rights  reserved.    | Outbrain  Propagator • Based  on  SQL  Scripts   • Concept  of  Environments 17
  • 18. Copyright  ©  2015  Oracle  and/or  its  affiliates.  All  rights  reserved.    | 18
  • 19. Copyright  ©  2015  Oracle  and/or  its  affiliates.  All  rights  reserved.    | Liquibase • Specify  change  in  XML/Yaml/JSON/SQL 19
  • 20. Copyright  ©  2015  Oracle  and/or  its  affiliates.  All  rights  reserved.    | ORM  Specific • Rails  Migrations   • Django  Migrations  (1.7+) 20
  • 21. Copyright  ©  2015  Oracle  and/or  its  affiliates.  All  rights  reserved.    | libeatmydata • Disables  fsyncs  and  related  functions   • Packaged  in  Ubuntu   • apt-­‐get  install  eatmydata 21 root@mysqldb:/usr/local/mysql# eatmydata ./bin/ mysqld —user=mysql
  • 22. Copyright  ©  2015  Oracle  and/or  its  affiliates.  All  rights  reserved.    | 22 Today’s  Agenda Introduction   Tools   Bootstrapping   Pushing  Database  Changes   Metrics  to  Capture 2 3 4 1 5 3
  • 23. Copyright  ©  2015  Oracle  and/or  its  affiliates.  All  rights  reserved.    | Building  a  new  QA  Environment • Recommend  starting  with  either  MySQL::Sandbox  or   official  repos.   • Can  restore  data  from  mysqldump,  or  copying  data  data   directory  in  place. 23
  • 24. Copyright  ©  2015  Oracle  and/or  its  affiliates.  All  rights  reserved.    | Official  Repos 24 sudo yum localinstall http://dev.mysql.com/get/ mysql-community-release-el6-5.noarch.rpm yum install mysql-community-server • More  Information:   • http://dev.mysql.com/downloads/repo/yum/   • http://dev.mysql.com/downloads/repo/apt/   • http://dev.mysql.com/downloads/repo/suse/
  • 25. Copyright  ©  2015  Oracle  and/or  its  affiliates.  All  rights  reserved.    | MySQL::Sandbox 25 $ make_sandbox mysql-5.6.23-osx10.9-x86_64.tar.gz unpacking /Users/morgo/Downloads/mysql-5.6.23-osx10.9-x86_64.tar.gz Executing low_level_make_sandbox --basedir=/Users/morgo/Downloads/ 5.6.23 --sandbox_directory=msb_5_6_23 --install_version=5.6 --sandbox_port=5623 --no_ver_after_name --my_clause=log-error=msandbox.err The MySQL Sandbox, version 3.0.47 (C) 2006-2013 Giuseppe Maxia installing with the following parameters: upper_directory = /Users/morgo/sandboxes sandbox_directory = msb_5_6_23 sandbox_port = 5623 .. do you agree? ([Y],n) Y loading grants .. sandbox server started Your sandbox server was installed in $HOME/sandboxes/msb_5_6_23
  • 26. Copyright  ©  2015  Oracle  and/or  its  affiliates.  All  rights  reserved.    | My  Local  Sandboxes 26 morgo@Rbook:~/sandboxes$ ls clear_all msb_5_5_40 msb_5_6_15 msb_5_6_22 msb_5_7_3 msb_5_7_5.bak sandbox_action status_all msb_5_5_32 msb_5_6_12 msb_5_6_16 msb_5_6_23 msb_5_7_4 plugin.conf send_kill_all stop_all msb_5_5_36 msb_5_6_13 msb_5_6_17 msb_5_7_1 msb_5_7_5 restart_all start_all use_all morgo@Rbook:~/sandboxes$ cd msb_5_6_23 morgo@Rbook:~/sandboxes/msb_5_6_23$ ./use Welcome to the MySQL monitor. Commands end with ; or g. Your MySQL connection id is 3 Server version: 5.6.23 MySQL Community Server (GPL) .. Type 'help;' or 'h' for help. Type 'c' to clear the current input statement. mysql [localhost] {msandbox} ((none)) > Version  5.6.23   =  Port  5623
  • 27. Copyright  ©  2015  Oracle  and/or  its  affiliates.  All  rights  reserved.    | Restoring  Data • Some  testing  environments  (i.e.  staging)  may  have  a   snapshot  of  actual  data.   • This  is  actually  a  very  good  practice  if  your  data   security  policy  allows  for  it.   • Ensures  highest  chance  of  same  performance   characteristics  as  production. 27
  • 28. Copyright  ©  2015  Oracle  and/or  its  affiliates.  All  rights  reserved.    | Restoring  Data  (cont.) • mysqldump  can  be  very  slow  to  load  data  into  your   newly  setup  environment.   • Consider  copying  data  directory  in  raw  format  instead. 28
  • 29. Copyright  ©  2015  Oracle  and/or  its  affiliates.  All  rights  reserved.    | How  to  Configure  MySQL  in  QA? • It’s  up  to  you!   • For  CI  rule  of  thumb  says  that  the  test  suite  should   execute  in  less  than  5  minutes. 29
  • 30. Copyright  ©  2015  Oracle  and/or  its  affiliates.  All  rights  reserved.    | Alternative  #1  -­‐  mysql-­‐reckless.cnf • Disable  MySQL’s  durability:   • Warning:  Not  100%  a  best  practice. 30 sync_frm=0 sync_binlog=0 innodb-flush-log-at-trx-commit=0 innodb-doublewrite=0 innodb_support_xa=0 innodb_checksum_algorithm=none innodb_adaptive_flushing=OFF Source:  https://github.com/morgo/mysql-­‐compatibility-­‐config/blob/master/mysql-­‐56/mysql-­‐56-­‐reckless.cnf  
  • 31. Copyright  ©  2015  Oracle  and/or  its  affiliates.  All  rights  reserved.    | Alternative  #2  -­‐  Disable  fsync  and  friends • At  a  lower  level,  kill  durability.   • Keeps  MySQL  functionality  consistent  between  QA  and   Production.   • Possibly  requires  Linux. 31 root@mysqldb:/usr/local/mysql# eatmydata ./bin/ mysqld —user=mysql
  • 32. Copyright  ©  2015  Oracle  and/or  its  affiliates.  All  rights  reserved.    | 32 Today’s  Agenda Introduction   Tools   Bootstrapping   Pushing  Database  Changes   Metrics  to  Capture 2 3 4 1 5 4
  • 33. Copyright  ©  2015  Oracle  and/or  its  affiliates.  All  rights  reserved.    | Two  Categories  of  Change • Data  Definition  Language   • aka  DDL   • Adding/Dropping  Indexes   • Adding/Dropping  Columns   • ..   • Data  manipulation  language   • aka  DML   • One  off  tasks  to  modify   data     • Repairing  incorrect  values   • .. 33
  • 34. Copyright  ©  2015  Oracle  and/or  its  affiliates.  All  rights  reserved.    | DDL  Considerations • DDL  does  not  support  transactions   • Is  still  atomic  on  a  per-­‐table  basis   • Grouping  multiple  tables  may  complicate  deployment: 34 ALTER TABLE t1 ADD INDEX (a); ALTER TABLE t2 ADD INDEX (a); // t2 fails ALTER TABLE t3 ADD INDEX (a);
  • 35. Copyright  ©  2015  Oracle  and/or  its  affiliates.  All  rights  reserved.    | DDL  Considerations  (cont.) • Good  practice  to  group  all  changes  for  one  table  to   single  chained  ALTER  command.   • Saves  on  table  rebuilds  where  required: 35 ALTER TABLE my_table ADD my_column1 VARCHAR(255), ADD my_column2 VARCHAR(255);
  • 36. Copyright  ©  2015  Oracle  and/or  its  affiliates.  All  rights  reserved.    | DDL  Considerations  (cont.) • Don’t  play  a  guessing  game  with  Online  DDL.   • ALTER  TABLE  supports  LOCK=NONE  extension: 36 CREATE TABLE acdc (a int); ALTER TABLE acdc ADD PRIMARY KEY (a), LOCK=NONE; Query OK, 0 rows affected (0.29 sec) Records: 0 Duplicates: 0 Warnings: 0 ALTER TABLE acdc DROP PRIMARY KEY, LOCK=NONE; ERROR 1846 (0A000): LOCK=NONE is not supported. Reason: Dropping a primary key is not allowed without also adding a new primary key. Try LOCK=SHARED.
  • 37. Copyright  ©  2015  Oracle  and/or  its  affiliates.  All  rights  reserved.    | DDL  Considerations  (cont.) • Any  time  you  change  indexes:   • Existing  query  plans  can  change   • Diligent  DBAs  watch  for  regressions  :) 37
  • 38. Copyright  ©  2015  Oracle  and/or  its  affiliates.  All  rights  reserved.    | DML  Example • Added  a  new  column  called  is_paying_user  on  users   table.   • New  code  correctly  sets  is_paying_user  to  0  or  1.   • All  5M  existing  users  will  need  the  is_paying_user   property  set. 38
  • 39. Copyright  ©  2015  Oracle  and/or  its  affiliates.  All  rights  reserved.    | DML  Considerations • SQL  is  not  guaranteed  idempotent   • Best  to  make  sure  that  any  script  fails  or  does  nothing  if   executed  twice. 39 UPDATE t SET a = a+1; // potentially bad. UPDATE t SET a = 11; // better UPDATE t SET a = 11 WHERE a = 10; // safest
  • 40. Copyright  ©  2015  Oracle  and/or  its  affiliates.  All  rights  reserved.    | DML  Considerations  (cont.) • Modifications  via  temporary  tables  are  unsafe  for   Statement-­‐based  replication: 40 CREATE TEMPORARY TABLE tmp_user_payments AS SELECT DISTINCT(user_id) as user_id FROM payments WHERE payment_total > 0; /* Slave can disconnect here and lose tmp table */ UPDATE users, tmp_user_payments SET is_paying_user=1 WHERE user tmp_user_payments.user_id=users.user_id;
  • 41. Copyright  ©  2015  Oracle  and/or  its  affiliates.  All  rights  reserved.    | Suggested  Fixes: • Use  Row-­‐Based  replication  (proposed  default  in  5.7)   • Use  base  table  instead  of  temporary  table.   • Perform  change  in  single  step,  such  as  via  sub  query   (really  requires  5.6+) 41
  • 42. Copyright  ©  2015  Oracle  and/or  its  affiliates.  All  rights  reserved.    | DML  Considerations  (cont.) • Locks  are  held  for  the  duration  of  a  transaction   • Scripts  that  appear  safe  in  QA  may  still  create   production  problems   • Common  practice  to  chunk-­‐split  batch  operations  to   yield  locks  (i.e.  10K  row  modifications  per  transaction.)   • Not  strictly  ACID  :) 42
  • 43. Copyright  ©  2015  Oracle  and/or  its  affiliates.  All  rights  reserved.    | Distributed  Systems • i.e.  Sharded  of  Functional  Partitioned  Deployments   • Presents  special  challenges   • Application  typically  must  talk  to  two  versions  of  a   schema  at  once.   • Requirement  still  true  for  non  distributed  systems… 43
  • 44. Copyright  ©  2015  Oracle  and/or  its  affiliates.  All  rights  reserved.    | Why  two  versions  of  a  Schema? • Even  when  DDL  is  online,  can’t  control  when  it  finishes   and  new  schema  is  immediately  visible  to  application.   • Guaranteed  safe  way:   • Stop  old  version  of  Application   • Apply  Database  Changes   • Start  new  version  of  Application 44  Painful
  • 45. Copyright  ©  2015  Oracle  and/or  its  affiliates.  All  rights  reserved.    | Examples  of  Incompatibilities • Renaming  a  column   • $row[4];  //  Using  nth  column.    Can’t  guarantee  new  column  preserves  order.   • INSERT  into  my_table  VALUES  (1,2,3);  //  Non-­‐full  inserts  if  column   count  changes   • SELECT  *  FROM  a  UNION  SELECT  *  FROM  b;  //  Column  count   mismatch  if  a  adds  a  column   • INSERT  INTO  a  SELECT  *  FROM  b  //  Column  count  mismatch  if  a  adds   a  column 45
  • 46. Copyright  ©  2015  Oracle  and/or  its  affiliates.  All  rights  reserved.    | How  to  make  an  application  speak  two   schemas? • Introduce  Social  Change   • Developers  will  not  always  consider  deployment   issues   • Easy  way  to  force  them  is  to  make  database  changes   separate  from  other  changes 46
  • 47. Copyright  ©  2015  Oracle  and/or  its  affiliates.  All  rights  reserved.    | When  to  add  that  column? • Make  the  change  happen  in  the  release  before.   • If  it’s  easier  to  explain,  have  two  types  of  software   releases:   • Database  Changes   • Code  Changes 47
  • 48. Copyright  ©  2015  Oracle  and/or  its  affiliates.  All  rights  reserved.    | When  to  add  that  column?  (cont.) • Can  also  be  handled  as  push  prerequisites  or  post-­‐ requisites.   • Adds  to  complexity.   • Release  steps  should  not  boil  the  ocean  -­‐  hard  to  keep   simple  and  automated. 48
  • 49. Copyright  ©  2015  Oracle  and/or  its  affiliates.  All  rights  reserved.    | Out  of  Scope  Today • Almost  starts  discussion  on   how  to  refactor  databases   • This  is  a  good  book   • Not  MySQL  specific 49
  • 50. Copyright  ©  2015  Oracle  and/or  its  affiliates.  All  rights  reserved.    | 50 Today’s  Agenda Introduction   Tools   Bootstrapping   Pushing  Database  Changes   Metrics  to  Capture 2 3 4 1 55
  • 51. Copyright  ©  2015  Oracle  and/or  its  affiliates.  All  rights  reserved.    | “Bad”  Things • Not  always  likely  to  catch  slow  queries  in  QA  while  tests   execute.   • Data  set  can  not  always  reflect  production.   • May  be  able  to  catch  symptoms. 51
  • 52. Copyright  ©  2015  Oracle  and/or  its  affiliates.  All  rights  reserved.    | Symptoms • SHOW  GLOBAL  STATUS  LIKE  'Select_full_join';   • Slow  queries   • Unhandled  errors  or  warnings   • In  non-­‐strict  versions  of  MySQL  “warnings”  are   probably  “bugs”.   • Not  recommended  to  use  deprecated  features  from   Day  #1. 52
  • 53. Copyright  ©  2015  Oracle  and/or  its  affiliates.  All  rights  reserved.    | Test  suite  execution  stats • SYS  schema  with  MySQL  is  very  useful.   • SQL  Interface  to  fetch  runtime  data  directly. 53
  • 54. Copyright  ©  2015  Oracle  and/or  its  affiliates.  All  rights  reserved.    | Slow  Queries 54 mysql> select * from statement_analysisG
 *************************** 1. row ***************************
 query: SELECT `sys` . `format_stateme ... cy` , `sys` . `format_time` (
 db: sys
 full_scan: *
 exec_count: 4
 err_count: 0
 warn_count: 0
 total_latency: 100.45 ms
 max_latency: 30.83 ms
 avg_latency: 25.11 ms
 lock_latency: 1.59 ms
 rows_sent: 683
 rows_sent_avg: 171
 rows_examined: 1367
 rows_examined_avg: 342
 rows_affected: 0
 rows_affected_avg: 0
 tmp_tables: 0
 tmp_disk_tables: 0
 rows_sorted: 683
 sort_merge_passes: 0
 digest: 0efbdc5d2727eea1b943011cde39e375
 first_seen: 2015-02-20 07:53:52
 last_seen: 2015-02-20 07:54:10
  • 55. Copyright  ©  2015  Oracle  and/or  its  affiliates.  All  rights  reserved.    | Runtime  Stats mysql> select * from wait_classes_global_by_latency;
 +-------------------+--------------+---------------+-------------+-------------+-------------+
 | event_class | total_events | total_latency | min_latency | avg_latency | max_latency |
 +-------------------+--------------+---------------+-------------+-------------+-------------+
 | wait/io/file | 550470 | 46.01 s | 19.44 ns | 83.58 µs | 4.21 s |
 | wait/io/socket | 228833 | 2.71 s | 0 ps | 11.86 µs | 29.93 ms |
 | wait/io/table | 64063 | 1.89 s | 99.79 ns | 29.43 µs | 68.07 ms |
 | wait/lock/table | 76029 | 47.19 ms | 65.45 ns | 620.74 ns | 969.88 µs |
 | wait/synch/mutex | 635925 | 34.93 ms | 19.44 ns | 54.93 ns | 107.70 µs |
 | wait/synch/rwlock | 61287 | 7.62 ms | 21.38 ns | 124.37 ns | 34.65 µs |
 +-------------------+--------------+---------------+-------------+-------------+-------------+ 55
  • 56. Copyright  ©  2015  Oracle  and/or  its  affiliates.  All  rights  reserved.    | 56