ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » TRANSACTION PROBLEM

Post new topic  Reply to topic
 TRANSACTION PROBLEM « View previous topic :: View next topic » 
Author Message
5zan
PostPosted: Mon Aug 11, 2008 7:48 am    Post subject: TRANSACTION PROBLEM Reply with quote

Novice

Joined: 08 Jul 2008
Posts: 24

i have two diffrent flows each accessing the same table

flow 1 is inserting records into the table .

flow 2 , if it finds any records in the same table fetches them all , processses them and deletes them all .

the sequence of flow2 is as :

FETCH ALL RECORDS

PROCESS ALL RECORDS

DELETE ALL RECORDS



now while flow2 is at the second step i.e processing the records..

Flow 1 write some records in between ...!!!

and then my flow 2 goes to the 3rd step of deleting all records...


Here the records inserted into the table by flow1 get deleted without being processed...



HOW CAN I AVOID THIS ?

I TRIED ATOMIC STATEMENT IN VAIN !

how can i allow only one flow to access the table at a time ??
Back to top
View user's profile Send private message
sridhsri
PostPosted: Mon Aug 11, 2008 9:29 am    Post subject: Reply with quote

Master

Joined: 19 Jun 2008
Posts: 297

I think perhaps having table-level locks might prevent this situation. I am not sure how these locks may be obtained though. If you are using JDBC APIs, I am sure there might be some documentation that'll tell you that.

Another option is

1) Introduce another column in the table - a delete flag which is set to 'N' buy flow 1.

2) Flow 2 after reading updates the column to 'Y'

3) A flow3 triggered by a timer or flow2 after completion puts a message in a queue which triggers flows, can delete those records where delete flag is set to 'Y'.
Back to top
View user's profile Send private message
5zan
PostPosted: Mon Aug 11, 2008 10:43 pm    Post subject: yep Reply with quote

Novice

Joined: 08 Jul 2008
Posts: 24

yes thats an alternative . But i guess there should be something as a locked access to the database in a single thread through the broker !!

Hmmph !!

Any clues ? lemme know plz !
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Tue Aug 12, 2008 3:06 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

Your transaction boundary is not atomic...
The atomic transaction would be:

get 1 record for update (dblock), process the record, delete the record.

What you do is get all records, process records, delete ALL records.... Which is precisely what got you into this mess.

You delete all records instead of deleting the processed records.
Your transaction is not atomic and does not care for threading or multiple threads... either.

You have a nice design problem here... Fix it!
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » TRANSACTION PROBLEM
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.