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

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@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@redhat.com> Gerrit-Reviewer: Allon Mureinik <amureini@redhat.com> Gerrit-Reviewer: Daniel Erez <derez@redhat.com> Gerrit-Reviewer: Freddy Rolland <frolland@redhat.com> Gerrit-Reviewer: Idan Shaby <ishaby@redhat.com> Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Tal Nisan <tnisan@redhat.com> Gerrit-Reviewer: gerrit-hooks <automation@ovirt.org>
participants (1)
-
tnisan@redhat.com