On Tuesday, February 12, 2013 5:39:10 PM UTC-6, John Mettraux wrote:
>
>
> Hello Iuri, 
>
> thanks I'm fine, I hope you're doing fine as well. 
>
>
I'm fine as well, thanks.
 

> What version of Ruby and ruote do you use? On which platform? What is the 
> database and it's version, if it's MySQL, are you using the msyql or the 
> mysql2 adapter? 
>

I am using latest MRI ruby 1.9.3 on OSX Lion and MySQL 5.5, with ruote 
2.3.0.1 and ruote-sequel 2.3.0. ruote-sequel is using sequel gem version 
3.42.0.


> May I see what this lock looks like? Do you mind if I integrate it in 
> ruote-sequel if necessary? 
>
>
Yes. I will post gist and reference it in this thread in the a.m. I would 
be more than happy to contribute to this project.
 

>
> The most likely scenario is that my locking scheme for ruote-sequel is 
> horribly wrong. 
>
>
So far, only locking mechanism that I see is the reserve method on the 
storage participant and uniqueness on primary key in table (which does not 
protect from same expid). I think the reserve method does its job well and 
problem is coming from the expressions ( I don't think there is any reserve 
method for the expressions, but I might be mistaken). So far I came up with 
three approaches to solve the problem:

1. Change primary keys on table so that expressions with same expid cannot 
be inserted. every time duplication happens, participants have same expid 
which does not make sense, since the expid structure looks like tree, and 
none of the nodes should have same number ( 0_0 and 0_0 (bad) vs 0_0 and 
0_1 (good) ). 
2. implement reserve for expressions and any other "storage reads" done by 
worker that will result in new data being inserted in storage. 
3. add locked or with_locking or exclusively method to storage and refactor 
Ruote::Wroker#run method to call step method using that (or refactore step 
to use with_locking method). for example
----
def run
  while allowed_to_run?
    @storage.with_locking do
      step   # sleeping logic needs to be extracted outside of locking 
block so we dont sleep while storage is locked.
    end
    sleep(@sleep_time)
  end
end
-------
 
Thanks,
Iuri

-- 
-- 
you received this message because you are subscribed to the "ruote users" group.
to post : send email to [email protected]
to unsubscribe : send email to [email protected]
more options : http://groups.google.com/group/openwferu-users?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"ruote" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to