Testing early mysql releases in a sandbox

61
Test early MySQL versions in a sandbox Giuseppe Maxia QA Director, Continuent, Inc Oracle ACE Director for MySQL 1 Wednesday, March 21, 12

description

Testing early versions of MySQL 5.6 using MySQL Sandbox.

Transcript of Testing early mysql releases in a sandbox

Page 1: Testing early mysql releases in a sandbox

Test early MySQL versions in a sandboxGiuseppe Maxia

QA Director, Continuent, Inc

Oracle ACE Director for MySQL

1Wednesday, March 21, 12

Page 2: Testing early mysql releases in a sandbox

about me - Giuseppe Maxia• a.k.a. The Data Charmer• QA Director at Continuent, Inc• Long time hacking with MySQL features• Formerly, community manager,db consultant, designer,

coder.• A passion for QA and open source• Blogger

•http://datacharmer.blogspot.com

Wednesday, March 21, 12

Page 3: Testing early mysql releases in a sandbox

MySQL Sandbox lightning

presentation

Wednesday, March 21, 12

Page 4: Testing early mysql releases in a sandbox

I used to install a lot of MySQL databases for

testing

MANUALLY

Wednesday, March 21, 12

Page 5: Testing early mysql releases in a sandbox

Then, I decided to use Perl ...

Wednesday, March 21, 12

Page 6: Testing early mysql releases in a sandbox

DBA pop quiz

Wednesday, March 21, 12

Page 7: Testing early mysql releases in a sandbox

HOW MANY KEYSTROKES to install a MySQL server?

Wednesday, March 21, 12

Page 8: Testing early mysql releases in a sandbox

HOW MANY KEYSTROKES to install a MySQL server?

10sb 5.0.831234567890

Wednesday, March 21, 12

Page 9: Testing early mysql releases in a sandbox

HOW MANY KEYSTROKES to install 3 MySQL servers

in replication?

Wednesday, March 21, 12

Page 10: Testing early mysql releases in a sandbox

HOW MANY KEYSTROKES to install 3 MySQL servers

in replication?

11sb r5.0.8312345678901

Wednesday, March 21, 12

Page 11: Testing early mysql releases in a sandbox

HOW LONG does it take

to install a MySQL server?

Wednesday, March 21, 12

Page 12: Testing early mysql releases in a sandbox

HOW LONG does it take

to install a MySQL server?

< 5 secondstime sb 5.0.83

0m1.518sWednesday, March 21, 12

Page 13: Testing early mysql releases in a sandbox

HOW LONG does it take

to install 3 MySQL servers in replication?

Wednesday, March 21, 12

Page 14: Testing early mysql releases in a sandbox

HOW LONG does it take

to install 3 MySQL servers in replication?

< 10 secondssb 5.0.830m4.515s

Wednesday, March 21, 12

Page 15: Testing early mysql releases in a sandbox

MySQL Sandbox

• Free software (Perl under GPL)

• One (unix) host

• Many database servers

• Single or multiple sandboxes

• Customized scripts to use the servers

• Standard or circular replication

• Installs IN SECONDS

http://mysqlsandbox.net

Wednesday, March 21, 12

Page 16: Testing early mysql releases in a sandbox

overview

MySQLserver

MySQLserver

Data DB1

DB2 DB3

Data DB1

DB2 DB3DATA DIRECTORY

PORT

SOCKET

Wednesday, March 21, 12

Page 17: Testing early mysql releases in a sandbox

overview

MySQLserver

MySQLserver

Data DB1

DB2 DB3

Data DB1

DB2 DB3

SAME DATA

DIRECTORY?

DATA CORRUPTION

/var/lib/mysql /var/lib/mysql

Wednesday, March 21, 12

Page 18: Testing early mysql releases in a sandbox

overview

MySQLserver

MySQLserver

SAME PORT or SOCKET?

DOES NOT START

/tmp/mysql.sock /tmp/mysql.sock

33063306

Wednesday, March 21, 12

Page 19: Testing early mysql releases in a sandbox

The hard way

Wednesday, March 21, 12

Page 20: Testing early mysql releases in a sandbox

The hard way

Read the manual

Wednesday, March 21, 12

Page 21: Testing early mysql releases in a sandbox

The hard way

Read the manual try to figure out what to change

Wednesday, March 21, 12

