atom feed4 messages in com.motion-twin.lists.haxeRe: [haXe] spod transaction question
FromSent OnAttachments
Robin PalotaiDec 19, 2010 1:12 pm 
Nicolas CannasseDec 20, 2010 12:23 am 
Robin PalotaiDec 20, 2010 2:46 am 
Marc WeberDec 25, 2010 1:14 pm 
Subject:Re: [haXe] spod transaction question
From:Nicolas Cannasse (ncan@motion-twin.com)
Date:Dec 20, 2010 12:23:48 am
List:com.motion-twin.lists.haxe

Le 19/12/2010 22:12, Robin Palotai a écrit :

Hi,

At the SPOD tutorial page, it is only mentioned that SPOD can be used with transaction somehow, which will be introduced "later". Is it introduced?

My idea was to not use any of the lock options of the SPOD, but wrap all my operations in standard cnx.startTransaction/commit calls (maybe with some nesting management). That should work too, shouldn't it?

If you're using MySQL+InnoDB, then all SELECT that you make will return the data that was visible at the start time of the transaction (which is actually your first SELECT, not your START TRANSACTION).

You have to use SELECT ... FOR UPDATE (SPOD lock=true) before making an update to make sure that : a) the data you select is the actual data present in the database b) other transactions will lock while doing the same SELECT/FOR UPDATE on this row until your commit your transaction

MySQL have an immediate deadlock resolution and a lock wait timeout for SELECT/FOR UPDATE.

Nicolas