Repository navigation
Conversation
|
Local test results for 4b7a916 (test commit cd53365, fix 0e6da0d, decision record 4b7a916). Unit tests (service module, run in the same reactor build as the ITs)
113 tests, 0 failures. Integration tests (MySQL and Elasticsearch, parallel lane)
179 tests, 0 failures, 3 skipped. The same tests against the code on
Statement counts per request ( Not run locally: the Postgres and OpenSearch lane, the rest of the merge queue suite, the nightly scale ITs ( |
pmbrull
left a comment
There was a problem hiding this comment.
❌ Changes needed · 2 🔴 · 0 🟡
| Blockers | ❌ 2 🔴 |
| Nits | ✅ none |
| Tests | ❌ gaps in rename freshness and pipeline-authorization ordering coverage |
| Cross-repo | ✅ checked Collate lineage writer callers |
| Trade-off | ✅ none |
| Auto-approved | ➖ changes needed |
Thanks for reducing repeated lineage reads and adding integration tests that measure the query count.
- 🔴
LineageEdgeAccess.java:119— The local name cache can return a stale entity ID after a rename on another replica. Keep the identity lookup fresh and reuse its result for authorization. Add a non-admin by-name regression with the local cache enabled. - 🔴
LineageRepository.java:799— Both PUT routes now resolve a newly linked pipeline before checkingViewBasic. Preserve the existing PUT denial behavior and use the same edge row for both authorization and persistence. Cover both PUT routes in the authorization tests. Existing review finding
Please keep #38697 open for the remaining table-read and authorization-query work tracked in the PR, including #38865.
What I checked
Traced dbt’s by-name read and write paths, the lineage repository’s edge read, the policy checks, and Collate’s ingestion writer. The query-budget integration tests exercise the intended savings. The current PR checks pass. The author’s reported MySQL and Elasticsearch run covers 179 selected integration tests with three skipped. PostgreSQL and OpenSearch results are still outstanding. PR checks
claude-verdict {"sha":"4b7a916f2ce1561d726c9877ae765afec0cc09cb","recommendation":"request_changes","blocking":2,"nits_to_fix":0,"human_decision":false,"tradeoff":"none","cross_repo":"checked","tests_ok":false}
| end.fullyQualifiedName(), | ||
| ResourceContext.authorizationFields(repository), | ||
| RelationIncludes.fromInclude(Include.ALL), | ||
| true); |
There was a problem hiding this comment.
🔴 With the default cache provider, replicas keep local entries without cross-replica invalidation. A rename committed on one replica can leave a by-name lineage operation on another replica using the previous name-to-ID mapping. Resolve the name with a fresh authorization projection and reuse that entity for the policy check. Add a regression for the non-admin by-name route after a rename with an existing cache entry.
There was a problem hiding this comment.
You're right, the non-admin path was trusting this server's name cache. Fixed in acbb2ce: LineageEdgeAccess now reads a non-admin's end straight from the database with the authorization projection (getByName with fromCache=false) and passes that same copy to the policy check. It's still one read per end, and a rename on another replica shows up right away.
The new LineageEdgeAuthorizationIT#byName_renamedOnAnotherServer_oldNameIsNotFoundForEveryCaller renames a metric in the database only, puts the old name back in the cache before each call, and expects 404 on GET, PUT and DELETE by the old name for both the bot and an admin. It failed on the previous head, where the bot's GET came back 200. The fresh read costs the bot two statements on the by name routes (GET 21, PUT 38, PATCH 22), so I updated the budget test and the table in the description.
❌ 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 |
|
@pmbrull thanks for going through this so carefully. Both fixes are pushed in acbb2ce and 959b639. The rename one is in your inline thread. For the PUT ordering, I changed the title and description to Part of #38697 so the issue stays open for the remaining table read and authorization work, including #38865. While I was there I reworded a "fix #27519" in the description that GitHub was treating as closing that issue too. Locally on MySQL and Elasticsearch at 959b639, the five lineage IT classes ran 136 tests with 0 failures (3 skipped, same as main), plus 115 unit tests. I haven't run the Postgres and OpenSearch lane yet, or |
pmbrull
left a comment
There was a problem hiding this comment.
✅ No issues found
| Blockers | ✅ prior code findings resolved |
| Nits | ✅ none |
| Tests | ✅ rename freshness and both PUT authorization paths are covered |
| Cross-repo | ✅ checked Collate lineage callers |
| Trade-off | ✅ fresh name lookups preserve correctness while PUT by name still makes fewer reads |
| Auto-approved | ➖ maintainer review of the authorization changes and passing checks required |
Thanks for addressing both findings and keeping #38697 open for the rest of the work. The revised code uses a fresh lookup for named lineage ends and checks permission before resolving a newly linked pipeline on both PUT routes.
Please link a tracking issue for the work this PR completes and keep #38697 as the parent reference. Linking the parent directly would close it when the PR merges. GitHub’s issue linking behavior The backend runner shut down mid-job. Rerun that job and check the red Compatibility status once the head is current. Metadata check · Backend job
What I checked
Read the follow-up diff and the integration tests for a stale cached name and both pipeline authorization routes. The reported head run covers 115 unit tests and 136 MySQL and Elasticsearch integration test cases with three skipped. PostgreSQL and OpenSearch coverage and the other affected integration tests are still outstanding.
claude-verdict {"sha":"959b6394df54dedfd76bd353c66756d5b8fce895","recommendation":"human","blocking":0,"nits_to_fix":0,"human_decision":true,"tradeoff":"holds","cross_repo":"checked","tests_ok":true}
|
@Vamsi-klu can you check the test failures |
|
Thanks, Mohit and Pablo. I checked the latest run. Java checkstyle passed, then the runner received a shutdown signal while the service unit tests were still running. Collate Compatibility passed on the current head. GitHub returned a 403 when I tried the rerun. Could someone with repo access retry the backend job? I linked #39112 for the edge-read work and kept #38697 open for the rest. Could you add #39112 to Shipping when you get a chance? |
Main moved addLineage into a locked LineageWriteTransaction. The PUT pipeline check now runs inside addLineageLocked, right after the edge's guard-row locks and before the ends are looked up.
Resolve LineageResource conflict with open-metadata#39193: keep main's by-id authorizeLineageReference overload for delete-by-type, drop the by-name overload this branch replaced with LineageEdgeAccess, and drop the EntityInterface import both sides stopped using.
|
@mohityadav766 @pmbrull the branch is refreshed with main in I ran the tests locally on that merge, on both engines. This covers the Postgres + OpenSearch gap and the three classes that had not been rerun after the two fixes (
The statement budgets in Unit tests: If the runner stops again on the new run, could one of you rerun it? Also, could #39112 be added to Shipping? #38697 stays open as the parent. |
Code Review ✅ Approved 🔴 High risk 1 closed / 1 findingsChanging lineage-end and pipeline authorization paths could expose restricted edge data or permit links if the loaded policy context differs. Reduces repeated lineage edge and name reads per request by reading the stored edge once, resolving each named end once, and dropping unneeded column tag reads on column lineage writes. No open issues remain; the previously flagged cached name resolution for non-admin ends has been addressed. ✅ 1 closed✅ Quality: Cached name resolution for non-admin lineage ends has no record
VerificationRules No rules evaluated Functional validation Not enabledAuto-approval Not enabledFor more verification details, comment OptionsDisplay: compact → Showing compact verification results. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
Describe your changes:
Fixes #39112.
Part of #38697. The issue stays open for the remaining table read and authorization query work, including #38865.
The lineage edge routes read the same stored edge twice in one request, and the routes that name their ends resolved each name twice. The dbt sink calls these routes once per model on every run (
add_lineage(check_patch=True)reads the edge by id, then writes it), so every repeated statement is paid once per model.Root cause
LineageResource.getLineageEdge(LineageResource.java:1184) calledLineageRepository.getLineageEdgeEnds(LineageRepository.java:1781, agetRecord) to authorize the ends, thengetLineageEdge(LineageRepository.java:1768), which reads the same row again throughgetLineageDetails(LineageRepository.java:1763, agetRelation).authorizeEdgePipeline(LineageResource.java:152) from its own read of the row, thenLineageRepository.addLineageread it again withgetRecord(LineageRepository.java:247). The OpenLineage endpoint did the same (OpenLineageResource.authorizeEdgePipeline, OpenLineageResource.java:284).addLineageByFQN(LineageRepository.java:307),patchLineageEdgeByFQN(:1841),deleteLineageByFQN(:1314) ordeleteLineageBySourceByFQN(:1378), which resolved them again. Each resolution is an uncachedfindReferencesByNameHashesquery (EntityRepository.getReferenceByName, EntityRepository.java:2676).getRegistryChildrenNames(LineageRepository.java:1270) asked for the container fields, and asking a table forcolumnsloads its column tags since Fixes 27519: return column tags when columns are requested #34351 (TableRepository.setFields, TableRepository.java:220). Dashboard data models, topics, ML models, API endpoints and worksheets run the same tag prefix query insetFields(Entity.populateEntityFieldTags, Entity.java:1014, queries even when tags were not asked for). That is one or two tag queries per end on every column lineage PUT and PATCH, for names that never use them.The fix
LineageRepository.getStoredEdge), authorizes both ends from that row, and answers from the same row.addLineage(AddLineage, String, Consumer<EntityReference>)reads the row it replaces once, runs the caller's view check on the requested pipeline against that row before it looks up the ends or the pipeline (the order PUT had onmain), then resolves the pipeline by the id it checked.LineageEdgeAccess, and pass the references to the by id repository methods. For a caller that is not an admin the end is loaded with the projection and relation include the lazy authorization context uses, straight from the database rather than the entity cache, and that copy is what the authorizer sees, so the name costs no separate query and a rename on another server is seen right away. An admin is never evaluated against an end, so an admin still gets the cheap reference read. Both branches call the authorizer, so a wrong admin answer can only cost a read, never skip a check.getRegistryChildrenNamesreads the stored entity withfind(id, NON_DELETED). Every registry type (table, dashboard data model, topic, container, ML model, pipeline, search index, API endpoint, worksheet) keeps its child containers inline in the stored JSON, and sets the child names insetFullyQualifiedNameorpreparebefore storing; theirstorageJsonNodeoverrides strip only the children's tags or owners.Nothing else moves: no schema, migration, Python, search or impact map change, and no new cache.
Statement counts
From
LineageEdgeQueryBudgetIT, per request, on the test commit (the code onmain, cd53365) and on this branch, asmain→ branch (959b639). Each request is sent once to settle the caches and counted the second time, except DELETE, which is counted once. "Edge reads" counts reads of the stored edge row, "Names per end" counts reference queries for one named end, "Column tags" counts column tag queries for both ends, and "Statements" is every statement the request ran. "bot" is the ingestion bot.How to read it:
The end to end dbt timing from the issue was not rerun.
Disclosures
main. The decision record "A lineage edge's pipeline must be a pipeline or stored procedure, and linking one needs view access to it" gets a v3 amendment for this.main: on both PUT routes a caller denied view on pipelines gets 403 whether the newly linked pipeline exists, is soft deleted or never existed, and nothing is written. Only a caller who can view pipelines gets 404 for one that is gone.put_pipelineCallerCannotView_isForbiddenWhetherOrNotItExistsandput_pipelineCallerCanViewButIsGone_isNotFoundcover both routes.fields=columns) is by design: Fixes 27519: return column tags when columns are requested #34351 made that change for GET /tables/{id}?fields=columns returns empty tags arrays for all columns #27519 ("fields=columns returns empty tags arrays"), so this PR does not revert it. It only stops the lineage write path from paying for it.EntityRepositorywork and is tracked in Authorization and inheritance walk the ancestors again for every entity in a request #38865. In the table, the gap between the bot and an admin on the same request (18 statements on GET by id) is that cost.*ByFQNmethods onLineageRepositoryandgetLineageEdgeEndshave no callers left in this repository. I kept them because Collate may call them; I could not check.Rebase note
#38139 rewrites the search lineage root code in
LineageResource(theauthorizeLineageRootblock). This PR leaves that block alone; the nearest hunks are the removedauthorizeLineageReference(SecurityContext, String, String, Include)just above it and one new import next to the import #38139 removes. Whichever merges second needs a rebase, which should be mechanical.Type of change:
High level design:
Resolution and authorization of named ends move into
LineageEdgeAccess, a small package private class next toLineageResource, so the 1,500 line resource does not grow. GET, PUT and PATCH by name resolve both ends before authorizing either, as before, so a missing end is still a 404 for every caller; DELETE still resolves and authorizesfrom, thento. The pipeline decision is one repository rule (newlyLinkedEdgePipeline) shared by PUT, PATCH and OpenLineage. PUT and OpenLineage check before they resolve the pipeline and PATCH resolves first, both as onmain.Rejected alternatives: reverting the column tags change (brings #27519 back); resolving names for callers that are not admins through the entity name cache (another server's rename can leave a stale name to id mapping until the TTL); a cached by name entity read for every caller (deserializes the entity twice on the bot path, and #28486 moved
getReferenceByNameto a projection on purpose); warmingRequestEntityCacheso the lazy context hits it (depends on exact cache keys); a request scoped memo around the ancestor walk (generic code with transaction and staleness hazards, left to the follow up).Tests:
Use cases covered
Unit tests
LineageEdgeAccessTest(new): which copy the authorizer sees for callers that are and are not admins, soft deleted ends, a missing end before a denial, denials.LineageRepositoryTest: thelinkEdgePipelinedecision table (no pipeline, newly linked, already on the edge, unsupported and new, unsupported and stored), a denied pipeline stores nothing, PUT checks the pipeline before it looks anything up,getStoredEdgeand the edge response.LineageResourceGetLineageEdgeAuthorizationTest: GET by id authorizes from the one stored read, and a row without details is 404 after authorization.LineageChildrenNamesTest: child names come from the stored entity for every registry type.Run locally on 959b639:
LineageEdgeAccessTest7,LineageResourceGetLineageEdgeAuthorizationTest11,LineageRepositoryTest60,LineageChildrenNamesTest13 andChildFieldResolverTest24, so 115 tests with 0 failures. On the test commit, with the code onmain,LineageChildrenNamesTesterrored in 10 of 13 tests andLineageRepositoryTestin 3 of 49 (the column lineage tests whose child names now come from the stored entity).OpenLineageResourcehas no unit test; its changed path is covered byopenLineageBatch_hiddenPipelineFailsOnlyItsOwnEdgesandOpenLineageResourceIT.Backend integration tests
LineageEdgeQueryBudgetIT(new) andLineageEdgeAuthorizationIT(new), includingbyName_renamedOnAnotherServer_oldNameIsNotFoundForEveryCaller.LineageEdgePipelineAuthorizationIT: both PUT routes with a pipeline the caller cannot view (live, soft deleted, missing), a missing pipeline the caller can view, and an OpenLineage batch with a hidden pipeline.Run locally on MySQL and Elasticsearch, parallel lane, on 959b639: 5 classes, 136 tests, 0 failures, 3 skipped (the three
LineageResourceITtests that are already disabled onmain).LineageEdgeQueryBudgetIT: 16 passedLineageEdgeAuthorizationIT: 8 passedLineageEdgePipelineAuthorizationIT: 11 passedSubResourceAuthorizationIT: 33 passedLineageResourceIT: 68 run, 65 passed, 3 skippedBefore the review fixes (4b7a916),
DomainIsolationIT(21),OpenLineageResourceIT(21) andTableColumnTagsIT(4) also passed; they were not rerun on 959b639.On the test commit, with the code on
main,LineageEdgeQueryBudgetITfailed 15 of 16 (only GET by name as admin already met its budget). The rename regression fails on 4b7a916: the bot's GET by the old name answered 200.Not run here:
DomainIsolationIT,OpenLineageResourceITandTableColumnTagsITon the latest head, the Postgres and OpenSearch lane and the rest of the merge queue suite, and the nightly scale ITs the planner lists (LineagePayloadScaleIT,LineageScenePerformanceScaleIT).Ingestion integration tests
Playwright (UI) tests
Manual testing performed
None beyond the tests above.
UI screen recording:
Not applicable: backend only change.
Checklist:
Part of #38697: Read each lineage edge and each named end once per request.Fixes #39112and references 2.1: lineage edge endpoints and table reads make many more DB round trips, slowing dbt ingestion ~65% #38697 as the parent.REVIEW.md.main(listed in the counts table and under Tests).