Maor Lipchuk has uploaded a new change for review. Change subject: core: Execute clear tasks with new thread. ......................................................................
core: Execute clear tasks with new thread. clearAsyncTasksWithOutVdsmId is executed at the finally step when executing a vdc command. If the execute phase encountered a problem, the engine roll backs the transaction and we can not use it any more. Since the clearAsyncTasksWithOutVdsmId uses calls to the DB, the engine throws a non-transaction exception, and the original exception does not flow to the user. The proposed solution is to clear the async tasks with a new transaction, so it will not be dependent on the related execute phase. Change-Id: I3434c2dbd605e741b2cfbbede8c4a120f21ca9fe Bug-Url: https://bugzilla.redhat.com/1037441 Signed-off-by: Maor Lipchuk <[email protected]> --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CommandBase.java 1 file changed, 14 insertions(+), 5 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/24/23724/1 diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CommandBase.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CommandBase.java index 3588e6f..d854ccc 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CommandBase.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CommandBase.java @@ -362,11 +362,20 @@ } private void clearAsyncTasksWithOutVdsmId() { - for (Guid asyncTaskId : getReturnValue().getTaskPlaceHolderIdList()) { - AsyncTasks task = getAsyncTaskDao().get(asyncTaskId); - if (task != null && Guid.isNullOrEmpty(task.getVdsmTaskId())) { - AsyncTaskManager.removeTaskFromDbByTaskId(task.getTaskId()); - } + if (getReturnValue().getTaskPlaceHolderIdList().size() > 0) { + TransactionSupport.executeInNewTransaction(new TransactionMethod<Object>() { + @Override + public Void runInTransaction() { + for (final Guid asyncTaskId : getReturnValue().getTaskPlaceHolderIdList()) { + AsyncTasks task = getAsyncTaskDao().get(asyncTaskId); + if (task != null && Guid.isNullOrEmpty(task.getVdsmTaskId())) { + AsyncTaskManager.removeTaskFromDbByTaskId(task.getTaskId()); + } + + } + return null; + } + }); } } -- To view, visit http://gerrit.ovirt.org/23724 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I3434c2dbd605e741b2cfbbede8c4a120f21ca9fe Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Maor Lipchuk <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
