Hello,in our act_hi_actinst table, we have aprox 10.000 entries of the type userTask by now. However there are about 400 entries of the type "userTask", that have taskId set to null…
SELECT *
FROM `act_hi_actinst`
WHERE ACT_TYPE_ = 'userTask'
AND ISNULL( TASK_ID_ )
I compared the times of those entries, and figured out, that all those entries have been createdduring the time we have been using activiti 5.12. (now Running 5.13)So, is there any chance that there is a update step, we missed?Was this a known bug in Activiti 5.12?—Would it be save to "rebuild" those missing values? Or is Activiti internally threating "old" activiti instances different,
and requires that id to be null?I noticed, that all Tasks are available in the act_hi_taskinst table.So, I would aquire the taskId from there. After joining the tables on executionid, proc_inst_id and activiti_name i noticed, that this is not enough, if a task has been executedtwo (or more) times within the same process.But i was able to match on the Start_time also, which seems to produce the correct result.The following query will perform the readout of both Task_ids:- fetched directly from act_hi_actinst- fetched from act_hi_taskinst, using the described join.
SELECT
aha.ID_ ,
aha.PROC_INST_ID_,
aha.EXECUTION_ID_,
aha.ACT_NAME_,
aha.TASK_ID_ AS TASK_ID_FROM_ACTIVITI_,
aht.ID_ AS TASK_ID_FROM_TASK_TABLE_
FROM
`act_hi_actinst` aha
LEFT JOIN
`act_hi_taskinst` aht
ON
aha.PROC_INST_ID_ = aht.PROC_INST_ID_ AND
aha.ACT_NAME_ = aht.NAME_ AND
aha.START_TIME_ = aht.START_TIME_
WHERE
aha.ACT_TYPE_ = 'userTask'
For me that are 10.880 rows in total. So, now both TaskId columns SHOULD be equal OR produce null on the TASK_ID_FROM_ACTIVITI_ variable.However, i found some entries, having both ids given as Null. This means, that the join could not find the propert task in act_hi_taskinst,when taking process id, act_name and starttime as a join condition. Narrowing down the query to "those":
SELECT * FROM (SELECT
aha.ID_ ,
aha.PROC_INST_ID_,
aha.EXECUTION_ID_,
aha.ACT_NAME_,
aha.START_TIME_,
aha.TASK_ID_ AS TASK_ID_FROM_ACTIVITI_,
aht.ID_ AS TASK_ID_FROM_TASK_TABLE_
FROM
`act_hi_actinst` aha
LEFT JOIN
`act_hi_taskinst` aht
ON
aha.PROC_INST_ID_ = aht.PROC_INST_ID_ AND
aha.ACT_NAME_ = aht.NAME_ AND
aha.START_TIME_ = aht.START_TIME_
WHERE
aha.ACT_TYPE_ = 'userTask'
) as temp
WHERE
ISNULL(TASK_ID_FROM_TASK_TABLE_)
Those didn't match, because the Execution Time was slightly different (+/- some seconds)However, not matching on completion time would cause more troubles, because one task can be completed multiple timeswithin some processes…And for the very same reason it is quite hard to use a tolerance on the completion time to match the proper taskId.(Assignee could also be equal for this problem, therefore doesn't provide any additional constraint)So, how to rebuild the missing taskIDs best ?