mirror of https://github.com/apache/cloudstack.git
server: fix vm_stats records are not removed if batchsize is 0 (#9818)
This commit is contained in:
parent
20901c7443
commit
019f2c60ce
|
|
@ -126,14 +126,7 @@ public class VolumeStatsDaoImpl extends GenericDaoBase<VolumeStatsVO, Long> impl
|
|||
|
||||
logger.debug(String.format("Starting to remove all volume_stats rows older than [%s].", limitDate));
|
||||
|
||||
long totalRemoved = 0;
|
||||
long removed;
|
||||
|
||||
do {
|
||||
removed = expunge(sc, limitPerQuery);
|
||||
totalRemoved += removed;
|
||||
logger.trace(String.format("Removed [%s] volume_stats rows on the last update and a sum of [%s] volume_stats rows older than [%s] until now.", removed, totalRemoved, limitDate));
|
||||
} while (limitPerQuery > 0 && removed >= limitPerQuery);
|
||||
long totalRemoved = batchExpunge(sc, limitPerQuery);
|
||||
|
||||
logger.info(String.format("Removed a total of [%s] volume_stats rows older than [%s].", totalRemoved, limitDate));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -123,14 +123,7 @@ public class VmStatsDaoImpl extends GenericDaoBase<VmStatsVO, Long> implements V
|
|||
|
||||
logger.debug(String.format("Starting to remove all vm_stats rows older than [%s].", limitDate));
|
||||
|
||||
long totalRemoved = 0;
|
||||
long removed;
|
||||
|
||||
do {
|
||||
removed = expunge(sc, limitPerQuery);
|
||||
totalRemoved += removed;
|
||||
logger.trace(String.format("Removed [%s] vm_stats rows on the last update and a sum of [%s] vm_stats rows older than [%s] until now.", removed, totalRemoved, limitDate));
|
||||
} while (limitPerQuery > 0 && removed >= limitPerQuery);
|
||||
long totalRemoved = batchExpunge(sc, limitPerQuery);
|
||||
|
||||
logger.info(String.format("Removed a total of [%s] vm_stats rows older than [%s].", totalRemoved, limitDate));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -247,14 +247,6 @@ public interface GenericDao<T, ID extends Serializable> {
|
|||
|
||||
int expungeList(List<ID> ids);
|
||||
|
||||
/**
|
||||
* Delete the entity beans specified by the search criteria with a given limit
|
||||
* @param sc Search criteria
|
||||
* @param limit Maximum number of rows that will be affected
|
||||
* @return Number of rows deleted
|
||||
*/
|
||||
int expunge(SearchCriteria<T> sc, long limit);
|
||||
|
||||
/**
|
||||
* expunge the removed rows.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1244,13 +1244,6 @@ public abstract class GenericDaoBase<T, ID extends Serializable> extends Compone
|
|||
}
|
||||
}
|
||||
|
||||
// FIXME: Does not work for joins.
|
||||
@Override
|
||||
public int expunge(final SearchCriteria<T> sc, long limit) {
|
||||
Filter filter = new Filter(limit);
|
||||
return expunge(sc, filter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int expunge(final SearchCriteria<T> sc, final Filter filter) {
|
||||
if (sc == null) {
|
||||
|
|
|
|||
|
|
@ -210,11 +210,6 @@ public class MockUsageEventDao implements UsageEventDao{
|
|||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int expunge(SearchCriteria<UsageEventVO> sc, long limit) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void expunge() {
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue