Commit 9550ebe
Batch VM and host lookups in StorageManagerImpl to eliminate N+1 queries 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.1 parent 21b2025 commit 9550ebe
3 files changed
Lines changed: 34 additions & 2 deletions
File tree
- engine/schema/src/main/java/com/cloud/vm/dao
- server/src/main/java/com/cloud/storage
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
197 | 197 | | |
198 | 198 | | |
199 | 199 | | |
| 200 | + | |
| 201 | + | |
200 | 202 | | |
Lines changed: 13 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1336 | 1336 | | |
1337 | 1337 | | |
1338 | 1338 | | |
| 1339 | + | |
| 1340 | + | |
| 1341 | + | |
| 1342 | + | |
| 1343 | + | |
| 1344 | + | |
| 1345 | + | |
| 1346 | + | |
| 1347 | + | |
| 1348 | + | |
| 1349 | + | |
| 1350 | + | |
| 1351 | + | |
1339 | 1352 | | |
Lines changed: 19 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1846 | 1846 | | |
1847 | 1847 | | |
1848 | 1848 | | |
| 1849 | + | |
| 1850 | + | |
| 1851 | + | |
| 1852 | + | |
1849 | 1853 | | |
1850 | 1854 | | |
1851 | 1855 | | |
| |||
1856 | 1860 | | |
1857 | 1861 | | |
1858 | 1862 | | |
| 1863 | + | |
| 1864 | + | |
| 1865 | + | |
| 1866 | + | |
| 1867 | + | |
1859 | 1868 | | |
1860 | 1869 | | |
1861 | 1870 | | |
1862 | | - | |
1863 | 1871 | | |
1864 | 1872 | | |
1865 | 1873 | | |
| |||
2126 | 2134 | | |
2127 | 2135 | | |
2128 | 2136 | | |
| 2137 | + | |
| 2138 | + | |
| 2139 | + | |
| 2140 | + | |
| 2141 | + | |
| 2142 | + | |
| 2143 | + | |
| 2144 | + | |
| 2145 | + | |
2129 | 2146 | | |
2130 | 2147 | | |
2131 | | - | |
| 2148 | + | |
2132 | 2149 | | |
2133 | 2150 | | |
2134 | 2151 | | |
| |||
0 commit comments