Ciao Fabio,

Our client is using a little bit weird construction as that every main account 
can have multiple linked subaccounts (I didn’t invent it;). For this reason 
when a subaccount is created the first time a linked main account (with 
different attributes) is also created. The two are linked by setting the id of 
the other in an attribute, like this:

main-account
id: 1
primary-sub-account-id: 2

sub-account
id: 2
main-account-id: 1

Because we do not have the id’s before an account is created the flow is:

1. create main-account
2. get generated id from main-account
3. create sub-account with attribute main-account-id = id from step 2
4. get generated id from sub-account
5. update main-account by setting attribute primary-sub-account-id = id from 
step 4

So step 1 and 5 will trigger two provisioning actions on the same record in a 
very short time.

Probably not what Syncope was designed for….

saluti,
Rob


On 6 mrt. 2015, at 14:28, Fabio Martelli <[email protected]> wrote:

> Il 06/03/2015 13:35, Rob van de Meulengraaf ha scritto:
>> Hi,
>> 
>> Our client is having some problems with the ScriptedSQL connector. In some 
>> cases it tries to do a create in an external database instead of the 
>> expected update. This will throw an exception that the entry is already 
>> existing.
>> 
>> Our flow is:
>> 1. Create account 1
>> 2. Create account 2
>> 3. Update attribute in account 1 with the ID from account 2 (link account2 
>> to account1)
>> 
>> In can see that in AbstractPropagationTaskExecutor the flow is:
>> 1. find entry to be updated
>> 2. if not found do create
>> 3. if found do update
>> 
>> Apparently there are some timing issues between the find and the 
>> create/update when doing two propagations quick after each other. They 
>> probably run in parallel? I does not happen always, only under some load.
>> 
>> I subclassed PriorityPropagationTaskExecutor and have overridden the execute 
>> method with a synchronized version and this seems to stop the problem:
>> 
>>  @Override
>>  public synchronized TaskExec execute(PropagationTask task, 
>> PropagationReporter reporter) {
>>  return super.execute(task, reporter);
>>  }
>> 
>> However that will probably slow down as all propagations are now sequential?
>> 
>> Any ideas for a better solution or workaround? Or is my solution correct?
>> 
>> We use Syncope 1.1.8
>> 
>> Thanks,
>> Rob
> Hi Rob, this sounds a little bit weird. Before apply your solution I do think 
> you have to try to find out the real cause of your problem.
> Can you explain better why you have two propagation tasks executed 
> concurrently on the same resource/account?
> Can you provide more details about your configuration?
> 
> Best regards,
> F.
> 
> -- 
> Fabio Martelli
> 
> Tirasa - Open Source Excellence
> http://www.tirasa.net/
> 
> Apache Syncope PMC
> http://people.apache.org/~fmartelli/

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

Reply via email to