T30, Transactions

Wed Aug 7th, 2002 03:07:01 AM EST

Diary Entry 106
[ << Prev | Diary Index | Next >> ]

In this episode, my transaction manager is smarter than I am, and I get most of my ThinkPad T30 working.


I've been building this application that manipulates lots of files, moving them around, deleting them, modifying them, etc. It has the possibility to bomb out in the middle if something goes wrong, and this worried me. So over the last day or so I built in a "transaction manager" that keeps track of everything that goes on and makes sure that it can be backed out all the way to the final action. If the transaction isn't explicitly committed or rolled back by the program, a shutdown hook runs when the program terminates that automatically rolls back the transaction.

Later, I was trying to test my program, but it seemed like nothing was working properly. I'd run it once to set something up, and then I'd run it a second time based on the results of the first run, and the second time it would always fail, telling me that the results of the first weren't there. It was very confusing. On the first run, the program always completed successfully, with no error messages or anything.

I started inserting all sorts of debug messages into the code paths for both runs, trying to figure out what was going wrong. I went about this for five minutes or so. Then the obvious hit me: I had forgotten to add the "commit" operation to the code path for the first operation, so each first run would do everything it was supposed to be, and the program would start shutting down, and the transaction manager would happily back out every action taken by the program. Sheesh. My transaction manager is smarter than me.

In other news, I got a new ThinkPad T30 a couple of days ago, and I've been working to get it going under Linux ever since. I'd made good progress so far, and today was good too. Today's challenge was that the middle button on the "UltraNav" pointing device didn't work properly. I managed to get a contact at Synaptic, maker of the touch pad part of the UltraNav, who suggested that I look at recent prereleases of gpm. And lo and behold, all it took was to make a simple patch against a recent prerelease. I've put up a T30 under Linux webpage that covers this, among other things. Now the only thing left is to somehow fix the video corruption on wake from suspend.


Last updated 03 Apr 2004 21:17. Copyright © 2004 Ben Pfaff.
May be freely redistributed, but copyright notice must be retained.