cancel
Showing results for 
Search instead for 
Did you mean: 

Alfresco Script and long running transactions

eureka
Champ in-the-making
Champ in-the-making
Hi all,

I've tried to search for this topic with no luck (I admit I was not so sure what to look for).

So here is my issue: I've to "adjust" a set of nodes (fixing some properties and move to a different path).

I usually do this with a simple javascript script that uses a lucene query to get the list of nodes and apply the logic I need to apply.

In this case the set of nodes overcome the limit of lucene search, so I've managed to get a csv of uuid from alfresco db. I've developed a script that splits the csv content line by line and apply the logic to each node.

The issue is that if the csv is small (100 lines or so) the script end and everything seem fine; if the csv is big (10000 lines or so) the script seems to end (I can see from the log I added) but it kinda has no effect, like it has not committed any changes.

Do you have any idea on the possible reasons of such a behaviour?

Do you any advice on a different way to implement such a script?

Thanks in advance,

Angelo
1 REPLY 1

rjohnson
Star Contributor
Star Contributor
I suggest you look at your error log, I suspect you will find a transacion buffer error (probably says warning but my experience is that it stops doing updates once you hit the warning). If I am correct then you problem is that your javascript is trying to do all the updates in one transaction and running out of transaction buffer space. You need to split it into multiple transactions.

Now, I have had this problem, but never found a way to split a single javascript execution into multiple transactions. I think you can do wthis by executing actions against each record because I believe (only from what I have read) that each action runs in a discrete transaction.

When I encountered this issue, in the end, I wrote a PHP script and did it via CMIS because each CMIS update is executed in a single transaction.