Skip to content

Fixes 36215: Widen task aboutFqnHash and repoint tasks on every FQN change (2.0) - #36262

Merged
yan-3005 merged 4 commits into
2.0from
yan-3005/entity-fqn-hash-2.0
Oct 27, 2026
Merged

yan-3005 merged 4 commits into
2.0from
yan-3005/entity-fqn-hash-2.0

Conversation

@yan-3005

@yan-3005 yan-3005 commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Describe your changes:

Fixes #36215

Backport of #36246 to 2.0. Same change; see #36246 for the full design and review discussion.

  • Migration (2.0.8, new version; 2.0.7 is released and untouched): widens task_entity.aboutFqnHash and domain_entity.fqnHash from 256 to 768 (MySQL aboutFqnHash → ascii_bin, so idx_status_about stays under InnoDB's 3072-byte key limit). Fixes task create / glossary-term move failing with value too long for type character varying(256) at 8+ levels, and 8th-level subdomains.
  • Tasks follow every rename/move: EntityUpdater.storeUpdate repoints aboutFqnHash and workflow instances when the stored FQN changed — exact match for the entity's own type, hash.% prefix for the types nested under it (getNestedFqnEntityTypes()), scoped by the task's about relationship type. Covers domain, tag, classification, data product, container, glossary, glossary term, page.

2.0-specific differences from #36246:

  • The task DAO change is in CollectionDAO.TaskDAO (2.0 has no FeedDAOs).
  • GlossaryRepository / GlossaryTermRepository keep 2.0's legacy-thread about updates; only the old glossary-only task-hash rewrite is removed.
  • Adds ListFilter.escapeLikeBindValue (identical to main) for the workflow-instance LIKE escaping.
  • GlossaryTermResourceIT gains the task imports that main already had.

Type of change:

  • Bug fix

Tests:

Run on this branch after the move to 2.0.8, merged with latest 2.0 (-DintegrationTests.lane=parallel): TaskAboutFqnChangeIT (8), GlossaryTermResourceIT#test_createTaskAboutEighthLevelTerm, #test_moveTermWithTaskToEighthLevel_repointsTask, DomainResourceIT#test_createEighthLevelSubDomain, ContinuousMigrationIT (3):

  • postgres-opensearch: Tests run: 14, Failures: 0, Errors: 0, Skipped: 0
  • mysql-elasticsearch: Tests run: 14, Failures: 0, Errors: 0, Skipped: 0

Broader regression runs and the before/after evidence are on #36246.

Checklist:

🤖 Generated with Claude Code

RetriggerView in GreptileConfidence Score: 4/5

The PR should not merge until cached task writes can no longer undo a rename and the outstanding repository requirements are satisfied.

Findings

  1. P1 Comments undo task moves ▶
  2. P2 Unchanged variables omit final ▶
  3. P2 Test strings lack shared constants ▶

Summary

Widens task and domain hashes in migration 2.0.8 and moves task and workflow rewrites into the shared entity update path.

  • Tasks and workflow history follow renamed or moved entities.
  • Deep task and domain names fit in the database.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Store entity update] --> B{Stored FQN changed?}
  B -->|No| C[Leave task and workflow links unchanged]
  B -->|Yes| D[Match own tasks by exact hash and type]
  D --> E[Match nested tasks by hash prefix and type]
  E --> F[Rewrite workflow links for matching types]
  F --> G[Commit transaction]
Loading

Reviews (3) · Last reviewed commit: "Merge remote-tracking branch 'origin/2.0..." · Reviewed by Greptile

…hange

Backport of #36246 to 2.0.

An FQN hash is one 32-char md5 per level, so anything eight or more levels
deep (263+ chars) overflowed task_entity.aboutFqnHash and
domain_entity.fqnHash, both varchar(256). The 2.0.7 migration widens both
to 768 (ascii_bin on MySQL so idx_status_about stays under InnoDB's
3072-byte key limit).

Tasks also lost their entity whenever an FQN changed outside the glossary.
The rewrite now runs once from EntityUpdater.storeUpdate when the stored
FQN changed: one statement matching the entity's own type by exact hash
and the types nested under it (getNestedFqnEntityTypes) by hash prefix,
scoped through the task's about relationship so a same-named entity of
another type keeps its tasks. Workflow-instance links are repointed the
same way, with LIKE wildcards escaped.

