Skip to content

fix(zdu): keep valid proposals in a batch and don't fail committed saves during a rollback - #21569

Open
gdatahub wants to merge 2 commits into
masterfrom
zdu/batch-keeps-valid-proposals
Open

gdatahub wants to merge 2 commits into
masterfrom
zdu/batch-keeps-valid-proposals

Conversation

@gdatahub

@gdatahub gdatahub commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Follows #20280. Two problems in the rollback tolerance. Both only apply with unknown-data tolerance on, which is off by default.

📋 Summary

With unknown-data tolerance on, keep the rest of an async batch when one proposal adds an unknown reference, and stop returning an error for a save that was already committed because its previous value came from a newer version.

What was wrong

  • The batch MCP consumer loses valid proposals. A proposal that adds a reference to an entity type this version doesn't know is rejected inside the write transaction, because telling "already stored" from "added" needs the stored row. The consumer writes each group (batchIngestSize, default 50) in one transaction, so that rejection failed the whole group and every proposal in it went to the failure topic. A typo type in the same position fails on its own, because it is rejected before the transaction.
  • A committed save reports an error. After a write commits and its MCL is produced, post-commit side effects build an MCLItemImpl, which validates the previous value. If that previous value holds an enum symbol only the newer version defines, the request fails after the fact: Rest.li answers 422 and OpenAPI 400, while the row was written and the MCL produced. Clients may retry a write that already succeeded.

Changes

  • EntityServiceImpl.mergeStoredReferences throws the new UnknownReferenceAddedException, a ValidationException with the same message that names the urn and aspect it rejects. API callers get the same 400/422 as before.
  • JavaEntityClient.ingestValidProposals (used by the batch MCP consumer) catches it, rejects the first proposal for that urn and aspect (it goes to the failure topic as before), and writes the rest of the group again. Nothing of the group was committed: every applyUpsert runs before the first commitAndContinue. Timeseries aspects, written before that transaction, are not written again. If no proposal of the group matches (a write hook added the reference), it rethrows and the group fails as today.
  • EntityServiceImpl.processPostCommitMCLSideEffects builds each item through sideEffectItem. When only the previous value fails validation and is attributed to a newer version, the side effects run without it and a rate-limited warning is logged. Any other validation failure still throws. Indexing already follows this rule for the same case (UpdateIndicesService).
  • The helpers indexing used for that case move so both paths share them: MCLItemImpl.buildWithoutPrevious, MCLItemImpl.withoutPreviousFromNewerVersion and GenericRecordUtils.deserializeAspectOrNull. Indexing behaviour is unchanged.
  • docs/how/breaking-changes.md: an entry for both changes. It also says which saves of an aspect holding a newer enum value are rejected (a patch, or an edit that writes the stored aspect back) and which are saved (a request that replaces the whole aspect).

Design

Options considered for the batch consumer: (A) retry the group without the rejected proposal, (B) report the rejection per item inside the same transaction, (C) read the stored row before the transaction. A was chosen: it stays inside the consumer's entity-client call and leaves the core write transaction untouched. Sync APIs are unchanged on purpose: a sync batch stays all-or-nothing, as it is for any invalid item.

Flags off

With tolerance off nothing changes. Strict handling never reports an added reference, and the previous value is only left out when unknown data is tolerated.

Known limitations

  • MCP observers that run before the write transaction run again for a retried group.
  • Post-commit side effects that diff against the previous value see none in the second case. For example, DataProductAssetsSideEffect mirrors the assets that save adds but not the ones it removes. Today no side effects run for the whole batch.

Testing

  • JavaEntityClientTest (22): only the proposal adding the reference is rejected and the rest are written; a later proposal for the same urn and aspect is kept; timeseries aspects aren't written twice; a reference no proposal added is rethrown.
  • EntityServiceImplTest (59): produceMCLAsync succeeds when the previous value is from a newer version, and strict handling still throws.
  • UpdateIndicesServiceTest (30) for the moved helpers.
  • Live, local Docker quickstart (consumers in GMS, batch MCP consumer on). The same probes were run against master and against this branch, each with tolerance off and on. Data the newer version wrote is seeded directly: its entityType row is registered, and an ownership row holds an owner type it defines.
