cancel
Showing results for 
Search instead for 
Did you mean: 

Need to purge data of activiti execution

sandeepkhatri01
Champ in-the-making
Champ in-the-making
I am new to activiti BPM. We have Activiti implemented in our project and I am seeing following tables are growing in the activiti.
ACT_HI_ACTINST 21,253,589
ACT_HI_DETAIL 18,867,706
ACT_HI_VARINST 18,867,705
ACT_HI_PROCINST 1,946,655
ACT_RU_VARIABLE 502,627
ACT_RU_EXECUTION 112,370
ACT_RU_IDENTITYLINK 56,307
I am of the understanding that after the workflow is finished, the variables associated with the workflow are deleted. But I still see half a million records in the my environment (ACT_RU_VARIABLE 502,627)
Similarly there are other tables which either needs to be purged or archived or both.
I wanted to know the best strategy to implement the purging in activiti.
Is there any script which comes with activiti which purges data?
6 REPLIES 6

trademak
Star Contributor
Star Contributor
All ACT_HI tables are history tables and will grow over time if you use a high history level. If you don't want any or less history information you can configure this in the history level. The ACT_RU tables are only for running instances, so they shouldn't grow (only if you start more instances than before).

Best regards,

I figured out the cause why I was seeing data growth in ACT_RU tables. Whenever some runtime exception comes like NullPointerException the process variables remain in ACT_RU table and when it completes normally it clears off from there.
I tried explicitly catching the exception and closed the execution by calling- ((ActivityExecution) execution).end(); but it is also not working.

Any pointer on this behaviour will be really helpful.

sandeepkhatri01
Champ in-the-making
Champ in-the-making
I was reading through the activit API and figured out the root cause. I am creating process variables at the process start up time and then executing service task asynchronusly. I am getting the runtime exception in service task which shall be running in transaction 2. (see the link below)
So, activiti process varibales were not rolled back.

Just wondering what is best stratgey to rollback process variables in this situation ?

http://www.activiti.org/userguide/index.html#bpmnConcurrencyAndTransactions

jbarrez
Star Contributor
Star Contributor
That is correct behaviour: the engine brings you back the latest stable state. Why would you want this different?

sandeepkhatri01
Champ in-the-making
Champ in-the-making
I have a requirement to delete all the leftover records from Runtime tables. The records remains in RU tables in cases where I am getting the runtime exception in service task which is running asynchronously.

jbarrez
Star Contributor
Star Contributor
About what data are we talking about? Activiti normally rolls back all data, also in the RU tables, when it encounters an exception