Fix: Resolve duplicate loop operations in TestCaseRepository#27448
Fix: Resolve duplicate loop operations in TestCaseRepository#27448aniruddhaadak80 wants to merge 1 commit intoopen-metadata:mainfrom
Conversation
|
Hi there 👋 Thanks for your contribution! The OpenMetadata team will review the PR shortly! Once it has been labeled as Let us know if you need any help! |
Code Review ✅ ApprovedRefactored TestCaseRepository to eliminate O(N^2) duplication, improving overall data processing efficiency. No issues found. OptionsDisplay: compact → Showing less information. Comment with these commands to change:
Was this helpful? React with 👍 / 👎 | Gitar |
There was a problem hiding this comment.
Pull request overview
This PR fixes an inefficient deletion path in the backend TestCaseRepository that caused redundant (O(N²)) deletions of TestCaseResolutionStatus children and also removed a duplicate deletion of test case results that was executed both synchronously and asynchronously.
Changes:
- Fix
deleteChildren()to perform a single pass over child records (O(N)) and instantiate theTestCaseResolutionStatusRepositoryonce. - Remove the redundant async deletion block in
deleteAllTestCaseResults()and delete exactly once. - Remove the now-unused
ExecutorService/Executorsfield and imports.
7311a54 to
cff7175
Compare
|
Hi there 👋 Thanks for your contribution! The OpenMetadata team will review the PR shortly! Once it has been labeled as Let us know if you need any help! |
Resolves issue #27060. The loop calling deleteChildren was incorrectly placed inside another loop, turning an O(N) deletion operation to O(N^2) against testcases. Also removes redundant AsyncExecutor deletion block