Case master, off branch, off master, on branch, on
Kafka batch of 5, one adds the newer version's type 0/5 written, 5 to failure topic same 0/5 written, 5 to failure topic 4/5 written, only that one to failure topic
Kafka batch of 5, one typo type (control) 0/5, 5 to failure topic same same same
Rest.li sync batch with that proposal 422, nothing written same same same
OpenAPI async write of that proposal 202, then failure topic same same same
Rest.li save, previous value holds the newer enum 422, but written and MCL produced same same 200, written, MCL produced
OpenAPI save, same 400, but written and MCL produced same same 200, written, MCL produced
Rest.li / OpenAPI save, known previous value (control) 200 same same same

With tolerance off, the branch gives the same result as master in every case. With it on, the post-commit case logs ownership's previous value, from a newer version (running post-commit side effects without it) once per save.

@github-actions github-actions Bot added docs Issues and Improvements to docs product PR or Issue related to the DataHub UI/UX labels Nov 24, 2026
@github-actions

github-actions Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Smart test selection

pytest smoke tests

Mode: shadow. The selection below is computed but not applied; this PR still runs the default matrix (p0).

  • Selection: smart: tests for the tagged features, plus always-run modules, this PR's changed tests, and the plumbing sample if the PR changes the pytest harness
  • Size: 207 of 846 tests in 2 batches, predicted longest batch ~4 min
  • Tags: change-type: docs; feature-dev: aspect-validation, mce-mcl-pipeline, search-indexing, system-metadata; feature-user: ingestion; technical-layer: kafka-events, openapi, restli
  • Confidence: MEDIUM (9 changed files)
  • Classifier reasoning: Changes handle unknown-reference and newer-version previous values in MCL/MCP write paths (batch ingestion, post-commit side effects, UpdateIndicesService) plus a breaking-changes doc, so they touch mce-mcl-pipeline and aspect-validation with search-indexing, and the Kafka batch consumer ties to in…

Medium confidence: a wrong tag means tests are skipped, so check the tags above against what this PR touches.

Selected scopes (37 files or classes, 207 tests)
  • tests/e2e/assertions/dbt_test_results_test.py
  • tests/e2e/audit_events/audit_events_test.py
  • tests/e2e/authorization/test_aspect_write_auth.py
  • tests/e2e/authorization/test_domain_scoped_create_entity_auth.py
  • tests/e2e/authorization/test_domain_scoped_create_entity_auth.py::TestDomainScopedCreateEntityAuth
  • tests/e2e/authorization/test_privilege_grant_auth.py
  • tests/e2e/authorization/test_self_entity_auth.py
  • tests/e2e/browse/browse_test.py
  • tests/e2e/cli/ingest_cmd/test_timeseries_rollback.py
  • tests/e2e/cli/migrate_cmd/test_migrate_instance2instance_smoke.py
  • tests/e2e/cli/migrate_cmd/test_migrate_scenarios_smoke.py
  • tests/e2e/dataproduct/test_dataproduct_hierarchy_delete.py
  • tests/e2e/delete/delete_test.py
  • tests/e2e/domains/domains_test.py
  • tests/e2e/entity_versioning/test_versioning_ingest.py
  • tests/e2e/forms/forms_test.py
  • tests/e2e/frontend/test_static_asset_encodings.py
  • tests/e2e/managed_ingestion/managed_ingestion_test.py
  • tests/e2e/mcp/mcp_test.py
  • tests/e2e/odcs/test_odcs_ingestion.py
  • tests/e2e/openapi/v1/test_tracking.py
  • tests/e2e/pgqueue/test_messaging_operations.py
  • tests/e2e/platform_resources/test_platform_resource.py
  • tests/e2e/query_projection/test_query_projection_smoke.py
  • tests/e2e/read_only/test_ingestion_list.py
  • tests/e2e/read_only/test_services_up.py
  • tests/e2e/search/test_lineage_search_index_fields.py
  • tests/e2e/search/test_search_projection.py::TestSearchProjection
  • tests/e2e/status/test_lifecycle_state.py::TestLifecycleStageAPIs
  • tests/e2e/structured_properties/test_structured_properties.py
  • tests/e2e/structured_properties/test_validator_error_messages.py
  • tests/e2e/telemetry/telemetry_test.py
  • tests/e2e/test_e2e.py
  • tests/e2e/test_kafka_default_sink.py
  • tests/e2e/test_rapid.py
  • tests/e2e/test_stateful_ingestion.py
  • tests/e2e/trace/test_api_trace.py

Add the run-all-tests:pytest label to run the full pytest suite on this PR.

Playwright E2E tests

This run: smart

  • Selection: smart: specs tagged aspect-validation, ingestion, mce-mcl-pipeline, search-indexing, system-metadata plus the tests the change affects
  • Size: 22 tests in 5 spec files, ~3 min predicted on 1 shard(s)
Specs selected because of this PR (5)
Spec Tests Why
ingestion-v3/odcs-source.spec.ts 2/2 tagged ingestion
ingestion-v3/run-history.spec.ts 6/6 tagged ingestion
ingestion-v3/secrets-tab.spec.ts 4/4 tagged ingestion
ingestion-v3/sources.spec.ts 7/7 tagged ingestion
mutations/manage-ingestion-secret-privilege.spec.ts 3/3 tagged ingestion

Add the run-all-tests:playwright label to run the full Playwright suite on this PR.

commit 4f74ba9 · workflow run

@codecov

codecov Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 88.33333% with 7 lines in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...om/linkedin/metadata/utils/GenericRecordUtils.java 0.00% 5 Missing ⚠️
...com/linkedin/metadata/client/JavaEntityClient.java 93.54% 0 Missing and 2 partials ⚠️

📢 Thoughts on this report? Let us know!

@cursor

cursor Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

PR Summary

Overview
When unknown-data tolerance is enabled (UNKNOWN_DATA_TOLERANCE_ENABLED), this PR fixes two zero-downtime rollback gaps that previously failed whole Kafka batches or returned 4xx after a successful commit.

Batch MCP ingest: A proposal that adds a reference to an entity type the rolled-back build doesn't know used to fail the entire ingest group. EntityServiceImpl now throws UnknownReferenceAddedException (urn + aspect). JavaEntityClient.ingestValidProposals catches it, sends only the matching proposal to the rejection list, and retries the rest of the group (skipping already-written timeseries aspects).

Post-commit saves: If a write commits but the MCL's previous aspect holds enums or fields only a newer version defines, post-commit side effects no longer fail the API response. sideEffectItem builds an MCLItem without the previous value when it's attributed to a newer version—aligned with indexing via shared helpers on MCLItemImpl (buildWithoutPrevious, withoutPreviousFromNewerVersion) and GenericRecordUtils.deserializeAspectOrNull. Strict handling and tolerance-off behavior are unchanged.

Breaking-change notes were added for both behaviors.

Reviewed by Cursor Bugbot for commit 4f74ba9. Bugbot is set up for automated code reviews on this repo. Configure here.

…ves during a rollback

With unknown-data tolerance on:

- The batch MCP consumer writes each group of proposals in one transaction.
  A proposal that adds a reference to an entity type this version doesn't
  know is only found inside that transaction, so it failed the whole group
  and every proposal went to the failure topic. EntityServiceImpl now throws
  UnknownReferenceAddedException (a ValidationException naming the urn and
  aspect); JavaEntityClient.ingestValidProposals rejects that proposal and
  writes the rest of the group again. Timeseries aspects, written before the
  transaction, are not written twice.
- Post-commit side effects validate the MCL's previous value. When that value
  holds an enum symbol only a newer version defines, the save was committed
  and its MCL produced, but the request still failed. The side effects now
  run without the previous value in that case, as indexing already does.

The helpers indexing used for this move to MCLItemImpl and
GenericRecordUtils so both paths share them. With tolerance off nothing
changes.

This branch was successfully deployed

1 active deployment
Preview — 4f74ba97 Deployed Nov 27, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Issues and Improvements to docs product PR or Issue related to the DataHub UI/UX

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant