Taking common_schema’s rdebug to a test-drive

This is a simple step-by-step introduction to rdebug: Debugger and Debugging API for MySQL Stored Routines, as part of common_schema.

In other words: let me take you through the steps for debugging your stored routines on your own server. We will step into, step over, step out, modify variables, set a breakpoint, run to breakpoint…

Command line geeks, this one’s for you. GUI lovers, this is actually an API; I am hoping for someone wrap it up with a plugin for your favorite GUI editor.

Requirements:

  • Install common_schema 2.0 or above (at this time of writing 2.0.0-alpha is released).
  • Get sample data & routine file [download id=”4″ format=”1″]
  • mysql> SOURCE rdebug_demo.sql_.txt
    • You should now have a table called color_count in the test database, along with two routines: review_colors() and review_single_color().
  • Open two sessions. We call them the debugger session and the worker session. The worker session will execute the routine; the debugger session will control it.

Walk-through: preparation

Walk this thing with me. We will alternate between the debugger and the worker. Continue reading » “Taking common_schema’s rdebug to a test-drive”

common_schema 2.0.0-alpha: rdebug, GPL

A new release for common_schema: an alpha version of rdebug: MySQL Debugger and Debugging API is now included with common_schema.

With a different license in mind for rdebug, common_schema changes license to GPL (2 or above).

common_schema 2.0 is ready for download. All things rdebug, it is alpha — otherwise it’s a stable release.

rdebug

I’m very happy to release this alpha version of rdebug, and urge everyone to try it out.

The idea is to have an open, free, server side debugger and debugging API for MySQL stored routines. To elaborate:

  • It’s server side by that it’s implemented by stored routines. Not by a connector; not an emulator; not a GUI tool hack. The entire functionality lies within common_schema, a schema in your server.
  • It’s a debugger: you can debug your own stored routines (with limitations)
  • It’s a debugging API: there’s a distinct specification and a set of calls which makes for a debugging process
  • It’s open since the source code is yours to browse.
  • It’s free as in free beer.
  • It’s free as it makes you independent of a specific debugger. It provides an API that anyone can use. You can run the API yourself from the command line; or plugins for your favorite GUI editor can be developed to use this API.

On a separate blog post I will take you to a rdebug test drive.

As always, nothing is released before extensive documentation is in place.

I’d love to get input on this. Continue reading » “common_schema 2.0.0-alpha: rdebug, GPL”

Percona Live 2013 schedule & events summary

Here’s the (hopefully) complete list of events throughout and following the upcoming Percona Live MySQL Conference & Expo, 2013.

The schedule is quite packed! Make sure to take a deep breath beforehand:

Monday, April 22

09:30 – 16:30: Tutorials

16:30 – 18:30: Welcome reception in Expo Hall

18:30 – 20:30: MySQL Community Reception by Oracle

Tuesday, April 23

09:00 – 11:00: Keynotes

11:00 – 17:40: Sessions

18:00 – 19:00: Birds of a Feather

19:00 – 22:00: Community dinner at Pedro’s

Wednesday, April 24

09:00 – 10:35: Keynotes

11:10 – 17:20: sessions

17:30 – 20:30: Community Networking Welcome Reception (in Expo Hall) MySQL Community Awards & Lightning Talks

Thursday, April 25

09:00 – 10:35: Keynotes

11:00 – 16:00: Sessions

16:00 – 16:45: Wrap-up

Following the conference, you can find:

Friday, April 26:

SkySQL and MariaDB’s 2nd Annual MySQL & Cloud Solutions Day

Assistance wanted: DotOrg Pavilion on Percona Live 2013

I’m looking for assistance in manning a DotOrg Pavilion on the upcoming Percona Live conference in Santa Clara.

As you may or may not know, free and open source projects are eligible to ask for a free booth on the Expo hall. This is a good chance to promote one’s project.

Of course, someone must stand behind the counter and answer [technical] questions.

I should like to have a booth for common_schema & openark-kit, but am limited in resources — namely the number of bodies I can occupy simultaneously, just one at this time. Along with some duties I have throughout the conference I do not expect to be able to be present for long periods behind the counter.

Are you familiar with common_schema/openark-kit? Would you like to lend a hand and contribute some hours at the conference?

For a full time attendee I can lend a hand and provide with a free conference pass + my gratitude.

Please comment below if you are willing to commit yourself to this task — thank you!

Speaking on the media: OurSQL, Reversim

I had the pleasure of speaking on two excellent podcasts:

OurSQL

No need for me to introduce this podcast. I just have to say it was only when I interviewed that I realized the amount of work taken for producing one single cast. Kudos to Sheeri & Gerry and Rich Goyette the sound producer and thank you for your kind hospitality!

You can find the cast on OurSQL Episode 129: New and Extended, where we speak about the upcoming Percona Live MySQL Conference & Expo, 2013.

Reversim

This is an Israeli, Hebrew speaking podcast, and is undoubtedly the queen of Software Development podcasts here. Run by two enthusiast, veteran, open source keen developers, this is a must hear podcast if your Hebrew isn’t rusty 😉 Thanks Ori & Ran for having me again!

I was honored to be interviewed for the 3rd time there, again speaking about MySQL and its ecosystem. In this recent podcast, I speak about the new 5.6 release, highlighting some features; about MariaDB; the Galera cluster technology; LGPL connectors; Percona Live 2013.

