Change in ovirt-engine[master]: backend: improve getLunsToUpdateInDb

tnisan at redhat.com tnisan at redhat.com
Thu Sep 8 09:24:56 UTC 2016


Tal Nisan has submitted this change and it was merged.

Change subject: backend: improve getLunsToUpdateInDb
......................................................................


backend: improve getLunsToUpdateInDb

The method getLunsToUpdateInDb in
SyncLunsInfoForBlockStorageDomainCommand used to iterate over lunsFromDb
inside the iteration over lunsFromVgInfo, i.e run with a complexity of
O(n^2), and the method updateLunsInDb used to make one db call for each
update (existing lun that should be updated or a new lun).

This patch is responsible for the following things:
- Improves the complexity of getLunsToUpdateInDb to O(n) by using hash
  maps.
- Makes less db calls - two calls in the worst case, one for updating
  all the luns that need to be updated and one for new luns.
- Fixes a bug introduced by I9cfd2 - if lunsFromVgInfo had more luns
  than lunsFromDb, and it contained luns with a new pv id (not identical
  to any lun in lunsFromDb), they would not be updated (happens when a
  user manually extends a vg with a new pv without using oVirt).
  Now these luns will be updated.
- Previously, if lunsFromVgInfo and lunsFromDb contained the same number
  of luns, but one of the luns in lunsFromVgInfo had a new pv id, it
  wouldn't be updated. Now it will.
- Adds some tests to SyncLunsInfoForBlockStorageDomainCommandTest.

Change-Id: I6b3f790b7a5c7bbed75ed4346d4f958cca0ed153
Signed-off-by: Idan Shaby <ishaby at redhat.com>
---
M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/domain/SyncLunsInfoForBlockStorageDomainCommand.java
M backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/storage/domain/SyncLunsInfoForBlockStorageDomainCommandTest.java
2 files changed, 113 insertions(+), 78 deletions(-)

Approvals:
  Daniel Erez: Looks good to me, approved
  Jenkins CI: Passed CI tests
  Allon Mureinik: Looks good to me, but someone else must approve
  Idan Shaby: Verified



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

Gerrit-MessageType: merged
Gerrit-Change-Id: I6b3f790b7a5c7bbed75ed4346d4f958cca0ed153
Gerrit-PatchSet: 6
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Idan Shaby <ishaby at redhat.com>
Gerrit-Reviewer: Allon Mureinik <amureini at redhat.com>
Gerrit-Reviewer: Daniel Erez <derez at redhat.com>
Gerrit-Reviewer: Freddy Rolland <frolland at redhat.com>
Gerrit-Reviewer: Idan Shaby <ishaby at redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Tal Nisan <tnisan at redhat.com>
Gerrit-Reviewer: gerrit-hooks <automation at ovirt.org>



More information about the Engine-commits mailing list