Skip to content

Fixes #32092: emit ChangeEvents for bulk entity updates - #32350

Merged
manerow merged 5 commits into
mainfrom
fix/bulk-ingestion-changeevent-suppression
Sep 2, 2026
Merged

manerow merged 5 commits into
mainfrom
fix/bulk-ingestion-changeevent-suppression

Conversation

@manerow

@manerow manerow commented Sep 1, 2026 •

Copy link
Copy Markdown
Contributor

Describe your changes:

Fixes #32092

What was broken. A Get Schema Changes alert 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_event table. 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_UPDATED or ENTITY_NO_CHANGE. That decision reads incrementalChangeDescription, the diff for this request.

EntityUpdater has 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:

// update() and friends, via flushUpdateBody()  ->  correct
updateInternal();                       // compute the diff
captureIncrementalFromCurrentChange();  // record it as this request's diff

// updateWithDeferredStore()  ->  the bug
updateInternal();                       // compute the diff
                                        // <- record step missing

The field stayed null, and incrementalFieldsChanged() reads null as "nothing changed". So the update was classified ENTITY_NO_CHANGE, and buildChangeEventJsonForBulkOperation() drops those. Entity row written, version history written, event silently discarded.

updateWithDeferredStore() is what every PUT /v1/{collection}/bulk endpoint uses, which is the standard ingestion sink for every data asset. So this affected all ingested types, sync and ?async=true alike.

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. AuditLogConsumer builds the audit trail from change_event with 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 on 1.13, 2.0 and main; not 1.12. Backports to follow via the usual To release flow.

Type of change:

  • Bug fix

High-level design:

Three commits, meant to be read in order:

  1. 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 EntityUpdater entry point, incrementalChangeDescription holds this request's diff" is relied on outside event classification too: SearchRepository.getEffectiveChangeDescription() and propagateEntitiesAfterBulkFlush() both prefer that field and only fall back to changeDescription because it might be unset. Fixing the producer fixes every consumer at once.

  2. refactor: single-source EntityUpdater change-type classification - no behaviour change. The incrementalFieldsChanged() ? ENTITY_UPDATED : ENTITY_NO_CHANGE ternary was copy-pasted at five call sites; they now share EntityUpdater.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.

  3. test: cover ChangeEvent emission on the bulk entity update path - see Tests.

Two things deliberately left alone, both verified rather than assumed:

  • The PATCH site calls 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

  • Metadata ingestion adds a column to a table, and a Get Schema Changes alert receives the event.
  • Ingestion re-runs with nothing changed, and no event is emitted (no spurious re-notification).
  • The same column add through bulk and through the single-entity PUT produces the same event.
  • Bulk-PUT of a soft-deleted entity emits its restore event.

Unit tests

Not applicable. The behaviour is the interaction between the updater, the store and the change_event table, so it is covered by integration tests rather than mocked unit tests.

Backend integration tests

  • Added 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/add path.

The no-op test is parameterised over both routes to "nothing changed": the sourceHash fast-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

  • Not applicable (no ingestion changes).

Playwright (UI) tests

  • Not applicable (no UI changes).

Manual testing performed

Local stack on main, seeded, same table and same column add, only the endpoint differing:

Path Version ENTITY_UPDATED events Alert totalEventsCount
PUT /v1/tables/bulk before fix 0.1 -> 0.2 0 1
PUT /v1/tables control 0.2 -> 0.3 1
PUT /v1/tables/bulk after fix 0.3 -> 0.4 1 2

The 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-level columns entry. A no-op re-send afterwards produced 0 new events.

UI screen recording / screenshots:

Not applicable.

Notes for reviewers

  • Expect more change_event rows. This restores pre-1.13 volume for ingestion updates; growth stays bounded by the existing DataRetention app. The first ingestion run after upgrade emits ENTITY_UPDATED for 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.
  • Bulk-PUT of a soft-deleted entity now emits an event (updateDeleted() records a deleted change). New behaviour, consistent with the single-PUT path, covered by a test.
  • The recursive delete/restore cascade still emits one event, not N. That is deliberate and documented in persistBulkUpdaters(). It shares updateWithDeferredStore() with this fix, so please do not "correct" it here.
  • Related to but independent of Pipeline alerts fire for historical executions ingested by the metadata agent #31782 / Fixes #31782: stop pipeline alerts firing for historical and re-ingested executions #32181. Different endpoint, different repository, opposite direction (that one emits too many events, this one emitted none). No functional overlap: Fixes #31782: stop pipeline alerts firing for historical and re-ingested executions #32181's EntityRepository change only widens two methods to package-private and does not touch updateWithDeferredStore() or either bulk classification site. Whichever merges second should rebase.

Checklist:

  • I have read the CONTRIBUTING document.
  • My PR title is Fixes <issue-number>: <short explanation>
  • My PR is linked to a GitHub issue via Fixes #<issue-number> above.
  • I have commented on my code, particularly in hard-to-understand areas.
  • For JSON Schema changes: not applicable, no schema changes.
  • For UI changes: not applicable, no UI changes.
  • I have added tests (unit / integration / Playwright as applicable) and listed them above.
  • I have added a test that covers the exact scenario we are fixing.

@manerow
manerow requested a review from a team as a code owner September 1, 2026 10:21
@manerow manerow added safe to test Add this label to run secure Github workflows on PRs backend labels Sep 1, 2026
@github-actions

github-actions Bot commented Sep 1, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR checks passed

The linked issue has a description and all required Shipping project fields set. Thanks!

@github-actions

github-actions Bot commented Sep 1, 2026 •

Copy link
Copy Markdown
Contributor

✅ Playwright Results — workflow succeeded

Validated commit 639484998023da057646602daf666412239524c1 in Playwright run 33597699989, attempt 1.

✅ 555 passed · ❌ 0 failed · 🟡 0 flaky · ⏭️ 0 skipped · 🧰 0 lifecycle flaky

Performance

Blocking 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:

  • Browser traffic was 214.63 requests per attempt (convergence target: fewer than 200).
  • Application boot ratio was 2.82 per UI scenario (1627 boots / 576 scenarios; convergence target: at most 1).
Shard Passed Failed Flaky Skipped Lifecycle failed Lifecycle flaky
✅ Shard chromium-01 133 0 0 0 0 0
✅ Shard chromium-02 140 0 0 0 0 0
✅ Shard chromium-03 126 0 0 0 0 0
✅ Shard data-asset-rules-01 63 0 0 0 0 0
✅ Shard domain-isolation-01 16 0 0 0 0 0
✅ Shard global-state-01 34 0 0 0 0 0
✅ Shard ingestion-01 1 0 0 0 0 0
✅ Shard reindex-01 2 0 0 0 0 0
✅ Shard search-01 11 0 0 0 0 0
✅ Shard search-rbac-01 29 0 0 0 0 0

📦 Download artifacts

How to debug locally
# Download playwright-test-results-<shard> artifact and unzip
npx playwright show-trace path/to/trace.zip    # view trace

@gitar-bot

gitar-bot Bot commented Sep 2, 2026

Copy link
Copy Markdown
Code Review ✅ Approved

Restores ChangeEvent emission for bulk entity updates by adding the missing captureIncrementalFromCurrentChange() phase to updateWithDeferredStore(), fixing a regression where /bulk endpoints wrote no events to change_event. Centralizes change-type classification across five call sites and adds comprehensive test coverage of the bulk path. No issues found.

Options

Display: compact → Showing less information.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source

@manerow
manerow added this pull request to the merge queue Sep 2, 2026
Merged via the queue into main with commit a3e5f5f Sep 2, 2026
111 checks passed
@manerow
manerow deleted the fix/bulk-ingestion-changeevent-suppression branch September 2, 2026 15:59
Rohit0301 pushed a commit that referenced this pull request Sep 3, 2026
* 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
manerow added a commit that referenced this pull request Sep 3, 2026
…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
manerow added a commit that referenced this pull request Sep 3, 2026
)

* 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)
shrabantipaul-collate pushed a commit to PRADDZY/OpenMetadata that referenced this pull request Sep 3, 2026
…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

This branch was previously deployed

1 inactive deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend safe to test Add this label to run secure Github workflows on PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bulk metadata ingestion suppresses ChangeEvents for entity updates

2 participants