Michael Kublin has uploaded a new change for review. Change subject: engine: Removing opening of global transaction from endAction ......................................................................
engine: Removing opening of global transaction from endAction The following patch will remove code that should open a global transaction over endAction. Meaning , by calling endAction no transaction will be open by default. Now, this is done in order to improve performance, supportabillity of code and simplify a flows. Also, open a global transaction should not be default behaviour, also we have a simple API for opening trnsaction for couple operation. The operations under same transaction should be only different updates of DB, no http calls, not locked section, no any other "cool stuff" The following patch can cause regression at some flows, so such flows should be fixed, we can not stop and not to introduce changes which will improve all system, because we have some bad flows, so such flow should be fixed. This is a first step, a second is disable all global transactions Change-Id: Ic4c114d4d3072b8b9213d73cf8e155d98c5fbef6 Signed-off-by: Michael Kublin <[email protected]> --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CommandBase.java 1 file changed, 4 insertions(+), 23 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/10/12010/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 e9bce6f..3eba1c2 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 @@ -9,8 +9,6 @@ import java.util.Map; import javax.ejb.TransactionRolledbackLocalException; -import javax.transaction.Status; -import javax.transaction.SystemException; import javax.transaction.Transaction; import org.apache.commons.lang.StringUtils; @@ -285,7 +283,6 @@ private String _description = ""; private TransactionScopeOption scope; - private TransactionScopeOption endActionScope; public VdcReturnValueBase canDoActionOnly() { setActionMessageParameters(); @@ -426,7 +423,7 @@ try { setActionState(); handleTransactivity(); - TransactionSupport.executeInScope(endActionScope, this); + TransactionSupport.executeInScope(TransactionScopeOption.Suppress, this); } catch (TransactionRolledbackLocalException e) { log.infoFormat("EndAction: Transaction was aborted in {0}", this.getClass().getName()); } finally { @@ -442,16 +439,11 @@ scope = (getParameters() != null) ? getParameters().getTransactionScopeOption() : TransactionScopeOption.Required; - endActionScope = scope; boolean forceCompensation = getForceCompensation(); // @NonTransactiveAttribute annotation overrides the scope passed by the // command parameters if (!getTransactive()) { scope = TransactionScopeOption.Suppress; - - // Set the end action scope to suppress only for non-compensating commands, or the end action for commands - // will run without transaction but compensation is not supported for end action. - endActionScope = forceCompensation ? endActionScope : scope; } if (getCompensationContext() == null) { @@ -488,23 +480,12 @@ exceptionOccurred = true; throw e; } finally { - if (TransactionSupport.current() == null) { - - // In the unusual case that we have no current transaction, try to cleanup after yourself and if the - // cleanup fails (probably since the transaction is aborted) then try to compensate. + if (exceptionOccurred) { + compensate(); + } else { try { cleanUpCompensationData(); } catch (RuntimeException e) { - logExceptionAndCompensate(e); - } - } else { - try { - if (!exceptionOccurred && TransactionSupport.current().getStatus() == Status.STATUS_ACTIVE) { - cleanUpCompensationData(); - } else { - compensate(); - } - } catch (SystemException e) { logExceptionAndCompensate(e); } } -- To view, visit http://gerrit.ovirt.org/12010 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ic4c114d4d3072b8b9213d73cf8e155d98c5fbef6 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Michael Kublin <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
