Repository navigation
Fixes 20966: clear sourceHash on PATCH so the bulk fast-path resyncs edited entities - #32246
zak-nuccio wants to merge 1 commit into
Conversation
…edited entities The bulk PUT fast-path skips any entity whose connector-supplied sourceHash matches the stored value. The stored sourceHash was never cleared when an entity was edited out-of-band via PATCH, so a manual edit (for example a tag removed in the UI) was not re-applied on the next ingestion run: the identical sourceHash compared equal and the entity was skipped before any diff. Clear sourceHash on every PATCH so the next bulk run sees a null stored hash, takes the full diff path and re-applies the source content. The next ingestion re-stamps the hash, so the fix forces at most one extra reprocess after a manual edit rather than discarding the edit permanently. Add a regression IT that PATCH-clears a tag and re-ingests with a matching sourceHash, asserting the tag is re-applied.
❌ PR checklist incompleteThis PR cannot be merged until the following are addressed on its linked issue:
The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically. Maintainers can bypass this check by adding the |
|
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! |
| @@ -187,6 +230,61 @@ private String tableFqn(String schemaFqn, String tableName) { | |||
| return schemaFqn + "." + tableName; | |||
| } | |||
|
|
|||
There was a problem hiding this comment.
The new comments above createClassificationAndTag, patchTableTagsToEmpty, and the manual patch call merely restate the self-explanatory operations, adding maintenance noise without documenting non-obvious rationale.
Context Used: CLAUDE.md (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Code Review ✅ ApprovedFixes the regression where manual edits via PATCH are silently lost on the next ingestion run by clearing 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 |
|
The goal of sourceHash is to preserve whats in the Source which is snowflake, databricks etc.. if nothing chnaged in source there is no reason to write it again. If we start incorporating the patch , any edits in the UI by the user now impacts the sourceHash, then everytime we run ingestion we write all the objects as the source hash is changed on the OM side. Can you give us an example what PATCH are you running, is the PATCH coming from the ingestion or externally |
|
@harshach For context, this was to try and get around the issue of wanting to make manual changes to a table in OpenMetadata, but hitting the issue that sourceHash would make the ingestion think nothing was changed, and thus a later bulk load wouldn't overwrite the change (which we wanted to use for ingestion testing). After some digging, we realised that sourceHash can actually just be edited via a PATCH call too, so instead we'll just be using a call to remove the hash so that later bulk ingestions see that the table should be reingested. Closing |
Why
Closes #20966.
The bulk
PUT /api/v1/tables/bulkfast-path (introduced in #28155) skips any entity whoseconnector-supplied
sourceHashmatches the stored value, before any field hydration or diffing.The stored
sourceHashis never cleared when an entity is edited out-of-band via PATCH, so amanual edit (e.g. a tag removed in the UI) is silently lost on the next ingestion run: the identical
sourceHashcompares equal and the entity is skipped.Concretely:
sourceHash = H(tags).sourceHashstaysH(tags).H(tags).H(tags) == H(tags)-> skip -> tags never restored.Before 2.0.0 the bulk path processed every entity, so tags always re-synced from source. This is a
regression from the sourceHash feature.
Fix
Clear
sourceHashon every PATCH. All PATCH endpoints funnel throughEntityRepository.patchCommonWithOptimisticLocking, so this is a single point of change. The nextbulk run then sees a null stored hash,
isSourceHashUnchangedreturns false, and the full diff pathre-applies the source content. The next ingestion re-stamps the hash, so the fix costs at most one
extra reprocess after a manual edit rather than losing the edit permanently.
EntityInterface: add adefault void setSourceHash(String)no-op (mirrors the existingdefault String getSourceHash()); generated entity POJOs that declaresourceHashalreadyoverride it with a real setter.
EntityRepository.patchCommonWithOptimisticLocking: setupdated.setSourceHash(null)beforepersisting, after
restorePatchSecretsso no hook can restore it.Trade-off
Clearing on every PATCH also affects ingestion-driven PATCHes (e.g. lineage or bulk description
patches), disabling the fast-path for those entities on the next bulk run. That is a performance
cost, not a correctness one, and only until the next successful ingestion re-stamps the hash. If
that matters for high-volume PATCH connectors, a follow-up could restrict the clear to patches not
authored by the ingestion bot.
Test
Adds
test_manualPatchClearsSourceHash_soSameHashReappliesTagstoBulkSourceHashFastPathIT:creates a table with a tag and a
sourceHash, PATCH-clears the tag (asserting the storedsourceHashbecomes null), then re-ingests the identical batch and asserts the tag is re-applied -proving the fast-path does not skip after a manual PATCH edit.
Verified with
mvn spotless:applyon the touched modules andmvn compileonopenmetadata-spec(clean).openmetadata-servicecompiles the changed files clean; the full modulebuild is blocked in this environment by a pre-existing relocated-ES-class error in
ElasticSearchClient/SearchUtilsunrelated to this change.Greptile Summary
The PR invalidates an entity’s stored source hash after a meaningful PATCH so the next bulk ingestion performs a full reconciliation instead of incorrectly taking the unchanged-hash fast path.
Confidence Score: 4/5
The PR appears safe to merge; the only identified issue is non-blocking redundant commentary in the regression test.
The shared PATCH flow clears and persists sourceHash for meaningful edits, allowing the next bulk ingestion to perform reconciliation, and no blocking correctness or security failure remains.
Files Needing Attention: openmetadata-integration-tests/src/test/java/org/openmetadata/it/tests/BulkSourceHashFastPathIT.java
Important Files Changed
Sequence Diagram
Reviews (1): Last reviewed commit: "Fixes 20966: clear sourceHash on PATCH s..." | Re-trigger Greptile
Context used (3)