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

masayag at redhat.com masayag at redhat.com
Mon Oct 19 09:25:28 UTC 2015


Moti Asayag 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:
  Ravi Nori: Looks good to me, but someone else must approve
  Daniel Erez: Verified; Looks good to me, approved
  Jenkins CI: Passed CI tests
  Oved Ourfali: Looks good to me, but someone else must approve



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

Gerrit-MessageType: merged
Gerrit-Change-Id: I50496b6bdf0627f74b9458967a52323d377cea7a
Gerrit-PatchSet: 3
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Moti Asayag <masayag at redhat.com>
Gerrit-Reviewer: Daniel Erez <derez at redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Maor Lipchuk <mlipchuk at redhat.com>
Gerrit-Reviewer: Moti Asayag <masayag at redhat.com>
Gerrit-Reviewer: Oved Ourfali <oourfali at redhat.com>
Gerrit-Reviewer: Ravi Nori <rnori at redhat.com>
Gerrit-Reviewer: automation at ovirt.org



More information about the Engine-commits mailing list