Liron Ar has posted comments on this change. Change subject: core: updateAllInBatch - sorting/transaction issues ......................................................................
Patch Set 2: (2 comments) http://gerrit.ovirt.org/#/c/28909/2//COMMIT_MSG Commit Message: Line 6: Line 7: core: updateAllInBatch - sorting/transaction issues Line 8: Line 9: *If there's no transaction, sorting is unneeded as deadlock can't occur Line 10: as each statement will be executed independently. > which statement will e executed independently? each update statement of the batch update Line 11: Line 12: *When the collection is sorted, the sorted result need to be passed to Line 13: the update and not the unsorted collection as being done today. Line 14: http://gerrit.ovirt.org/#/c/28909/2/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/MassOperationsGenericDaoDbFacade.java File backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/MassOperationsGenericDaoDbFacade.java: Line 55: Collection<T> paramValues, Line 56: MapSqlParameterMapper<T> mapper) { Line 57: Line 58: // To overcome possible deadlocks, we need to sort the collection if the code is executed in transaction Line 59: if (TransactionSupport.current() != null) { > Why is that? Can't 2 different sections of the code run the batch update, r When running without transaction. the updates are done separately as db local transaction so you shouldn't have chance of deadlock because of different order between transactions..so in that case we can save the sorting. Line 60: List<T> sortedParamValues = new ArrayList<>(paramValues); Line 61: Collections.sort(sortedParamValues, BusinessEntityComparator.<T, ID> newInstance()); Line 62: paramValues = sortedParamValues; Line 63: } -- To view, visit http://gerrit.ovirt.org/28909 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I935555bae208786e64f109e267749eafea57fb60 Gerrit-PatchSet: 2 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Liron Ar <lara...@redhat.com> Gerrit-Reviewer: Allon Mureinik <amure...@redhat.com> Gerrit-Reviewer: Daniel Erez <de...@redhat.com> Gerrit-Reviewer: Eli Mesika <emes...@redhat.com> Gerrit-Reviewer: Liran Zelkha <lzel...@redhat.com> Gerrit-Reviewer: Liron Ar <lara...@redhat.com> Gerrit-Reviewer: Maor Lipchuk <mlipc...@redhat.com> Gerrit-Reviewer: Yair Zaslavsky <yzasl...@redhat.com> Gerrit-Reviewer: automat...@ovirt.org Gerrit-Reviewer: oVirt Jenkins CI Server Gerrit-HasComments: Yes _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches