Differences in History tables

Hello,

Creating some simple queries in the Camunda mysql database, I’ve noticed some differences between the data in two historical tables (i.e. ACT_HI_TASKINST and ACT_HI_ACTINST).

For instance for a task entry the END_TIME_ field has been correctly inserted in the ACT_HI_ACTINST table but it has remained NULL into the corresponding row in the ACT_HI_TASKINST table.

What could be the reason for these differences ?
Do you know on which table the HistoryService will do its searches for instance when looking for active tasks as in
historyService.createHistoricProcessInstanceQuery() .superProcessInstanceId(superProcessInstanceId) .active() .singleResult();

Is the “active()” search based exclusively on the END_TIME_ field being equal to null or is it based on any other field / table ?

Our application is looking for the “active” tasks and sometimes we are getting back also tasks that have indeed already been completed but they still have a END_TIME_ null in the ACT_HI_TASKINST

Thanks to whom could shed some light on this issue.

Hi @mfmanca,

  • Task Instances point to user tasks only.
  • Activity Instances point to all kinds of activities including user tasks (service task, call activity…)
  • Process Instance is an instance of a process definition and it lasts until the execution of the whole process is ended.

Method active() returns not suspended instances whereas method unfinished() returns unfinished instances. Also keep in mind that by using createHistoricProcessInstanceQuery, you are querying historic process instances (not task or activity instances)

Thank you @hassang .
I don’t know yet why the developers have chosen to query the HistoryService but I have to cope with that decision.

Do you know what could cause an activity END_TIME_ to be correctly set in the ACT_HI_ACTINST but the same activity (indeed a user task) was still having a null END_TIME_ in the ACT_HI_TASKINST.

Do you know if sometimes a “set completed command” could not entirely be reflected in all the history tables ?

This looks weird. Could you please share the steps with a simple model to reproduce the same.

Almost impossible to reproduce.
It’s something that is happening on 10% of processes (according to the users in Production) and we are not able to reproduce it consistently.

Moreover I wouldn’t be able to extract just the Java code to recreate the steps but thanks already for the time you’ve taken replying.
Appreciated.