Archive for February, 2007


On Barack Obama and Blackness…

by Jeremy Cole on Sunday, February 11th, 2007 at 13:51:13 in Politics

The other night, the guest on The Colbert Report was Debra Dickerson, the author of the book The End of Blackness. Colbert questioned her about Barack Obama—whether or not he is “black”. She argued that in the “American political context” Barack Obama is not “black”. I can kind of buy that, but what really made me chuckle was her insistence in referring to him as “African African American”, as though the term “African American” is reserved for the “real” blacks in America.

Get over yourself, Debra: “Black” is a reference to the color of his skin, not to his upbringing; and “African American” is a reference to his lineage in Africa—he is only 2nd generation after all—his father was born in Kenya. He is a hell of a lot more African American than most people in the US that give themselves that designation. American politics is such a joke these days.

Progress in MySQL Process List

by Jeremy Cole on Thursday, February 8th, 2007 at 01:27:48 in MySQL, MySQL Patches, MySQL Tips

Today I had a sort of short epiphany regarding getting progress of running statements in MySQL. MySQL already keeps a running count of rows touched in most multi-row statements (called thd->row_count1), so I figured there must be a way to make use of it. It was trivial to expose row_count through SHOW PROCESSLIST. After that, it was fairly obvious that another variable could be added: row_count_expected. For certain statements (currently only ALTER TABLE) it is easy to estimate how many rows will be touched, so that number can be used to calculate a Progress_percent column.

The Progress_rows number indicates progress within a given step of executing the query. For instance, if you run a SELECT with a GROUP BY that can’t be done using an index, you will see two cycles of Progress_rows: once with a State of “Copying to tmp table” and once with “Sending data”.

I implemented this all in a small patch to MySQL 5.0 (and backported to MySQL 4.1) which produces the following output from SHOW FULL PROCESSLIST:

mysql> show full processlist \G
*************************** 1. row ***************************
              Id: 1
            User: jcole
            Host: localhost
              db: test
         Command: Query
            Time: 3
           State: copy to tmp table
            Info: alter table sclot__a type=myisam
   Progress_rows: 44141
Progress_percent: 76.09

This was really way, way too easy. Hopefully it can be one with MySQL Community soon.

1 Note that currently thd->row_count is a 32-bit unsigned integer, so it will wrap at about 4.2 billion rows. Someone should really think about fixing this. :)

Corrupted relay logs?

by Jeremy Cole on Tuesday, February 6th, 2007 at 11:34:44 in MySQL

I just opened MySQL Bug #26123, to attempt to find out how many people are seeing this possible replication bug. A few Proven Scaling customers have seen the same bug, and I haven’t been able to reproduce it, so I opened a bug as a feeler. It appears to have something to do with using BLOB or TEXT fields in replication.

Are you seeing slaves stop with corrupted relay logs? Does restarting replication using CHANGE MASTER and the Exec_Master_Log_Pos from the stopped slave1 work just fine? Do the master’s binary logs look perfectly OK? Leave a comment on the bug.

1 This effectively forces the slave to re-download the exact same log events that it currently has in its relay logs. Since the corruption appears to happen either in the master’s slave thread, or the slave’s replication IO thread, this gets things going again.