[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mysql
Subject:    Re: timing problem
From:       Nuno Pereira <nuno.pereira () carclasse ! pt>
Date:       2005-09-29 15:35:36
Message-ID: 433C09C8.9060209 () carclasse ! pt
[Download RAW message or body]

Tony Leake wrote:
> On Thu, 2005-09-29 at 16:15 +0100, Nuno Pereira wrote:
> 
>>SGreen@unimin.com wrote:
> 
> 
>>This one is interesting in terms of concurrency...
>>
>>Is the app2 the one responsable for setting the flag? I supose that it is.
>>If that happens it's important that app2 doesn't mess with the flag, i 
>>mean, it may lead to problems if app2 sees that app1 writes the sales 
>>data, app2 sees it, starts reading it, app1 writes more data and app2 
>>sets the flag without seeing that app1 have written more data, and sets 
>>the flag without reading the new one.
>>
>>Make this work without problems can be tricky, and I don't see a good 
>>solution to this in five minutes. When app2 reads data what app does 
>>with it? How app2 sees what was the last data she read?
>>
>>-- 
>>Nuno Pereira
>>
> 
> 
> I don't think there is any concurency problem:
> 
> App 2 sets the flag and then polls for it to be unset, it is unset by
> app 1 when it has written all of the sales data. meanwhile app 2 is
> polling for the flag to be unset again and does nothing until it is, if
> app 1 dies before unsetting the flag app then app 2 will sit in a loop
> forever.

That isn't true if you are using transactions.

> when the flag is unset, app 2 reads it, process it and posts it to a
> website via xmlrpc
> 
> app 2 site in a shell script while loop: (pseudocide)
> 
> while (1){
>  start app 2
> sleep (60)
> }
> 
> so there can never be more than one instance of app 2 running. 
> 
> tony

You may be right, but app2 is running while app1 is...

You know better if there are problems...

-- 
Nuno Pereira

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/mysql?unsub=mysql@progressive-comp.com

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic