sureshanaparti opened a new pull request, #10848: URL: https://github.com/apache/cloudstack/pull/10848
### Description This PR removes unfinished usage job entries for the host. The stale / unfinished usage job entries are not allowing to pick the latest job for processing, and prevents usage from running, to fix this, cleanup the unfinished usage jobs during start. <!--- Describe your changes in DETAIL - And how has behaviour functionally changed. --> <!-- For new features, provide link to FS, dev ML discussion etc. --> <!-- In case of bug fix, the expected and actual behaviours, steps to reproduce. --> <!-- When "Fixes: #<id>" is specified, the issue/PR will automatically be closed when this PR gets merged --> <!-- For addressing multiple issues/PRs, use multiple "Fixes: #<id>" --> <!-- Fixes: # --> <!--- ******************************************************************************* --> <!--- NOTE: AUTOMATION USES THE DESCRIPTIONS TO SET LABELS AND PRODUCE DOCUMENTATION. --> <!--- PLEASE PUT AN 'X' in only **ONE** box --> <!--- ******************************************************************************* --> ### Types of changes - [ ] Breaking change (fix or feature that would cause existing functionality to change) - [ ] New feature (non-breaking change which adds functionality) - [ ] 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 - [ ] test (unit or integration test code) ### Feature/Enhancement Scale or Bug Severity #### Feature/Enhancement Scale - [ ] Major - [x] Minor #### Bug Severity - [ ] BLOCKER - [ ] Critical - [ ] Major - [ ] Minor - [ ] Trivial ### Screenshots (if appropriate): ### How Has This Been Tested? Tested with some unfinished job entires in the cloud_usage.usage_job table. ``` 2025-05-12 09:10:25,875 INFO [cloud.usage.UsageManagerImpl] (main:null) (logid:) Starting Usage Manager 2025-05-12 09:10:25,985 INFO [usage.dao.UsageJobDaoImpl] (main:null) (logid:) Found 13 opens job, to remove 2025-05-12 09:10:25,986 DEBUG [usage.dao.UsageJobDaoImpl] (main:null) (logid:) Removing job - id: 17099, pid: 683, job type: 0, scheduled: 0, heartbeat: Fri Nov 27 10:20:58 UTC 2020 2025-05-12 09:10:25,998 DEBUG [usage.dao.UsageJobDaoImpl] (main:null) (logid:) Removing job - id: 17100, pid: 683, job type: 0, scheduled: 0, heartbeat: Fri Nov 27 10:25:58 UTC 2020 2025-05-12 09:10:26,005 DEBUG [usage.dao.UsageJobDaoImpl] (main:null) (logid:) Removing job - id: 17101, pid: 683, job type: 0, scheduled: 0, heartbeat: Fri Nov 27 10:30:58 UTC 2020 2025-05-12 09:10:26,014 DEBUG [usage.dao.UsageJobDaoImpl] (main:null) (logid:) Removing job - id: 17102, pid: 683, job type: 0, scheduled: 0, heartbeat: Fri Nov 27 10:34:58 UTC 2020 2025-05-12 09:10:26,022 DEBUG [usage.dao.UsageJobDaoImpl] (main:null) (logid:) Removing job - id: 17103, pid: 683, job type: 0, scheduled: 0, heartbeat: Fri Nov 27 10:39:58 UTC 2020 2025-05-12 09:10:26,028 DEBUG [usage.dao.UsageJobDaoImpl] (main:null) (logid:) Removing job - id: 17104, pid: 683, job type: 0, scheduled: 0, heartbeat: Fri Nov 27 10:44:58 UTC 2020 2025-05-12 09:10:26,034 DEBUG [usage.dao.UsageJobDaoImpl] (main:null) (logid:) Removing job - id: 17105, pid: 683, job type: 0, scheduled: 0, heartbeat: Fri Nov 27 23:19:58 UTC 2020 2025-05-12 09:10:26,040 DEBUG [usage.dao.UsageJobDaoImpl] (main:null) (logid:) Removing job - id: 19990, pid: 814, job type: 0, scheduled: 0, heartbeat: Thu Oct 21 22:17:16 UTC 2021 2025-05-12 09:10:26,045 DEBUG [usage.dao.UsageJobDaoImpl] (main:null) (logid:) Removing job - id: 19991, pid: 814, job type: 0, scheduled: 0, heartbeat: Thu Oct 21 22:17:19 UTC 2021 2025-05-12 09:10:26,051 DEBUG [usage.dao.UsageJobDaoImpl] (main:null) (logid:) Removing job - id: 19992, pid: 814, job type: 0, scheduled: 0, heartbeat: Thu Oct 21 22:17:19 UTC 2021 2025-05-12 09:10:26,057 DEBUG [usage.dao.UsageJobDaoImpl] (main:null) (logid:) Removing job - id: 19993, pid: 814, job type: 0, scheduled: 0, heartbeat: Thu Oct 21 22:17:19 UTC 2021 2025-05-12 09:10:26,064 DEBUG [usage.dao.UsageJobDaoImpl] (main:null) (logid:) Removing job - id: 19994, pid: 814, job type: 0, scheduled: 0, heartbeat: Fri Oct 22 22:16:16 UTC 2021 2025-05-12 09:10:26,070 DEBUG [usage.dao.UsageJobDaoImpl] (main:null) (logid:) Removing job - id: 26119, pid: 1855871, job type: 0, scheduled: 0, heartbeat: Mon May 12 09:00:08 UTC 2025 ``` <!-- Please describe in detail how you tested your changes. --> <!-- Include details of your testing environment, and the tests you ran to --> #### How did you try to break this feature and the system with this change? <!-- see how your change affects other areas of the code, etc. --> <!-- Please read the [CONTRIBUTING](https://github.com/apache/cloudstack/blob/main/CONTRIBUTING.md) document --> -- 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