There may be a need to change the security subject of a process instance (PI), after a BPM resource is deleted. You may use Openspace or replaceUser API for this purpose.
When using either of the methods, there is an option to replace all PIs related to a deleted user. When there are a large number of PIs owned by a deleted user, the replace all changes the owner for a few PIs.
Cause:
The process engine has a system level property that controls the result size from the database. Even though the replaceUser is initiated for all PIs, the process engine returns the number of PIs as per this system property.
v4.2.0 and prior, this system property is set on the BPMNode(s) JVM argument (if not set, default max result size is 500) -
com.tibco.bx.management.queryMaxResultSize=500
From 4.3, this system property is controlled using bx.properties file (location controlled by JVM argument - n2.config.location) -
# Maximum number of query results returned queryMaxResultSize=500
It is not recommended to change this system property due to these reasons - - This is a system property which applies to all queries to the process engine and not specific to replaceUser - Increasing the property can result in long-running SELECT statements on the BPM database.
Issue/Introduction
When a BPM resource is deleted, it is not expected that it still owns a high number of process instances. When there are more than 500 PIs, the replace all needs to be invoked multiple times.
Environment
ALL
Resolution
TIBCO recommends making repeat calls to replaceUser API until the owner of all the PIs, for the deleted user, is replaced.