2.0-specific: the task DAO change lives in CollectionDAO.TaskDAO, the
glossary repositories keep updating legacy threads, and
ListFilter.escapeLikeBindValue is added as on main.
@yan-3005
yan-3005 requested a review from a team as a code owner October 26, 2026 14:05
@yan-3005
yan-3005 requested review from TeddyCr and removed request for a team October 26, 2026 14:05
@github-actions

Copy link
Copy Markdown
Contributor

❌ PR checklist incomplete

This PR cannot be merged until the following are addressed on its linked issue:

  • No GitHub issue is linked. Link an issue in the Development section of the PR (or add Fixes #12345 to the description). For a same-org cross-repo issue, add Fixes open-metadata/<repo>#123 to the description.

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 skip-pr-checks label.

@github-actions github-actions Bot added backend safe to test Add this label to run secure Github workflows on PRs labels Oct 26, 2026
Comment on lines +2447 to +2455
int tasks =
daoCollection
.taskDAO()
.updateAboutFqnHashBatch(
new ArrayList<>(fqnHashUpdates.keySet()), new ArrayList<>(fqnHashUpdates.values()));
for (int count : counts) {
rows += count;
.repointAboutFqnHash(
FullyQualifiedName.buildHash(oldFqn),
FullyQualifiedName.buildHash(newFqn),
entityType,
Relationship.MENTIONED_IN.ordinal(),
nestedTypes);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Comments undo task moves

The new rewrite changes task rows but leaves their cached JSON unchanged. Read a domain task by ID, rename the domain, then add a comment. EntityRepository.find can return the cached task with its old aboutFqnHash. TaskRepository.addComment calls storeEntity without running prepare, so it saves the old hash back and the task disappears from the renamed domain's task list.

Evict the affected task cache entries after commit. Add a regression test that warms the task cache before renaming, then adds a comment.

Knowledge Base Used: Metadata entity lifecycle

Comment on lines +2445 to +2447
private void repointTasksAndWorkflowInstancesForFqnChange(String oldFqn, String newFqn) {
List<String> nestedTypes = List.copyOf(getNestedFqnEntityTypes());
int tasks =

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Unchanged variables omit final

The new helpers omit final on parameters and local variables that never change. CLAUDE.md explicitly requires it for these declarations. Apply it to the new helpers, including nestedTypes and tasks here and the link variables in repointWorkflowInstancesForFqnChange. This repository requirement must be satisfied before merging.

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!

Comment on lines +228 to +229
new DescriptionUpdatePayload()
.withFieldPath("description")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Test strings lack shared constants

The new tests repeat raw strings such as "tag" and "description" instead of using named constants. CLAUDE.md requires a named constant whenever a string appears more than once. The added task helper in GlossaryTermResourceIT.java also repeats "description". Extract shared constants to satisfy this repository requirement before merging.

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!

2.0.7 is released, so the task_entity.aboutFqnHash and domain_entity.fqnHash
widening moves to a new 2.0.8 version; 2.0.7 matches 2.0 again.
@gitar-bot

gitar-bot Bot commented Oct 27, 2026

Copy link
Copy Markdown
Code Review ✅ Approved

🔴 High risk · The migration widens persisted FQN-hash columns and bulk-repoints task/workflow links on renames; SQL or matching errors could orphan or misassociate records.

Widens task_entity.aboutFqnHash and domain_entity.fqnHash to 768 characters in a 2.0.8 migration so deep task and domain FQNs fit, and repoints task and workflow hashes whenever an entity's stored FQN changes. No issues found.

Verification

Rules No rules evaluated

Functional validation Not enabled

Set up

Auto-approval Not enabled

Set up

For more verification details, comment gitar display:verbose.

Options

Display: compact → Showing compact verification results.

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

…sh-2.0

# Conflicts:
#	bootstrap/sql/migrations/native/2.0.8/mysql/schemaChanges.sql
#	bootstrap/sql/migrations/native/2.0.8/postgres/schemaChanges.sql

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.

2 participants