Repository navigation
Fixes #32092: emit ChangeEvents for bulk entity updates - #32350
Conversation
✅ PR checks passedThe linked issue has a description and all required Shipping project fields set. Thanks! |
✅ Playwright Results — workflow succeededValidated commit ✅ 555 passed · ❌ 0 failed · 🟡 0 flaky · ⏭️ 0 skipped · 🧰 0 lifecycle flaky PerformanceBlocking targets: ✅ met · Optimization targets: 🟡 in progress Shard-job maxima below are not the full workflow wall time; the linked run includes build, fixture, planning, and reporting. 🕒 Full workflow signal wall (to summary) 57m 45s ⏱️ Max setup 4m 18s · max shard execution 17m 16s · max shard-job elapsed before upload 20m 46s · reporting 4s 🌐 214.63 requests/attempt · 2.82 app boots/UI scenario · 4.05% common-shard skew Optimization targets still in progress:
How to debug locally# Download playwright-test-results-<shard> artifact and unzip
npx playwright show-trace path/to/trace.zip # view trace |
Code Review ✅ ApprovedRestores ChangeEvent emission for bulk entity updates by adding the missing OptionsDisplay: compact → Showing less information. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
…32536) * Fixes #32092: emit ChangeEvents for bulk entity updates (#32350) * Fixes #32092: emit ChangeEvents for bulk entity updates * refactor: single-source EntityUpdater change-type classification * test: cover ChangeEvent emission on the bulk entity update path (cherry picked from commit a3e5f5f) * test: add the BulkApi harness helper required by BulkChangeEventIT on 1.13
…pen-metadata#32350) * Fixes open-metadata#32092: emit ChangeEvents for bulk entity updates * refactor: single-source EntityUpdater change-type classification * test: cover ChangeEvent emission on the bulk entity update path
Describe your changes:
Fixes #32092
What was broken. A
Get Schema Changesalert on a table fired when a person added a column, and stayed silent when the metadata agent added one. The column and a new version showed up in Version History, so the write had clearly happened. The alert just never saw it.Why. Every entity change is supposed to write a row to the
change_eventtable. That table is the notification bus: alerts, the activity feed, governance workflow triggers and the audit log all read from it. No row means none of them see the change.Whether a row is written comes down to one classification:
ENTITY_UPDATEDorENTITY_NO_CHANGE. That decision readsincrementalChangeDescription, the diff for this request.EntityUpdaterhas four write entry points. Three share a pipeline that computes the diff and then records it in that field. The fourth,updateWithDeferredStore(), computed the diff and never recorded it:The field stayed
null, andincrementalFieldsChanged()readsnullas "nothing changed". So the update was classifiedENTITY_NO_CHANGE, andbuildChangeEventJsonForBulkOperation()drops those. Entity row written, version history written, event silently discarded.updateWithDeferredStore()is what everyPUT /v1/{collection}/bulkendpoint uses, which is the standard ingestion sink for every data asset. So this affected all ingested types, sync and?async=truealike.The fix. Add the missing record step. One call, reusing the same private helper and phase-timing convention the other three paths already use.
Wider than alerts.
AuditLogConsumerbuilds the audit trail fromchange_eventwith no filtering of its own, so no ingestion-driven update has been auditable either. That is the compliance-relevant part and is not mentioned in the issue.Not a "never worked". Before #25709 (Feb 2026) the bulk path used
putResponse.getChangeType()and was correct. Present on1.13,2.0andmain; not1.12. Backports to follow via the usualTo releaseflow.Type of change:
High-level design:
Three commits, meant to be read in order:
Fixes #32092: emit ChangeEvents for bulk entity updates- the functional fix, described above.Fixed at the producer rather than at the consumer on purpose. The rule "after any
EntityUpdaterentry point,incrementalChangeDescriptionholds this request's diff" is relied on outside event classification too:SearchRepository.getEffectiveChangeDescription()andpropagateEntitiesAfterBulkFlush()both prefer that field and only fall back tochangeDescriptionbecause it might be unset. Fixing the producer fixes every consumer at once.refactor: single-source EntityUpdater change-type classification- no behaviour change. TheincrementalFieldsChanged() ? ENTITY_UPDATED : ENTITY_NO_CHANGEternary was copy-pasted at five call sites; they now shareEntityUpdater.getChangeType(). The invariant is also written on the field's javadoc, since the bug was a write-side omission and centralising the read does not stop a sixth entry point repeating it. Safe to drop this commit if a reviewer considers it out of scope.test: cover ChangeEvent emission on the bulk entity update path- see Tests.Two things deliberately left alone, both verified rather than assumed:
setChangeDescription(...)unconditionally, unlike the two PUT sites which gate it. That asymmetry predates this PR and is untouched.reactUpdate()'s!incrementalFieldsChanged()is a boolean short-circuit, not an event classification, so it keeps calling the predicate directly.Tests:
Use cases covered
Get Schema Changesalert receives the event.PUTproduces the same event.Unit tests
Not applicable. The behaviour is the interaction between the updater, the store and the
change_eventtable, so it is covered by integration tests rather than mocked unit tests.Backend integration tests
openmetadata-integration-tests/src/test/java/org/openmetadata/it/tests/BulkChangeEventIT.java(6 cases).There was previously no coverage of change-event emission on
PUT /{collection}/bulk, which is why #25709 shipped green. The nearest existing test,BulkAssetChangeEventUserIT, covers the unrelated/domains/{fqn}/assets/addpath.The no-op test is parameterised over both routes to "nothing changed": the
sourceHashfast-path that short-circuits before diffing (what real connectors hit, since they always stamp a hash) and the full diff that finds nothing.These fail without the fix. Reverting commit 1 and rebuilding, 4 of the 6 cases fail with
ConditionTimeout ... expected the predicate to return <true> but was null- precisely the ones asserting an event appears. The two no-op cases still pass, correctly, since "no event" holds either way.Ingestion integration tests
Playwright (UI) tests
Manual testing performed
Local stack on
main, seeded, same table and same column add, only the endpoint differing:ENTITY_UPDATEDeventstotalEventsCountPUT /v1/tables/bulkbefore fixPUT /v1/tablescontrolPUT /v1/tables/bulkafter fixThe event produced by the bulk path carries what the alert rule needs:
{"eventType":"entityUpdated","currentVersion":0.4,"previousVersion":0.3, "fieldsAdded":["columns"],"fieldsUpdated":[]}matchAnyFieldChange({'columns','dataModel','joins'})matches on that top-levelcolumnsentry. A no-op re-send afterwards produced 0 new events.UI screen recording / screenshots:
Not applicable.
Notes for reviewers
change_eventrows. This restores pre-1.13 volume for ingestion updates; growth stays bounded by the existingDataRetentionapp. The first ingestion run after upgrade emitsENTITY_UPDATEDfor every asset that genuinely changed in that run. That is correct and bounded by the run's real diff, not a replay of history, but customers who created alerts while the bug was live have not seen this traffic before. Worth a release note.updateDeleted()records adeletedchange). New behaviour, consistent with the single-PUT path, covered by a test.persistBulkUpdaters(). It sharesupdateWithDeferredStore()with this fix, so please do not "correct" it here.EntityRepositorychange only widens two methods to package-private and does not touchupdateWithDeferredStore()or either bulk classification site. Whichever merges second should rebase.Checklist:
Fixes <issue-number>: <short explanation>Fixes #<issue-number>above.