ofri masad has posted comments on this change.
Change subject: core: Fast update quota cache
......................................................................
Patch Set 8: (5 inline comments)
....................................................
File backend/manager/dbscripts/create_functions.sql
Line 620: quota_limitation.quota_id as quota_id,
Line 621: quota_limitation.vds_group_id as vds_group_id,
Line 622: vds_groups.name AS vds_group_name,
Line 623: quota_limitation.virtual_cpu,
Line 624: cast(COALESCE(sum(num_of_sockets * cpu_per_socket *
cast(vm_dynamic.status not in (0, 13 , 14, 15) as INTEGER)), 0) as INTEGER) as
virtual_cpu_usage,
Done
Line 625: quota_limitation.mem_size_mb,
Line 626: COALESCE(sum(vm_static.mem_size_mb), 0) as mem_size_mb_usage
Line 627: FROM quota_limitation
Line 628: LEFT JOIN vm_static ON vm_static.quota_id =
quota_limitation.quota_id
....................................................
File
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/quota/QuotaManager.java
Line 33:
Line 34: // when (cache size/number of quota in DB) ratio is under this
minimum threshold - the calls to
Line 35: // updateQuotaCache() would result in cache update. otherwise
update will be executed.
Line 36: private static final double MINIMUM_CACHE_FACTOR =
Line 37: (double) Config.<Integer>
GetValue(ConfigValues.MinimumPercentageToUpdateQuotaCache) / 100;
Done
Line 38:
Line 39: public static QuotaManager getInstance() {
Line 40: return INSTANCE;
Line 41: }
Line 1010: if
(!storagePoolQuotaMap.containsKey(quota.getStoragePoolId())) {
Line 1011:
storagePoolQuotaMap.put(quota.getStoragePoolId(), new HashMap<Guid,Quota>());
Line 1012: }
Line 1013:
storagePoolQuotaMap.get(quota.getStoragePoolId()).put(quota.getId(), quota);
Line 1014: }
Done
Line 1015: } finally {
Line 1016: lock.writeLock().unlock();
Line 1017: }
Line 1018: long timeEnd = System.currentTimeMillis();
....................................................
File
backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/QuotaDAODbFacadeImpl.java
Line 182: }
Line 183: return quotaEntity;
Line 184: }
Line 185:
Line 186: private static ParameterizedRowMapper<Long> intMapper = new
ParameterizedRowMapper<Long>() {
Done
Line 187: @Override
Line 188: public Long mapRow(ResultSet resultSet, int i) throws
SQLException {
Line 189: return (Long) resultSet.getObject(1);
Line 190: }
Line 205: @Override
Line 206: public List<Quota> getAllQuotaIncludingConsumption() {
Line 207: MapSqlParameterSource parameterSource = new
MapSqlParameterSource();
Line 208: // get thin quota (only basic quota meta data)
Line 209: List<Quota> allThinQuota =
getCallsHandler().executeReadList("getAllThinQuota",
getQuotaMetaDataFromResultSet(), parameterSource);
this is called every 10 minutes (configurable).
Line 210:
Line 211: if (allThinQuota != null && !allThinQuota.isEmpty()){
Line 212: Map<Guid, Quota> allQuotaMap = new HashMap<Guid, Quota>();
Line 213: for (Quota quota : allThinQuota) {
--
To view, visit http://gerrit.ovirt.org/10159
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: Id3db08957e413d2f1e0480b764334dd7268c8221
Gerrit-PatchSet: 8
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: ofri masad <[email protected]>
Gerrit-Reviewer: Doron Fediuck <[email protected]>
Gerrit-Reviewer: Eli Mesika <[email protected]>
Gerrit-Reviewer: Gilad Chaplik <[email protected]>
Gerrit-Reviewer: Michael Kublin <[email protected]>
Gerrit-Reviewer: Yair Zaslavsky <[email protected]>
Gerrit-Reviewer: ofri masad <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches