Let me start by saying a big “thank you” to the staff at Oracle for deciding to open source reducer.sh. It’s a tool I developed whilst I was working for them several years ago. Its sole purpose is to do one thing – but do it good: test-case simplification.
So, let’s say some customer just sent you 120,000 lines of SQL code and affirms that “it definitely causes a crash.” Or maybe you ran RQG (the Random Query Generator) for awhile (with the general query log turned on) and now you have a nice SQL trace which may just lead to that crash the run resulted in. Or you’re a DBA testing the company’s usual queries with Valgrind, and noticed that 2 in 1000 queries give a Valgrind warning in the mysqld error log – you’re just not sure which one. Or maybe you’re a developer, and during testing you saw that a SELECT query output did not look the way it should – the output was “7” where it should have been “5” – the only problem – you have 1000 lines of INSERT statements and are not sure which one caused it. In all of these cases reducer can help.
Here are some of it’s benefits/features:
So, without further ado, let’s have a look at how to get it to do your simplification job
https://www.youtube.com/watch?v=Cny1JrQxp0w
To get reducer.sh today, use these commands (yum example used, but this can easily be adapted to apt-get):
|
1 |
$ sudo yum install bzr <br>$ cd ~ <br>$ bzr branch lp:randgen <br>$ cd randgen/util/reducer/ <br>$ ls * |
(You may also want to checkout ./status.sh in this directory which is a handy tool for seeing what reducer.sh is upto when it is doing it’s first/original attempt to reproduce a given issue.)
And you can get percona-qa (for parse_general_log.pl [and the prepare_reducer.sh code bit if you need it] as shown in the video):
|
1 |
$ cd ~ <br>$ bzr branch lp:percona-qa<br>$ cd perconq-qa<br>$ ls * |
Enjoy!
Resources
RELATED POSTS