Repository navigation
Fix governance AUT failures: slow workflow cancel on hard delete, stale glossary and ontology specs - #37337
Conversation
…stale glossary/ontology specs - WorkflowHandler.cancelInstancesForEntities: find running instances with one native IN query per chunk. Flowable's or().variableValueEquals() emits one correlated EXISTS per id, a full ACT_RU_VARIABLE scan each; with ~10k running instances a 100-id chunk took 15-18s, so hard-deleting a 400-concept ontology took ~97s and OntologyLargeGraph cleanup timed out. - LargeGlossaryPerformance: glossary terms page at 15 since #35288; after clearing the search, wait for a listed term the search did not match. - utils/glossary assignTagToGlossaryTerm: name the confirmation heading; #37179 made the glossary title an h2. - OntologyConceptDrawer: match "Unsaved changes" case-insensitively (Collate overrides the label); preselect the test's own ontology in All ontologies so a parallel worker deleting the first one cannot leave the drawer loading a 404.
…; tighten comments
|
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! |
EntityDAO.deleteByIds (#36868) renders DELETE /*+ INDEX(t PRIMARY) */ FROM t, so SqlFailureProbe and SqlQueryCounter fragments like "delete from chart_entity" stopped matching. The bulk-path atomicity cases in EntityHardDeletionAtomicityIT injected nothing and failed. Match against the SQL with block comments removed.
Code Review ✅ Approved🟡 Medium risk · Replacing Flowable's entity-workflow lookup with native IN queries could miss linked instances, leaving workflows active after hard deletion. Replaces the per-id OR-of-EXISTS Flowable lookup in VerificationRules No rules evaluated Functional validation Not enabledAuto-approval Not enabledFor more verification details, comment OptionsDisplay: compact → Showing compact verification results. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
|
Local Java test run: PASSED — details
Tests run locally
Per-class counts come from the test reports, which can credit a test to the wrong class when classes run concurrently, and keep only the last run of a nested class that several test classes inherit. The summary's step totals are Maven's own counts. Broader coverage not executed by this focused run
Why these tests
Impacted, not run locally (1)
Commandsmvn -B verify -pl :openmetadata-integration-tests -am -Dspring-boot.repackage.skip=true -Pmysql-elasticsearch -DintegrationTests.lane=parallel -Dit.test=CredentialHotPathNoIoIT,EntityBulkCreateRecoveryIT,EntityHardDeletionAtomicityIT,IndependentOntologyAuthorizationIT,IndependentOntologyStatusIT,MultiTeamUserFanOutIT,NativeOntologyDataGraphContextIT,NativeOntologyDataGraphPageIT,OntologyImpactIT,SqlFailureProbeTest,SqlQueryCounterTest,SqlTestDecoratorsIT,TableMetadataReadIT,TeamUserOwnsFanOutIT,TopicServiceHydrationIT -Dfailsafe.failIfNoSpecifiedTests=false -Dtest=NoUnitTestsInThisRun -Dsurefire.failIfNoSpecifiedTests=false
mvn -B verify -pl :openmetadata-integration-tests -am -Dspring-boot.repackage.skip=true -Pcache-tests -DintegrationTests.lane=global-state -Dit.test=CredentialRedisDownIT -Dfailsafe.failIfNoSpecifiedTests=false -Dtest=NoUnitTestsInThisRun -Dsurefire.failIfNoSpecifiedTests=false |
Describe your changes:
Fixes the governance failures in nightly AUT run 42312928697 (build
om-ef95276e, currentmain):OntologyLargeGraph.spec.ts,OntologyConceptDrawer.spec.ts,Pages/Glossary.spec.tsandnightly/LargeGlossaryPerformance.spec.ts.Each failure was reproduced locally before it was fixed.
1. OntologyLargeGraph: 10 Postgres tests and 2 MySQL tests failed on every retry (backend fix)
The fixture cleanup
DELETE /ontologies/{id}?recursive=true&hardDelete=truetimed out at 90 s. The server's slow-request log for that DELETE:The rows were deleted in 0.6 s. The other 96 s went to
WorkflowHandler.cancelInstancesForEntities, which finds running Flowable instances withor().variableValueEquals(...), 100 ids at a time.EXISTSper id.ACT_RU_VARIABLE, so one batch means 100 full scans.Reproduction: throwaway databases seeded with 10k running instances × 25 variables, one batch of 100 ids:
INquery (this PR)Fix:
cancelInstancesForEntitiesnow runs one nativeINquery per batch, still behind the samecount() == 0short-circuit.2. LargeGlossaryPerformance: 2 tests failed (expected 50 rows, got 15)
#35288 changed the glossary terms page size from 50 to 15. Search results are now also capped at 15, so after clearing the search a stale result and the full list both show 15 rows. The test now waits for a listed term that the search did not match, instead of counting rows.
3. Glossary.spec "Update Glossary and Glossary Term": strict-mode violation
#37179 made the glossary title an
<h2>, so the baregetByRole('heading')inassignTagToGlossaryTermmatched two elements. The helper now looks the heading up by its name, asGlossaryAdvancedOperations.specalready does.4. OntologyConceptDrawer
label.unsaved-changesas "Unsaved Changes", and the AUT runs the Collate UI. The spec now matches the text case-insensitively.pw_concept_drawer_361ac5c8, which belonged to another worker./ontologyConcepts?ontology=…returned 404 and the drawer stayed on<Loader />.5. EntityHardDeletionAtomicityIT bulk-path cases, already failing on
main(test helper fix)incidentAndResultCleanupFollowsSuccessfulDeletion[6]/[8]androwDeleteFailureRollsBackAllDependentMetadata[2]fail on a cleanorigin/main(ef95276e73e) too.EntityDAO.deleteByIds, so the bulk row delete now renders asDELETE /*+ INDEX(chart_entity PRIMARY) */ FROM chart_entity WHERE id IN (…).SqlFailureProbelooks for the fragment"delete from chart_entity"(or"delete from test_case"). The hint sits betweenDELETEandFROM, so the probe never fired and the tests saw no exception.SqlFailureProbeandSqlQueryCounternow match against the SQL with block comments removed and whitespace collapsed. That fixes every caller in one place.Type of change:
High-level design:
N/A — one targeted backend query change, three spec fixes and an IT-helper matching fix.
Tests:
Use cases covered
global_relatedEntityIdis in the deleted set, and leaves other instances running.<h2>page title.Unit tests
SqlFailureProbeTest#matchesAStatementWhoseOptimizerHintSplitsTheFragmentandSqlQueryCounterTest#countsAStatementWhoseOptimizerHintSplitsTheFragment(new): a hintedDELETEmatches its fragment.WorkflowHandlerchange is a native SQL query, which only an IT against a real database can check (below).Backend integration tests
EntityHardDeletionAtomicityIT#bulkCancellationEndsOnlyTheDeletedEntitiesWorkflows(new): starts three instances, cancels two entities in one call, and asserts that only the bystander is still running. It catches a wrongINlist or a predicate that cancels too much.EntityHardDeletionAtomicityIT#workflowCancellationWaitsForTheEnclosingCommit(existing) runs the single and bulk hard-delete paths through the new query.EntityHardDeletionAtomicityITpasses in full on both engines atfba6b6945f5(latestmainmerged in): 19/19 on MySQL + ES and 19/19 on Postgres + OpenSearch. Before the probe fix the three bulk-path cases failed, the same as onmain.SqlFailureProbeorSqlQueryCounterwas also run, to check that the broader matching changes no other count or injection. Results are in the block below.CredentialAuthBenchITalso uses the counter, but it is@Tag("scale")and runs only in the nightly scale-it job.Local Java test run: PASSED
fba6b6945f57(baseorigin/main)--scope full).Ingestion integration tests
Not applicable: no ingestion changes.
Playwright (UI) tests
Specs run locally: this branch's UI served by Vite against a local Collate server, with
retries: 0.nightly/LargeGlossaryPerformance› paginationExpected: 50 Received: 15nightly/LargeGlossaryPerformance› search and filterExpected: >= 50 Received: 15nightly/LargeGlossaryPerformance› child term paginationPages/Glossary› Update Glossary and Glossary TermgetByRole('heading')Features/OntologyConceptDrawer› guards unsaved text (classic, ai), Collate label applied locallyExpected "Unsaved changes" Received "Unsaved Changes"Features/OntologyConceptDrawer› guards unsaved text (classic, ai), OSS labelFeatures/OntologyConceptDrawer› Add concept in All ontologies (classic, ai)Pages/Glossary"Update Glossary and Glossary Term" is the only caller of the changedassignTagToGlossaryTermhelper.utils/glossary.tschanged. I didn't run those locally; the merge queue runs the full suite.OntologyLargeGraphwasn't run end to end, because that needs a server built from this branch. The SQL reproduction and the ITs above cover the backend change.Manual testing performed
bulkHardDeleteWorkflowsphase in the server's slow-request log, then reproduced the query cost in Postgres 16 and MySQL 8 containers (table above).UI screen recording:
Not applicable: a backend query fix plus Playwright spec fixes, with no product UI change.
Checklist:
Fixes <issue-number>: <short explanation>. N/A: test-fix PR, labelledskip-pr-checks.Fixes #<issue-number>above. N/A: test-fix PR.REVIEW.mdand fixed every 🔴 finding, or answered it on the line below.baa41dafb49: no 🔴. On its nits, I added the two-id + bystander IT and tightened the comments (f3f804d1b38). The pre-existing drawer spinner-on-404 is left for a follow-up.fba6b6945f5adds theSqlFailureProbe/SqlQueryCountermatching fix, with a unit test for each. It's test-only code.🤖 Generated with Claude Code