Batch VM and host lookups in StorageManagerImpl to eliminate N+1 queries during cleanup and pool connect#13353
Batch VM and host lookups in StorageManagerImpl to eliminate N+1 queries during cleanup and pool connect#13353vishesh92 wants to merge 2 commits into
Conversation
|
@blueorangutan package |
|
@vishesh92 a [SL] Jenkins job has been kicked to build packages. It will be bundled with no SystemVM templates. I'll keep you posted as I make progress. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #13353 +/- ##
============================================
- Coverage 18.75% 18.75% -0.01%
+ Complexity 17966 17964 -2
============================================
Files 6160 6160
Lines 552578 552604 +26
Branches 67348 67352 +4
============================================
Hits 103660 103660
- Misses 437512 437538 +26
Partials 11406 11406
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:
|
…ies during cleanup and pool connect cleanupStorage: replaced per-volume _vmInstanceDao.findById(vol.getInstanceId()) with a single batch SELECT ... WHERE id IN (...) before the loop, using a HashMap for O(1) lookups. Added null guard for volumes with null instanceId. connectHostsToPool: replaced per-thread _hostDao.findById(hostId) with a batch load before thread pool submission. Each thread now reads from a pre-built HashMap instead of hitting the DB. Added null guard with warning log for hosts removed between list assembly and batch read. Added VMInstanceDao.listByIds(List<Long>) with empty-list guard and IN-clause SearchBuilder, matching the established pattern in HostDao.
c8a1b22 to
ed025d2
Compare
ed025d2 to
dad9933
Compare
dad9933 to
d867216
Compare
|
@blueorangutan package |
|
@vishesh92 a [SL] Jenkins job has been kicked to build packages. It will be bundled with no SystemVM templates. I'll keep you posted as I make progress. |
|
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 18188 |
|
@blueorangutan test |
|
@vishesh92 a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests |
|
[SF] Trillian test result (tid-16262)
|
Description
cleanupStorage: replaced per-volume _vmInstanceDao.findById(vol.getInstanceId()) with a single batch SELECT ... WHERE id IN (...) before the loop, using a HashMap for O(1) lookups. Added null guard for volumes with null instanceId.
connectHostsToPool: replaced per-thread _hostDao.findById(hostId) with a batch load before thread pool submission. Each thread now reads from a pre-built HashMap instead of hitting the DB. Added null guard with warning log for hosts removed between list assembly and batch read.
Added VMInstanceDao.listByIds(List) with empty-list guard and IN-clause SearchBuilder, matching the established pattern in HostDao.
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?