Yair Zaslavsky has uploaded a new change for review.

Change subject: core: compensation should not clean entities with associated 
tasks
......................................................................

core: compensation should not clean entities with associated tasks

Compensation should not execute on commands that have running tasks.
When such a command executes , its end flow may rely on entity that
got changed (and had an entry inserted for this change).
In general, such a situation should not occur, as after tasks are
created, the business_entity_snapshot records for the command
get cleaned, so this fix is in order to handle a case in which
engine crashes after tasks are created at vdsm, but the business
_entity_snapshot records for the command weren't yet cleaned.

Bug-Url: https://bugzilla.redhat.com/873697
Change-Id: Iec0941108ae66c6174626915a45f02ab0996cfea
Signed-off-by: Yair Zaslavsky <yzasl...@redhat.com>
---
M backend/manager/dbscripts/business_entity_snapshot_sp.sql
1 file changed, 2 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/22/9122/1

diff --git a/backend/manager/dbscripts/business_entity_snapshot_sp.sql 
b/backend/manager/dbscripts/business_entity_snapshot_sp.sql
index e5b64be..ac35c43 100644
--- a/backend/manager/dbscripts/business_entity_snapshot_sp.sql
+++ b/backend/manager/dbscripts/business_entity_snapshot_sp.sql
@@ -43,7 +43,8 @@
 $procedure$
 BEGIN
       RETURN QUERY SELECT distinct business_entity_snapshot.command_id, 
business_entity_snapshot.command_type
-      FROM business_entity_snapshot;
+      FROM business_entity_snapshot WHERE NOT EXISTS 
+      (select 1 from async_tasks where async_tasks.command_id = 
business_entity_snapshot.command_id);
 
 END; $procedure$
   LANGUAGE plpgsql;


--
To view, visit http://gerrit.ovirt.org/9122
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iec0941108ae66c6174626915a45f02ab0996cfea
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Yair Zaslavsky <yzasl...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to