Transactions

60 views
Skip to first unread message

Simon Verona

unread,
May 4, 2012, 6:11:06 AM5/4/12
to jBASE
Hi

I am about to embark on using "Transactions" (ie transstart and
transend) in my application to maintain database integrity.

I have a question relating to how transactions work, and thought it
would be an easy answer rather than me constructing a test.

If I have a routine that updates a file with sequential ids - ie
1000,1001,1002 etc using a parameter which contains the next id no, and
there are other routines that are running simultaneously what happens if
the routine within the transaction aborts and has to rollback?

For example..

If my next id parameter starts off at 1000. My subroutine within the
transaction writes up 3 records, 1000,1001,1002 and moves the parameter
to 1003. Meanwhile, whilst the rest of the transaction is processing
another process writes a record, moving the parameter to 1004. If the
first transaction then aborts what is left in the parameter ? I know
that the transactions themselves will disappear.

Many thanks in advance

Regards
Simon

--
=======================================
Simon Verona
Director
Dealer Management Services Ltd
T: 0845 686 2300
========================================


Mark Hogden

unread,
May 4, 2012, 12:26:26 PM5/4/12
to jb...@googlegroups.com
Not what you asked but...

We use transaction boundaries for some updates with varying degrees of
success, and we turn transaction logging off on files that contain next
numbers. We also keep a pool of returned numbers in a second parameter in
each next number record, and the next number routine recycles those before
incrementing the main number.
We also use our own locking scheme(a holdover from the old group lock days)
and we don't release locks on records written within the boundaries (the
next number being the exception) until after we hit either transend or
transabort.
--
IMPORTANT: T24/Globus posts are no longer accepted on this forum.

To post, send email to jB...@googlegroups.com
To unsubscribe, send email to jBASE-un...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/jBASE?hl=en

Simon Verona

unread,
May 4, 2012, 3:58:48 PM5/4/12
to jb...@googlegroups.com
Stupid question...

How do exclude a file from transaction rollback??


Simon Verona 

Mark Hogden

unread,
May 4, 2012, 4:13:19 PM5/4/12
to jb...@googlegroups.com

jchmod –T filename

 

jchmod {-BCLNTRSt} {+ABCLNT} {+RRestoreSpec} {DICT} Filename{,FileSection}

       -t      Tabulate description about the file

       -B      Remove backup of file using jbackup

       -C      Remove control file usage flag

       -L      Remove logging of file

       -N      Remove the network friendly flag

       -R      Remove resize specification

       -S      Remove secure mode updates

       -T      Remove transaction boundary support

       +A      Auto-detect if a file is network friendly

       +B      Add backup of file using jbackup

       +C      Add control file usage flag

       +L      Add logging of file

       +N      Add the network friendly flag

       +S      Add the secure mode updates

       +T      Add transaction boundary support

       +Rspec  Add restore spec , used during jrestore

       Note:   Other databases may have their own options

** Error [ 200 ] **

hat is the file name ??

sh msh ~ -->

Simon Verona

unread,
May 4, 2012, 4:58:59 PM5/4/12
to jb...@googlegroups.com
Thanks Mark

I should have known that one!

Regards
Simon

John Watson

unread,
May 5, 2012, 5:50:52 AM5/5/12
to jBASE
Hi,

The assumption is that process would need to lock all records within
the transaction boundary - hence process 2 would not be able to
increment the sequence parameter file.

The locks will be maintained until the TRANSEND and only released when
the transaction is finalised - the lock will not be released with the
WRITE function.

This can present all sorts of issues for multi-threaded processing and
there is a need to keep a transaction boundary as efficient as
possible (although sods law means that the larger the boundary the
more efficient the final write!)

John.

Simon Verona

unread,
May 6, 2012, 6:46:55 AM5/6/12
to jb...@googlegroups.com
Thanks

That makes sense - that all the locks would be kept until the transend.   

Regards
Simon


Simon Verona 
Reply all
Reply to author
Forward
0 new messages