Change in ovirt-engine[ovirt-engine-3.6.0]: engine: Update command associated entities instantly

tnisan at redhat.com tnisan at redhat.com
Mon Oct 19 12:01:44 UTC 2015


Tal Nisan has submitted this change and it was merged.

Change subject: engine: Update command associated entities instantly
......................................................................


engine: Update command associated entities instantly

The command associated entities shouldn't be considered as
part of any command's transaction.

The root cause of this bug is a difference between the behavior of
postgres 8.4 and 9.1.

In the described scenarios (and other similar to this issue as we faced
on AddVmTemplate) we have the following sequence:

On The main thread:
Open new transaction (either explicit or as default command's scope):
CommandCoordinatorUtil.executeAsyncCommand(...)
  |
  +-- coco.persistCommandAssociatedEntities(...)
      which internally updates command_assoc_entities table

On the submitted thread we calls:
  CommandBase.setCommandStatus()
  which updates the command_entities table.

The first update of 'command_assoc_entities' table is done on
transaction Tx1 a, which is open. While  Tx1 is open, the update for
'command_entities' is executed in other transaction Tx2.

In postgres 9.1, that scenario is permitted without any locking on the
command_entities table.

However in postgres 8.4, an update for 'command_entities' isn't
permitted, unless the referred table 'command_assoc_entities' is closed.

In order to make the code compliant for both postgres versions, the
first update to 'command_assoc_entities' should be immediately
committed.

Change-Id: I50496b6bdf0627f74b9458967a52323d377cea7a
Bug-Url: https://bugzilla.redhat.com/1264691
Signed-off-by: Moti Asayag <masayag at redhat.com>
---
M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/tasks/CommandsCacheImpl.java
1 file changed, 8 insertions(+), 1 deletion(-)

Approvals:
  Tal Nisan: Passed CI tests
  Daniel Erez: Looks good to me, approved
  Moti Asayag: Verified



-- 
To view, visit https://gerrit.ovirt.org/47457
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I50496b6bdf0627f74b9458967a52323d377cea7a
Gerrit-PatchSet: 2
Gerrit-Project: ovirt-engine
Gerrit-Branch: ovirt-engine-3.6.0
Gerrit-Owner: Moti Asayag <masayag at redhat.com>
Gerrit-Reviewer: Daniel Erez <derez at redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Moti Asayag <masayag at redhat.com>
Gerrit-Reviewer: Tal Nisan <tnisan at redhat.com>
Gerrit-Reviewer: automation at ovirt.org



More information about the Engine-commits mailing list