Page 22: Testing early mysql releases in a sandbox

The hard way

Read the manual try to figure out what to change Install

Wednesday, March 21, 12

Page 23: Testing early mysql releases in a sandbox

The easy way

$ make_sandbox \ /path/to/mysql-5.1.54_linux.tar.gz

# it should work always

MySQL Sandbox

Wednesday, March 21, 12

Page 24: Testing early mysql releases in a sandbox

The easier way

$ make_sandbox 5.1.54

Prepare once Install many times

# some # preliminary # work

Wednesday, March 21, 12

Page 25: Testing early mysql releases in a sandbox

The easiest way

$ sb 5.1.54

Prepare once Install many times

# some # preliminary # work

Wednesday, March 21, 12

Page 26: Testing early mysql releases in a sandbox

MySQL Sandbox

MySQLserver

VERSION

$SANDBOX_HOME/msb_VERSION/dataData DB1

DB2 DB3

VERSION

/tmp/mysql_VERSION.sock

Wednesday, March 21, 12

Page 27: Testing early mysql releases in a sandbox

MySQL Sandbox

MySQLserver

5.1.54

$SANDBOX_HOME/msb_5_1_54/dataData DB1

DB2 DB3

5154

/tmp/mysql_5154.sock

Wednesday, March 21, 12

Page 28: Testing early mysql releases in a sandbox

MySQL Sandbox

MySQLserver

5.5.9

$SANDBOX_HOME/msb_5_5_09/dataData DB1

DB2 DB3

5509

/tmp/mysql_5509.sock

Wednesday, March 21, 12

Page 29: Testing early mysql releases in a sandbox

Single SandboxMySQLserver

customized scripts

startstop

restartstatusclear

send_killuse

Wednesday, March 21, 12

Page 30: Testing early mysql releases in a sandbox

Multiple SandboxMySQLserver

customized scripts

start_allstop_all

restart_allstatus_allclear_all

send_kill_all

use_all

ms1s2

n1n2n3

Wednesday, March 21, 12

Page 31: Testing early mysql releases in a sandbox

Where do you get it

•from CPANsudo su -

cpan MySQL::Sandbox

•from launchpadhttp://launchpad.net/mysql-sandbox

Wednesday, March 21, 12

Page 32: Testing early mysql releases in a sandbox

The easy replication way

# some# preparation

MySQL Sandbox

$ make_replication_sandbox \ /path/to/mysql-5.1.54_linux.tar.gz

Prepare once Install many times

$ make_replication_sandbox 5.1.54

Wednesday, March 21, 12

Page 33: Testing early mysql releases in a sandbox

default architecture

$HOME

/sandboxes opt

mysql

$SANDBOX_HOME

$SANDBOX_BINARY

expandedtarballs

installed sandboxes

Wednesday, March 21, 12

Page 34: Testing early mysql releases in a sandbox

default architecture

$HOME

/sandboxes opt

mysql

5.0.91

5.1.45

5.1.48

5.5.4

msb_5_0_91

msb_5_1_48

rsandbox_5_1_48

master

node1

node2Wednesday, March 21, 12

Page 35: Testing early mysql releases in a sandbox

MySQL Sandbox cookbook

$ perldoc MySQL::Sandbox::Recipes

Wednesday, March 21, 12

Page 36: Testing early mysql releases in a sandbox

Early MySQL versions in a sandbox

5.6

5.6

5.6

Wednesday, March 21, 12

Page 37: Testing early mysql releases in a sandbox

Where to get the software

http://dev.mysql.com

http://labs.mysql.com

Wednesday, March 21, 12

Page 38: Testing early mysql releases in a sandbox

Wednesday, March 21, 12

Page 39: Testing early mysql releases in a sandbox

Where is MySQL 5.6

Wednesday, March 21, 12

Page 40: Testing early mysql releases in a sandbox

The bleeding edge

http://code.launchpad.net/mysql-server

Wednesday, March 21, 12

Page 41: Testing early mysql releases in a sandbox

HANDS ONls labs

mysql-5.6.2-m5-osx10.6-x86_64.tar.gzmysql-5.6.5-m8-osx10.7-.tar.gzmysql-5.6.3-labs-innodb-fts-osx10.5-x86.tar.gzmysql-5.6.4-m7-osx10.5-x86.tar.gz

