Skip to content

fix(search-indexing): reclaim orphaned ingestion pipelines and guard null testDefinition during reindex - #29836

Merged
mohityadav766 merged 4 commits into
mainfrom
fix-reindex-orphan-ingestion-pipeline-and-testcase-npe
Jul 13, 2026
Merged

mohityadav766 merged 4 commits into
mainfrom
fix-reindex-orphan-ingestion-pipeline-and-testcase-npe

Conversation

@mohityadav766

@mohityadav766 mohityadav766 commented Jul 8, 2026 •

Copy link
Copy Markdown
Member

Problem

Two failures observed in SearchIndexingApplication (reindex) that the DataRetention orphan cleanup did not cover:

  1. Orphaned ingestion pipelines — when a service (or test suite) is hard-deleted without the cascade reaching its ingestion pipeline, the pipeline row survives with no incoming CONTAINS relationship. Reindex then throws:

    Entity type ingestionPipeline <id> does not have expected relationship contains to/from entity type null

    because IngestionPipelineRepository.setFields resolves the container via getContainer (mustHaveRelationship=true). Nothing swept these, so every reindex kept hitting them.

  2. NullPointerException building the TestCase search doc — TestCaseIndex called testCase.getTestDefinition().getId() with no null check, so a test case whose testDefinition relationship is gone NPE'd. Unlike the "expected relationship" errors (which are downgraded to stale-reference warnings), this NPE is not classified as stale, so it failed the reindex outright.

Fix

  • OrphanIngestionPipelineCleanup (new) — mirrors OrphanTestCaseRelationshipCleanup, wired into DataRetention. Pages ingestion pipelines, finds ones with no CONTAINS container, and hard-deletes them via the standard delete with a force-delete fallback (search doc, pipeline-status time series, relationship rows, entity row) — needed because the standard delete itself resolves the missing container and throws. Soft-deleted pipelines are skipped.
  • TestCaseIndex — guards the testDefinition lookup with if (testCase.getTestDefinition() != null), exactly like TestCaseResultIndex already does.

Notes

  • Orphan detection uses findFromBatch(..., CONTAINS); relationship rows are only ever hard-deleted (never deleted=TRUE), so this matches getContainer's semantics with no false positives.
  • The testCaseResolutionStatus orphan sweep for the same class of reindex error is already on main (feat(dataRetention): sweep orphan time-series rows for per-type tables #28384); this PR adds the two remaining cases.

Testing

  • OrphanIngestionPipelineCleanupIT — asserts an orphaned pipeline (its CONTAINS row removed) is deleted while a healthy pipeline survives (selective, not a blanket wipe).
  • mvn -pl openmetadata-service -am install → BUILD SUCCESS; openmetadata-integration-tests test-compile → BUILD SUCCESS; spotless:check clean.

🤖 Generated with Claude Code

Greptile Summary

This PR fixes reindex failures caused by orphaned ingestion pipelines and missing test definitions. The main changes are:

  • Adds a DataRetention cleanup for ingestion pipelines without a container relationship.
  • Adds a direct cleanup fallback for orphaned pipeline rows and related data.
  • Guards TestCase search indexing when testDefinition is missing.
  • Adds integration coverage for selective orphan pipeline cleanup.

Confidence Score: 5/5

This looks safe to merge.

  • No blocking issues found in the changed code.

Important Files Changed

Filename Overview
openmetadata-service/src/main/java/org/openmetadata/service/util/OrphanIngestionPipelineCleanup.java Adds orphan ingestion pipeline detection and deletion with a direct fallback path.
openmetadata-service/src/main/java/org/openmetadata/service/apps/bundles/dataRetention/DataRetention.java Runs the new orphan ingestion pipeline cleanup during DataRetention.
openmetadata-service/src/main/java/org/openmetadata/service/search/indexes/TestCaseIndex.java Skips test definition fields when the test case no longer has a definition.
openmetadata-integration-tests/src/test/java/org/openmetadata/it/tests/OrphanIngestionPipelineCleanupIT.java Covers deletion of an orphan pipeline while keeping a healthy pipeline.

Reviews (4): Last reviewed commit: "Merge branch 'main' into fix-reindex-orp..." | Re-trigger Greptile

Context used (3)

  • Context used - CLAUDE.md (source)
  • Context used - openmetadata-ui-core-components/CLAUDE.md (source)
  • Context used - AGENTS.md (source)

…null testDefinition during reindex

Two reindex failures observed in SearchIndexingApplication that DataRetention did
not cover:

1. Orphaned ingestion pipelines. When a service (or test suite) is hard-deleted
   without the cascade reaching its ingestion pipeline, the pipeline row survives
   with no incoming CONTAINS relationship. Reindex then throws "Entity type
   ingestionPipeline <id> does not have expected relationship contains to/from
   entity type null" because IngestionPipelineRepository.setFields resolves the
   container via getContainer (mustHaveRelationship=true). Nothing swept these.

   Adds OrphanIngestionPipelineCleanup (mirrors OrphanTestCaseRelationshipCleanup)
   wired into DataRetention: pages pipelines, finds ones with no container, and
   hard-deletes them via the standard delete with a force-delete fallback (search
   doc, pipeline-status time series, relationship rows, entity row) since the
   standard delete itself resolves the missing container and throws.

2. NullPointerException building the TestCase search doc. TestCaseIndex called
   testCase.getTestDefinition().getId() with no null check, so a test case whose
   testDefinition relationship is gone NPE'd. Unlike the "expected relationship"
   errors, this NPE is not classified as a stale-reference warning, so it failed
   the reindex outright. Guards the lookup exactly like TestCaseResultIndex does.

Adds OrphanIngestionPipelineCleanupIT covering selective deletion (orphan removed,
healthy pipeline preserved).

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Copilot AI review requested due to automatic review settings July 8, 2026 09:49
@github-actions

github-actions Bot commented Jul 8, 2026

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 Jul 8, 2026

Copilot AI left a comment

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.

Pull request overview

This PR hardens reindexing and retention cleanup by reclaiming orphaned ingestion pipelines (missing CONTAINS container relationship) and preventing NullPointerException when indexing TestCase entities whose testDefinition relationship is missing.

Changes:

  • Add OrphanIngestionPipelineCleanup and wire it into the DataRetention app to hard-delete ingestion pipelines that have no incoming CONTAINS relationship.
  • Guard TestCaseIndex search-doc construction against null testDefinition references to avoid reindex failures.
  • Add an integration test that validates selective deletion of orphaned ingestion pipelines.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
openmetadata-service/src/main/java/org/openmetadata/service/util/OrphanIngestionPipelineCleanup.java New cleanup utility to detect and hard-delete ingestion pipelines missing their container relationship, with a force-delete fallback.
openmetadata-service/src/main/java/org/openmetadata/service/search/indexes/TestCaseIndex.java Adds a null-guard around testDefinition lookup during search doc construction.
openmetadata-service/src/main/java/org/openmetadata/service/apps/bundles/dataRetention/DataRetention.java Wires orphan ingestion pipeline cleanup into the Data Retention execution flow and stats.
openmetadata-integration-tests/src/test/java/org/openmetadata/it/tests/OrphanIngestionPipelineCleanupIT.java New IT verifying an orphaned pipeline is deleted while a healthy one remains.

Comment on lines +146 to +156
private Set<String> idsWithContainer(List<String> pipelineIds) {
List<EntityRelationshipObject> records =
collectionDAO
.relationshipDAO()
.findFromBatch(pipelineIds, INGESTION_PIPELINE, Relationship.CONTAINS.ordinal());
Set<String> withContainer = new HashSet<>();
for (EntityRelationshipObject record : records) {
withContainer.add(record.getToId());
}
return withContainer;
}
Comment on lines +196 to +205
try {
// Drop the search doc by id (no-op when the broken pipeline was never indexed; this does not
// rebuild the doc, so it won't re-trigger the container resolution).
try {
Entity.getSearchRepository().deleteEntityIndex(pipeline);
} catch (Exception ex) {
LOG.debug(
"Search-index cleanup skipped for ingestion pipeline {}: {}", id, ex.getMessage());
}
// Remove its pipeline-status time series, all relationship rows, then the row itself.
Comment on lines +193 to +207
private boolean forceDelete(IngestionPipeline pipeline) {
UUID id = pipeline.getId();
boolean deleted;
try {
// Drop the search doc by id (no-op when the broken pipeline was never indexed; this does not
// rebuild the doc, so it won't re-trigger the container resolution).
try {
Entity.getSearchRepository().deleteEntityIndex(pipeline);
} catch (Exception ex) {
LOG.debug(
"Search-index cleanup skipped for ingestion pipeline {}: {}", id, ex.getMessage());
}
// Remove its pipeline-status time series, all relationship rows, then the row itself.
if (!nullOrEmpty(pipeline.getFullyQualifiedName())) {
collectionDAO

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Quality: forceDelete leaves orphaned tag_usage rows for the pipeline

OrphanIngestionPipelineCleanup.forceDelete manually removes the pipeline's time-series status (ingestion Pipeline.pipelineStatus), all entity_relationship rows (deleteAll), the search index doc, and the ingestion_pipeline_entity row. However, the normal delete path (EntityRepository.cleanup / clearCommonRelationshipsForMany) also removes tag_usage rows for the entity. Since ingestion pipelines can carry tags, the force-delete fallback can leave orphaned tag_usage rows keyed by the pipeline's FQN/id behind. This is a rare fallback path (only hit when the standard delete throws due to the missing container) and cosmetic, but it slightly defeats the goal of fully reclaiming the pipeline footprint. Consider also calling the tag usage cleanup (e.g. tagUsageDAO().deleteTagsByTarget(...) / by FQN hash) in the fallback.

Was this helpful? React with 👍 / 👎

Comment on lines +78 to +92
public Result performCleanup(int batchSize) {
LOG.info(
"Starting orphan ingestion pipeline cleanup. Dry run: {}, Batch size: {}",
dryRun,
batchSize);
Result result = Result.builder().build();

int offset = 0;
while (true) {
List<String> jsonBatch =
collectionDAO
.ingestionPipelineDAO()
.listAfterWithOffset(
collectionDAO.ingestionPipelineDAO().getTableName(), batchSize, offset);
if (nullOrEmpty(jsonBatch)) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Quality: Methods exceed 15-line Java complexity guideline

Per the project's Java complexity guideline (methods ≤ 15 lines), performCleanup (~lines 78-113, ~28 lines) and forceDelete (~lines 193-221, ~27 lines) exceed the limit. They can be split, e.g. extract the paging loop body of performCleanup into a helper that reads+cleans one batch, and extract the search-doc removal and the DB-footprint removal in forceDelete into small helpers. Purely a maintainability/style note.

Was this helpful? React with 👍 / 👎

@github-actions

github-actions Bot commented Jul 8, 2026 •

Copy link
Copy Markdown
Contributor

🟡 Playwright Results — all passed (23 flaky)

✅ 4514 passed · ❌ 0 failed · 🟡 23 flaky · ⏭️ 95 skipped

Shard Passed Failed Flaky Skipped
🟡 Shard 1 423 0 4 16
✅ Shard 2 11 0 0 0
🟡 Shard 3 816 0 12 8
🟡 Shard 4 819 0 1 18
✅ Shard 5 829 0 0 5
✅ Shard 6 833 0 0 46
🟡 Shard 7 783 0 6 2
🟡 23 flaky test(s) (passed on retry)
  • Features/CustomizeDetailPage.spec.ts › API Collection - customization should work (shard 1, 1 retry)
  • Features/Glossary/GlossaryPagination.spec.ts › should check for nested glossary term search (shard 1, 1 retry)
  • Pages/Lineage/LineageRightPanel.spec.ts › Verify custom properties tab IS visible for supported type: metric (shard 1, 1 retry)
  • Flow/SearchRBAC.spec.ts › a fully denied user sees neither asset type when browsing (shard 1, 1 retry)
  • Features/BulkEditEntity.spec.ts › Glossary Term (Nested) (shard 3, 2 retries)
  • Features/BulkImportWithDotInName.spec.ts › Import at database level with dot in service name (shard 3, 1 retry)
  • Features/ContextCenterArchivePage.spec.ts › archive page lazy-loads more rows on scroll within its own scroll container (shard 3, 1 retry)
  • Features/ContextCenterArticles.spec.ts › Article listing search filters, clears, and shows empty state (shard 3, 1 retry)
  • Features/ContextCenterArticles.spec.ts › Article list cards, recently viewed widget, and pagination work (shard 3, 1 retry)
  • Features/ContextCenterArticles.spec.ts › description: switching articles does not bleed unsaved content into next article (shard 3, 1 retry)
  • Features/ContextCenterDocument.spec.ts › move document to folder via card menu shows folder name on the card (shard 3, 1 retry)
  • Features/ContextCenterMemories.spec.ts › clicking a memory row adds ?memory= param to the URL (shard 3, 1 retry)
  • Features/ContextCenterMemories.spec.ts › ArrowDown + Enter keyboard navigation selects the linked table result (shard 3, 1 retry)
  • Features/ContextCenterPermission.spec.ts › user with view-only permission cannot see restore or delete actions on an archived document (shard 3, 2 retries)
  • Features/ContextCenterPermission.spec.ts › created-by-me filter on the archive page shows only the current user's archived documents (shard 3, 1 retry)
  • Features/Glossary/GlossaryAdvancedOperations.spec.ts › should remove domain from glossary (shard 3, 1 retry)
  • Features/SearchExport.spec.ts › Export queues a background job and downloads from the jobs tray (shard 4, 1 retry)
  • Pages/GlossaryImportExport.spec.ts › Import partial success - some terms pass, some fail (shard 7, 1 retry)
  • Pages/GlossaryImportExport.spec.ts › Glossary CSV import rejects unknown relation type (shard 7, 1 retry)
  • Pages/Lineage/LineageFilters.spec.ts › Verify Impact Analysis service filter selection (shard 7, 1 retry)
  • Pages/Lineage/LineageRightPanel.spec.ts › Verify custom properties tab is NOT visible for pipelineService in platform lineage (shard 7, 1 retry)
  • Pages/Lineage/LineageRightPanel.spec.ts › Verify custom properties tab is NOT visible for apiService in platform lineage (shard 7, 1 retry)
  • Pages/TestSuite.spec.ts › Logical TestSuite (shard 7, 1 retry)

📦 Download artifacts

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

@mohityadav766 mohityadav766 self-assigned this Jul 9, 2026
@mohityadav766 mohityadav766 added the To release Will cherry-pick this PR into the release branch label Jul 9, 2026
Copilot AI review requested due to automatic review settings July 9, 2026 09:09

Copilot AI left a comment

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.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

Comment on lines +193 to +215
private boolean forceDelete(IngestionPipeline pipeline) {
UUID id = pipeline.getId();
boolean deleted;
try {
// Drop the search doc by id (no-op when the broken pipeline was never indexed; this does not
// rebuild the doc, so it won't re-trigger the container resolution).
try {
Entity.getSearchRepository().deleteEntityIndex(pipeline);
} catch (Exception ex) {
LOG.debug(
"Search-index cleanup skipped for ingestion pipeline {}: {}", id, ex.getMessage());
}
// Remove its pipeline-status time series, all relationship rows, then the row itself.
if (!nullOrEmpty(pipeline.getFullyQualifiedName())) {
collectionDAO
.entityExtensionTimeSeriesDao()
.delete(pipeline.getFullyQualifiedName(), PIPELINE_STATUS_EXTENSION);
}
collectionDAO.relationshipDAO().deleteAll(id, INGESTION_PIPELINE);
collectionDAO
.ingestionPipelineDAO()
.delete(collectionDAO.ingestionPipelineDAO().getTableName(), id);
deleted = true;
Comment on lines +169 to +172
// Clean up ingestion pipelines whose container (service/test suite) CONTAINS row is gone. Such
// a pipeline can never run and breaks search indexing ("does not have expected relationship
// contains to/from entity type null"). Runs after the relationship/hierarchy cleanup above so a
// container relationship that was just repaired is not mistaken for missing.
Copilot AI review requested due to automatic review settings July 10, 2026 11:35

Copilot AI left a comment

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI review requested due to automatic review settings July 13, 2026 06:11

Copilot AI left a comment

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@sonarqubecloud

Copy link
Copy Markdown

@mohityadav766
mohityadav766 merged commit b8d9f3e into main Jul 13, 2026
68 of 74 checks passed
@mohityadav766
mohityadav766 deleted the fix-reindex-orphan-ingestion-pipeline-and-testcase-npe branch July 13, 2026 11:02
@github-actions

Copy link
Copy Markdown
Contributor

Failed to cherry-pick changes to the 1.13 branch.
Please cherry-pick the changes manually.
You can find more details here.

@gitar-bot

gitar-bot Bot commented Jul 13, 2026

Copy link
Copy Markdown
Code Review 👍 Approved with suggestions 0 resolved / 2 findings

Adds orphaned ingestion pipeline cleanup and NPE guards for TestCase search indexing to resolve recurring reindex failures. Address minor complexity violations in performCleanup and forceDelete methods and potential tag_usage dangling rows to align with project standards.

💡 Quality: forceDelete leaves orphaned tag_usage rows for the pipeline

📄 openmetadata-service/src/main/java/org/openmetadata/service/util/OrphanIngestionPipelineCleanup.java:193-207

OrphanIngestionPipelineCleanup.forceDelete manually removes the pipeline's time-series status (ingestion Pipeline.pipelineStatus), all entity_relationship rows (deleteAll), the search index doc, and the ingestion_pipeline_entity row. However, the normal delete path (EntityRepository.cleanup / clearCommonRelationshipsForMany) also removes tag_usage rows for the entity. Since ingestion pipelines can carry tags, the force-delete fallback can leave orphaned tag_usage rows keyed by the pipeline's FQN/id behind. This is a rare fallback path (only hit when the standard delete throws due to the missing container) and cosmetic, but it slightly defeats the goal of fully reclaiming the pipeline footprint. Consider also calling the tag usage cleanup (e.g. tagUsageDAO().deleteTagsByTarget(...) / by FQN hash) in the fallback.

💡 Quality: Methods exceed 15-line Java complexity guideline

📄 openmetadata-service/src/main/java/org/openmetadata/service/util/OrphanIngestionPipelineCleanup.java:78-92 📄 openmetadata-service/src/main/java/org/openmetadata/service/util/OrphanIngestionPipelineCleanup.java:193-207

Per the project's Java complexity guideline (methods ≤ 15 lines), performCleanup (~lines 78-113, ~28 lines) and forceDelete (~lines 193-221, ~27 lines) exceed the limit. They can be split, e.g. extract the paging loop body of performCleanup into a helper that reads+cleans one batch, and extract the search-doc removal and the DB-footprint removal in forceDelete into small helpers. Purely a maintainability/style note.

🤖 Prompt for agents
Code Review: Adds orphaned ingestion pipeline cleanup and NPE guards for TestCase search indexing to resolve recurring reindex failures. Address minor complexity violations in performCleanup and forceDelete methods and potential tag_usage dangling rows to align with project standards.

1. 💡 Quality: forceDelete leaves orphaned tag_usage rows for the pipeline
   Files: openmetadata-service/src/main/java/org/openmetadata/service/util/OrphanIngestionPipelineCleanup.java:193-207

   `OrphanIngestionPipelineCleanup.forceDelete` manually removes the pipeline's time-series status (`ingestion Pipeline.pipelineStatus`), all entity_relationship rows (`deleteAll`), the search index doc, and the ingestion_pipeline_entity row. However, the normal delete path (EntityRepository.cleanup / clearCommonRelationshipsForMany) also removes `tag_usage` rows for the entity. Since ingestion pipelines can carry tags, the force-delete fallback can leave orphaned `tag_usage` rows keyed by the pipeline's FQN/id behind. This is a rare fallback path (only hit when the standard delete throws due to the missing container) and cosmetic, but it slightly defeats the goal of fully reclaiming the pipeline footprint. Consider also calling the tag usage cleanup (e.g. `tagUsageDAO().deleteTagsByTarget(...)` / by FQN hash) in the fallback.

2. 💡 Quality: Methods exceed 15-line Java complexity guideline
   Files: openmetadata-service/src/main/java/org/openmetadata/service/util/OrphanIngestionPipelineCleanup.java:78-92, openmetadata-service/src/main/java/org/openmetadata/service/util/OrphanIngestionPipelineCleanup.java:193-207

   Per the project's Java complexity guideline (methods ≤ 15 lines), `performCleanup` (~lines 78-113, ~28 lines) and `forceDelete` (~lines 193-221, ~27 lines) exceed the limit. They can be split, e.g. extract the paging loop body of `performCleanup` into a helper that reads+cleans one batch, and extract the search-doc removal and the DB-footprint removal in `forceDelete` into small helpers. Purely a maintainability/style note.

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 👍 / 👎 | Gitar

mohityadav766 added a commit that referenced this pull request Jul 14, 2026
…a Retention build fix (#29984), realign DataRetention with main (#30030)

* feat(dataRetention): sweep orphan time-series rows for per-type tables (#28384)

* feat(dataRetention): sweep orphan time-series rows for per-type tables

Adds `cleanOrphanedTimeSeriesRows()` to `DataRetention` alongside the existing
orphan-relationship and orphan-tag sweeps. Each of the five affected DAOs gets a
`deleteOrphanedRecords(int limit)` query (MySQL + PostgreSQL) that left-joins
to its parent and deletes rows the parent no longer covers:

- `testCaseResolutionStatus`: parent link via `entity_relationship` PARENT_OF
- `agentExecution`: `agentId` → `ai_application_entity.id`
- `mcpExecution`: `serverId` → `mcp_server_entity.id`
- `profile_data`: `entityFQNHash` → `table_entity.fqnHash`
- `query_cost_time_series`: `entityFQNHash` → `query_entity.fqnHash`

The sweep runs after `cleanOrphanedRelationshipsAndHierarchies()` so the
PARENT_OF check sees the post-cleanup `entity_relationship` state. Pairs with
PR #28367, where the bulk hard-delete cascade now skips time-series children
and relies on `DataRetention` to reclaim them out-of-band.

Adds `OrphanedTimeSeriesCleanupIT` covering all five per-type queries:
inserts a real-parent row and a bogus-parent row through the existing DAO
`insert(...)` paths, runs `deleteOrphanedRecords(BATCH)`, asserts the orphan
is gone and the valid row is preserved.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* test(dataRetention): fix orphan-cleanup IT name lengths and McpExecution table arg

- McpExecutionDAO.insertWithoutExtension uses `<table>` placeholder; the test
  was passing `null`, which made Jdbi fail to render the SQL template. Pass
  the literal table name `mcp_execution_entity`.
- `ns.prefix(...)` embeds class + method names, so chaining it through
  database -> schema -> table -> auto-created test_suite pushed the test_suite
  `name` column past its VARCHAR(256) bound. Use `ns.uniqueShortId()` for the
  hierarchy components and shorten the test method names so the resulting
  FQN stays well under the column limit.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* review(dataRetention): bound profile-data orphan delete by rows + clarify PARENT_OF=9

Addresses two PR review findings:

- `profiler_data_time_series.deleteOrphanedRecords` previously LIMITed distinct
  `entityFQNHash` values, then deleted every row for each hash — a batch could
  delete tens of millions of rows if many orphan hashes each had thousands of
  rows. Switch to row-level limiting: single-table `DELETE ... WHERE NOT EXISTS
  (...) LIMIT N` on MySQL, and `ctid IN (SELECT ... LIMIT N)` on PostgreSQL
  (the table has no `id` column, so we use Postgres ctid for the inner subquery).
  This matches the row-count cap used by the other four orphan-cleanup queries.

- Annotate `er.relation = 9` in the testCaseResolutionStatus query with a
  `// 9 = Relationship.PARENT_OF` inline comment plus a leading block comment
  noting the ordinal is stable because the enum appends new values.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

---------

Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
(cherry picked from commit 5f5a123)

* fix(search-indexing): reclaim orphaned ingestion pipelines and guard null testDefinition during reindex (#29836)

Two reindex failures observed in SearchIndexingApplication that DataRetention did
not cover:

1. Orphaned ingestion pipelines. When a service (or test suite) is hard-deleted
   without the cascade reaching its ingestion pipeline, the pipeline row survives
   with no incoming CONTAINS relationship. Reindex then throws "Entity type
   ingestionPipeline <id> does not have expected relationship contains to/from
   entity type null" because IngestionPipelineRepository.setFields resolves the
   container via getContainer (mustHaveRelationship=true). Nothing swept these.

   Adds OrphanIngestionPipelineCleanup (mirrors OrphanTestCaseRelationshipCleanup)
   wired into DataRetention: pages pipelines, finds ones with no container, and
   hard-deletes them via the standard delete with a force-delete fallback (search
   doc, pipeline-status time series, relationship rows, entity row) since the
   standard delete itself resolves the missing container and throws.

2. NullPointerException building the TestCase search doc. TestCaseIndex called
   testCase.getTestDefinition().getId() with no null check, so a test case whose
   testDefinition relationship is gone NPE'd. Unlike the "expected relationship"
   errors, this NPE is not classified as a stale-reference warning, so it failed
   the reindex outright. Guards the lookup exactly like TestCaseResultIndex does.

Adds OrphanIngestionPipelineCleanupIT covering selective deletion (orphan removed,
healthy pipeline preserved).

Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
(cherry picked from commit b8d9f3e)

* Fixes #20753: replace non-schema jobStackTrace with IndexingError.stackTrace (#29965)

* Fixes #20753: replace non-schema jobStackTrace with IndexingError.stackTrace

App failure contexts wrote an ad-hoc "jobStackTrace" map key that is not part
of the schema. The failureContext.failure field is already typed as
IndexingError, which has a schema-defined stackTrace field. Use the typed
IndexingError (matching the canonical pattern used across the other apps)
instead of raw maps, deduplicating DataRetention's repeated failure blocks.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

* Convert DataContractValidationApp failure to typed IndexingError

Replace the generic Map<String, Object> failure collector with the typed
IndexingError: the top-level exception populates message/stackTrace, and the
per-entity errors go into the schema's failedEntities (EntityError) list
instead of being keyed by FQN in a raw map. Makes all three apps consistent
with the schema-defined failureContext.failure shape.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

---------

Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
(cherry picked from commit a33d41c)

* Fix Data Retention Build Issue (#29984)

* Fix Data Retention Build Issue

* Checkstyle

(cherry picked from commit ee2a438)

---------

Co-authored-by: Sriharsha Chintalapani <[email protected]>
Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>

This branch was previously deployed

1 inactive deployment
test — 9ee00a44 Deployed Jul 13, 2026 by mohityadav766 via playwright-ci-postgresql (3, 7) #56024
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 To release Will cherry-pick this PR into the release branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants