What do you think of this piece of C code? void foo(long v) { unsigned long u; unsigned sign; if (v < 0) { u = -v; sign = 1; } else { u = v; sign = 0; } … Seems pretty simple, right? Then what do you think of this output from MySQL:… Continue reading Integer overflow
Tag: programming
Tale of a bug
This is a tale of the bug lp:798213. The bug report has the initial report, and a summary of the real problem obtained after detailed analysis, but it does not describe the processes of getting from the former to the latter. I thought it would be interesting to document this, as the analysis of this… Continue reading Tale of a bug
Benchmarking thread scheduling in group commit, part 2
I got access to our 12-core Intel server, so I was able to do some better benchmarks to test the different group commit thread scheduling methods: This graph shows queries-per-second as a function of number of parallel connections, for three test runs: Baseline MariaDB, without group commit. MariaDB with group commit, using the simple thread… Continue reading Benchmarking thread scheduling in group commit, part 2
Benchmarking thread scheduling in group commit
The best part of the recent MariaDB meeting in Lisbon for me was that I got some good feedback on my group commit work. This has been waiting in the review queue for quite some time now. One comment I got revolve around an optimisation in the implementation related to how threads are scheduled. A… Continue reading Benchmarking thread scheduling in group commit
The future of replication revealed in Istanbul
A very good meeting in Istanbul is drawing to an end. People from Monty Program, Facebook, Galera, Percona, SkySQL, and other parts of the community are meeting with one foot on the European continent and another in Asia to discuss all things MariaDB and MySQL and experience the mystery of the Orient. At the meeting… Continue reading The future of replication revealed in Istanbul
Dynamic linking costs two cycles
It turns out that the overhead of dynamic linking on Linux amd64 is 2 CPU cycles per cross-module call. I usually take forever to get to the point in my writing, so I thought I would change this for once 🙂 In MySQL, there has been a historical tendency to favour static linking, inpart because… Continue reading Dynamic linking costs two cycles
Micro-benchmarking pthread_cond_broadcast()
In my work on group commit for MariaDB, I have the following situation: A group of threads are going to participate in group commit. This means that one of the threads, called the group leader, will run an fsync() for all of them, while the other threads wait. Once the group leader is done, it… Continue reading Micro-benchmarking pthread_cond_broadcast()
MySQL/MariaDB replication: applying events on the slave side
Working on a new set of replication APIs in MariaDB, I have given some thought to the generation of replication events on the master server. But there is another side of the equation: to apply the generated events on a slave server. This is something that most replication setups will need (unless they replicate to… Continue reading MySQL/MariaDB replication: applying events on the slave side
Dissecting the MySQL replication binlog events
For the replication project that I am currently working on in MariaDB, I wanted to understand exactly what information is needed to do full replication of all MySQL/MariaDB statements on the level of completeness that existing replication does. So I went through the code, and this is what I found. What I am after here… Continue reading Dissecting the MySQL replication binlog events
Fixing MySQL group commit (part 4 of 3)
(No three–part series is complete without a part 4, right?) Here is an analogy that describes well what group commit does. We have a bus driving back and forth transporting people from A to B (corresponding to fsync() “transporting” commits to durable storage on disk). The group commit optimisation is to have the bus pick… Continue reading Fixing MySQL group commit (part 4 of 3)