Normal Topic Locks, Transactions, and Crash Recovery (Read 485 times)
MP
Full Member
***
Offline



Posts: 104
Joined: Sep 3rd, 2007
Locks, Transactions, and Crash Recovery
Nov 30th, 2007 at 3:17am
Print Post Print Post  
I'm looking to implement a transactional batch, whereby either all of the records are updated or none of the records are updated.  Please confirm or correct the following:

A) Sesame does not have the ability to wrap multiple updates into a single transaction.  Thus, when using XResultSetValue to perform an update, each call is its own discrete "transaction".
B) A record in Sesame is locked if and only if it is the current record in a result set, whether that result set is being managed by a form or managed programatically via the XResultSet commands.

Assuming those two statements are true, I'll go ahead and implement my plan for a transactional batch.  If my assumptions are incorrect though, I'll have to revise my plan, so I'd rather know up front if I'm on target or not.

(BTW, does this mean that it is possible for a form update to only partially complete?  i.e. If a user updates multiple layout elements in a form, and the server crashes in the middle of a save, can this result in a partial update?)

For the curious, my plan for a transactional batch is the following (a quasi-two-phase-commit):

1) Update each record in the batch with a unique transaction key.
2) Once all processing is complete, record the transaction as being ready to commit using a record in a separate database which only holds transaction keys.
3) Complete the update by re-running through the result set and doing the true update.
4) Flagging the transaction key as being committed in my separate "transaction" database.
5) On startup, search the "transaction" database for partially committed transactions.  If found, complete the transaction.
  
Back to top
 
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: Locks, Transactions, and Crash Recovery
Reply #1 - Nov 30th, 2007 at 2:07pm
Print Post Print Post  
MP wrote on Nov 30th, 2007 at 3:17am:
I'm looking to implement a transactional batch, whereby either all of the records are updated or none of the records are updated.  Please confirm or correct the following:

A) Sesame does not have the ability to wrap multiple updates into a single transaction.  Thus, when using XResultSetValue to perform an update, each call is its own discrete "transaction".
B) A record in Sesame is locked if and only if it is the current record in a result set, whether that result set is being managed by a form or managed programatically via the XResultSet commands.

Assuming those two statements are true, I'll go ahead and implement my plan for a transactional batch.  If my assumptions are incorrect though, I'll have to revise my plan, so I'd rather know up front if I'm on target or not.


Your assumptions are correct.
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged