Yair Zaslavsky has posted comments on this change.
Change subject: core: Migrate RuntimeInfo to use Batch Updates
......................................................................
Patch Set 1: (3 inline comments)
....................................................
File
backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/MassOperationsDao.java
Line 45: /**
Line 46: * Calls an update stored procedure multiple timse in a batch
Line 47: * @param procedureName
Line 48: * @param entities
Line 49: */
Liran, maybe we need a different approach here -
I would prefer to have updateAllInBatch(String procedureName, Collection<T>
paramValues) and have have a helper class for performing the converstion from T
to MapSqlParameterSource.
Line 50: void updateAllInBatch(String procedureName,
List<MapSqlParameterSource> paramValues);
....................................................
File
backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/MassOperationsGenericDaoDbFacade.java
Line 46: * Enables to send update procedure name as a parameter that
overrides the default
Line 47: * one.
Line 48: * In case this parameter is null the default procedure is used.
Line 49: */
Line 50: public void updateAllInBatch(String procedureName,
List<MapSqlParameterSource> paramValues) {
Ok, so we can use this class to what I thought about.
Have a method that converts T to MapSqlParametersSource (I think we have such
method in other Daos, please try and find it).
Line 51: getCallsHandler().executeStoredProcAsBatch(procedureName ==
null ? getProcedureNameForUpdate() : procedureName,
Line 52: paramValues);
Line 53: }
Line 54:
....................................................
File
backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/network/VmNetworkStatisticsDaoDbFacadeImpl.java
Line 60: };
Line 61: }
Line 62:
Line 63: @Override
Line 64: public void updateAllInTransaction(List<VmNetworkStatistics>
vmInterfaceStatisticsToSave) {
Here you basically implemented my idea from the previous comments.
Let's try to have it more "infrastructure".
Line 65: List<MapSqlParameterSource> paramValues = new
ArrayList<MapSqlParameterSource>();
Line 66:
Line 67: for (VmNetworkStatistics entity : vmInterfaceStatisticsToSave)
{
Line 68: MapSqlParameterSource paramValue = new
MapSqlParameterSource();
--
To view, visit http://gerrit.ovirt.org/16018
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I96dd3a2f407e36194c0ccf07a5a9c7e83be61d48
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Liran Zelkha <[email protected]>
Gerrit-Reviewer: Eli Mesika <[email protected]>
Gerrit-Reviewer: Yair Zaslavsky <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches