Repository navigation
Exclude deleted jobs from lineage graph traversal - #3120
Open
NopeCharon wants to merge 1 commit into
Open
NopeCharon wants to merge 1 commit into
NopeCharon wants to merge 1 commit into
Conversation
Deleting a job only marks it as hidden, but its current rows in job_versions_io_mapping remain. LineageDao.getLineage() built its recursive traversal from those rows without checking whether the job was still visible, so a deleted job kept linking the datasets it consumed and produced. The deleted job itself was dropped by the final join on jobs_view, which left unrelated datasets and jobs in the graph with no visible edge connecting them to the requested node. Join the job_io CTE on jobs_view (resolving symlinked jobs to their target, as the final join already does) so only visible jobs are traversed. LineageDao.getJobFromInputOrOutput() also skips hidden jobs, so lineage requested for a dataset produced by a deleted job starts from a job that is still visible instead of returning an orphan graph. Closes: MarquezProject#3085 Signed-off-by: NopeCharon <115794254+NopeCharon@users.noreply.github.com>
|
Thanks for opening your first pull request in the Marquez project! Please check out our contributing guidelines (https://github.com/MarquezProject/marquez/blob/main/CONTRIBUTING.md). |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Deleting a job (
DELETE /api/v1/namespaces/{namespace}/jobs/{job}) only marks the job as hidden; its current rows injob_versions_io_mappingare kept.LineageDao.getLineage()built its recursive traversal from those rows without checking whether the job was still visible, so a deleted job kept connecting the datasets it consumed and produced. The final join onjobs_viewthen dropped the deleted job itself, which left datasets and jobs in the graph with no visible edge linking them to the requested node.For
d1 → job1 → d2 → job3 → d3 → job2 → d4, after deletingjob3the lineage ford1still containedd3 → job2 → d4.Closes: #3085
Solution
LineageDao.getLineage(): thejob_ioCTE now joinsjobs_view(resolving symlinked jobs to their target, the same way the final join already does), so only visible jobs are traversed and the graph stops at the deleted job.LineageDao.getJobFromInputOrOutput(): skip hidden jobs when choosing the job to start from for a dataset node. Without this, lineage for a dataset whose producer was deleted (d3above) would start from the deleted job and come back as an orphan graph. It now starts from a visible consumer, sod3 → job2 → d4is returned.No schema changes.
One-line summary: API: Exclude deleted jobs from lineage graph traversal
Checklist
CHANGELOG.md(Depending on the change, this may not be necessary)..sqldatabase schema migration according to Flyway's naming convention (if relevant)Testing
LineageDaoTest.testGetLineageWithDeletedJobandLineageDaoTest.testGetJobFromInputOrOutputIgnoresDeletedJob; both fail without this change.LineageDaoTest,LineageServiceTest,JobDaoTest,ColumnLineageDaoTest,OpenLineageServiceIntegrationTest,OpenLineageIntegrationTest, andJobResourceIntegrationTestpass./api/v1/lineagein a local integration run: after deletingjob3, lineage ford1only containsd1 → job1 → d2, and lineage ford3containsd3 → job2 → d4../gradlew :api:spotlessJavaCheckpasses.