2011/07/21

Not Garbage Yet!

The three phases of things:
  1. Shiny and new and desirable;
  2. Garbage (very little survives);
  3. Old and desirable (aka Retro or Antique).

An example: the Pullman car was something a president wanted; North America reworked its railroads to accommodate it (and him). By now, most are destroyed. However, The New Brunswick Railway Museum has two. They also have a small shunting yard full of train cars, engines and cabooses that have survived the Garbage phase (in some cases just barely) and are moving into the Old and Desirable phase.

I ended up at the museum by accident; driving back to Shediac from the Hopewell Rocks, I saw a jet fighter plane parked by the side of the road. On a lark I turned the van around and drove pack to take pictures of it. My 14-year-old self wouldn't have forgiven me. But then Désirée claimed she wanted to see the trains. In fact she wanted to enter the trains. And so we did. And this brought back my 8 year old self and memories of the few train trips I made from Toronto to Montreal. There were no VIA Rail cars from the 70s, which I assume are still in the Garbage Phase, but some of the car seats from the 60s looked I bit like what I remember.

The real joy (for me) was in the large shed, where they had a Caboose we could enter. As a kid in North Hatley we used to watch the trains go by and wave at the man in the caboose. Cabooses (cabeese?) are now only a thing of memory (I had to explain to Dominique what a caboose was), but my inner 8-year-old-train-geek got a kick waving from the caboose at the passing kids. Or rather, my wife.

The next best thing was clambering around 3 locomotives, 2 diesel-electrics from the late 50s and a steam locomotive beast from 1912. And this is what is so awesome about this museum. I was afraid it would be all staring at immaculate restorations through plexiglass. Quite the contrary: we got to clamber on and around the locomotives and into the engineering rooms, sit on the beat-up seats, admire the different levels of tech in the controls from large brass levers all the way to 80s era scram switches and digital speedometers. Désirée could have shimmied into the boiler's furnace if her mother would have allowed her and her father could have cajoled her to do so. We pushed on the huge levers, pull the ropes, opened up the panels to see the turbines.

Were we supposed to do all this? No one was around to tell us not to; these are huge machines made to withstand years of hard work. We would have been hard pressed to break anything the engineers hadn't already.

Conclusion: Worth the price, worth a detour, would go again.

2011/07/20

Weighing the border

Years ago Susan used some mapping software to plot a route from North Hatley to (I think) New Brunswick. This was back when software came from a CD-ROM, not a web server. The software routed her through the USA. She added (I suspect) Rimouski to her itinerary as a way of by-passing the USA. It still routed her through Maine. As I remember, she then contacted tech support, who said they'd fix it in the next release. Remember, this was back when software was burned on CD-ROMs so they couldn't just tweak something and have it available next morning.

Because really, what you want is to give a border crossing a very high weight, so the AI will give it a low priority. CD-ROMs might also make you think of a time when crossing a border consisted of answering "yes, $DESTINATION, no, no" to a surly border guard. Nowadays it requires passports, finger printing and the possibility that you get shot when you go to reach for your glove compartment. So whatever the weight used to be, multiply it by 5. Or you could have a user configuration "USA border guards scare the hell out of me."

All this makes me wonder if there's someone at Google Maps who's job is to evaluate the relative difficulty of crossing various borders, updating the system as foreign policy deteriorates.

What brought this back to mind is that I'm currently IN Shediac, New Brunswick.

In semi-related news: I've finally mastered wireless connection setup in CentOS. Delete ifcfg-eth1 (in both /etc/sysconfig/network-scripts AND /etc/sysconfig/networking/devices), run nm-connection-editor, let the wizard to its work. NetworkManager stores its config in ~/.gconf/system/networking/connections. The WEP key is stored somewhere else. Yes, the place I'm staying uses WEP, which takes less then a minute to crack but more then a minute for the owner to write down for you.

2011/07/15

Pain

Something you don't see everyday:

# cat /proc/mdstat 
Personalities : [raid6] [raid5] [raid4]
md0 : active raid5 sdb2[3](S) sdc2[2] sda2[4](F)
312367616 blocks level 5, 256k chunk, algorithm 2 [3/1] [__U]

unused devices:
Of course, this happens the day before I leave on a 2 week vacation.

2011/07/08

Fun with mysqldump

mysqldump makes for a quick and dirty way of backing up MySQL. Restore is trivial, if slow. However, it ties up the DB for the entire time it's running. Say you're like me and you have a table with 918,732,676 rows (yes, 9 hundred million rows). This means that the DB is tied up for 5 hours of dumping and 7 days for the restore. Clearly something better is needed.

However, before I work on integrating xtrabackup, I decided to see how slicing the dump with a LIMIT clause would work. mysqldump doesn't allow me to set LIMIT directly, however it does zero validation on the WHERE clause I can set. So:
(

mysqldump --opt DB --ignore-table BIGTABLE
mysqdump -NB --no-data DB BIGTABLE
MAX=$(mysql -NB DB -e 'select count(*) from BIGTABLE')
INC=$(( $MAX/1000 ))
seq -f '%.0f' 0 $INC $MAX | while read start ; do
mysqldump --compact --no-create-info DB BIGTABLE --where "1 LIMIT $start,$INC"
done
) > /my/backup.sql

This only works because mysqldump blindly tacks the WHERE clause onto it's select statement, giving us (roughly)
SELECT * FROM BIGTABLE WHERE 1 LIMIT 0,918732

This is a hack and a half: a- while it works now (Perconna 5.1.54) there's no guarantee it won't break at some point. But more importantly, b- this will still take a week to restore.

BTW, black-eyes to the idiots made %g the default seq format.