Wednesday, March 21, 12

Page 42: Testing early mysql releases in a sandbox

Innodb fulltextmake_sandbox mysql-5.6.5-m8-osx10.7-.tar.gz ........Your sandbox server was installed in $HOME/sandboxes/msb_5_6_5

Wednesday, March 21, 12

Page 43: Testing early mysql releases in a sandbox

testing innodb fulltext~/sandboxes/msb_5_6_5/useWelcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 2

Server version: 5.6.5-m8 Source distributionCopyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respective owners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql [localhost] {msandbox} ((none)) >

Wednesday, March 21, 12

Page 44: Testing early mysql releases in a sandbox

testing innodb fulltextcreate table mysql_manual ( id int not null auto_increment , title varchar(100) not null, chapter mediumtext, primary key (id),fulltext index (title, chapter)) engine = INNODB;

Wednesday, March 21, 12

Page 45: Testing early mysql releases in a sandbox

testing innodb fulltextshow create table mysql_manual\G****************** 1. row ********* Table: mysql_manualCreate Table: CREATE TABLE `mysql_manual` ( `id` int(11) NOT NULL AUTO_INCREMENT, `title` varchar(100) NOT NULL, `chapter` mediumtext, PRIMARY KEY (`id`), FULLTEXT KEY `title` (`title`,`chapter`)) ENGINE=InnoDB DEFAULT CHARSET=latin1

Wednesday, March 21, 12

Page 46: Testing early mysql releases in a sandbox

testing innodb fulltext

for P in $PWD/refman-5.5-en.html-chapter/*.html; do echo "insert into mysql_manual(title,chapter) values ('`basename $P .html`', load_file('$P'));"; done | ~/sandboxes/msb_5_6_5/use -vv test....insert into mysql_manual(title,chapter) values ('stored-programs-views', load_file('/Users/gmax/labs/refman-5.5-en.html-chapter/stored-programs-views.html'))Query OK, 1 row affected....

Using a copy of MySQL manual to fill the table

Wednesday, March 21, 12

Page 47: Testing early mysql releases in a sandbox

testing innodb fulltextselect title from mysql_manual where match(title,chapter) against ('+optimize +queries' in boolean mode);+-------------------------+| title |+-------------------------+| backup-and-recovery |...| extending-mysql || functions || ha-overview |...| optimization || partitioning || replication || restrictions |+-------------------------+16 rows in set (0.00 sec)

Wednesday, March 21, 12

Page 48: Testing early mysql releases in a sandbox

testing innodb fulltextselect title from mysql_manual where match(title,chapter) against ('"optimize queries" @10' in boolean mode);+------------------+| title |+------------------+| introduction || optimization |+------------------+2 rows in set (0.00 sec)

#### @10 = proximity operator##

Wednesday, March 21, 12

Page 49: Testing early mysql releases in a sandbox

testing some replicationmake_replication_sandbox mysql-5.6.5-m8-osx10.7-.tar.gz ........replication directory installed in $HOME/sandboxes/rsandbox_mysql-5_6_5

Wednesday, March 21, 12

Page 50: Testing early mysql releases in a sandbox

testing some replication~/sandboxes/rsandbox_mysql-5_6_5/s1show slave status\G******** 1. row *************************** Slave_IO_State: Waiting for master to send event Master_Host: 127.0.0.1 Master_User: rsandbox Master_Port: 12630 Connect_Retry: 60 Master_Log_File: mysql-bin.000001 Read_Master_Log_Pos: 2524 Relay_Log_File: mysql_sandbox12631-relay-bin.000002 Relay_Log_Pos: 2677 Relay_Master_Log_File: mysql-bin.000001 Slave_IO_Running: Yes Slave_SQL_Running: Yes

Wednesday, March 21, 12

Page 51: Testing early mysql releases in a sandbox

testing some replication~/sandboxes/rsandbox_mysql-5_6_5/s1show slave status\G....Master_Server_Id: 1Master_UUID: be3c022a-726f-11e1-a26a-a64f991393aaMaster_Info_File: /Users/gmax/sandboxes/rsandbox_mysql-5_6_5/node1/data/master.infoSQL_Delay: 0SQL_Remaining_Delay: NULLSlave_SQL_Running_State: Slave has read all relay log; waiting for the slave I/O thread to update it

Wednesday, March 21, 12

Page 52: Testing early mysql releases in a sandbox

uncovering replication features

show variables like '%info%';+---------------------------+----------------+| Variable_name | Value |+---------------------------+----------------+| master_info_repository | FILE || relay_log_info_file | relay-log.info || relay_log_info_repository | FILE || sync_master_info | 0 || sync_relay_log_info | 0 |+---------------------------+----------------+show variables like '%worker%';+------------------------+-------+| Variable_name | Value |+------------------------+-------+| slave_parallel_workers | 0 |+------------------------+-------+

Wednesday, March 21, 12

Page 53: Testing early mysql releases in a sandbox

uncovering replication features

STOP SLAVE;

set global master_info_repository='table';Query OK, 0 rows affected (0.00 sec)

slave1 [localhost] {msandbox} ((none)) > set global relay_log_info_repository='table';Query OK, 0 rows affected (0.00 sec)

slave1 [localhost] {msandbox} ((none)) > set global slave_parallel_workers=3;Query OK, 0 rows affected (0.00 sec)

Wednesday, March 21, 12

Page 54: Testing early mysql releases in a sandbox

fixing replication tablesuse mysql;

slave1 [localhost] {msandbox} (mysql) > alter table slave_master_info engine=innodb;Query OK, 1 row affected (0.01 sec)Records: 1 Duplicates: 0 Warnings: 0

slave1 [localhost] {msandbox} (mysql) > alter table slave_relay_log_info engine=innodb;Query OK, 1 row affected (0.01 sec)Records: 1 Duplicates: 0 Warnings: 0

slave1 [localhost] {msandbox} (mysql) > alter table slave_worker_info engine=innodb;Query OK, 0 rows affected (0.01 sec)Records: 0 Duplicates: 0 Warnings: 0

Wednesday, March 21, 12

Page 55: Testing early mysql releases in a sandbox

Look at the new featuresshow slave status\G........Master_UUID: be3c022a-726f-11e1-a26a-a64f991393aaMaster_Info_File: mysql.slave_master_info

Wednesday, March 21, 12

Page 56: Testing early mysql releases in a sandbox

Look at the new featuresselect * from mysql.slave_master_info\G*************************** 1. row ****** Master_id: 101 Number_of_lines: 22 Master_log_name: mysql-bin.000001 Master_log_pos: 2524 Host: 127.0.0.1 User_name: rsandbox User_password: rsandbox Port: 12630.... Heartbeat: 1800 Bind: Ignored_server_ids: 0 Uuid: be3c022a-726f-11e1-a26a-a64f991393aa Retry_count: 86400

Wednesday, March 21, 12

Page 57: Testing early mysql releases in a sandbox

Look at the new featuresselect * from mysql.slave_relay_log_info\G*************************** 1. row *************** Master_id: 101 Number_of_lines: 6 Relay_log_name: ./mysql_sandbox12631-relay-bin.000002 Relay_log_pos: 2677 Master_log_name: mysql-bin.000001 Master_log_pos: 2524 Sql_delay: 0Number_of_workers: 3

Wednesday, March 21, 12

Page 58: Testing early mysql releases in a sandbox

Look at the new featuresselect * from mysql.slave_worker_info\G************** 3. row ********************* Master_id: 101 Worker_id: 2 Relay_log_name: ./mysql_sandbox12631-relay-bin.000003 Relay_log_pos: 1394 Master_log_name: mysql-bin.000001 Master_log_pos: 3651 Checkpoint_relay_log_name: ./mysql_sandbox12631-relay-bin.000003 Checkpoint_relay_log_pos: 1199Checkpoint_master_log_name: mysql-bin.000001 Checkpoint_master_log_pos: 3456 Checkpoint_seqno: 0 Checkpoint_group_size: 64 Checkpoint_group_bitmap:

Wednesday, March 21, 12

Page 59: Testing early mysql releases in a sandbox

DEMO

Wednesday, March 21, 12

Page 60: Testing early mysql releases in a sandbox

Participate!

Wednesday, March 21, 12

Page 61: Testing early mysql releases in a sandbox

This work is licensed under the Creative Commons Attribution-Share Alike 3.0 Unported License. To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/3.0/ or send a letter to Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA.

THANKSLet's talk!

Wednesday, March 21, 12