Repository navigation
feat!: add warehouse_id to PKs of all table* and view* tables - #1254
Conversation
Types used for IDsFunctions in table/common.rs are currently taking For consistency, should we open a follow up PR to make all the |
warehouse_id to keys of all table* and view* tables
warehouse_id to keys of all table* and view* tableswarehouse_id to PKs of all table* and view* tables
warehouse_id to PKs of all table* and view* tableswarehouse_id to PKs of all table* and view* tables
There was a problem hiding this comment.
Pull Request Overview
This PR adds warehouse_id to the primary keys of all table* and view* tables to enable table and view ID reuse across different warehouses. The changes include database schema migration, updated function signatures throughout the codebase, and modifications to SQL queries to include warehouse ID constraints.
Key Changes:
- Database migration to add
warehouse_idcolumn to all table and view related tables and update primary keys to composite keys - Updated function signatures across catalog operations to include
warehouse_idparameter - Modified SQL queries to include warehouse ID in WHERE clauses and constraints
Reviewed Changes
Copilot reviewed 15 out of 75 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| crates/lakekeeper/migrations/20250718142650_reusable_table_id.sql | Database migration script to add warehouse_id to PKs and FKs |
| crates/lakekeeper/src/service/catalog.rs | Updated catalog trait methods to include warehouse_id parameter |
| crates/lakekeeper/src/implementations/postgres/catalog.rs | Updated catalog implementation to pass warehouse_id to underlying functions |
| crates/lakekeeper/src/implementations/postgres/tabular/table/mod.rs | Updated table operations to include warehouse_id in queries and function signatures |
| crates/lakekeeper/src/implementations/postgres/tabular/view/mod.rs | Updated view operations to include warehouse_id in queries and function signatures |
| crates/lakekeeper/src/implementations/postgres/tabular/table/create.rs | Updated table creation to pass warehouse_id to all helper functions |
| crates/lakekeeper/src/implementations/postgres/tabular/table/common.rs | Updated common table operations to include warehouse_id in all SQL operations |
| crates/lakekeeper/src/implementations/postgres/tabular/table/commit.rs | Updated table commit operations to pass warehouse_id parameter |
| crates/lakekeeper/src/implementations/postgres/tabular/mod.rs | Updated core tabular operations to include warehouse_id |
| crates/lakekeeper/src/service/task_queue/tabular_expiration_queue.rs | Updated expiration queue to pass warehouse_id to drop operations |
| crates/lakekeeper/src/service/task_queue/mod.rs | Updated test to include warehouse_id parameter |
| crates/lakekeeper/src/catalog/tables.rs | Updated table catalog operations to pass warehouse_id |
| crates/lakekeeper/src/catalog/views/drop.rs | Updated view drop operations to include warehouse_id |
| crates/lakekeeper/src/catalog/views/create.rs | Updated view creation to pass warehouse_id |
| crates/lakekeeper/src/catalog/views/commit.rs | Updated view commit to include warehouse_id |
Files not reviewed (60)
- .sqlx/query-017952754d856de83252a1a37265a3e6cb3d10b76815fccdc3bc2dbc7ef79ac1.json: Language not supported
- .sqlx/query-06008ceac1e6d9b23c1411d3091273759c410ad6f000ad42a24ef29ab481dc1d.json: Language not supported
- .sqlx/query-0a3adc4ccfa66e006d2e72c7f56da189e8e48b2dea713b75773d226612993840.json: Language not supported
- .sqlx/query-1782897da2409ef85283e5de1c05a751dca0c5972ffa8afabc0e65bf7dd70fe1.json: Language not supported
- .sqlx/query-17e54b156bb6d9eee483e8ad4a2150526ee047a05358fa0adddb42c2dad0a746.json: Language not supported
- .sqlx/query-1db0ae52116231e61eac7c55362562b82a27a05f51f78ad64a71647754f22b95.json: Language not supported
- .sqlx/query-2ba51f56104f882a79f08442995f551cedd0374c1cd8d16c5e0170abab6af3c1.json: Language not supported
- .sqlx/query-2c9c9bfc5ed5f3cf4b0781497232087de65802bf8b924a73de8bf0a6464a63de.json: Language not supported
- .sqlx/query-2fd94b3a4aa8d63db105799391dc8a5fff652eda2646f90b8447842bc69c771b.json: Language not supported
- .sqlx/query-33c18c9f7fe22c2b8a8dc3035e2a08e7afd9801552ed9a5d681b5d823ceec793.json: Language not supported
- .sqlx/query-397339fb4d3f481a27217d1b0e8620f72fc81ea338c368623ffc76123ee64b1a.json: Language not supported
- .sqlx/query-399779427589d30b9245c82f585b44b96c7d7cc515f278b1ea8dfa02d4598c24.json: Language not supported
- .sqlx/query-41eea5598b0e84140ee0245fed70a78c2d4b987e4598b1a275870b84e066d5b9.json: Language not supported
- .sqlx/query-4428ac094e8531f9d29b26233e9068c8049553df52a945e5f1c4cffccdc3cdac.json: Language not supported
- .sqlx/query-47a887cd627d113130da736de9dfb963b3586ba12e61ccdaaef2f7577a4cdecd.json: Language not supported
- .sqlx/query-480cae797e1b736bc7f19a867fbcbb518befd0840b9c3938fe8d35a754a67c38.json: Language not supported
- .sqlx/query-4d87773ace56e5c715c791f80e0126ae2f7894fa774a410a228e3508404d9c38.json: Language not supported
- .sqlx/query-50884faf327442a7251667adf30e1cce2e17293b925715c6d0cb4e39eaf37569.json: Language not supported
- .sqlx/query-53da3c9246658eff646528ee82a7052553481f8616406323e79d46638587c8de.json: Language not supported
- .sqlx/query-5542e10936d7edbae370bb05c55e4f0d52f474628734b0441a4be81b556bb209.json: Language not supported
- .sqlx/query-5cac03aba836386937989346a936bf133cadf311a06087e7d7871e8d6caa540b.json: Language not supported
- .sqlx/query-5de8c09711d96b3d4d0daaae279d0aa455b51574e02ee1c4c777179d27ef58eb.json: Language not supported
- .sqlx/query-5f878db758b7c05564ed3bcbbbdcbf2a7432ec5b8a1274fe485813dd5fcc6658.json: Language not supported
- .sqlx/query-63f2536def72ab190047fb567c45f691d57236823eefac70b40d5c590f17d5c7.json: Language not supported
- .sqlx/query-67a21db829b560f801c4241cdf615e0edf3ac1ccbb9954e629d1090dc46d83c7.json: Language not supported
- .sqlx/query-684915074934609ebd67cf11131a5fa0c144e72cfa058549d43c0423c00b5d21.json: Language not supported
- .sqlx/query-6ab99529ccdf4650171314597824aecb5477524fdaa085c06c048eba528d16e7.json: Language not supported
- .sqlx/query-6b0a0d9879b88803b90dc63a8c101f9c01085d235f103a9bc966b1caf3e7fac8.json: Language not supported
- .sqlx/query-71987a557eadf1f3e5b22ae13474a095db57de2f1ca70db6f6d081a34d312921.json: Language not supported
- .sqlx/query-73ec40ca1f8d3a435547be042de7662ee3f08f7407c58e09b7c8f64878c2044d.json: Language not supported
- .sqlx/query-76e03d470bb4221068d84e458d034c46a91ee9ae560f27ab3c782345f27d0668.json: Language not supported
- .sqlx/query-795b314195aed913d2c1857bd732366f1215e4729c7bf63e8c51f47ef3f73716.json: Language not supported
- .sqlx/query-800c4f4d85d95b7b0cd9c1c72858177c1660a4df12870fe23182234856c98970.json: Language not supported
- .sqlx/query-82355a1d7b64fd8db5f630d8a0dee784e2179b658aa1e5f3b078ded839d2ee5e.json: Language not supported
- .sqlx/query-856c21e4026ac861fbc034e03e20cd2b5d6ace119b6fd07e5f25015a5397c850.json: Language not supported
- .sqlx/query-8a5e0c881d24f11ae1df89168a001a5b85af8ebc9267845faf60e0e11a48a64f.json: Language not supported
- .sqlx/query-929ebebbe40a3208fd249ca77b6875165f0b7b88e5ce60c37c3eca0331469302.json: Language not supported
- .sqlx/query-92b403b07793061ed856e5db770137b5e076514670a5c45491feb00b8b82d3f4.json: Language not supported
- .sqlx/query-9750eec4a2c92b0794c41604bec902833574cd2899476c89880abb1ebb481495.json: Language not supported
- .sqlx/query-97f15e36e448dc85f6e2bcc475b97e77a58b18caf991b19d46827133deeb5ef0.json: Language not supported
- .sqlx/query-9ade6ba12a8be8064328c864690c410ff514ee47ba5a5a1deaae6c6c6a089666.json: Language not supported
- .sqlx/query-9b49d0ef4a8ab4e0faae4462dc4402d73f6092a27501fd76214f145702ffca9b.json: Language not supported
- .sqlx/query-9c0b17eea8289f737ba0e0aec4f260b2c1de14872aeef58250197742e61225ac.json: Language not supported
- .sqlx/query-a4ae51cda20286eabd67d87e2b2cf1952af3a6db2d712d6ef6236c69383efeec.json: Language not supported
- .sqlx/query-a4c9aa19924c03216a18bcad5bc64ad14614ecf903eefb7c2330d7eb307a8c8b.json: Language not supported
- .sqlx/query-abf1b1451d1c0ca5ce6a73ec56e0a86af0b2a11c8cef90558cf20d8a2be079aa.json: Language not supported
- .sqlx/query-b09b56b59dc4fadfe4cf87146485a23aa95e5da5ce2d0be10859fe4fe7ddc077.json: Language not supported
- .sqlx/query-b7a466d0b45ab5168e6308d6fbab49cf411b55f4e10e1fa7055c188e04e01a9e.json: Language not supported
- .sqlx/query-b93625950a3997dcb86b85cfb7229abddbf58234b732c61477920a90f32d328e.json: Language not supported
- .sqlx/query-be08f52123e6a810df435cc3c98d8513422a19b6b8417a5c858a8c8e1b5821c9.json: Language not supported
- .sqlx/query-bf7c5f1d79d1f396c1ae33eee5f518144e3918a4185b3da3af2531e60ebb66d2.json: Language not supported
- .sqlx/query-c24c344963b77bb8047c55ef37000a801aaa7b0dc3af81e5846fca58fbbc1bc6.json: Language not supported
- .sqlx/query-cb3afc9d619f8b4013d2083474f7270f0b59d88e785f4794e9af00ed38ae0a5f.json: Language not supported
- .sqlx/query-cc460bfab86e5977b8b5d64da72c8d22a7198541b1a5f251d3f5337a95c09a36.json: Language not supported
- .sqlx/query-cd3e1ab9247c580ac9a95f1e5ce45919fe399010e02807239dd294772990a342.json: Language not supported
- .sqlx/query-cdf732eb3f13c53210b3404a29be7182ab8cd7242b28d8cbdd84d6f35a1a8511.json: Language not supported
- .sqlx/query-e60fc7a9ca96af4c37668e75afdbba7b8b4946139ecabbf73000c8ec28d6457e.json: Language not supported
- .sqlx/query-f1cc7ea940739efb55afee47253b35c5451a692dea1c75c6492562c6626ae195.json: Language not supported
- .sqlx/query-f774c8e0414e6605bd0ad0ad5488240974189d1adbaf580d55d2e7adbe406482.json: Language not supported
- .sqlx/query-fa993a9b8fb8f4e9d4b7a828e5aae3d55a3e9335e1b42a6c4e750e0638aa22bd.json: Language not supported
Comments suppressed due to low confidence (1)
crates/lakekeeper/src/implementations/postgres/tabular/table/common.rs:648
- The parameter name
snapshot_idsinremove_partition_statisticsis misleading. The function documentation and usage context suggest these are snapshot IDs, but the variable name in the function signature should match the actual parameter name used in the function body for consistency.
snapshot_ids: Vec<i64>,
|
@CodeRabbit review |
✅ Actions performedReview triggered.
|
✅ Actions performedReview triggered.
|
|
@CodeRabbit review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
crates/lakekeeper/src/catalog/tables.rs (1)
213-218: Bug:warehouse.idlikely does not exist; passwarehouse_id.
TableCreation { warehouse_id: warehouse.id, ... }should use the already-validatedwarehouse_id(orwarehouse.warehouse_idif the struct exposes that). As written, this will not compile ifidisn’t a field and may silently pick the wrong identifier if it is.Apply this diff in both places:
- TableCreation { - warehouse_id: warehouse.id, + TableCreation { + warehouse_id, namespace_id: namespace.namespace_id, table_ident: &table, table_metadata, metadata_location: metadata_location.as_ref(), },And:
- TableCreation { - warehouse_id: warehouse.id, + TableCreation { + warehouse_id, namespace_id, table_ident: &table, table_metadata, metadata_location: Some(&metadata_location), },Also applies to: 405-411
♻️ Duplicate comments (3)
crates/lakekeeper/src/implementations/postgres/tabular/view/load.rs (1)
127-131: Anchor JOINs on v.warehouse_id for clarity and future‑proofingCurrent predicates use the parameter
$1. Functionally OK given the WHERE clause, but joining via the left table is clearer and guards against accidental parameter misuse.Apply:
- INNER JOIN tabular ta ON ta.warehouse_id = $1 AND ta.tabular_id = v.view_id + INNER JOIN tabular ta + ON ta.warehouse_id = v.warehouse_id AND ta.tabular_id = v.view_id - INNER JOIN current_view_metadata_version cvv - ON cvv.warehouse_id = $1 AND v.view_id = cvv.view_id + INNER JOIN current_view_metadata_version cvv + ON cvv.warehouse_id = v.warehouse_id AND cvv.view_id = v.view_idcrates/lakekeeper/src/catalog/tables.rs (1)
371-373: Log argument order is now correct.The parameters match the intended message structure; this addresses the earlier feedback about swapped placeholders.
crates/lakekeeper/src/implementations/postgres/tabular/table/mod.rs (1)
517-590: Good: all table metadata subqueries are filtered bywarehouse_id.Consistently applying
warehouse_id = $1in subselects andWHERE t.warehouse_id = $1resolves prior ambiguity and improves query selectivity.
🧹 Nitpick comments (3)
.sqlx/query-bac81d1da85f779cdade01163cb7a2942d1a2a2b8725d15f3d253d981cf185d2.json (1)
3-3: Non-blocking: confirm$3is never NULL.
(ti.deleted_at IS NULL OR $3)behaves oddly with NULL. Ensure callers always bind a strict bool. No change needed if already enforced..sqlx/query-c3d504db2b139d6f6cbd1802987414791825a842cf6cbdc26e0dbf1a2467eb64.json (1)
36-39: "metadata_location!" marked non-null but descriptor shows nullable; reconcile invariant.Alias uses “!” (non-null) yet nullable[4] is true. If the DB can return NULL here, sqlx will panic at runtime. Either enforce NOT NULL at schema or drop “!” and handle Option.
If the column is guaranteed non-null, confirm the table constraint; otherwise, change to
as "metadata_location"(no bang) orCOALESCE(ta.metadata_location, '')and update the Rust type accordingly. After changes, re-run sqlx prepare.Also applies to: 129-135
crates/lakekeeper/src/implementations/postgres/tabular/table/mod.rs (1)
1206-1207: Redundant assert; remove or make it meaningful.
assert_eq!(create_result.table_metadata, create_result.table_metadata);is a tautology.Apply this diff:
- assert_eq!(create_result.table_metadata, create_result.table_metadata); + // Optionally assert the staged re-create produced a new metadata UUID or keep no-op removed. + // For now, remove the redundant assertion.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (8)
.sqlx/query-612be6b2dfef21f18e8a18fdbe0b68a1cca974349a3217dad60ffa85531af01f.json(2 hunks).sqlx/query-bac81d1da85f779cdade01163cb7a2942d1a2a2b8725d15f3d253d981cf185d2.json(2 hunks).sqlx/query-c3d504db2b139d6f6cbd1802987414791825a842cf6cbdc26e0dbf1a2467eb64.json(1 hunks)crates/lakekeeper/src/api/iceberg/v1/namespace.rs(0 hunks)crates/lakekeeper/src/api/management/mod.rs(0 hunks)crates/lakekeeper/src/catalog/tables.rs(9 hunks)crates/lakekeeper/src/implementations/postgres/tabular/table/mod.rs(31 hunks)crates/lakekeeper/src/implementations/postgres/tabular/view/load.rs(5 hunks)
💤 Files with no reviewable changes (2)
- crates/lakekeeper/src/api/iceberg/v1/namespace.rs
- crates/lakekeeper/src/api/management/mod.rs
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: mooori
PR: lakekeeper/lakekeeper#1254
File: .sqlx/query-76e03d470bb4221068d84e458d034c46a91ee9ae560f27ab3c782345f27d0668.json:0-0
Timestamp: 2025-09-04T15:53:09.396Z
Learning: When reviewing PRs with focused scope (like adding warehouse_id to enable multi-warehouse support), avoid suggesting refactors of pre-existing code patterns that weren't introduced by the PR. Respect the PR's boundaries and suggest follow-up issues for unrelated improvements instead.
Learnt from: mooori
PR: lakekeeper/lakekeeper#1254
File: .sqlx/query-7ebda80ee60f12b9723e555f1d146e815a906481dd28c2986ec11cb1185b00aa.json:0-0
Timestamp: 2025-09-05T15:17:37.543Z
Learning: When reviewing .sqlx query descriptors in PRs with focused scope (like adding warehouse_id for multi-warehouse support), defer query optimization suggestions to follow-up issues if the existing pattern was functional before the changes, even if the query structure could be improved.
📚 Learning: 2025-09-05T15:17:37.543Z
Learnt from: mooori
PR: lakekeeper/lakekeeper#1254
File: .sqlx/query-7ebda80ee60f12b9723e555f1d146e815a906481dd28c2986ec11cb1185b00aa.json:0-0
Timestamp: 2025-09-05T15:17:37.543Z
Learning: When reviewing .sqlx query descriptors in PRs with focused scope (like adding warehouse_id for multi-warehouse support), defer query optimization suggestions to follow-up issues if the existing pattern was functional before the changes, even if the query structure could be improved.
Applied to files:
.sqlx/query-bac81d1da85f779cdade01163cb7a2942d1a2a2b8725d15f3d253d981cf185d2.jsoncrates/lakekeeper/src/implementations/postgres/tabular/view/load.rs.sqlx/query-612be6b2dfef21f18e8a18fdbe0b68a1cca974349a3217dad60ffa85531af01f.json
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
- GitHub Check: docker / docker
- GitHub Check: docker / docker
- GitHub Check: docker / docker
- GitHub Check: docker / docker
- GitHub Check: sqlx-check
- GitHub Check: test
🔇 Additional comments (19)
.sqlx/query-612be6b2dfef21f18e8a18fdbe0b68a1cca974349a3217dad60ffa85531af01f.json (1)
3-3: LGTM — warehouse-scoped join and filters verified. Repository scan shows no 'JOIN tabular' occurrences outside .sqlx..sqlx/query-bac81d1da85f779cdade01163cb7a2942d1a2a2b8725d15f3d253d981cf185d2.json (1)
77-77: Descriptor hash update — OK.Hash change matches the query rewrite.
.sqlx/query-c3d504db2b139d6f6cbd1802987414791825a842cf6cbdc26e0dbf1a2467eb64.json (3)
91-99: Version log arrays may be NULL; confirm consumer handles Option.
version_log_ids/version_log_timestampswill be NULL when no log exists. Ensure Rust struct fields areOption<Vec<_>>(no “!” present here) and callers handle None.Also applies to: 101-104
121-127: Parameter typing and order look correct.
$1: Uuid (warehouse_id),$2: Uuid (view_id),$3: Bool (include_deleted)is consistent with the WHERE and JOIN predicates.
3-3: Soft-delete predicate is correct for include_deleted toggle.
(ta.deleted_at IS NULL OR $3)on the inner-joined tabular row matches intended semantics.Confirm callers pass
$3 = TRUEfor administrative reads where deleted views should be visible.crates/lakekeeper/src/implementations/postgres/tabular/view/load.rs (4)
23-24: Typed WarehouseId import — good additionBrings type-safety into this module without churn. LGTM.
134-136: LGTM: subqueries correctly scoped by (warehouse_id, view_id)Each derived set filters by both keys and joins back on view_id, preventing cross‑warehouse leakage. Good.
Also applies to: 141-143, 148-151, 168-173
27-31: API change: warehouse_id threaded into load_view — verify callersSignature change matches the PR goal; ensure all callers now pass WarehouseId as the first argument. Automated grep returned no output — run this to list callers and inspect argument order:
rg -n --hidden --no-ignore -S --type rust 'load_view\s*(' -C3
Update any callers that still use the old (view_id, include_deleted, conn) ordering to (warehouse_id, view_id, include_deleted, conn).
54-54: Incorrect — do not replace these derefsViewId implements Deref<Target = Uuid> so
*view_idis valid (and the repo uses the same pattern for warehouse IDs). The suggested.into()diffs are unnecessary; ignore this change.Likely an incorrect or invalid review comment.
crates/lakekeeper/src/catalog/tables.rs (5)
762-764: Good: drops/soft-deletes are warehouse-scoped.Passing
warehouse_idintoC::drop_tableandC::mark_tabular_as_deletedensures isolation across warehouses.Also applies to: 812-818
1168-1174: Nice: bounded, jittered backoff on concurrent updates.Capped exponential backoff with jitter reduces contention without unbounded waits.
1499-1503: Regex accepts optional compression extension.Allowing
(\.\w+)?before.metadata.jsonfixes parsing for compressed paths; tests cover both forms.
3703-3800: Solid coverage: ID reuse across warehouses with hard delete.End-to-end assertions (visibility after delete and recreation) look correct.
3807-3895: Solid coverage: ID reuse across warehouses with soft delete.Good verification of list flags vs. soft-deleted visibility.
crates/lakekeeper/src/implementations/postgres/tabular/table/mod.rs (5)
436-444: Good: joins/filters enforce warehouse scoping.Joining
t↔tion both ids and constraining to$1avoids cross-warehouse leakage.
681-686: Good:get_table_metadata_*queries are warehouse-scoped.Explicit
$1scoping in joins and WHERE clauses prevents cross-warehouse matches by id or location.Also applies to: 749-757
822-835: Good:drop_tableAPI now includeswarehouse_id.Delegating to
drop_tabularwith(warehouse_id, TabularId::Table(*table_id), ...)aligns with the composite PK.
985-997: Test helper API improvements look good.Docstring + optional
table_idparameter make multi-warehouse tests straightforward; defaulting toUuid::now_v7()is fine.Also applies to: 1015-1016
517-590: Confirmed — composite PKs/FKs and composite indexes presentcrates/lakekeeper/migrations/20250904142650_reusable_table_id.sql updates primary keys to include warehouse_id (e.g. table_pkey -> (warehouse_id, table_id)), converts table_* PKs/FKs to composite keys and re-creates supporting composite indexes (e.g. tabular_warehouse_id_location_idx, unique_name_per_namespace_id), so the WHERE/JOIN patterns using warehouse_id + table_id are covered.
|
@CodeRabbit review |
✅ Actions performedReview triggered.
|
✅ PR Title Formatted CorrectlyThe title of this PR match the correct format. Thank you! |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (2)
.sqlx/query-d40e3c7d861bae5fed1b1d305279452251efee6a91bd1b8407cb1e30ecc159b7.json (1)
3-3: Minor: redundant filters and potentially unnecessary join.
INNER JOIN warehouse w ON w.warehouse_id = $1andWHERE w.warehouse_id = $1duplicate the same filter. Keep one.- If no
ti.*columns are used, theINNER JOIN tabular ti ...may be unnecessary becausetalready has the FK; consider dropping it to reduce work.Safe to leave as-is for now; consider in a follow-up.
crates/lakekeeper/migrations/20250904142650_reusable_table_id.sql (1)
425-428: Step numbering nit: header says “8: Recreate views” but top comment lists 0–7.Harmless, but renumber for clarity.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
.sqlx/query-552ddb89100de8fb3c374e95c885dfd2da32c9d51d30acf2d60811edbd545dbc.json(2 hunks).sqlx/query-c962b71a92ff3e1177084527a92518ce0690428ee01723166823549a9909a30d.json(2 hunks).sqlx/query-d40e3c7d861bae5fed1b1d305279452251efee6a91bd1b8407cb1e30ecc159b7.json(2 hunks)crates/lakekeeper/migrations/20250904142650_reusable_table_id.sql(1 hunks)crates/lakekeeper/src/implementations/postgres/tabular/table/mod.rs(31 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- crates/lakekeeper/src/implementations/postgres/tabular/table/mod.rs
🧰 Additional context used
🧠 Learnings (4)
📓 Common learnings
Learnt from: mooori
PR: lakekeeper/lakekeeper#1254
File: .sqlx/query-76e03d470bb4221068d84e458d034c46a91ee9ae560f27ab3c782345f27d0668.json:0-0
Timestamp: 2025-09-04T15:53:09.396Z
Learning: When reviewing PRs with focused scope (like adding warehouse_id to enable multi-warehouse support), avoid suggesting refactors of pre-existing code patterns that weren't introduced by the PR. Respect the PR's boundaries and suggest follow-up issues for unrelated improvements instead.
Learnt from: c-thiel
PR: lakekeeper/lakekeeper#1316
File: .sqlx/query-98ca1801d4e1cf55ce25e7da1de6d4a49d6b32d58bbe53a9ba6ff5284ced6460.json:3-3
Timestamp: 2025-08-31T12:39:49.486Z
Learning: The unique constraint on task(warehouse_id, entity_type, entity_id, queue_name) exists as 'task_warehouse_entity_queue_unique' and was created in migration 20250523101407_tasks_store_their_state.sql, supporting ON CONFLICT operations on these columns.
Learnt from: c-thiel
PR: lakekeeper/lakekeeper#1316
File: .sqlx/query-98ca1801d4e1cf55ce25e7da1de6d4a49d6b32d58bbe53a9ba6ff5284ced6460.json:3-3
Timestamp: 2025-08-31T12:39:49.486Z
Learning: The unique index on task(warehouse_id, entity_type, entity_id, queue_name) exists as 'task_warehouse_id_entity_type_entity_id_queue_name_idx' and was created in migration 20250523101407_tasks_store_their_state.sql, supporting ON CONFLICT operations on these columns.
📚 Learning: 2025-09-05T15:17:37.543Z
Learnt from: mooori
PR: lakekeeper/lakekeeper#1254
File: .sqlx/query-7ebda80ee60f12b9723e555f1d146e815a906481dd28c2986ec11cb1185b00aa.json:0-0
Timestamp: 2025-09-05T15:17:37.543Z
Learning: When reviewing .sqlx query descriptors in PRs with focused scope (like adding warehouse_id for multi-warehouse support), defer query optimization suggestions to follow-up issues if the existing pattern was functional before the changes, even if the query structure could be improved.
Applied to files:
.sqlx/query-d40e3c7d861bae5fed1b1d305279452251efee6a91bd1b8407cb1e30ecc159b7.json.sqlx/query-c962b71a92ff3e1177084527a92518ce0690428ee01723166823549a9909a30d.jsoncrates/lakekeeper/migrations/20250904142650_reusable_table_id.sql
📚 Learning: 2025-08-31T12:39:49.486Z
Learnt from: c-thiel
PR: lakekeeper/lakekeeper#1316
File: .sqlx/query-98ca1801d4e1cf55ce25e7da1de6d4a49d6b32d58bbe53a9ba6ff5284ced6460.json:3-3
Timestamp: 2025-08-31T12:39:49.486Z
Learning: The unique constraint on task(warehouse_id, entity_type, entity_id, queue_name) exists as 'task_warehouse_entity_queue_unique' and was created in migration 20250523101407_tasks_store_their_state.sql, supporting ON CONFLICT operations on these columns.
Applied to files:
crates/lakekeeper/migrations/20250904142650_reusable_table_id.sql
📚 Learning: 2025-08-31T12:39:49.486Z
Learnt from: c-thiel
PR: lakekeeper/lakekeeper#1316
File: .sqlx/query-98ca1801d4e1cf55ce25e7da1de6d4a49d6b32d58bbe53a9ba6ff5284ced6460.json:3-3
Timestamp: 2025-08-31T12:39:49.486Z
Learning: The unique index on task(warehouse_id, entity_type, entity_id, queue_name) exists as 'task_warehouse_id_entity_type_entity_id_queue_name_idx' and was created in migration 20250523101407_tasks_store_their_state.sql, supporting ON CONFLICT operations on these columns.
Applied to files:
crates/lakekeeper/migrations/20250904142650_reusable_table_id.sql
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
- GitHub Check: test
- GitHub Check: tests (spark_adls-1.6.1) / spark_adls-1.6.1
- GitHub Check: tests (spark_adls-1.5.2) / spark_adls-1.5.2
- GitHub Check: tests (spark_aws_sts-1.6.1) / spark_aws_sts-1.6.1
- GitHub Check: tests (spark_aws_sts-1.5.2) / spark_aws_sts-1.5.2
- GitHub Check: tests (spark_aws_sts-1.8.0) / spark_aws_sts-1.8.0
- GitHub Check: tests (spark_gcs-1.8.0) / spark_gcs-1.8.0
🔇 Additional comments (3)
.sqlx/query-c962b71a92ff3e1177084527a92518ce0690428ee01723166823549a9909a30d.json (2)
3-3: LGTM! Comprehensive warehouse scoping implementation.The query properly implements warehouse-scoped isolation by:
- Adding
warehouse_id = $1filters to all main table joins (tabular, namespace, warehouse, table_current_schema, etc.)- Consistently filtering all subqueries with
WHERE warehouse_id = $1 AND table_id = ANY($2)- Using the correct final filter
t.warehouse_id = $1instead ofw.warehouse_id = $1This ensures complete data isolation between warehouses across all related table entities and their aggregated data (schemas, snapshots, partition specs, etc.).
315-315: Query hash updated correctly.The hash change reflects the comprehensive warehouse scoping modifications made to the SQL query.
crates/lakekeeper/migrations/20250904142650_reusable_table_id.sql (1)
333-335: PostgreSQL 15+ feature used (UNIQUE NULLS NOT DISTINCT); confirm target version.
UNIQUE NULLS NOT DISTINCTrequires PG 15+. Verify that all supported deployments are on 15+; otherwise switch to a partial/functional unique index pattern compatible with PG <15.
|
@CodeRabbit review |
✅ Actions performedReview triggered.
|
* feat: Publish images to Dockerhub (lakekeeper#1274) * feat: Update UI to 0.9.0 with multi-project support (lakekeeper#1275) * chore: release 0.9.4 Release-As: 0.9.4 * chore: release main (lakekeeper#1262) * chore(ci): Fix Dockerhub login * chore(docs): Improve developer guide (lakekeeper#1265) * chore(docs): add info regarding `view_version`'s internal representation (lakekeeper#1261) * chore(docs): Architecture clarify Secret Store (lakekeeper#1284) * fix: Update Limes to 0.2.2 - Fixes compilation issue due to breaking `jwks_client_rs` change (lakekeeper#1282) * fix: Update Limes to 0.2.2 * increase min rust version * chore: release 0.9.5 Release-As: 0.9.5 * chore: release main (lakekeeper#1286) * chore: enable changelog sections for release-please (lakekeeper#1264) k * fix(deps): update rust crate rand to v0.9.2 (lakekeeper#1252) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update rust crate async-channel to v2.5.0 (lakekeeper#1225) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update dependency mkdocs-material to v9.6.17 (lakekeeper#1289) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update rust crate anyhow to v1.0.99 (lakekeeper#1290) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore: Remove bitnami images (lakekeeper#1288) * feat!: Move to Lakekeeper IO based on hyperscaler SDKs (lakekeeper#1285) * chore(deps): update rust crate reqwest to v0.12.23 (lakekeeper#1294) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(docs): Improve Cloud storage test docs * fix: accept "disable" as PG sslmode as documented (lakekeeper#1303) * feat: Simplify task interface, re-exports, enable delete-after-commit (lakekeeper#1302) * feat: Introduce `RequestMetadata` for Internal Principals which bypass AuthZ (lakekeeper#1306) * chore(deps): update azure/setup-helm action to v4.3.1 (lakekeeper#1299) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(test): use nextest filterset instead of needs_env_var (lakekeeper#1304) * chore(deps): update rust crate openssl-src to v300.5.2 (lakekeeper#1292) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update rust crate async-compression to v0.4.28 (lakekeeper#1311) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update rust crate thiserror to v2.0.16 (lakekeeper#1296) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * feat: Provide `ApiContext` to externally registered tasks (lakekeeper#1307) * feat!: Simplify Task interface, extend SpecializedTask interface (lakekeeper#1310) * feat: Improve authorizer `are_allowed_*` batch check signature (lakekeeper#1315) * chore(authz): Enforce use of AuthZ decisions with #[must_use] (lakekeeper#1317) * feat: Task Management APIs (lakekeeper#1316) * chore(deps): update rust crate tracing-subscriber to v0.3.20 [security] (lakekeeper#1318) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * feat: Add `RunNow` and `RunAt` to Controls for Tasks (lakekeeper#1322) * chore(deps): update rust crate tokio-util to v0.7.16 (lakekeeper#1313) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(docs): Improve Entra ID docs (lakekeeper#1325) * chore(docs): Improve Upgrades & Migration docs (lakekeeper#1326) * feat: Add tasks heartbeat with Catalog state (lakekeeper#1324) * ci: add configuration for CodeRabbit reviews (lakekeeper#1327) * feat: Add optional STS session-tags in S3 STS requests for ABAC authorization (lakekeeper#1230) * feat: Random Server IDs (lakekeeper#1328) * chore(deps): update rust crate percent-encoding to v2.3.2 (lakekeeper#1312) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * feat(authz): Deprecate Permission Endpoints for Tables without WarehouseIDs (lakekeeper#1334) * fix: Tasks endpoints in router (lakekeeper#1335) * feat(ci): add nextest profile ci_no_secrets for external PRs (lakekeeper#1333) * chore(deps): update rust crate chrono to v0.4.42 (lakekeeper#1331) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore: Pin examples duckdb version to 1.3 (lakekeeper#1343) * feat!: Require warehouse_id when checking permissions on views or tables via ID (lakekeeper#1340) * fix: migrate away from bitnami in unittest.yml (lakekeeper#1344) * chore: Remove coderabitt config * fix(docs): Fix inconsistent URL format in README (lakekeeper#1345) Co-authored-by: Christian <[email protected]> * feat: Remove serde_yaml & serde_yml (lakekeeper#1341) * feat!: add `warehouse_id` to PKs of all `table_*` and `view_*` tables (lakekeeper#1254) * feat: Minor namespace join performance improvements * fix: Warehouse permissions are directly used for task retrieval & control (lakekeeper#1347) * fix: Potential Race Condition when undropping Tabulars (lakekeeper#1342) * fix: table rename authz and error handling (lakekeeper#1346) Co-authored-by: Andre Luis Anastacio <[email protected]> * chore(deps): update rust crate google-cloud-auth to v1.1.2 (lakekeeper#1337) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Christian <[email protected]> * chore(deps): update rust crate time to v0.3.44 (lakekeeper#1349) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update dependency mkdocs-material to v9.6.20 (lakekeeper#1309) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Christian <[email protected]> * feat: Set ServerID during migration (lakekeeper#1348) * chore(deps): Remove utoipa fork (lakekeeper#1352) * chore(deps): update rust crate serde_with to v3.14.1 (lakekeeper#1351) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update rust crate url to v2.5.7 (lakekeeper#1354) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update rust crate async-compression to v0.4.30 (lakekeeper#1323) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Christian <[email protected]> * chore(deps): update rust crate serde_json to v1.0.145 (lakekeeper#1250) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Christian <[email protected]> * chore(deps): update strum monorepo to v0.27.2 (lakekeeper#1251) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Christian <[email protected]> * chore(deps): update serde monorepo to v1.0.226 (lakekeeper#1355) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * fix(deps): update rust crate clap to v4.5.48 (lakekeeper#1356) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * feat: Add Entity Names to Tasks (lakekeeper#1353) * fix: case insensitivity of catalog endpoints (lakekeeper#1338) * fix: Improve delete_warehouse error message for active tasks * chore(deps): update rust crate tempfile to v3.22.0 (lakekeeper#1359) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Christian <[email protected]> * chore(deps): update rust crate axum-prometheus to 0.9.0 (lakekeeper#1358) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * fix: PgSslMode not supported error string * feat(authz)!: add OpenFGA schema v4 and v3->v4 migration (lakekeeper#1314) Co-authored-by: Christian <[email protected]> Co-authored-by: Christian Thiel <[email protected]> * chore(deps): update rust crate uuid to v1.18.1 (lakekeeper#1362) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update dependency markdown-grid-tables to v0.6.0 (lakekeeper#1357) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update rust crate anyhow to v1.0.100 (lakekeeper#1350) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * fix: clippy * chore(deps): update rust crate moka to v0.12.11 (lakekeeper#1365) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update rust crate tempfile to v3.23.0 (lakekeeper#1367) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update rust crate async-nats to 0.43.0 (lakekeeper#1366) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update actions/setup-node action to v5 (lakekeeper#1371) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update actions/checkout action to v5 (lakekeeper#1369) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update actions/setup-python action to v6 (lakekeeper#1372) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * feat: V3 support (lakekeeper#1364) * chore: Set Get Task Permission to "CanGetMetadata" (lakekeeper#1376) * chore(deps): update dependency node to v22 (lakekeeper#1373) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * feat(authz)!: extend OpenFGA tabular entities with WarehouseId (lakekeeper#1329) --------- Co-authored-by: Christian <[email protected]> Co-authored-by: Christian Thiel <[email protected]> * feat: Add support for tasks affecting views (lakekeeper#1378) * feat(authz): Add specific Task Actions (lakekeeper#1379) * chore(tests): Test with Iceberg 1.9.2 & 1.10.0 (lakekeeper#1267) * feat: Enrich task metadata with concrete tabular type (lakekeeper#1383) * feat: Add loadTable Snapshots filter (lakekeeper#1385) * feat: add endpoint for fuzzy search of tabulars (lakekeeper#1387) * feat: Update UI to 0.10.0 (lakekeeper#1390) * feat(ui): Update UI to 0.10.1 * chore: Use lakekeeper re-exports in bin (lakekeeper#1391) * fix(tabular-search): distance and docs for `searchterm is uuid` (lakekeeper#1393) * chore(examples): Idempotent bucket creation in minimal example (lakekeeper#1386) In the case where you already have a bucket created, like the "examples" bucket, I ran into an issue where the createbuckets service fails, and this prevents lakekeeper from starting back up. This fix adds a simple minio flag to ignore buckets that already exist, making things even more user friendly * feat: Make number of workers spawned for Expiration & Purge configurable (lakekeeper#1395) * chore: release main (lakekeeper#1295) * chore: added gif to readme (lakekeeper#1396) * chore: remove unneded `#[allow(dead_code)]` (lakekeeper#1399) * fix: Use FnOnce for queue & service registration * Revert "fix: Use FnOnce for queue & service registration" This reverts commit 47b03a0. * chore(docs): Add 0.10 docs * perf(db): remove `join namespace` from `active_tabulars` view (lakekeeper#1401) * doc(db): how to connect to db and inspect schema (lakekeeper#1402) * feat: implement `OpenFgaEntity` for `ServerId` (lakekeeper#1394) * impl OpenFgaEntity * Use the implementation * fix: Use FnOnce for queue & service registration (lakekeeper#1404) * chore(deps): update dependency mkdocs-material to v9.6.21 (lakekeeper#1406) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * feat: Expose client-managed X-Iceberg-Access-Delegation (lakekeeper#1407) * fix: Use higher consistency for some OpenFGA queries (lakekeeper#1408) * feat: Improve Kubernetes Auth docs (lakekeeper#1415) * chore: release 0.10.1 Release-As: 0.10.1 * fix: Endpoint stats for Project Endpoints (lakekeeper#1412) * feat: Add create table guard to cleanup location on Failure (lakekeeper#1418) * chore: Generate ID types with Macro (lakekeeper#1419) * chore: Re-Export Tokio from lakekeeper-io create (lakekeeper#1420) * fix: Add support for `write.metadata.metrics.` Table Properties (lakekeeper#1422) * fix: Update UI to 0.10.2 (lakekeeper#1423) * chore: release main (lakekeeper#1403) * fix: Parse empty ProjectID headers as None (lakekeeper#1424) * chore: release 0.10.2 Release-As: 0.10.2 * chore: release main (lakekeeper#1425) * feat: Add `debug_migrate_before_serve` env var (lakekeeper#1426) * feat: Move OpenFGA Authorizer to separate crate (lakekeeper#1421) * chore(renovate): Group dependencies * chore(renovate): ignore additional deps * chore: Rename src/service -> src/server, trait Catalog -> CatalogStore (lakekeeper#1428) * feat(examples): add k8s iceberg sink connector (avro) (lakekeeper#1336) --------- Co-authored-by: Christian <[email protected]> * chore(ci): Fix release please (lakekeeper#1433) * feat: Expose License Information via API (lakekeeper#1432) * fix(deps): update all non-major dependencies (lakekeeper#1429) * chore(ci): Remove mgmt API version update via release-please * chore: Restructure catalog_store into multiple modules (lakekeeper#1434) * feat: Validate Downscoping works on Warehouse creation (lakekeeper#1437) * chore(ci): Fix release please * docs: Add info about installing sqlx to developer-guide.md (lakekeeper#1438) * docs: Update developer-guide.md (lakekeeper#1439) * chore(deps): update all non-major dependencies (lakekeeper#1436) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * fix: Better normalization for ARNs in S3 Profile (lakekeeper#1441) * chore(deps): update all non-major dependencies (lakekeeper#1442) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(main): release 0.10.3 (lakekeeper#1427) * fix: Release Please CI outputs * fix(ci): Revert 0.10.3 release * chore(main): release 0.10.3 (lakekeeper#1446) * feat: Introduce CatalogWarehouseOps & CatalogNamespaceOps abstractions (lakekeeper#1440) * feat: Allow x-user-agent header (lakekeeper#1453) * feat: Table & View Ops Abstractions, Improved Error Handling (lakekeeper#1454) * fix: CORS allow access delegation & etag headers (lakekeeper#1455) * fix: Headers should be lowercase (lakekeeper#1457) * chore(tests): Add trino information_schema.tables test (lakekeeper#1456) * chore: Introduce open-api feature to gate utoipa and swagger (lakekeeper#1458) * chore: Release As 0.11 * fix: Debug assertion table identifier mismatch for signer (lakekeeper#1460) * feat: Caching Short-Term-Credentials (STC) (lakekeeper#1459) * feat: Warehouse Cache (lakekeeper#1462) * chore(deps): update actions/setup-node action to v6 (lakekeeper#1443) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * feat: Version based Warehouse Cache (lakekeeper#1465) * feat: AuthZ Server and Project Ops (lakekeeper#1471) * chore(deps): update github artifact actions (lakekeeper#1461) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore: Rename release branch pattern to rel-* * feat: Catalog returns full Namespace Hierarchy for nested Namespaces (lakekeeper#1472) --------- Co-authored-by: Christian <[email protected]> Co-authored-by: Christian Thiel <[email protected]> Co-authored-by: Dao Thanh Tung <[email protected]> Co-authored-by: Moritz Zielke <[email protected]> Co-authored-by: Baptiste Gouhoury <[email protected]> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Dolan Antenucci <[email protected]> Co-authored-by: Anatoly Popov <[email protected]> Co-authored-by: Andre Luis Anastacio <[email protected]> Co-authored-by: Scott Haines <[email protected]> Co-authored-by: Viktor Kessler <[email protected]> Co-authored-by: Yohan Valencia <[email protected]> Co-authored-by: Paul Roman <[email protected]>
Part of the effort to make
tableandviewids re-usable across warehouses [#1114].Summary by CodeRabbit
New Features
Refactor
Migrations
Tests