My Dear debuggers,
Here is a new posting about a situation I thing this may comes up in the most BPM setups.
My customer installed a new snapshot and later, he migrated the instances from the last snapshot to the new one - nothing out of the ordinary.
As a next step, they deactivated the old snapshot and tried to delete it using the wsadmin command,
wsadmin>AdminTask.BPMDeleteSnapshot('[-containerAcronym ABC -containerSnapshotAcronyms [ABCV81]]')
but they faced the following error
WASX7017E: Exception received while running file "/usr/local/bin/bpm_deletesnapshot.py"; exception information:
java.lang.Exception: java.lang.Exception: You cannot delet e a snapshot that is referenced by tasks belonging to BPD instances referencing
As you know there are some conditions that should be fulfilled to be able to delete a snapshot
* The snapshot must exist
* The snapshot must be inactive
* The snapshot must have no running instances
* The snapshot must not be deployed
* On IBM BPM Advanced, any business-level applications that are related to the snapshot must be uninstalled before you can delete the snapshot.
We checked the records in BPMDB, the migrated BPD instances were still associated to previous shanpshot and those statuses were still active. However, after migration there's no instance for snapshot ABCV81. We checked that as follows
wsadmin>print AdminTask.BPMShowProcessApplication('[-containerAcronym ABC]')
Name: Bla Bla Bla
List of Snapshots:
Created On: 2016-09-30 15:32:51.087
Created By: User.X
Is Default: false
No of running instances: 0
Created On: 2016-09-30 15:35:38.86
Created By: User.X
Is Default: true
No of running instances: 1
Why there still exist a task in the DB? And how can we delete the old snapshot?
Well, the problem is related to the application. You can see from the sample, there are 2 Human Services containing Human Tasks.
The Human Task in HS1 was started and finished in the old snapshot, so the execution token is on HS2 when the instance migration happened.
If there is a task which has been completed in an old snapshot_A, and then the instance is migrated to snapshot_B, the problem happens when you try to delete snapshot_A subsequently. The reason is because the completed task will NOT be migrated with the instance together (by BPM design), it will leave on snapshot_A.
In this way, snapshot_A cannot be deleted since there still exist a running instance on it. And the reason that snapshot_A is also related to this instance after migration is because snapshot_A has a completed task on the certain instance.
As a conclusion of that we have to delete the completed task first to remove the link to snapshot_A before we can delete the snapshot itself.
The deletion of the completed task will lose the track of tasks in the DB. We run a fast test in the lab and it will not have some impact to the future tasks.
The instances can be run till the end without problems.
Anyway, it was not an official and detailed test, so we cannot be sure by 100% that it will not have some impact to the future tasks. So it depends on the user whether to
proceed with the available work around or not.
The possible workaround is as follows:
Run the BPMTasksCleanup command to delete the completed tasks from the running process instances.
Afterwards it should be possible to delete snapshot_A correctly.
If this procedure seems to be to risky, the official way to resolve this problem is to wait till the instance completed and then delete the old snapshot.
Next time you run into such kind of problems remember on that posting, maybe it's the solution already.
And if this does not help, take two of these and call me in the morning.
Your Dr. Debug