JoaoJandre opened a new pull request, #8740: URL: https://github.com/apache/cloudstack/pull/8740
### Description ACS has a job that periodically removes records from the `vm_stats` table that are older than the retention time (setting `vm.stats.max.retention.time`). In environments that have a large amount of statistics being collected and have a long retention time, if the retention time is shortened, table cleaning may fail to finish due to the huge amount of records being deleted leading to a query timeout. The `vm.stats.remove.batch.size` configuration has been added to define the batch size of statistics removal queries. This way, instead of trying to remove all records in a single query, ACS will remove records in batches, with the batch size being defined with the `vm.stats.remove.batch.size setting`. The default value is -1, where no limit will be applied; thus, the current behavior is maintained. ### Types of changes - [ ] Breaking change (fix or feature that would cause existing functionality to change) - [ ] New feature (non-breaking change which adds functionality) - [X] Bug fix (non-breaking change which fixes an issue) - [X] Enhancement (improves an existing feature and functionality) - [ ] Cleanup (Code refactoring and cleanup, that may add test cases) - [ ] build/CI ### Feature/Enhancement Scale or Bug Severity #### Feature/Enhancement Scale - [ ] Major - [X] Minor #### Bug Severity - [ ] BLOCKER - [ ] Critical - [ ] Major - [X] Minor - [ ] Trivial ### How Has This Been Tested? In a local lab, I artificially generated 60 million rows on `vm_stats` and set the retention time to one minute. Before the change, the delete job would timeout and no rows would be removed. After applying the change and setting `vm.stats.max.retention.time` to 100000, the table was successfully cleaned. -- 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