-
Bug
-
Resolution: Done
-
Major
-
6.3.3, 6.4.0
-
- Any supported database (reproduced with MySQL and Postgres only)
-
Release Notes
-
-
-
-
-
-
CR1
-
-
-
When you have more than 150 records on *Log tables and try to delete the history using the REST API:
curl -X POST -u 'bpmsAdmin:redhat2014!' http://localhost:8080/business-central/rest/history/clear
The server hangs and never finish the request. We can see a transaction timeout in logs (expected since it takes more than 5 minutes, the default transaction timeout in JBoss EAP)
Checking the sources, we see that the code tries to delete record by record and it is not good when we have more 200k registers in each table. Check the JPAAuditLogService clear method:
Unable to find source-code formatter for language: java. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
@Override public void clear() { EntityManager em = getEntityManager(); Object newTx = joinTransaction(em); try { List<ProcessInstanceLog> processInstances = em.createQuery("FROM ProcessInstanceLog").getResultList(); for (ProcessInstanceLog processInstance: processInstances) { em.remove(processInstance); } List<NodeInstanceLog> nodeInstances = em.createQuery("FROM NodeInstanceLog").getResultList(); for (NodeInstanceLog nodeInstance: nodeInstances) { em.remove(nodeInstance); } List<VariableInstanceLog> variableInstances = em.createQuery("FROM VariableInstanceLog").getResultList(); for (VariableInstanceLog variableInstance: variableInstances) { em.remove(variableInstance); } } finally { closeEntityManager(em, newTx); } }
May we instead use a direct command to clean these tables?
- clones
-
RHPAM-292 Endpoint /history/clear not responsive
- Closed