Liron Aravot has posted comments on this change.

Change subject: core: WIP : RemoveImageDisk - race when updating snapshots ovf 
(#828192)
......................................................................


Patch Set 4: (2 inline comments)

....................................................
File 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveImageCommand.java
Line 103: 
Line 104:     private void removeImageFromDB() {
Line 105:         final DiskImage diskImage = getDiskImage();
Line 106: 
Line 107:         updateSnapshotConfigWithoutImage(diskImage.getId());
it can't be moved into the same transaction. the lock is performed on the each 
snapshot separately and released in order to avoid starvation - in a case of 
removal of two disks simultaneously when one of them is done with 'removing' 
itself from a snapshot, the other disk will be able to acquire lock on that 
snapshot and proceed with the ovf update as well. if we acquire lock on all 
snapshots at first and try to remove N disks from M snapshots for example, the 
last one will have to wait N*M - that's the situation i'm trying to avoid.
Line 108:         
TransactionSupport.executeInScope(TransactionScopeOption.Required,
Line 109:                 new TransactionMethod<Object>() {
Line 110:                     @Override
Line 111:                     public Object runInTransaction() {


Line 190:     private EngineLock snapshotEngineLock = new EngineLock();
Line 191:     private Map<String, String> snapshotsExlusiveLockMap = new 
HashMap<String, String>();
Line 192: 
Line 193:     private void lockSnapshotWithWait(Guid snapshotId) {
Line 194:         snapshotsExlusiveLockMap.clear();
because i acquire the lock for every snapshot separately, so no need to create 
the map few times and not just keep one instance of it (as we will use it 
anyway).
Line 195:         snapshotsExlusiveLockMap.put(snapshotId.toString(), 
LockingGroup.SNAPSHOT.name());
Line 196:         
snapshotEngineLock.setExclusiveLocks(snapshotsExlusiveLockMap);
Line 197:         getLockManager().acquireLockWait(snapshotEngineLock);
Line 198:     }


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

Gerrit-MessageType: comment
Gerrit-Change-Id: Iccb44f1aa9d204477955343167133849a4146753
Gerrit-PatchSet: 4
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Liron Aravot <lara...@redhat.com>
Gerrit-Reviewer: Allon Mureinik <amure...@redhat.com>
Gerrit-Reviewer: Ayal Baron <aba...@redhat.com>
Gerrit-Reviewer: Daniel Erez <de...@redhat.com>
Gerrit-Reviewer: Liron Aravot <lara...@redhat.com>
Gerrit-Reviewer: Maor Lipchuk <mlipc...@redhat.com>
Gerrit-Reviewer: oVirt Jenkins CI Server
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to