vishesh92 commented on code in PR #8740:
URL: https://github.com/apache/cloudstack/pull/8740#discussion_r1512245114


##########
framework/db/src/main/java/com/cloud/utils/db/GenericDaoBase.java:
##########
@@ -1208,9 +1208,14 @@ public boolean expunge(final ID id) {
         }
     }
 
-    // FIXME: Does not work for joins.
     @Override
     public int expunge(final SearchCriteria<T> sc) {
+        return expunge(sc, -1);
+    }
+
+    // FIXME: Does not work for joins.
+    @Override
+    public int expunge(final SearchCriteria<T> sc, long limit) {

Review Comment:
   ```suggestion
       public int expunge(final SearchCriteria<T> sc, final Filter filter) {
   ```
   I would suggest keeping the parameters for this method similar to how it is 
for other methods for this class.



##########
server/src/main/java/com/cloud/server/StatsCollector.java:
##########
@@ -290,6 +287,11 @@ public String toString() {
     protected static ConfigKey<Boolean> vmStatsCollectUserVMOnly = new 
ConfigKey<>("Advanced", Boolean.class, "vm.stats.user.vm.only", "false",
             "When set to 'false' stats for system VMs will be collected 
otherwise stats collection will be done only for user VMs", true);
 
+    protected static ConfigKey<Long> vmStatsRemoveBatchSize = new 
ConfigKey<>("Advanced", Long.class, "vm.stats.remove.batch.size", "0", 
"Indicates the" +

Review Comment:
   Should we have a generic global setting which we can use for other 
operations as well?
   We can also reuse `detail.batch.query.size` for deletion as well.



##########
framework/db/src/main/java/com/cloud/utils/db/GenericDaoBase.java:
##########
@@ -1223,6 +1228,11 @@ public int expunge(final SearchCriteria<T> sc) {
             str.append(sc.getWhereClause());
         }
 
+        if (limit > 0) {

Review Comment:
   Use `addFilter` method with filter to add limit. This will also allow to add 
order by in the Delete queries.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to