Find the cast on the reversim website: 171 MySQL 5.6

My next speaking event will be at the conference itself; more on that later.

MySQL Stored Routines Debugger & Debugging API: sneak preview II, video

This is the 2nd sneak preview of common_schema‘s rdebug: debugger & debugging API for MySQL stored routines (see 1st preview here).

rdebug will be released as part of common_schema, free and open sourced.

In this sneak preview I present:

  • Compiling multiple routines with debug info
  • Starting/stopping a debug session
  • Step-over, step-in, step-out
  • Showing stack trace
  • Showing the next-statement to execute
  • Viewing and manipulating local routine variables
  • Misc. meta routines

The quick technical overview

rdebug is a server-side mechanism, itself written in MySQL stored routines. It manipulates your routines by injecting debug code (easily removed afterwards).

To debug a routine you will need two connections: one is the debugging connection, and the other is the worker connection. The debugger connection attaches itself to the worker connection, where your routines execute.

rdebug is controlled by an API of stored routines. This means any GUI tool may choose to use rdebug as its routine debugging mechanism. Your are not bound to a specific tool, a specific OS or framework. You may choose to invoke the API via command line, if you like; it’s all in your server.

A video is worth a thousand blogs Continue reading » “MySQL Stored Routines Debugger & Debugging API: sneak preview II, video”

Cheating mysqlsandbox to install MariaDB 10.0

mysqlsandbox is version-aware. The new 5.6 version, for example, requires special care because of the system InnoDB tables or otherwise modified system tables.

At this moment, it will refuse to install MariaDB 10.0 (alpha):

bash$ make_sandbox /tmp/mariadb-10.0.1-linux-x86_64.tar.gz 
unpacking /tmp/mariadb-10.0.1-linux-x86_64.tar.gz
unsupported version 10.0

This is perfectly legitimate, and I have no quarrel with this fact. However, I did want to setup MariaDB 10.0 as a sandbox.

As it turns out mysqlsandbox relies on MySQL package naming conventions to detect the version: the fact that a tgz file distribution is named mariadb-10.0.1-linux-x86_64.tar.gz and extracts onto mariadb-10.0.1-linux-x86_64, tells mysqlsandbox that this is version 10.0.1. Easy enough to cheat, then: pick a version that mysqlsandbox will work with, and which is compatible sandbox-wise with your own, and do the renames. For that matter, I picked 5.5, and, actually, made it 5.5.100: Continue reading » “Cheating mysqlsandbox to install MariaDB 10.0”

Percona Live 2013 news: Oracle, BoF, Lightning Talks

Oracle

Oracle? Oracle! We’re extremely happy to have Oracle as presenter in Percona Live 2013!

You can expect three sessions by Oracle engineers:

MySQL 5.6: Performance Benchmarks, Tuning, and Best Practices – Dmitri Kravtchuk

MySQL 5.6: What’s New in InnoDB – Sunny Bains

MySQL 5.6: Redefining Replication – Luís Soares

And Tomas Ulin will present the obligatory “State of the Dolphin” keynote.

Skip my part in this conference for the moment; I’m very happy this is happening. For the community this is an obvious gain. I also wish to congratulate both Oracle and Percona for pulling this off; both parties deserve warm words here.

See announcement here.

BoF

Birds of a Feather schedule is published. This happens on Tuesday, second day of the conference and first day of conference sessions, 6:00pm to 7:00pm. The BoF sessions are reviewed by the conference committee.

Lightning Talks

Lightning talks are very short, rapid talks. We have 9 talks, totaling at about one hour. Giuseppe Maxia is orchestrating the talks. The talks are presented during the Community evening, Wednesday, 5:30pm to 8:30pm, where community awards are also presented. Giuseppe will naturally elaborate on that.

For me excitement is quickly building up!

Merging tables with INSERT…ON DUPLICATE KEY UPDATE

Had a case recently where I had to merge data from two identically structured tables containing nearly identical data.

“Nearly identical” meaning most table data is identical in both; sometimes a row is missing from one of the tables; sometimes same row (according to PK) appears in both, but some columns are NULL is one tables (while others can be NULL in the second).

Otherwise no contradicting data: it was not possible for some data to be “3” in one table and “4” in the other.

How do you create a merge of the tables, such that all missing rows are completed, and NULLs replaced by actual values when possible?

pt-table-sync comes to mind: one can do a bidirectional syncing of two tables, and actually stating how to resolve ambiguities (like “greater value wins”). Very powerful! An example would be:

pt-table-sync --bidirectional --conflict-column=a --conflict-comparison=greatest --tables ...

However I didn’t actually have any problem with the tables themselves. The two tables were just fine as they were; missing or NULL data does not indicate an error on their part. I wanted to get their merge. pt-table-sync is still up for the job: we can duplicate them, merge on the copy… But I prefer a query over an external script when possible.

INSERT…ON DUPLICATE KEY UPDATE

This MySQL-specific syntax is actually quite powerful. It basically says “if the insert fails due to unique constraint, you get a chance to update the row causing the failure”. But it also allows for smart setting of the column via the VALUES() clause. Let’s present some sample data and then see the solution. Continue reading » “Merging tables with INSERT…ON DUPLICATE KEY UPDATE”