abh1sar commented on code in PR #10017:
URL: https://github.com/apache/cloudstack/pull/10017#discussion_r1872933584


##########
engine/schema/src/main/java/com/cloud/storage/dao/BucketDaoImpl.java:
##########
@@ -79,4 +98,21 @@ public List<BucketVO> searchByIds(Long[] ids) {
         sc.setParameters("idIN", ids);
         return search(sc, null, null, false);
     }
+
+    @Override
+    public Long countBucketsForAccount(long accountId) {
+        SearchCriteria<Long> sc = CountBucketsByAccount.create();
+        sc.setParameters(ACCOUNT_ID, accountId);
+        sc.setParameters(STATE, BucketVO.State.Destroyed);
+        return customSearch(sc, null).get(0);

Review Comment:
   I don't think this custom search will return null as it is counting the 
number of entries in the bucket table for that account.
   Tested that If there are no buckets, it returns one element in the list with 
value 0.



-- 
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