Lightweight Transactions

An interesting example from a world where transactions cost next to nothing.

The "2 Phase Commit Puzzle" application is a little Windows Forms puzzle that doesn’t use Indigo or the Longhorn bits, but rather employs a little lightweight 2PC transaction manager that Steve Swartz and myself hacked up when we were on our Scalable Applications tour this spring.

The puzzle uses four resource managers (transaction participants). The TileWorker keeps track of the tiles as they are moved around, always votes "yes" on Prepare, does nothing on Commit and rolls all tiles back into their original (shuffled) state on Abort. The TimeoutWorker votes "yes" if the puzzle is completed (pressing the “Done” button) within the preset time-span and "no" otherwise. It does nothing on either Commit or Abort otherwise. The GridWorker votes "yes" on Prepare if the puzzle is completed (order is correct) and otherwise "no". It also does nothing on Commit or Abort. The OutcomeContingentMessage is a participant that will always vote "yes" on Prepare and shows a “Congratulations” message on Commit and a "You failed!" message on Abort.

It's worth reading the transaction deck presentation too (not linked since it's a compressed PowerPoint file. You can find it on Google if you search for the exact phrase "figuring it out on safe ground")


Other posts tagged as programming, technology

Earlier Posts