Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve BOM processing performance and make it transactional (#218)
* Add bloated BOM for ingestion performance testing Signed-off-by: nscuro <nscuro@protonmail.com> * Prevent query compilation cache being bypassed for `matchSingleIdentity` queries See DependencyTrack/dependency-track#2540 This also cleans the query from containing weird statements like `(cpe != null && cpe == null)` in case a component does not have a CPE. Signed-off-by: nscuro <nscuro@protonmail.com> * WIP: Improve BOM processing performance Signed-off-by: nscuro <nscuro@protonmail.com> * Handle dependency graph Signed-off-by: nscuro <nscuro@protonmail.com> * Improve dependency graph assembly Instead of using individual bulk UPDATE queries, use setters on persistent components instead. This way we can again make use of batched flushing. Signed-off-by: nscuro <nscuro@protonmail.com> * Completely replace old processing logic Also decompose large processing method into multiple smaller ones, and re-implement notifications. Signed-off-by: nscuro <nscuro@protonmail.com> * Fix not all BOM refs being updated with new component identities Signed-off-by: nscuro <nscuro@protonmail.com> * Be smarter about indexing component identities and BOM refs Also add more documentation Signed-off-by: nscuro <nscuro@protonmail.com> * Reduce logging noise Signed-off-by: nscuro <nscuro@protonmail.com> * Mark new components as such ... via new transient field. Required for compatibility with #217 Signed-off-by: nscuro <nscuro@protonmail.com> * Compatibility with #217 Signed-off-by: nscuro <nscuro@protonmail.com> * Cleanup tests Signed-off-by: nscuro <nscuro@protonmail.com> * Reduce code duplication Signed-off-by: nscuro <nscuro@protonmail.com> * Cleanup; Process services Signed-off-by: nscuro <nscuro@protonmail.com> * Finishing touches 🪄 Signed-off-by: nscuro <nscuro@protonmail.com> * Make flush threshold configurable The optimal value could depend on how beefy the database server is, and how much memory is available to the API server. Signed-off-by: nscuro <nscuro@protonmail.com> * Clarify `warn` log when rolling back active transactions Signed-off-by: nscuro <nscuro@protonmail.com> * Log number of consumed components and services before and after de-dupe Signed-off-by: nscuro <nscuro@protonmail.com> * Extend BOM processing test with bloated BOM Signed-off-by: nscuro <nscuro@protonmail.com> * Make component identity matching strict To address DependencyTrack/dependency-track#2519 (comment). Also add regression test for this specific issue. Signed-off-by: nscuro <nscuro@protonmail.com> * Add regression test for DependencyTrack/dependency-track#1905 Signed-off-by: nscuro <nscuro@protonmail.com> * Clarify why "reachability on commit" is disabled; Add assertion for persistent object state Signed-off-by: nscuro <nscuro@protonmail.com> * Add tests for `equals` and `hashCode` of `ComponentIdentity` Signed-off-by: nscuro <nscuro@protonmail.com> * Address review comments Signed-off-by: nscuro <nscuro@protonmail.com> --------- Signed-off-by: nscuro <nscuro@protonmail.com> Signed-off-by: mehab <meha.bhargava@citi.com>
- Loading branch information