mysqlguy.net

It's all about the metrics, but what do they mean?

I'm working on an update to my myq_gadgets package for 5.1, particularly the innodb stats tracker.  I'm liking the additional stats that are in SHOW STATUS now for Innodb, particularly because I don't need to parse SHOW INNODB STATUS anymore.  I'm in love with being able to compare logical to physical I/Os for the buffer pool.  


I'm a bit confused, however, as some of my numbers don't quite line up.  Here's what I've got so far:

            | Innodb Engine       Buffer Pool                        Data                     Log       Lock
Time         read  ins  upd  del  new read %phy wrte %phy %dirt wait read      wrte      fsyc wrte fsyc wait time
02/22-10:06  3.8k    0    0    0    0 9.8k  259 15.0  0.1   0.0    0  351 6.6M  0.9 2.6K  0.9  0.7  0.8    0    0
02/22-10:07  5.6k    0    0    0    0  14k  344 21.8  0.1   0.0    0  461 8.7M  1.3 3.9K  1.3  1.0  1.1    0    0

Using Events to manage Table Partitioning by Date: wrap-up

As a follow up to the series of posts I've been making, I wanted to post what I ended up with.  Thanks to everyone who posted comments, your help was extremely useful. To recap, I have a working pair of events to add and remove partitions to this table:


create table log (
    logged datetime not null,
    id int not null auto_increment,
    text varchar(256),
    PRIMARY KEY ( logged, id )
)
PARTITION BY RANGE( TO_DAYS( logged ) ) (
    PARTITION p20080206 VALUES LESS THAN (733444),
    PARTITION p20080207 VALUES LESS THAN (733445),
    PARTITION p20080208 VALUES LESS THAN (733446)

Props to drupal

Congrats to Drupal for releasing version 6.0 yesterday.  This site has been running 6.0 since about rc2 (upgrading every release along the way) and I've been very happy with it.  Also, thanks to the developer(s) of the 'Channel Nine' theme, which I've adopted for my own (with some modifications).

Event Scheduling reliability

I created my Events to handle adding new partitions (and removing old ones) from my log table and they seem to be working.  However, today I noticed that the events ran a few hours later than they ran yesterday.  


          EVENT_TYPE: RECURRING
          EXECUTE_AT: NULL
      INTERVAL_VALUE: 1
      INTERVAL_FIELD: DAY
            SQL_MODE: 
              STARTS: 2008-02-13 05:36:21
                ENDS: NULL
              STATUS: ENABLED
       ON_COMPLETION: NOT PRESERVE
             CREATED: 2008-02-13 05:36:21
        LAST_ALTERED: 2008-02-13 05:36:21
       LAST_EXECUTED: 2008-02-14 07:32:22

My addpartition event is current date dependent: it creates a partition for tomorrow hopefully before tomorrow comes so we don't miss a partition and so my INSERTs don't get "No partition" errors.  So if it waits a few extra hours more each day, gradually it will push past midnight and screw things up.  

Ruby Succinctness competition

For some reason I never was that excited about trying to accomplish these sorts of things in Perl:

1..rand(256)).inject("") {|string,n| string + ('a'..'z').to_a[rand(25)] }

This generates a string from 1 to 256 characters long, containing random letters from 'a' to 'z'.  

Normally, I wouldn't use something that's quite so unreadable, but I'm starting to like Ruby's way of taking what should be a very simple operation that I might have done in 3-5 lines in Perl and boiling it down to a single line.

I'd love to see if anyone can make this more succinct (but one line is still a requirement!)

Here's the code in it's context. It's just a test script writing into my partition table every minute so I can verify my Events from previous posts are working correctly.

About Me

Jay Janssen
Yahoo!, Inc.
jayj at yahoo dash inc dot com
MySQL
High Availability
Global Load Balancing
Failover
View Jay Janssen on Twitter  View Jay Janssen's LinkedIn profile View Jay Janssen's Facebook profile