如何删除没有结束时间的Camunda历史流程实例?

How to delete a Camunda historic process instance without an end time?

不知何故,我的数据库中有一个没有结束时间的历史流程实例。

条目如下所示:

ACT_HI_PROCINST (ID_, PROC_INST_ID_, BUSINESS_KEY_, END_TIME_)
VALUES ('0c128aec-e6f0-11e6-bc94-5456dbfc2b09', '0c128aec-e6f0-11e6-bc94-5456dbfc2b09', '3bc71b87-7134-4ead-8493-4c0f11d635be', null);

当我尝试删除具有 DELETE HTTP request to the REST interface 的历史流程实例时,出现此错误:

ERROR [org.camunda.bpm.engine.context] (default task-7) ENGINE-16004 Exception while closing command context: Process instance is still running, cannot delete historic process instance: 0c128aec-e6f0-11e6-bc94-5456dbfc2b09: instance.getEndTime() is null: org.camunda.bpm.engine.exception.NullValueException: Process instance is still running, cannot delete historic process instance: 0c128aec-e6f0-11e6-bc94-5456dbfc2b09: instance.getEndTime() is null
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
    at org.camunda.bpm.engine.impl.util.EnsureUtil.generateException(EnsureUtil.java:329)
    at org.camunda.bpm.engine.impl.util.EnsureUtil.ensureNotNull(EnsureUtil.java:49)
    at org.camunda.bpm.engine.impl.util.EnsureUtil.ensureNotNull(EnsureUtil.java:44)
    at org.camunda.bpm.engine.impl.cmd.DeleteHistoricProcessInstanceCmd.execute(DeleteHistoricProcessInstanceCmd.java:49)
    at org.camunda.bpm.engine.impl.interceptor.CommandExecutorImpl.execute(CommandExecutorImpl.java:24)
    at org.camunda.bpm.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:95)
    at org.camunda.bpm.engine.impl.interceptor.JtaTransactionInterceptor.execute(JtaTransactionInterceptor.java:58)
    at org.camunda.bpm.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:30)
    at org.camunda.bpm.engine.impl.HistoryServiceImpl.deleteHistoricProcessInstance(HistoryServiceImpl.java:99)
    at org.camunda.bpm.engine.rest.sub.history.impl.HistoricProcessInstanceResourceImpl.deleteHistoricProcessInstance(HistoricProcessInstanceResourceImpl.java:53)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)

如何在 Java 或通过 HTTP 中删除没有结束时间的历史流程实例?

流程实例未完成。我认为你只能删除实例。 https://docs.camunda.org/manual/7.6/reference/rest/process-instance/delete/

您还可以降低历史级别以获取较少的数据https://docs.camunda.org/manual/7.6/user-guide/process-engine/history/#set-the-history-level