Deleting workflows in Alfresco


I tried to find out how to delete completed workflows in Alfresco, but I find no way to do that. I’m talking about HUGE number of completed workflows – a thousands. There are many questions on that topic, but no solution. I tried to play with Workflow console, also tried Alfresco Workflow Purge webscript by Rothbury software and also tried to write own deleters based on Workflow service (more on this next time), but no success at all. In better cases process dies with „out of memory“, or completely locks Alfresco in worst cases. So I choose hardcore solution – to delete database tables. And it works :-).

I’m talking about 10 tables, which are bind with foreign keys. So to remove ALL workflows follow those steps (note I’m not responsible for data loses, you’re on your own, so backup carefully!):

  1. Stop Alfresco and stop mysql
  2. Do backups – at least alf_data and /var/lib/mysql
  3. Start mysql and open mysql client
  4. Turn off foreign key checking: SET FOREIGN_KEY_CHECKS=0;
  5. Truncate following tables:
    • JBPM_TOKEN
    • JBPM_TOKENVARIABLEMAP
    • JBPM_TASKINSTANCE
    • JBPM_SWIMLANEINSTANCE
    • JBPM_PROCESSINSTANCE
    • JBPM_MODULEINSTANCE
    • JBPM_LOG
    • JBPM_BYTEBLOCK
    • JBPM_BYTEARRAY
    • JBPM_VARIABLEINSTANCE
  6. Maybe it’s good idea to set index.recovery.mode to FULL
  7. Start Alfresco and hope everything is well
  8. Turn off reindexing set in step 6

Simple yet effective. Please, let me know, if it works on your Alfresco too. I tested it od Community versions 3.4.e, 3.4.d and 4.1.0 (built from svn).


7 komentářů: “Deleting workflows in Alfresco”

  1. I’m not sure if this suits you, but we took a different approach so that a script could periodically be triggered to remove completed/ended workflows.

    We had to extend the org.alfresco.repo.workflow.jbpm.JBPMEngine class so that we could create our own ‚getInactiveWorkflows‘ method from which we could access from a serverside javascript.

    Are you interested?

  2. Hi Tom, I’m running script now with cron, but with huge amount of completed workflows it didn’t work (it hung up on workflowService.getAssignedTasks). So I need to clean old workflows first to get this script able to work :-). But your solution sounds like one step further, so if you can share it…it would be nice!

  3. Sure thing. I’ll try and get something with more detail published. Stay tuned.

  4. Thank you, Tom. Unfortunately, we left the workflows way, but I’ll bookmark that thread for future :-).
    FTR and things around were implemented by colleague of mine, I’m just an audience and he’s not writing anything.

Napsat komentář

Vaše e-mailová adresa nebude zveřejněna. Vyžadované informace jsou označeny *