On 06/03/2015 13:35, Rob van de Meulengraaf wrote:
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

Hi Rob,
in principle, the whole propagation process is synchronous, as the PropagationTaskExecutor instance that is in use by a given deployment (PriorityPropagationTaskExecutor by default, or a subclass as in your case) is generally looping over all defined PropagationTask instances to be executed and invoking exactly the method you override above.

However, a PropagationTask execution will end up in calling the underlying connector, and such invocation is instead delegated to a Future task returned by AsyncConnectorFacade, which relies on Spring's @Async (this mainly for the ability to define a timeout on effective connector invocation).

So, briefly: I don't believe your solution is wrong, even if I am not 100% convinced it is the best solution for the general case. As explained, anyway, I don't see problems for slowing down the propagation process as you wonder above.

Regards.

--
Francesco Chicchiriccò

Tirasa - Open Source Excellence
http://www.tirasa.net/

Involved at The Apache Software Foundation:
member, Syncope PMC chair, Cocoon PMC, Olingo PMC
http://people.apache.org/~ilgrosso/

Reply via email to