fix: prevent duplicate lineage cleanup and remove blocking refresh in PATCH /api/v1/tables/{id}#26702
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! |
1178d93 to
ef589a8
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! |
ef589a8 to
ed4f0ea
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! |
…on and remove blocking refresh in lineage cleanup Fixes open-metadata#26674 Two issues caused PATCH /api/v1/tables/{id} to be extremely slow (49-99s) when a database service had many lineage entries: 1. During session change consolidation (when the same user edits the same entity within 10 minutes), updateInternal() was called multiple times: - once in incrementalChange() for incremental diff calculation - once or twice in revert() for consolidation - once in the final flush phase Each call registered deleteColumnsInUpstreamLineage as a deferred operation, causing it to execute 2-4 times per PATCH request. Fix: add deferOpsEnabled flag to EntityUpdater that is set to false during intermediate calculations (incrementalChange and revert), so deferred operations are only registered during the final updateInternal. 2. updateByQuery in deleteColumnsInUpstreamLineage and updateColumnsInUpstreamLineage used Refresh.True, which blocks until all shards have refreshed after updating potentially thousands of documents. This caused ~90s of blocking per call. Fix: remove the refresh parameter, allowing ES/OpenSearch to refresh on its normal schedule (within ~1s), which is sufficient for lineage cleanup. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
ed4f0ea to
fd125db
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! |
Code Review ✅ ApprovedFixes duplicate lineage cleanup and removes blocking refresh in PATCH /api/v1/tables/{id} to improve performance. No issues found. OptionsAuto-apply is off → Gitar will not commit updates to this branch. Comment with these commands to change:
Was this helpful? React with 👍 / 👎 | Gitar |
Fixes #26674
Root Cause
Two issues caused
PATCH /api/v1/tables/{id}to be extremely slow (49–99s) when a database service had many lineage entries:Issue 1: Duplicate deferred operations during session consolidation
When the same user edits the same entity within 10 minutes, session change consolidation is triggered. In this path,
updateInternal()is called multiple times:incrementalChange()for incremental diff calculationrevert()for consolidationEach call traversed
entitySpecificUpdate()→updateColumns()→handleColumnLineageUpdates()→deferReactOperation(), registeringdeleteColumnsInUpstreamLineageas a deferred operation 2–4 times per PATCH request.Fix: Add a
deferOpsEnabledflag toEntityUpdaterthat is set tofalseduring intermediate calculations (incrementalChangeandrevert). Deferred operations are only registered during the finalupdateInternalcall.Issue 2: Blocking refresh in updateByQuery
deleteColumnsInUpstreamLineageandupdateColumnsInUpstreamLineageusedRefresh.TrueinupdateByQuery, which blocks until all shards have refreshed after updating potentially thousands of documents. With 13,275 matching documents, this caused ~90s of blocking per call.Fix: Remove the
refreshparameter, allowing ES/OpenSearch to refresh on its normal schedule (~1s), which is sufficient for lineage cleanup.Verification
Confirmed with local testing:
Duplicate call fix: Server logs showed
deleteColumnsInUpstreamLineageexecuting 3 times per PATCH with consolidation before the fix, and 1 time after.Refresh fix: Direct ES measurement with 1,000 documents:
refresh=true(before)Combined effect (3x duplicate calls × blocking refresh): expected >80% reduction in PATCH latency for tables with many lineage entries.
Test plan
/api/v1/tables/{id}completes in reasonable timedeleteColumnsInUpstreamLineageappears only once per PATCH request even with session consolidation active🤖 Generated with Claude Code