Timing queries in the 21st century (with LD_PRELOAD and sed)

So… Baron blogged about wanting higher precision timers from the mysql binary and that running sed on the binary wasn’t cutting it. However… I am not one to give up that easily!

This is what LD_PRELOAD was made for! Evil nasty hacks to make your life easier!

By looking at the mysql.cc source code, I can easily work out how this works… I just have to override two calls! They being sysconf() (we fake how many ticks per second there are) and times() (let’s return a much higher precision number).

Combined with the sed hack on the binary to change the sprintf call to print out the higher precision number, we have:

mysql> select count(*) from t1;
+----------+
| count(*) |
+----------+
|   710720 |
+----------+
1 row in set (1.080110 sec)

Get it from my junkcode: http://www.flamingspork.com/junkcode/high_precision_mysql_timer.c

(or you can get it from http://paste.drizzle.org/show/364/)

Implicit COMMIT considered harmful.

If you execute the following, what does your RDBMS do?

CREATE TABLE t1 (a int);
START TRANSACTION;
INSERT INTO t1 (a) VALUES (1);
START TRANSACTION;
INSERT INTO t1 (a) VALUES (2);
ROLLBACK;
SELECT * FROM t1;

The answer may surprise you.

linux.conf.au 2011 Monday wrap-up

This year was a lot of fun. My talk was on the Thursday, which meant that there was most of the week spent going “eep” and making sure I was ready for it.

Total hats off to the organisers – you may have heard about a small area of Queensland (about the area of France and Germany combined – or ~ twice that of Texas) was declared a disaster area a couple of weeks before the conference. Honestly, if you didn’t hear about it, you wouldn’t have noticed.

Sunday night we had a gathering of linux.conf.au Ghosts of Conferences Past. We refer to those previously involved in running an LCA “Ghosts” – a wealth of knowledge for future teams. One of the most amusing tales was John Ferlito asking people what would they have done if just less than two weeks out they had to change venues. The consensus: curl up in a corner and cry hoping it would all just go away.

The lca2011 organisers didn’t.

So on the Monday I managed to catch a few good talks. In the morning I seemed to stalk Pia in her two talks: “Applying martial arts to the workplace: your guide to kicking arse” and “Cloud computing: finding the silver lining for government” in the Haeksen and Freedom In The Cloud miniconfs respectively.

If you didn’t manage to catch the martial arts talk, check out Pia’s blog post on it. I also strongly recommend a good martial arts school (contact me if you want).

The big take away for me from the Cloud in Government talk was that I really should go and read the AGIMO Cloud Strategy document. The other take away for me was that while government is looking at using new technology it is not currently thinking at all about individuals rights (such as privacy), security and safety in the cloud.

I have been known to rock up to talks with no real idea of the content but on the hope that it could end up being cool. This was the next one I went to. The title: “Open Source: Saving the World” sounded like a lovely idea and the speaker, Noirin is pretty cool. It turns out there’s some really awesome open source software out there for dealing with natural disasters, incidents of violence and education. Go check out the Lanka software foundation, the SAHANA Disaster Management System, Ushahidi (coming out of Kenya to track incidents of violence) and the Talking Book (a little yellow box that records and plays back audio).

I checked out Aeriana’s talk on overcomplicating home networks… and a bit too much of it was familiar :) I also have ideas.

Daniel Stone’s talk on input in X and everything related was interesting – there is a lot of historical things around and some truly bizarre things. Think: grabs are what grabs all input and makes you sad and OMG Multi-Pointer-X exists and it’s all backwards compatible OMG. I haven’t even mentioned the bits that allow your keyboard to have a key that makes demons fly from the screen and a harpsichord to play tunes while they do.

I managed to catch Matthew Garrett’s talk “License compliance in Open Source business” talk. The fact that the very first store he walked into after arriving in Australia was selling a device that violates his copyright is, well, not a good sign.

At the end of the Monday I managed to catch about the last half of “Training Allies” that was the last session in the Haecksen miniconf. This was a pretty good session with a rather packed room (standing room only). This is rather promising I think.

Big Day Out 2011

Yesterday, I headed to the Big Day Out in Melbourne with Leah, Hayden and Michael. This is after Leah and I had spent the last week at linux.conf.au – which (as anyone who’s ever been knows) is wonderful and tiring. I am amazed that this conference has continued to be so incredibly awesome and am still amazed that I speak at it and that my talks are often well received.

Leah @ Big Day Out Hayden and michael at BDO

First off we managed to see the Deftones. Somebody seriously needed smacking around the head with the levels… it just didn’t quite sound right. I do like the Deftones though, and was glad to catch them.\

By this time in the day, it was making days on the playa seem like childs play. Lots of water and really quite warm. Out of 52,000 at BDO this year, 1000 were treated for dehydration. I think there needs to be giant “Piss Clear” signs here too.

I managed to see Paul Dempsey, who I’ve seen solo once before playing Something For Kate material several years ago now – and it was truly one of the most awesome shows I’ve seen. I really enjoyed his performance at BDO and he certainly has to be one of my most favourite male vocalists.

Paul Dempsey

Next up? Wolfmother! That’s right kids, I missed half of Iggy and the Stooges to see Wolfmother. They didn’t disappoint – it was rather awesome and sooo totally nearly ditched everyone in the shade to run in jumping about.

Wolfmother Wolfmother

Iggy and the Stooges (well, the last half). I want to be doing this when I’m 63. Seriously. One year Hayden said that Iggy Pop was the best act he saw… and I can believe it. Again, awesome.

Iggy

Then it did get explodingly awesome. Yes, this means Rammstein.

Rammstein Rammstein Rammstein Rammstein

There should certainly be more bands using explosions as instruments and midway through fire a flamethrower high enough so that shorter people in the middle of the crowd can see it – how considerate! The heat from fire could be felt from where we were – AWESOME.

Finally….. Tool.

Tool

I saw them last time they were at Big Day Out (and when they played in Melbourne the next week). I’m doing the same this time around. I think finishing with Stinkfist gave a lovely end to the night – and loved how the crowd was right into Aenima. I cannot wait to see them on Wednesday night.