Repository navigation
fix: Potential Race Condition when undropping Tabulars - #1342
Conversation
WalkthroughAdds Default to pagination types and queries; refines soft-delete/undrop APIs and types; introduces lock-based, warehouse-scoped rename/drop/undrop flows in Postgres with updated SQLx descriptors; aligns event publishing with renamed UndropTabularResponse fields; adds end-to-end soft-deletion tests; updates force-deletion docs. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Client
participant API as API (Mgmt)
participant Svc as Service (Catalog)
participant PG as Postgres (Tabular)
rect rgba(230,245,255,0.6)
note right of Client: Undrop tabular(s)
Client->>API: POST /undropTabulars
API->>Svc: undrop_tabulars(request)
Svc->>PG: clear_tabular_deleted_at(ids, warehouse)
end
rect rgba(240,255,230,0.6)
note over PG: Atomic undelete with locks
PG->>PG: locked_tabulars FOR UPDATE
PG->>PG: validation (all_found)
PG->>PG: locked_tasks FOR UPDATE (queue tabular_expiration)
PG->>PG: UPDATE tabular SET deleted_at=NULL
PG-->>Svc: rows(name, tabular_id, expiration_task_id?, namespace_name[], all_found)
end
Svc-->>API: UndropTabularResponse { table_id, expiration_task_id, ... }
API-->>Client: 200 OK
sequenceDiagram
autonumber
actor Client
participant API as API (Catalog)
participant Svc as Service
participant PG as Postgres (Tabular)
rect rgba(255,245,230,0.6)
note right of Client: Rename tabular
Client->>API: PUT /tables/{source} -> {destination}
API->>Svc: rename_tabular(warehouse, source_id, source, destination)
Svc->>PG: rename_tabular(...)
end
rect rgba(240,240,255,0.6)
note over PG: Locking & conflict checks
PG->>PG: lock target tabular FOR UPDATE
PG->>PG: lock source/target namespace
PG->>PG: warehouse active check
PG->>PG: conflict_check (name collision)
PG->>PG: UPDATE tabular SET name/namespace_id
PG-->>Svc: tabular_id
end
Svc-->>API: 200 OK
API-->>Client: 200 OK
sequenceDiagram
autonumber
actor Client
participant API as API (Catalog)
participant Svc as Service
participant PG as Postgres (Tabular)
rect rgba(255,235,235,0.6)
note right of Client: Drop/mark delete
Client->>API: DELETE /tables/{id}?force/purgeRequested
API->>Svc: drop_or_mark(...)
Svc->>PG: mark_tabular_as_deleted or hard delete
end
alt soft-delete
PG->>PG: lock tabular FOR UPDATE
PG->>PG: set deleted_at=now() if not protected or override
PG-->>Svc: protected, was_marked
else hard-delete
PG->>PG: lock tabular FOR UPDATE
PG->>PG: DELETE ... RETURNING locations
PG-->>Svc: protected, fs info, was_deleted
end
Svc-->>API: 200/409 per result
API-->>Client: Response
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 10
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/implementations/postgres/tabular/mod.rs (1)
766-776:all_foundcan be false with an empty UPDATE result set; current check misses that case.If no rows are updated (e.g., all IDs invalid or belong to another warehouse),
.first()isNoneand you silently returnOk(vec![]). You need to readvalidation.all_foundeven when UPDATE returns zero rows.Suggested patch:
- if undrop_tabular_informations - .first() - .is_some_and(|r| !r.all_found) - { + if undrop_tabular_informations.first().is_some_and(|r| !r.all_found) { return Err(ErrorModel::not_found( "One or more tabular IDs to undrop not found", "NoSuchTabularError", None, ) .into()); } + if undrop_tabular_informations.is_empty() { + // Re-run the validation CTE without the UPDATE to get the boolean. + let all_found = sqlx::query_scalar!( + r#" + WITH locked_tabulars AS ( + SELECT t.tabular_id + FROM tabular t + JOIN namespace n ON t.namespace_id = n.namespace_id + WHERE n.warehouse_id = $2 + AND t.tabular_id = ANY($1::uuid[]) + FOR UPDATE OF t + ), + validation AS ( + SELECT NOT EXISTS ( + SELECT 1 FROM unnest($1::uuid[]) AS id + WHERE id NOT IN (SELECT tabular_id FROM locked_tabulars) + ) AS all_found + ) + SELECT all_found FROM validation + "#, + tabular_ids, + *warehouse_id, + ) + .fetch_one(&mut **transaction) + .await + .map_err(|e| e.into_error_model("Error validating undrop IDs".to_string()))?; + if !all_found { + return Err(ErrorModel::not_found( + "One or more tabular IDs to undrop not found", + "NoSuchTabularError", + None, + ) + .into()); + } + }
🧹 Nitpick comments (6)
crates/lakekeeper/src/catalog/tables.rs (1)
753-757: Minor: preferlet profile = …;then shadow withmatchby refTiny readability nit: avoid moving the enum by value if you don’t need ownership; matching by ref prevents accidental future cloning.
- let delete_profile = if force { + let delete_profile = if force { TabularDeleteProfile::Hard {} } else { warehouse.tabular_delete_profile }; - match delete_profile { + match &delete_profile {docs/docs/concepts.md (1)
156-166: Fix markdownlint nits and add fenced languageSwitch list markers to asterisks and annotate the fenced block language to satisfy MD004/MD040.
- - Bypasses protection settings - - Overrides soft-deletion mechanisms for immediate hard deletion + * Bypasses protection settings + * Overrides soft-deletion mechanisms for immediate hard deletion @@ -``` -DELETE /catalog/v1/{prefix}/namespaces/{namespace}?force=true -``` +```http +DELETE /catalog/v1/{prefix}/namespaces/{namespace}?force=true +```crates/lakekeeper/src/tests/soft_deletion.rs (2)
94-121: Minor: flatten create logic to avoid extra spawn overhead.Spawning 20 short tasks adds scheduling overhead and complicates error handling. Iterating with
futures::stream::iter(...).buffer_unordered(N)keeps concurrency with simpler errors.Happy to provide a refactor if desired.
83-92: Avoid brittleunwrap()chain when extracting namespace_id.If
propertiesorNAMESPACE_ID_PROPERTYis missing the test panics with poor diagnostics.Consider:
- let ns_id = NamespaceId::from( - uuid::Uuid::parse_str( - create_ns_response - .properties - .unwrap() - .get(NAMESPACE_ID_PROPERTY) - .unwrap(), - ) - .unwrap(), - ); + let props = create_ns_response.properties.as_ref().expect("namespace properties missing"); + let nid = props.get(NAMESPACE_ID_PROPERTY).expect("namespace id property missing"); + let ns_id = NamespaceId::from(uuid::Uuid::parse_str(nid).expect("invalid namespace id"));crates/lakekeeper/src/implementations/postgres/tabular/mod.rs (2)
778-787: Map optional task IDs, or enforce presence upstream.After making
task_idoptional, this mapping must handleNone. If the API must always return an ID, enforce an inner join and guarantee a single task; otherwise returnOption<TaskId>.Proposed mapping change (requires
UndropTabularResponse { expiration_task_id: Option<TaskId>, .. }):- .map(|undrop_tabular_information| UndropTabularResponse { - table_id: TableId::from(undrop_tabular_information.tabular_id), - expiration_task_id: TaskId::from(undrop_tabular_information.task_id), + .map(|undrop_tabular_information| UndropTabularResponse { + table_id: TableId::from(undrop_tabular_information.tabular_id), + expiration_task_id: undrop_tabular_information.task_id.map(TaskId::from), name: undrop_tabular_information.name, namespace: NamespaceIdent::from_vec(undrop_tabular_information.namespace_name) .unwrap_or(NamespaceIdent::new("unknown".into())), })If you need help updating the API surface, I can draft the type changes and call sites.
820-823: Incorrect error message (prints type where ID should be).
format!("Table with id {} not found", tabular_id.typ_str())prints “Table/View” instead of the UUID.Apply this diff:
- format!("Table with id {} not found", tabular_id.typ_str()), + format!("{} with ID {} not found", tabular_id.typ_str(), tabular_id.as_ref()),
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (20)
.sqlx/query-0ae506a3e9bed7d6c28e5009f82ecc7160d546b77188629b2c62b8b582639195.json(1 hunks).sqlx/query-13c9d4d97f27858856f98f940b834735793a11997c6e55e8add91c7bcb934fa2.json(1 hunks).sqlx/query-3333a3bbc33b05c4ef4afcc533e21e624ad22afef181f157a1aa343e5fcf6958.json(1 hunks).sqlx/query-399779427589d30b9245c82f585b44b96c7d7cc515f278b1ea8dfa02d4598c24.json(0 hunks).sqlx/query-3b9480a09b144ce8b45d2c67716c1f51450a869cbbaca3de6a3ee5468b0a44e9.json(0 hunks).sqlx/query-455bd533ad53f32804a8948153219816ab36a99332e1adf98d882684e702d75f.json(1 hunks).sqlx/query-7a7f0fd559a39693588da60cca2f7695a96022cb6fe5b2e54bb380b5861d5f13.json(0 hunks).sqlx/query-9262b4ac7e10b2920a2bfac056f28db7469315cd48b4e2606edd62a86acbebd9.json(1 hunks).sqlx/query-9dc410938dc597bbf9146ed467d46136e827690eb2cecb799a21456375a1fc6d.json(0 hunks).sqlx/query-a74228eb4787521ca9c5d22617a81920410ce4e5f0d09d7493dde9b4e88d7aa2.json(0 hunks)crates/lakekeeper/src/api/iceberg/types.rs(1 hunks)crates/lakekeeper/src/api/iceberg/v1/tables.rs(1 hunks)crates/lakekeeper/src/api/management/v1/warehouse/mod.rs(2 hunks)crates/lakekeeper/src/catalog/tables.rs(1 hunks)crates/lakekeeper/src/implementations/postgres/tabular/mod.rs(10 hunks)crates/lakekeeper/src/service/catalog.rs(1 hunks)crates/lakekeeper/src/service/event_publisher/mod.rs(1 hunks)crates/lakekeeper/src/tests/mod.rs(1 hunks)crates/lakekeeper/src/tests/soft_deletion.rs(1 hunks)docs/docs/concepts.md(1 hunks)
💤 Files with no reviewable changes (5)
- .sqlx/query-7a7f0fd559a39693588da60cca2f7695a96022cb6fe5b2e54bb380b5861d5f13.json
- .sqlx/query-9dc410938dc597bbf9146ed467d46136e827690eb2cecb799a21456375a1fc6d.json
- .sqlx/query-399779427589d30b9245c82f585b44b96c7d7cc515f278b1ea8dfa02d4598c24.json
- .sqlx/query-a74228eb4787521ca9c5d22617a81920410ce4e5f0d09d7493dde9b4e88d7aa2.json
- .sqlx/query-3b9480a09b144ce8b45d2c67716c1f51450a869cbbaca3de6a3ee5468b0a44e9.json
🧰 Additional context used
🧬 Code graph analysis (2)
crates/lakekeeper/src/tests/soft_deletion.rs (3)
crates/lakekeeper/src/catalog/tables.rs (6)
futures(1371-1375)catalog(107-107)create_table(140-306)drop_table(697-834)list_tables(80-136)load_table(484-584)crates/lakekeeper/src/api/management/v1/warehouse/mod.rs (6)
catalog(868-868)default(136-138)create_warehouse(280-379)from(1092-1102)list_soft_deleted_tabulars(846-962)undrop_tabulars(787-843)crates/lakekeeper/src/tests/mod.rs (5)
get_api_context(269-296)random_request_metadata(298-300)memory_io_profile(50-52)create_table(105-123)drop_table(125-146)
crates/lakekeeper/src/implementations/postgres/tabular/mod.rs (3)
crates/iceberg-ext/src/catalog/rest/error.rs (3)
bad_request(127-133)new(232-244)not_found(182-188)crates/lakekeeper/src/service/tabular_idents.rs (2)
typ_str(24-29)typ_str(69-74)crates/lakekeeper/src/service/storage/mod.rs (1)
join_location(894-896)
🪛 markdownlint-cli2 (0.17.2)
docs/docs/concepts.md
158-158: Unordered list style
Expected: asterisk; Actual: dash
(MD004, ul-style)
159-159: Unordered list style
Expected: asterisk; Actual: dash
(MD004, ul-style)
162-162: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
⏰ 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). (9)
- GitHub Check: docker / docker
- GitHub Check: docker / docker
- GitHub Check: docker / docker
- GitHub Check: docker / docker
- GitHub Check: sqlx-check
- GitHub Check: test
- GitHub Check: check-generated-openapi-matches
- GitHub Check: clippy
- GitHub Check: openfga
🔇 Additional comments (12)
crates/lakekeeper/src/api/iceberg/v1/tables.rs (1)
26-41: LGTM: sensible Default for query DTODeriving Default on
ListTablesQueryaligns with the newPageToken::default(). No concerns.crates/lakekeeper/src/api/management/v1/warehouse/mod.rs (2)
40-54: Defaults on query params: good hardening
#[derive(Default)]+#[serde(default)]avoids 400s for omitted filters. Looks good.
819-824: expiration_task_id type & null-safety verified — optional dedupeUndropTabularResponse.expiration_task_id is TaskId (crates/lakekeeper/src/service/catalog.rs) and is built from the DB task UUID via TaskId::from(...) (crates/lakekeeper/src/implementations/postgres/tabular/mod.rs); the Postgres code also surfaces missing cleanup_task_id with ok_or(...). Optional: deduplicate the collected IDs before passing to TaskFilter::TaskIds to avoid redundant cancels.
.sqlx/query-0ae506a3e9bed7d6c28e5009f82ecc7160d546b77188629b2c62b8b582639195.json (1)
1-58: LGTM: lock + conditional hard delete with protected/force guardThe
locked_tabular+deletedCTE pattern avoids TOCTOU and returns a clearwas_deleted!signal. Good alignment with purge scheduling..sqlx/query-9262b4ac7e10b2920a2bfac056f28db7469315cd48b4e2606edd62a86acbebd9.json (1)
1-35: LGTM: rename path guarded by row lock and active warehouse checkLocking the tabular row and validating warehouse activity prior to UPDATE is correct. No issues.
crates/lakekeeper/src/api/iceberg/types.rs (1)
36-46: Default(PageToken) → Empty — make implicit defaults explicit where “unspecified” is requiredPageToken now #[default] = Empty; any query struct built with ..Default::default() that contains a PageToken will get Empty (client-supports-pagination) instead of NotSpecified (param-missing). Change call sites that relied on “unspecified” to set page_token: PageToken::NotSpecified explicitly.
Actionable fixes (update to PageToken::NotSpecified if you expect “param not provided”):
- crates/lakekeeper/src/tests/soft_deletion.rs:157 — ListTablesQuery { return_uuids: true, ..Default::default() }
- crates/lakekeeper/src/tests/soft_deletion.rs:252 — ListTablesQuery { ..Default::default() }
Important places to review (behavior change impact):
- crates/lakekeeper/src/catalog/mod.rs:192–196 — fetch_until_full_page() uses matches!(page_token, PageToken::NotSpecified) to choose pagination_size_max vs pagination_size_default.
- crates/lakekeeper/src/api/iceberg/v1/tables.rs:26–48 — ListTablesQuery derives Default and contains PageToken (source of implicit Empty).
If the intended semantics are “unspecified” for any of the above, replace the implicit default with an explicit page_token: PageToken::NotSpecified.
crates/lakekeeper/src/service/event_publisher/mod.rs (1)
398-398: LGTM: emit undrop events using the newtable_idfield.Correctly adapts to
UndropTabularResponse { table_id, … }viaTabularId::from(…).crates/lakekeeper/src/tests/mod.rs (1)
4-4: LGTM: register the new soft‑deletion test module.crates/lakekeeper/src/tests/soft_deletion.rs (1)
175-194: Potential flake: immediate task listing after drops.If scheduling commits lag slightly, the assertion may race. If you see intermittent failures, add a short retry with timeout.
.sqlx/query-3333a3bbc33b05c4ef4afcc533e21e624ad22afef181f157a1aa343e5fcf6958.json (1)
14-31: Ensure UNIQUE index on tabular(namespace_id, name)Search did not reveal a UNIQUE constraint/index; the UPDATE in .sqlx/query-3333a3bbc33b05c4ef4afcc533e21e624ad22afef181f157a1aa343e5fcf6958.json relies on uniqueness — add a UNIQUE INDEX ON tabular(namespace_id, name) or confirm migrations include one.
crates/lakekeeper/src/service/catalog.rs (1)
206-210: Field-rename ripple check — manual verification required.rg shows both old names and new names still present; confirm the struct rename didn't break call sites, SQLx row mappings, or (de)serialization.
- Check crates/lakekeeper/src/service/catalog.rs (pub table_ident at ~line 193 vs pub table_id / pub expiration_task_id at ~lines 206–207).
- Check crates/lakekeeper/src/api/management/v1/warehouse/mod.rs:937 (uses info.table_ident).
- Check SQL/migration artifacts and sqlx metadata (crates/lakekeeper/migrations/** and .sqlx/*.json) for column/name expectations (task_id / table_id).
crates/lakekeeper/src/implementations/postgres/tabular/mod.rs (1)
925-926: LGTM: location resolution after drop is now unconditional.Using
active_tabularsand always returning a joined location simplifies the code path.
|
@CodeRabbit review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Actionable comments posted: 0
♻️ Duplicate comments (2)
.sqlx/query-87ecc303171b04d2f8403bf615ce8290276a2f9d85bb912f96a6cc10a731c6aa.json (1)
3-3: Potential cross-warehouse rename vulnerability: locked_source_namespace uses incorrect bind parameter.The
locked_source_namespaceCTE joins onn.warehouse_id = $2, but$2is thetabular_idparameter, not thewarehouse_id. This should ben.warehouse_id = $4to properly validate warehouse membership. This bug could allow moving tabulars across warehouses if the caller knows the tabular_id.Apply this diff to fix the warehouse validation:
locked_source_namespace AS ( -- source namespace of the tabular SELECT n.namespace_id FROM namespace n JOIN locked_tabular lt ON lt.namespace_id = n.namespace_id - WHERE n.warehouse_id = $2 + WHERE n.warehouse_id = $4 FOR UPDATE ),crates/lakekeeper/src/implementations/postgres/tabular/mod.rs (1)
594-599: Same warehouse validation bug in the single-namespace rename path.The
locked_source_namespaceCTE uses$2for warehouse validation, but$2is thetabular_idparameter. It should be$4which is the actualwarehouse_idparameter.Apply this diff to fix the warehouse validation:
locked_source_namespace AS ( -- source namespace of the tabular SELECT n.namespace_id FROM namespace n JOIN locked_tabular lt ON lt.namespace_id = n.namespace_id - WHERE n.warehouse_id = $2 + WHERE n.warehouse_id = $4 FOR UPDATE },
🧹 Nitpick comments (2)
.sqlx/query-b4dc189340e2addd91deba9130d787782bca3d07ff69e254af041157c7349ec0.json (2)
3-3: Prefer EXISTS and skip no-op updates; reduces writes and clarifies non-nullability.Use EXISTS (boolean, non-null) and guard against rewriting the same value. This tightens semantics and can help SQLx infer non-null for "was_marked!".
- ), - marked AS ( - UPDATE tabular - SET deleted_at = $2 - FROM locked_tabular lt - WHERE tabular.tabular_id = lt.tabular_id - AND ((NOT lt.protected) OR $3) - RETURNING tabular.tabular_id - ) + ), + marked AS ( + UPDATE tabular + SET deleted_at = $2 + FROM locked_tabular lt + WHERE tabular.tabular_id = lt.tabular_id + AND ((NOT lt.protected) OR $3) + AND tabular.deleted_at IS DISTINCT FROM $2 + RETURNING 1 + ) @@ - (SELECT tabular_id FROM marked) IS NOT NULL as "was_marked!" + EXISTS (SELECT 1 FROM marked) as "was_marked!"
3-3: Nit: simplify RETURNING payload.Since you only need existence, RETURNING 1 is cheaper than returning tabular_id.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (8)
.sqlx/query-2b32fe8b066b3c81101a8b2b3868df20313a544e59810ba8803fb8442bee1d7b.json(1 hunks).sqlx/query-7969d42534dac6d2ea88a7e3acbf8cf068e2204d6d53a1a5069365118ca5129b.json(1 hunks).sqlx/query-87ecc303171b04d2f8403bf615ce8290276a2f9d85bb912f96a6cc10a731c6aa.json(1 hunks).sqlx/query-b4dc189340e2addd91deba9130d787782bca3d07ff69e254af041157c7349ec0.json(1 hunks)crates/lakekeeper/src/api/management/v1/warehouse/mod.rs(2 hunks)crates/lakekeeper/src/implementations/postgres/tabular/mod.rs(11 hunks)crates/lakekeeper/src/service/catalog.rs(1 hunks)crates/lakekeeper/src/tests/soft_deletion.rs(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
- crates/lakekeeper/src/api/management/v1/warehouse/mod.rs
- crates/lakekeeper/src/tests/soft_deletion.rs
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2025-08-30T10:35:58.939Z
Learnt from: c-thiel
PR: lakekeeper/lakekeeper#1316
File: crates/lakekeeper/src/implementations/postgres/tasks.rs:169-173
Timestamp: 2025-08-30T10:35:58.939Z
Learning: In the task picking SQL query in crates/lakekeeper/src/implementations/postgres/tasks.rs, the WHERE clause intentionally allows both Running and ShouldStop tasks to be re-picked if their last heartbeat is older than max_time_since_last_heartbeat. This is a reconciliation mechanism to handle cases where workers are killed or crash, preventing tasks from being stuck indefinitely in Running or ShouldStop states.
Applied to files:
crates/lakekeeper/src/implementations/postgres/tabular/mod.rs
📚 Learning: 2025-09-18T08:18:17.541Z
Learnt from: c-thiel
PR: lakekeeper/lakekeeper#1342
File: crates/lakekeeper/src/implementations/postgres/tabular/mod.rs:712-745
Timestamp: 2025-09-18T08:18:17.541Z
Learning: Task cancellation in the lakekeeper codebase is not trivial because it requires recording the cancellation in task history for audit purposes. Task cancellation is handled through a separate method within the same transaction rather than being done inline in SQL queries.
Applied to files:
crates/lakekeeper/src/implementations/postgres/tabular/mod.rs
🔇 Additional comments (11)
.sqlx/query-b4dc189340e2addd91deba9130d787782bca3d07ff69e254af041157c7349ec0.json (3)
3-3: Confirm result handling when the row isn’t found.CTE seeds from locked_tabular; if tabular_id doesn’t exist, the final SELECT returns 0 rows. Ensure the caller uses fetch_optional (or equivalent) and maps NotFound correctly.
3-3: “Bang” alias vs. JSON nullable metadata.Alias uses "was_marked!" (non-null), but describe.nullable shows null for that column. After switching to EXISTS, please re-run sqlx prepare and confirm the Rust type isn’t Option.
3-3: Approve — consistent tabular-first lock ordering verifiedConfirmed: all mutators in crates/lakekeeper/src/implementations/postgres/tabular/mod.rs acquire locks on tabular first (WITH locked_tabular ... FOR UPDATE or direct UPDATE), then lock namespace/tasks; no inverse ordering found.
.sqlx/query-7969d42534dac6d2ea88a7e3acbf8cf068e2204d6d53a1a5069365118ca5129b.json (1)
1-37: LGTM! Well-structured concurrency-safe rename with multi-CTE locking.The query properly implements a concurrency-safe tabular rename across namespaces with appropriate locking (FOR UPDATE) on all involved entities. The conflict detection and warehouse validation ensure data integrity.
.sqlx/query-2b32fe8b066b3c81101a8b2b3868df20313a544e59810ba8803fb8442bee1d7b.json (1)
38-44: Good practice on explicit nullability column markings.The query correctly marks
task_idas nullable with the?suffix since it comes from a LEFT JOIN, andall_foundas non-nullable with the!suffix. This ensures proper type mapping in the Rust code.crates/lakekeeper/src/service/catalog.rs (1)
206-207: Field renames improve API clarity.The rename from
table_identtotable_idand makingexpiration_task_idoptional better reflects the actual data being returned and handles cases where tasks might not exist.crates/lakekeeper/src/implementations/postgres/tabular/mod.rs (5)
640-690: Cross-namespace rename properly validates source tabular membership.The query correctly locks all involved entities and validates that the source tabular exists with matching name and type. The conflict check prevents name collisions in the destination namespace.
743-776: Robust undrop implementation with proper task locking.The implementation correctly:
- Locks tabulars and their associated expiration tasks
- Validates all requested IDs exist before performing updates
- Returns nullable task_id for cases where tasks might be missing
- Preserves task history through separate cancellation (as noted in learnings)
812-813: Field updates match the API contract changes.The response construction correctly uses the renamed fields
table_idandexpiration_task_idto match the updatedUndropTabularResponsestructure.
891-914: Well-structured tabular deletion with protection checks.The drop operation properly:
- Locks the tabular for update to prevent concurrent modifications
- Respects the protection flag unless force is specified
- Returns the location unconditionally for cleanup purposes
- Uses a CTE pattern for atomic operations
964-964: Simplified location handling.Good change to always return the joined location from the locked row data, removing the need for a conditional fallback.
|
@CodeRabbit full review |
✅ Actions performedFull review triggered. |
There was a problem hiding this comment.
Actionable comments posted: 0
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/implementations/postgres/tabular/mod.rs (1)
637-644: Map unique-name conflicts to a client error instead of generic DB error.When two concurrent renames land on the same name, rely on the unique constraint and return a deterministic 409/400-style error rather than a generic 500.
- .map_err(|e| match e { + .map_err(|e| match &e { sqlx::Error::RowNotFound => ErrorModel::builder() .code(StatusCode::NOT_FOUND.into()) .message(format!("ID of {} to rename not found", source_id.typ_str())) .r#type(format!("Rename{}IdNotFound", source_id.typ_str())) .build(), - _ => e.into_error_model(format!("Error renaming {}", source_id.typ_str())), + sqlx::Error::Database(db_err) if db_err.constraint() == Some("unique_name_per_namespace_id") => { + ErrorModel::bad_request( + "Tabular with the same name already exists in the namespace.", + "TabularNameAlreadyExists", + Some(Box::new(e)), + ) + } + _ => e.into_error_model(format!("Error renaming {}", source_id.typ_str())), })?;And for the cross-namespace branch:
- .map_err(|e| match e { + .map_err(|e| match &e { sqlx::Error::RowNotFound => ErrorModel::builder() .code(StatusCode::NOT_FOUND.into()) .message(format!( "ID of {} to rename not found or destination namespace not found", source_id.typ_str() )) .r#type(format!( "Rename{}IdOrNamespaceNotFound", source_id.typ_str() )) .build(), - _ => e.into_error_model(format!("Error renaming {}", source_id.typ_str())), + sqlx::Error::Database(db_err) if db_err.constraint() == Some("unique_name_per_namespace_id") => { + ErrorModel::bad_request( + "Tabular with the same name already exists in the destination namespace.", + "TabularNameAlreadyExists", + Some(Box::new(e)), + ) + } + _ => e.into_error_model(format!("Error renaming {}", source_id.typ_str())), })?;Also applies to: 703-716
♻️ Duplicate comments (3)
.sqlx/query-26bb2d281b7e22daf49c5436cad391648b309468e75d3b20ec9fc721b11e5259.json (1)
1-31: Soft‑mark now gated at DB layer with force; returns was_markedGreat:
AND ((NOT lt.protected) OR $4)enforces protection at write time, andwas_marked!exposes outcome. This addresses the earlier concern about enforcing protection only in application logic.If not already done, ensure the Rust mapping uses the new 4th param (force) and consumes
was_marked!where relevant.crates/lakekeeper/src/tests/soft_deletion.rs (1)
147-151: Good fix: surface JoinHandle failuresYou now await and check JoinHandles for drop tasks, ensuring panics are not masked.
crates/lakekeeper/src/implementations/postgres/tabular/mod.rs (1)
603-608: Wrong bind for warehouse_id in same-namespace rename (breaks query).In
locked_source_namespace,n.warehouse_id = $2compares a UUID (source_id) to warehouse_id. This makes the CTE empty and the UPDATE returns 0 rows → false 404s.Apply:
- WHERE n.warehouse_id = $2 + WHERE n.warehouse_id = $4
🧹 Nitpick comments (10)
crates/lakekeeper/src/catalog/tables.rs (1)
799-829: Schedule expiration after a successful soft-mark to avoid needless workBoth scheduling and marking run in the same transaction, so a failure rolls back the task. Still, marking first reduces work and makes intent clearer.
Apply this reordering:
- let _ = TabularExpirationTask::schedule_task::<C>(/* ... */).await?; - C::mark_tabular_as_deleted(warehouse_id, TabularId::Table(*table_id), force, t.transaction()).await?; + C::mark_tabular_as_deleted( + warehouse_id, + TabularId::Table(*table_id), + force, + t.transaction(), + ) + .await?; + let _ = TabularExpirationTask::schedule_task::<C>(/* unchanged */).await?;docs/docs/concepts.md (1)
156-166: Fix markdown lint: list style and fenced languageSwitch to asterisk bullets and add a language to the fenced block.
- - Bypasses protection settings - - Overrides soft-deletion mechanisms for immediate hard deletion + * Bypasses protection settings + * Overrides soft-deletion mechanisms for immediate hard deletion @@ -``` +```http DELETE /catalog/v1/{prefix}/namespaces/{namespace}?force=true</blockquote></details> <details> <summary>crates/lakekeeper/src/api/iceberg/v1/tables.rs (1)</summary><blockquote> `26-41`: **Harden deserialization for missing fields** Add serde defaults so missing query params never error and align with your `PageToken` semantics. ```diff -#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, Default)] -#[serde(rename_all = "camelCase")] +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, Default)] +#[serde(rename_all = "camelCase", default)] pub struct ListTablesQuery { - #[serde(skip_serializing_if = "PageToken::skip_serialize")] + #[serde(skip_serializing_if = "PageToken::skip_serialize")] pub page_token: PageToken, /// For servers that support pagination, this signals an upper bound of the number of results that a client will receive. For servers that do not support pagination, clients may receive results larger than the indicated `pageSize`. #[serde(rename = "pageSize")] #[serde(skip_serializing_if = "Option::is_none")] pub page_size: Option<i64>,crates/lakekeeper/src/service/catalog.rs (1)
536-544: Docstring now out of date with API (task id is optional)The method returns
Vec<UndropTabularResponse>whereexpiration_task_idisOption<TaskId>. Update the comment to avoid implying it always exists.- /// Returns the task id of the expiration task associated with the soft-deletion. + /// Returns metadata for each undropped tabular, including the optional expiration task id + /// (if a soft-deletion task had been scheduled).crates/lakekeeper/src/api/management/v1/warehouse/mod.rs (1)
819-835: Skip cancel call when there’s nothing to cancelAvoid an unnecessary DB roundtrip if no
expiration_task_idwere present; keep the warn for missing ids.- TabularExpirationTask::cancel_scheduled_tasks::<C>( - TaskFilter::TaskIds( - undrop_tabular_responses - .iter() - .filter_map(|r| { - if r.expiration_task_id.is_none() { - tracing::warn!( - "No expiration task found for tabular with soft deletion marker set {:?}", - r.table_id - ); - } - r.expiration_task_id}) - .collect(), - ), - transaction.transaction(), - false, - ) - .await?; + let to_cancel: Vec<_> = undrop_tabular_responses + .iter() + .filter_map(|r| { + if r.expiration_task_id.is_none() { + tracing::warn!( + "No expiration task found for tabular with soft deletion marker set {:?}", + r.table_id + ); + } + r.expiration_task_id + }) + .collect(); + if !to_cancel.is_empty() { + TabularExpirationTask::cancel_scheduled_tasks::<C>( + TaskFilter::TaskIds(to_cancel), + transaction.transaction(), + false, + ) + .await?; + }crates/lakekeeper/src/tests/soft_deletion.rs (1)
199-217: Minor: assert helpers could tighten intentConsider asserting both name and id match for deleted entries to reduce false positives if names collide in future refactors.
crates/lakekeeper/src/service/event_publisher/mod.rs (1)
392-401: Prefer explicit TabularId construction for clarityAn
impl From<TableId> for TabularIdexists, so both forms are valid; prefer the explicit constructor to match surrounding style.- tabular_id: TabularId::from(utr.table_id), + tabular_id: TabularId::Table(utr.table_id),crates/lakekeeper/src/implementations/postgres/tabular/mod.rs (3)
615-621: Optional: allow no-op rename without false conflict.If
dest_name == source_name,conflict_checklocks the same row and blocks the UPDATE. Exclude the source row to make no-op idempotent.- WHERE t.name = $1 + WHERE t.name = $1 AND t.tabular_id <> $2
777-782: Optional: avoid no-op writes when undropping.Guard the UPDATE to only touch actually deleted rows. Keeps WAL noise down and avoids bumping
updated_atif a trigger exists.- WHERE tabular.tabular_id = lt.tabular_id AND tabular.warehouse_id = $2 + WHERE tabular.tabular_id = lt.tabular_id + AND tabular.warehouse_id = $2 + AND tabular.deleted_at IS NOT NULL
873-873: Fix error message: prints type instead of the ID.Message currently says “Table with id table/view not found”. Include the actual UUID.
- format!("Table with id {} not found", tabular_id.typ_str()), + format!("{} with id {} not found", tabular_id.typ_str(), tabular_id.as_ref()),
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (20)
.sqlx/query-26bb2d281b7e22daf49c5436cad391648b309468e75d3b20ec9fc721b11e5259.json(1 hunks).sqlx/query-279ce4f07a2984b6802ff8ea8fdc499cb02598c129263559f58296e5bf379421.json(1 hunks).sqlx/query-2ec1d9e7b94680fe34a8b73d555590d92cd8ff19da6426e8d7e372c2917ed4cb.json(0 hunks).sqlx/query-30edc2ab6f86048f7e931be5ea40b92140581770bae81a924bb259dabaffe49a.json(0 hunks).sqlx/query-424be398e2f02558c560cfec035c3f20db759b32f27492e23902f43bf515b289.json(0 hunks).sqlx/query-4ca739c2b4a21ce84ff66dea186659aed20dca28ab0b6f1574e1762e34e08ea2.json(0 hunks).sqlx/query-4f32af5649130f938689517ab7afa579c1af1a84ccf89ba26e42efd67f8bdc42.json(0 hunks).sqlx/query-9a2902aec51f6a34cc770c9989442ece6675192a25dfc847477fbfbe0217867d.json(1 hunks).sqlx/query-bdaa60e71c4197cfc14a789d194bfbc32cb7c1d0c6f0e640da743c6a2f74512a.json(1 hunks).sqlx/query-ef2de6a83059e434bb548fbae0f87df918ae9be9dfb4bf0533a7e0ca6a57eeb8.json(1 hunks)crates/lakekeeper/src/api/iceberg/types.rs(1 hunks)crates/lakekeeper/src/api/iceberg/v1/tables.rs(1 hunks)crates/lakekeeper/src/api/management/v1/warehouse/mod.rs(2 hunks)crates/lakekeeper/src/catalog/tables.rs(1 hunks)crates/lakekeeper/src/implementations/postgres/tabular/mod.rs(10 hunks)crates/lakekeeper/src/service/catalog.rs(1 hunks)crates/lakekeeper/src/service/event_publisher/mod.rs(1 hunks)crates/lakekeeper/src/tests/mod.rs(1 hunks)crates/lakekeeper/src/tests/soft_deletion.rs(1 hunks)docs/docs/concepts.md(1 hunks)
💤 Files with no reviewable changes (5)
- .sqlx/query-424be398e2f02558c560cfec035c3f20db759b32f27492e23902f43bf515b289.json
- .sqlx/query-2ec1d9e7b94680fe34a8b73d555590d92cd8ff19da6426e8d7e372c2917ed4cb.json
- .sqlx/query-4f32af5649130f938689517ab7afa579c1af1a84ccf89ba26e42efd67f8bdc42.json
- .sqlx/query-30edc2ab6f86048f7e931be5ea40b92140581770bae81a924bb259dabaffe49a.json
- .sqlx/query-4ca739c2b4a21ce84ff66dea186659aed20dca28ab0b6f1574e1762e34e08ea2.json
🧰 Additional context used
🧠 Learnings (4)
📚 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:
crates/lakekeeper/src/catalog/tables.rs
📚 Learning: 2025-09-18T20:08:00.643Z
Learnt from: c-thiel
PR: lakekeeper/lakekeeper#1254
File: .sqlx/query-552ddb89100de8fb3c374e95c885dfd2da32c9d51d30acf2d60811edbd545dbc.json:3-3
Timestamp: 2025-09-18T20:08:00.643Z
Learning: In the lakekeeper codebase, table_id and view_id are scoped by warehouse_id through composite primary keys (warehouse_id, table_id) and (warehouse_id, view_id). This design allows ID reuse across warehouses while preventing cross-warehouse joins through proper foreign key constraints. When reviewing SQL queries, JOIN conditions like `t.warehouse_id = $1 AND t.table_id = ti.tabular_id` are correct because they ensure warehouse scoping without needing additional `ti.warehouse_id = $1` constraints.
Applied to files:
crates/lakekeeper/src/implementations/postgres/tabular/mod.rs
📚 Learning: 2025-08-30T10:35:58.939Z
Learnt from: c-thiel
PR: lakekeeper/lakekeeper#1316
File: crates/lakekeeper/src/implementations/postgres/tasks.rs:169-173
Timestamp: 2025-08-30T10:35:58.939Z
Learning: In the task picking SQL query in crates/lakekeeper/src/implementations/postgres/tasks.rs, the WHERE clause intentionally allows both Running and ShouldStop tasks to be re-picked if their last heartbeat is older than max_time_since_last_heartbeat. This is a reconciliation mechanism to handle cases where workers are killed or crash, preventing tasks from being stuck indefinitely in Running or ShouldStop states.
Applied to files:
crates/lakekeeper/src/implementations/postgres/tabular/mod.rs
📚 Learning: 2025-09-18T08:18:17.541Z
Learnt from: c-thiel
PR: lakekeeper/lakekeeper#1342
File: crates/lakekeeper/src/implementations/postgres/tabular/mod.rs:712-745
Timestamp: 2025-09-18T08:18:17.541Z
Learning: Task cancellation in the lakekeeper codebase is not trivial because it requires recording the cancellation in task history for audit purposes. Task cancellation is handled through a separate method within the same transaction rather than being done inline in SQL queries.
Applied to files:
crates/lakekeeper/src/implementations/postgres/tabular/mod.rs
🪛 markdownlint-cli2 (0.17.2)
docs/docs/concepts.md
158-158: Unordered list style
Expected: asterisk; Actual: dash
(MD004, ul-style)
159-159: Unordered list style
Expected: asterisk; Actual: dash
(MD004, ul-style)
162-162: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
⏰ 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). (4)
- GitHub Check: clippy
- GitHub Check: docker / docker
- GitHub Check: Analyze (javascript-typescript)
- GitHub Check: Analyze (python)
🔇 Additional comments (10)
crates/lakekeeper/src/catalog/tables.rs (1)
760-765: Force ⇒ Hard delete selection looks correctOverriding with Hard when
forceis true, otherwise deferring to warehouse profile is the right behavior for predictable semantics.crates/lakekeeper/src/api/iceberg/types.rs (1)
36-46: Default = Empty: double‑check client/server expectations
PageTokennow defaults toEmpty. Deserialization of missing fields still yieldsNotSpecified(per tests), but any code constructing defaults (e.g.,ListTablesQuery::default()) will send “Empty.” Verify this matches your API compatibility expectations.Would you like me to scan for default constructions of pagination queries to confirm behavior across endpoints?
.sqlx/query-279ce4f07a2984b6802ff8ea8fdc499cb02598c129263559f58296e5bf379421.json (1)
1-59: Hard delete path is lock‑safe and protection‑awareThe CTE locks the row, restricts to active tabulars, and
((NOT protected) OR $4)gates deletion. Returningwas_deleted!is helpful for precise error handling.crates/lakekeeper/src/tests/mod.rs (1)
4-4: Nice: loading soft deletion integration testsGood coverage addition for end‑to‑end soft‑delete/undrop flows.
.sqlx/query-bdaa60e71c4197cfc14a789d194bfbc32cb7c1d0c6f0e640da743c6a2f74512a.json (1)
1-47: No action needed —task_id?is already nullable in Rust.sqlx contains "task_id?" and crates/lakekeeper/src/service/catalog.rs::UndropTabularResponse defines expiration_task_id: Option, so the nullable mapping is correct; no changes required.
crates/lakekeeper/src/api/management/v1/warehouse/mod.rs (1)
40-54: LGTM: safer deserialization defaults for listing deleted tabularsDeriving Default and adding serde(default) on fields removes brittle client requirements and matches other query types.
.sqlx/query-9a2902aec51f6a34cc770c9989442ece6675192a25dfc847477fbfbe0217867d.json (1)
1-4: Allow idempotent renames (exclude source tabular from conflict_check)Exclude the source tabular row from conflict_check so renaming to the same name in the same namespace doesn't block the UPDATE.
- conflict_check AS ( + conflict_check AS ( SELECT 1 FROM tabular t JOIN locked_namespace ln ON t.namespace_id = ln.namespace_id AND t.warehouse_id = $2 - WHERE t.name = $1 + WHERE t.name = $1 + AND t.tabular_id <> (SELECT tabular_id FROM locked_tabular) FOR UPDATE - ) + ).sqlx/query-ef2de6a83059e434bb548fbae0f87df918ae9be9dfb4bf0533a7e0ca6a57eeb8.json (1)
1-4: Bug: wrong bind parameter used for warehouse_id in CTElocked_source_namespace uses $2 (tabular_id) instead of $4 (warehouse_id), which prevents locking the correct namespace and can make the UPDATE a no-op.
Apply:
- WHERE n.warehouse_id = $2 + WHERE n.warehouse_id = $4After fixing the Rust-side SQL (descriptor is generated), regenerate descriptors:
cargo sqlx prepare --workspaceAutomated verification failed in the sandbox; run locally to locate and patch any occurrences:
rg -n -C3 -P 'locked_source_namespace.*WHERE\s+n\.warehouse_id\s*=\s*\$2' --type=rustcrates/lakekeeper/src/implementations/postgres/tabular/mod.rs (2)
909-930: Drop flow looks solid.Active-only lock, protected gating with optional force, and returning the joined FS path are correct.
Also applies to: 985-985
783-787: LGTM — nullable expiration task on undrop handled correctly.lta.task_id as "task_id?" is mapped to UndropTabularResponse.expiration_task_id: Option, and API/call-sites use expiration_task_id and table_id — no changes required.
|
@CodeRabbit review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Actionable comments posted: 6
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
crates/lakekeeper/src/implementations/postgres/tabular/mod.rs (2)
637-645: Map unique‑name violations to a client error instead of a generic failure.If a concurrent rename creates a duplicate, this should surface as a 409/“TabularNameAlreadyExists”, not an internal error.
Apply:
- .map_err(|e| match e { + .map_err(|e| match e { sqlx::Error::RowNotFound => ErrorModel::builder() .code(StatusCode::NOT_FOUND.into()) .message(format!("ID of {} to rename not found", source_id.typ_str())) .r#type(format!("Rename{}IdNotFound", source_id.typ_str())) .build(), - _ => e.into_error_model(format!("Error renaming {}", source_id.typ_str())), + sqlx::Error::Database(db) if db.constraint() == Some("unique_name_per_namespace_id") => { + ErrorModel::conflict( + "Tabular with the same name already exists in the namespace".into(), + "TabularNameAlreadyExists", + Some(Box::new(e)), + ) + } + _ => e.into_error_model(format!("Error renaming {}", source_id.typ_str())), })?;
646-716: Also map unique constraint violations in the cross‑namespace path.Same rationale as above.
Apply:
- .map_err(|e| match e { + .map_err(|e| match e { sqlx::Error::RowNotFound => ErrorModel::builder() .code(StatusCode::NOT_FOUND.into()) .message(format!( "ID of {} to rename not found or destination namespace not found", source_id.typ_str() )) .r#type(format!( "Rename{}IdOrNamespaceNotFound", source_id.typ_str() )) .build(), - _ => e.into_error_model(format!("Error renaming {}", source_id.typ_str())), + sqlx::Error::Database(db) if db.constraint() == Some("unique_name_per_namespace_id") => { + ErrorModel::conflict( + "Tabular with the same name already exists in the destination namespace".into(), + "TabularNameAlreadyExists", + Some(Box::new(e)), + ) + } + _ => e.into_error_model(format!("Error renaming {}", source_id.typ_str())), })?;
🧹 Nitpick comments (3)
crates/lakekeeper/src/implementations/postgres/tabular/mod.rs (3)
589-601: Optional: Add a source‑name precondition for same‑namespace renames for consistency.Cross‑namespace path asserts the old name (
AND name = $6), but same‑namespace does not. Consider asserting the old name to fail fast on TOTOU.
592-627: Heads‑up: possible deadlock on swap renames (A↔B).Both transactions lock their own row then attempt to lock the other via
FOR UPDATEinconflict_check, risking deadlock. Consider locking both candidate rows in a deterministic order (e.g.,ORDER BY tabular_id) before proceeding.
873-874: Fix error message: prints type instead of the actual ID.Use the UUID in the message.
Apply:
- format!("Table with id {} not found", tabular_id.typ_str()), + format!("{} with ID {} not found", tabular_id.typ_str(), tabular_id.as_ref()),
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
.sqlx/query-57b15b5e096575b3a731147dff42c706d6fb125e5baa1426dce1c61f43841762.json(1 hunks)crates/lakekeeper/src/implementations/postgres/tabular/mod.rs(10 hunks)
🧰 Additional context used
🧠 Learnings (3)
📚 Learning: 2025-09-18T20:08:00.643Z
Learnt from: c-thiel
PR: lakekeeper/lakekeeper#1254
File: .sqlx/query-552ddb89100de8fb3c374e95c885dfd2da32c9d51d30acf2d60811edbd545dbc.json:3-3
Timestamp: 2025-09-18T20:08:00.643Z
Learning: In the lakekeeper codebase, table_id and view_id are scoped by warehouse_id through composite primary keys (warehouse_id, table_id) and (warehouse_id, view_id). This design allows ID reuse across warehouses while preventing cross-warehouse joins through proper foreign key constraints. When reviewing SQL queries, JOIN conditions like `t.warehouse_id = $1 AND t.table_id = ti.tabular_id` are correct because they ensure warehouse scoping without needing additional `ti.warehouse_id = $1` constraints.
Applied to files:
crates/lakekeeper/src/implementations/postgres/tabular/mod.rs
📚 Learning: 2025-08-30T10:35:58.939Z
Learnt from: c-thiel
PR: lakekeeper/lakekeeper#1316
File: crates/lakekeeper/src/implementations/postgres/tasks.rs:169-173
Timestamp: 2025-08-30T10:35:58.939Z
Learning: In the task picking SQL query in crates/lakekeeper/src/implementations/postgres/tasks.rs, the WHERE clause intentionally allows both Running and ShouldStop tasks to be re-picked if their last heartbeat is older than max_time_since_last_heartbeat. This is a reconciliation mechanism to handle cases where workers are killed or crash, preventing tasks from being stuck indefinitely in Running or ShouldStop states.
Applied to files:
crates/lakekeeper/src/implementations/postgres/tabular/mod.rs
📚 Learning: 2025-09-18T08:18:17.541Z
Learnt from: c-thiel
PR: lakekeeper/lakekeeper#1342
File: crates/lakekeeper/src/implementations/postgres/tabular/mod.rs:712-745
Timestamp: 2025-09-18T08:18:17.541Z
Learning: Task cancellation in the lakekeeper codebase is not trivial because it requires recording the cancellation in task history for audit purposes. Task cancellation is handled through a separate method within the same transaction rather than being done inline in SQL queries.
Applied to files:
crates/lakekeeper/src/implementations/postgres/tabular/mod.rs
⏰ 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). (2)
- GitHub Check: test-migration (v0.8, default)
- GitHub Check: test-migration (latest, default)
🔇 Additional comments (1)
crates/lakekeeper/src/implementations/postgres/tabular/mod.rs (1)
985-986: LGTM: return valueJoining fs protocol/location after a locked drop is correct and safe once the TOCTOU above is fixed.
|
@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: 0
🧹 Nitpick comments (14)
.sqlx/query-a02df0ff30895ec09168d38c713f34b0966fdd3290a8fee6ac26323cd311808a.json (7)
3-3: Use EXISTS/USING and guard against multi-row subselects.The
(SELECT tabular_id FROM deleted)scalar subquery can error if multiple rows are returned. PreferEXISTSandDELETE ... USINGto couple the locked row directly and avoid IN-subquery overhead.-WITH locked_tabular AS ( +WITH locked_tabular AS ( SELECT tabular_id, protected, metadata_location, fs_location, fs_protocol FROM tabular WHERE tabular_id = $2 AND warehouse_id = $1 AND typ = $3 AND tabular_id in (SELECT tabular_id FROM active_tabulars WHERE warehouse_id = $1 AND tabular_id = $2) FOR UPDATE - ), - deleted AS ( - DELETE FROM tabular - WHERE tabular_id IN ( - SELECT tabular_id FROM locked_tabular - WHERE ((NOT protected) OR $4) - AND ($5::text IS NULL OR metadata_location = $5) - ) - AND warehouse_id = $1 - RETURNING tabular_id - ) - SELECT - lt.protected as "protected!", - lt.metadata_location, - lt.fs_protocol, - lt.fs_location, - (SELECT tabular_id FROM deleted) IS NOT NULL as "was_deleted!" - FROM locked_tabular lt + ), + deleted AS ( + DELETE FROM tabular t + USING locked_tabular lt + WHERE t.tabular_id = lt.tabular_id + AND t.warehouse_id = $1 + AND ((NOT lt.protected) OR $4) + AND ($5::text IS NULL OR lt.metadata_location = $5) + RETURNING t.tabular_id + ) + SELECT + lt.protected as "protected!", + lt.metadata_location, + lt.fs_protocol, + lt.fs_location, + EXISTS (SELECT 1 FROM deleted) as "was_deleted!" + FROM locked_tabular lt
3-3: Defensive filter: include typ in DELETE.If tabular_id isn’t globally unique, add
AND t.typ = $3to the DELETE to match the locked row’s typ.- WHERE t.tabular_id = lt.tabular_id + WHERE t.tabular_id = lt.tabular_id AND t.warehouse_id = $1 + AND t.typ = $3
3-3: Clarify locking semantics (NOWAIT/SKIP LOCKED vs blocking).
FOR UPDATEwill block. That may be intended to serialize drop/undrop/rename flows, but confirm this matches API expectations. If you want “fail fast,” considerFOR UPDATE NOWAIT; if you want to skip busy rows,SKIP LOCKED. Ensure other new queries in this PR acquire locks in a consistent order to avoid deadlocks.
3-3: Active check: prefer EXISTS over IN for readability/plan shape.
AND tabular_id in (SELECT tabular_id FROM active_tabulars …)can be expressed asEXISTS (SELECT 1 FROM active_tabulars …). It’s clearer and avoids redundant equality.-AND tabular_id in (SELECT tabular_id FROM active_tabulars WHERE warehouse_id = $1 AND tabular_id = $2) +AND EXISTS (SELECT 1 FROM active_tabulars a WHERE a.warehouse_id = $1 AND a.tabular_id = $2)
52-57: Descriptor nullability for "was_deleted!" should be non-null.
IS NOT NULL/EXISTSyields a non-null boolean. Consider regenerating descriptors after adoptingEXISTSto make thisfalseinstead ofnullfor better type guarantees.Run
cargo sqlx prepareand commit the refreshed descriptors.
3-3: Metadata guard: confirm allowing NULL bypass is intentional.
($5 IS NULL OR lt.metadata_location = $5)disables idempotency when $5 is NULL. If callers might omit it by mistake, consider requiring a match unless$4(force) is true.-AND ($5::text IS NULL OR lt.metadata_location = $5) +AND ( $4 OR lt.metadata_location = $5 )Or enforce non-null at the API layer.
3-3: Indexing note.This plan benefits from a unique or composite index covering
(warehouse_id, tabular_id)and filtering bytyp. Ensure indexes match these predicates to keep the lock acquisition cheap..sqlx/query-63ecdb3a8d43d592f12b5d2371e8e05f26f998352a7e2f4f9a1fb64298d0e758.json (1)
3-3: Narrow the lock in conflict_check to the tabular table.Use FOR UPDATE OF t to avoid locking other relations unnecessarily.
Apply:
- FOR UPDATE + FOR UPDATE OF tcrates/lakekeeper/src/implementations/postgres/tabular/mod.rs (6)
596-606: Same-namespace rename should assert the expected current name.Cross-namespace path verifies current name (
AND name = $6), but same-namespace path doesn’t. Add the check to guard against stale clients and unexpected prior renames.Apply:
WITH locked_tabular AS ( - SELECT tabular_id, name, namespace_id + SELECT tabular_id, name, namespace_id FROM tabular WHERE tabular_id = $2 AND warehouse_id = $4 AND typ = $3 AND metadata_location IS NOT NULL AND deleted_at IS NULL + AND name = $5 FOR UPDATE ), ... "#, &**dest_name, *source_id, TabularType::from(source_id) as _, *warehouse_id, + &**source_name, )Also applies to: 625-634
618-624: Tighten lock scope in conflict_check (same-namespace).Prefer FOR UPDATE OF t for precision.
Apply:
- FOR UPDATE + FOR UPDATE OF t
681-687: Tighten lock scope in conflict_check (cross-namespace).Same as above: lock only tabular rows.
Apply:
- FOR UPDATE + FOR UPDATE OF t
774-781: Guard against duplicate expiration tasks returning duplicate rows.If data drift ever creates multiple tabular_expiration tasks per entity, LEFT JOIN will duplicate results. Select one deterministically.
Apply:
- locked_tasks AS ( - SELECT ta.task_id, ta.entity_id + locked_tasks AS ( + SELECT DISTINCT ON (ta.entity_id) ta.task_id, ta.entity_id FROM task ta JOIN locked_tabulars lt ON ta.entity_id = lt.tabular_id WHERE ta.entity_type = 'tabular' AND ta.warehouse_id = $2 AND ta.queue_name = 'tabular_expiration' - FOR UPDATE OF ta + ORDER BY ta.entity_id, ta.scheduled_for DESC + FOR UPDATE OF ta )Also applies to: 785-793
876-889: Incorrect “not found” message formatting (wrong placeholder, casing).Message says “Table with id Table not found”. It should include the actual ID and respect the entity type.
Apply:
- ErrorModel::not_found( - format!("Table with id {} not found", tabular_id.typ_str()), - "NoSuchTabularError".to_string(), - Some(Box::new(e)), - ) + ErrorModel::not_found( + format!("{} with ID {} not found", tabular_id.typ_str(), tabular_id.as_ref()), + "NoSuchTabularError".to_string(), + Some(Box::new(e)), + )
1041-1313: Tests cover key deletion paths; consider a rename same-namespace test.Add a test ensuring same-namespace rename checks the expected current name (once implemented) and a regression for undrop with duplicate tasks (if you adopt DISTINCT ON).
I can add focused sqlx::test cases mirroring these flows if you want.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
.sqlx/query-63ecdb3a8d43d592f12b5d2371e8e05f26f998352a7e2f4f9a1fb64298d0e758.json(1 hunks).sqlx/query-a02df0ff30895ec09168d38c713f34b0966fdd3290a8fee6ac26323cd311808a.json(1 hunks)crates/lakekeeper/src/implementations/postgres/tabular/mod.rs(11 hunks)
🧰 Additional context used
🧠 Learnings (5)
📚 Learning: 2025-09-18T20:08:00.643Z
Learnt from: c-thiel
PR: lakekeeper/lakekeeper#1254
File: .sqlx/query-552ddb89100de8fb3c374e95c885dfd2da32c9d51d30acf2d60811edbd545dbc.json:3-3
Timestamp: 2025-09-18T20:08:00.643Z
Learning: In the lakekeeper codebase, table_id and view_id are scoped by warehouse_id through composite primary keys (warehouse_id, table_id) and (warehouse_id, view_id). This design allows ID reuse across warehouses while preventing cross-warehouse joins through proper foreign key constraints. When reviewing SQL queries, JOIN conditions like `t.warehouse_id = $1 AND t.table_id = ti.tabular_id` are correct because they ensure warehouse scoping without needing additional `ti.warehouse_id = $1` constraints.
Applied to files:
crates/lakekeeper/src/implementations/postgres/tabular/mod.rs
📚 Learning: 2025-08-30T10:35:58.939Z
Learnt from: c-thiel
PR: lakekeeper/lakekeeper#1316
File: crates/lakekeeper/src/implementations/postgres/tasks.rs:169-173
Timestamp: 2025-08-30T10:35:58.939Z
Learning: In the task picking SQL query in crates/lakekeeper/src/implementations/postgres/tasks.rs, the WHERE clause intentionally allows both Running and ShouldStop tasks to be re-picked if their last heartbeat is older than max_time_since_last_heartbeat. This is a reconciliation mechanism to handle cases where workers are killed or crash, preventing tasks from being stuck indefinitely in Running or ShouldStop states.
Applied to files:
crates/lakekeeper/src/implementations/postgres/tabular/mod.rs
📚 Learning: 2025-09-18T08:18:17.541Z
Learnt from: c-thiel
PR: lakekeeper/lakekeeper#1342
File: crates/lakekeeper/src/implementations/postgres/tabular/mod.rs:712-745
Timestamp: 2025-09-18T08:18:17.541Z
Learning: Task cancellation in the lakekeeper codebase is not trivial because it requires recording the cancellation in task history for audit purposes. Task cancellation is handled through a separate method within the same transaction rather than being done inline in SQL queries.
Applied to files:
crates/lakekeeper/src/implementations/postgres/tabular/mod.rs
📚 Learning: 2025-09-04T15:53:09.396Z
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.
Applied to files:
crates/lakekeeper/src/implementations/postgres/tabular/mod.rs
📚 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:
crates/lakekeeper/src/implementations/postgres/tabular/mod.rs
⏰ 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: test
- GitHub Check: sqlx-check
- GitHub Check: docker / docker
🔇 Additional comments (6)
.sqlx/query-63ecdb3a8d43d592f12b5d2371e8e05f26f998352a7e2f4f9a1fb64298d0e758.json (2)
3-3: Scope and locking look solid; warehouse membership and active-state checks are in place.The multi-CTE approach with row/namespace locks plus warehouse activity gating is good. No blockers here.
3-3: Confirm conflict semantics match the unique index.If uniqueness ignores soft-deleted/staged rows, consider mirroring that in conflict_check to reduce false negatives; otherwise relying on the unique index is fine. Please confirm which is intended.
crates/lakekeeper/src/implementations/postgres/tabular/mod.rs (4)
580-582: Good early exit for no-op renames.Short-circuiting before hitting the DB is the right call.
758-793: Undrop flow: locking + validation + optional task_id mapping looks correct.Warehouse scoping, row locking, and nullable task_id are handled well. Nice use of the validation CTE.
813-823: Nice fix for the “all_found when 0 rows” edge case.The map_or(tabular_ids.is_empty(), …) logic handles empty inputs and missing IDs cleanly.
914-945: TOCTOU on required metadata_location is fixed; post-check + debug_assert are appropriate.DELETE is gated on the expected metadata, and you still verify and fail fast for mismatches. Looks good.
Also applies to: 985-993, 995-1001
* 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]>
Summary by CodeRabbit
New Features
Bug Fixes
API Changes
Documentation
Tests