Switching between history cleanup strategies

Hi everyone! We have some stale versions of a bpmn process definition deployed. For some of them there are incompleted process instances. We can not forcibly stop the instances and remove old versions. But we want to remove any historic data for completed instances. These process definition versions haven’t TTL set. For the latest deployed version the TTL is set :slight_smile: and current cleanup strategy is set to removalTimeBased.

  1. Will switching the cleanup strategy to endTimeBased lead(help) to remove history data for the completed process instances/vars and so on without TTL?
  2. Is it safe to switch cleanup strategy from removalTimeBased to endTimeBased and back to removalTimeBased for the production environment?

Hi Dmitriy,

Yes, please check (1) Changing the TTL of a definition also affects already written history data.

I personally won’t recommend that I would propose another option:
You could set the removal time via batch operation, you could find it as an option in the limitations of the removal strategy (2) However, it is possible to Set a Removal Time via Batch Operations.
Batch operation docs: Java API (3) and REST API (4). (Available in Cockpit only for enterprise edition (5))

I hope that helps.

(1): https://docs.camunda.org/manual/latest/user-guide/process-engine/history/#end-time-based-strategy
(2): https://docs.camunda.org/manual/latest/user-guide/process-engine/history/#removal-time-based-strategy
(3): https://docs.camunda.org/manual/latest/user-guide/process-engine/batch-operations/#set-a-removal-time
(4): https://docs.camunda.org/manual/develop/reference/rest/history/process-instance/post-process-instance-set-removal-time/
(5): https://docs.camunda.org/manual/latest/webapps/cockpit/batch/batch-operation/

Best regards,

Thanks a lot, Yana!