I have upgraded my flowable version to 6.8.0 from 6.6.0. I am trying to write a script that would delete historic data.
I have created HistoricProcessInstanceQuery as -
HistoricProcessInstanceQuery query = processEngineConfiguration.getHistoryService()
.createHistoricProcessInstanceQuery()
.startedBefore(date);
query.deleteSequentiallyUsingBatch(2, "historic-data-deletion")
But this is not working. HistoricProcessInstanceQuery is successfully getting created and I am getting intended data as well but deleteSequentiallyUsingBatch
function is not working. Although query.deleteWithRelatedData()
is working perfectly fine.
I have upgraded the flowable version but not the DB version. Can somebody please help me with this?
Also i would like to mention while upgrading flowable from 6.6.0 to 6.8.0 the flowable properties that are set in my spring boot application is-
flowable.idm.enabled=false
flowable.database-schema-update=false
flowable.check-process-definitions=true
Please help me with this issue
Further debugging the issue, and checking the sql history I see that few insert queries are getting triggered internally and delete query is never triggered.
select count(distinct RES.ID_)
from ACT_HI_PROCINST RES
left outer join ACT_RE_PROCDEF DEF on RES.PROC_DEF_ID_ = DEF.ID_
WHERE RES.START_TIME_ <= '2023-07-12 00:00:00';
insert into ACT_GE_BYTEARRAY(ID_, REV_, NAME_, BYTES_, DEPLOYMENT_ID_)
values (
'd6f9a5a1-3681-11ee-a880-aaaf421bc944',
1,
'batchDocumentJson',
_binary'{"numberOfInstances":1,"batchSize":1,"sequential":true,"query":{"startedBefore":"2023-07-11T18:30:00.000Z"}}',
null
);
insert into ACT_RU_JOB (
ID_,
REV_,
CATEGORY_,
TYPE_,
LOCK_OWNER_,
LOCK_EXP_TIME_,
EXCLUSIVE_,
EXECUTION_ID_,
PROCESS_INSTANCE_ID_,
PROC_DEF_ID_,
ELEMENT_ID_,
ELEMENT_NAME_,
SCOPE_ID_,
SUB_SCOPE_ID_,
SCOPE_TYPE_,
SCOPE_DEFINITION_ID_,
CORRELATION_ID_,
RETRIES_,
EXCEPTION_STACK_ID_,
EXCEPTION_MSG_,
DUEDATE_,
REPEAT_,
HANDLER_TYPE_,
HANDLER_CFG_,
CUSTOM_VALUES_ID_,
CREATE_TIME_,
TENANT_ID_)
values ('d6f9ccb5-3681-11ee-a880-aaaf421bc944',
1,
null,
'message',
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
'd6f9ccb4-3681-11ee-a880-aaaf421bc944',
3,
null,
null,
null,
null,
'delete-historic-processes-sequential',
'd6f9a5a3-3681-11ee-a880-aaaf421bc944',
null,
'2023-08-09 12:26:18.044',
''
)
INSERT INTO FLW_RU_BATCH(ID_, REV_, TYPE_, SEARCH_KEY_, SEARCH_KEY2_, CREATE_TIME_, COMPLETE_TIME_, STATUS_, BATCH_DOC_ID_, TENANT_ID_)
VALUES ('d6f9a5a2-3681-11ee-a880-aaaf421bc944',
1,
'historicProcessDelete',
'historic-data-deletion',
null,
'2023-08-09 12:26:18.043',
null,
'inProgress',
'd6f9a5a1-3681-11ee-a880-aaaf421bc944',
null)
INSERT INTO FLW_RU_BATCH_PART(ID_, REV_, BATCH_ID_, TYPE_, SCOPE_ID_, SUB_SCOPE_ID_, SCOPE_TYPE_, SEARCH_KEY_, SEARCH_KEY2_, STATUS_, CREATE_TIME_, COMPLETE_TIME_, RESULT_DOC_ID_, TENANT_ID_)
VALUES ('d6f9a5a3-3681-11ee-a880-aaaf421bc944',
1,
'd6f9a5a2-3681-11ee-a880-aaaf421bc944',
'deleteProcess',
null,
null,
null,
'0',
null,
'waiting',
'2023-08-09 12:26:18.043',
null,
null,
null)
My guess is internally only half of the queries are getting triggered. Any suggestions on why that might be happening?