Repository navigation
Conversation
VirtualMachinePowerStateSyncImpl maintained a lazy cache of host id->host and vm id->vm mappings in order to provide host and vm objects in method debug/trace logs. On a cache miss, debug logs would use HostDao and VMInstanceDao to query the respective objects from the primary database. If all HikariCP DB connections were exhausted, this call would spin for 30 seconds before timing out and throwing a CloudRuntimeException. This meant that simple logging blocked agent-handler threads, creating performance degradation for the entire management server. Fix by logging just host ID and VM ID instead of objects, removing the need to call the primary DB and maintain a cache. Remove corresponding imports, constructors, helper methods, and test scaffold.
Contributor
Author
|
@blueorangutan package |
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
There are no active review issues for the change removing logging-only database lookups.
No open issues 🎉
What changed in this PR
Removes database lookups used only for VM power-state logging, preventing those logs from blocking agent-handler threads when database connections are exhausted.
Changes:
- Logs host and VM IDs instead of loading objects through caches.
- Removes logging-only caches, lookup helpers, and the HostDao dependency.
- Removes obsolete test mocks and setup.
| File | Description |
|---|---|
| engine/orchestration/src/test/java/com/cloud/vm/VirtualMachinePowerStateSyncImplTest.java | Removes setup and mocks for deleted logging lookups. |
| engine/orchestration/src/main/java/com/cloud/vm/VirtualMachinePowerStateSyncImpl.java | Replaces cached object logging with IDs and removes lookup infrastructure. |
Review effort: Balanced
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #14940 +/- ##
============================================
+ Coverage 3.86% 21.08% +17.22%
- Complexity 0 21284 +21284
============================================
Files 494 6058 +5564
Lines 42890 549881 +506991
Branches 8142 73538 +65396
============================================
+ Hits 1657 115934 +114277
- Misses 41001 420320 +379319
- Partials 232 13627 +13395
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR addresses the following problem:
VirtualMachinePowerStateSyncImpl maintained a lazy cache of host id->host and vm id->vm mappings in order to provide host and vm objects in method debug/trace logs. On a cache miss, debug logs would use HostDao and VMInstanceDao to query the respective objects from the primary database. If all HikariCP DB connections were exhausted, this call would spin for 30 seconds before timing out and throwing a CloudRuntimeException. This meant that simple logging blocked agent-handler threads, creating performance degradation for the entire management server.
This PR fixes by logging just host ID and VM ID instead of objects, removing the need to call the primary DB and maintain a cache
Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
How Has This Been Tested?
How did you try to break this feature and the system with this change?