Skip to content

feat: Add Entity Names to Tasks - #1353

Merged
c-thiel merged 9 commits into
mainfrom
ct/task-entity-names
Sep 22, 2025
Merged

c-thiel merged 9 commits into
mainfrom
ct/task-entity-names

Conversation

@c-thiel

@c-thiel c-thiel commented Sep 21, 2025 •

Copy link
Copy Markdown
Member

Summary by CodeRabbit

  • New Features

    • Tasks now include an entity name, shown in task lists and details, and propagated across scheduling, logging, and lifecycle operations.
    • Namespace drop info now returns table identifiers and human-readable names for child tables.
  • Bug Fixes

    • Warehouse deletion check no longer deletes tasks while counting unfinished tasks.
  • Documentation

    • OpenAPI updated: Task schema adds required entity-name (array of strings).
  • Chores

    • Database migration adds and backfills entity_name columns for tasks and task logs.

@coderabbitai

coderabbitai Bot commented Sep 21, 2025 •

Copy link
Copy Markdown
Contributor

Walkthrough

Adds entity_name (Vec) across API, service, DB schema, SQLx queries, and task flows. Introduces NamedEntity trait to derive name parts from identifiers. Updates migrations to add/populate entity_name on task and task_log. Adjusts list/get/resolution/queueing to persist and return entity_name. Revises several SQLx artifacts and warehouse/namespace queries.

Changes

Cohort / File(s) Summary
DB migration
crates/lakekeeper/migrations/20250919101934_add_task_entity_name.sql
Adds entity_name Text[] to task and task_log, backfills via joins, sets NOT NULL.
API surface: Task and OpenAPI
crates/lakekeeper/src/api/management/v1/tasks.rs, docs/docs/api/management-open-api.yaml
Task gains public field entity_name: Vec; OpenAPI Task adds required property entity-name (array of strings).
Service API: NamedEntity + TaskMetadata
crates/lakekeeper/src/service/mod.rs, crates/lakekeeper/src/service/task_queue/mod.rs
Adds NamedEntity trait and impl for TableIdent; TaskMetadata gains pub entity_name: Vec.
Task pipeline wiring (enqueue/pick/record/list/get)
crates/lakekeeper/src/implementations/postgres/tasks.rs, .../tasks/list_tasks.rs, .../tasks/get_task_details.rs, .../tasks/resolve_tasks.rs, crates/lakekeeper/src/tests/tasks.rs
Propagates entity_name through inputs, INSERTs, SELECTs, Task/TaskMetadata mapping, and tests.
Catalog scheduling: tables, views, namespaces
crates/lakekeeper/src/catalog/tables.rs, crates/lakekeeper/src/catalog/views/drop.rs, crates/lakekeeper/src/catalog/namespace.rs
Passes entity_name into TaskMetadata when scheduling purge/expiration; imports NamedEntity; uses into_name_parts from identifiers.
Tabular flows
crates/lakekeeper/src/implementations/postgres/tabular/table/mod.rs, .../tabular/view/mod.rs, .../service/task_queue/tabular_expiration_queue.rs
Adds/propagates entity_name in expiration/purge payloads and tests; schedules subsequent tasks with entity_name.
Namespace drop info enrichment
crates/lakekeeper/src/implementations/postgres/namespace.rs, crates/lakekeeper/src/service/catalog.rs
Extends NamespaceDropInfo with namespace/table names and TableIdent; helper to convert JSON to NamespaceIdent; updates tests.
Warehouse deletion query change
crates/lakekeeper/src/implementations/postgres/warehouse.rs, .sqlx/query-d7dd04f6....json
Switches unfinished-task check to active_tasks-only (no delete side-effect).
SQLx: add entity_name to task queries/results
.sqlx/query-0700e1e2....json, .sqlx/query-f8e2335b....json, .sqlx/query-7fce6648....json, .sqlx/query-9bea16fe....json
Extends projections/parameters to include entity_name (TextArray/JsonbArray), updates ordinals/hashes.
SQLx: reschedule/update/log workflows (added/modified)
.sqlx/query-051e5bb6....json, .sqlx/query-5524e81f....json, .sqlx/query-4f951124....json, .sqlx/query-7c06f9bb....json, .sqlx/query-47a083ad....json, .sqlx/query-f71b45c1....json
Adds/updates CTE-based delete/update/log queries (failed/success), parameter types, and result descriptors; includes ON CONFLICT handling.
SQLx: namespace-related queries
.sqlx/query-fa7cc5c2....json, .sqlx/query-a2c36625....json
Adds new namespace/tabular meta query descriptor; tightens warehouse filter in namespace delete.
SQLx: removed legacy delete/log/reschedule artifacts
.sqlx/query-0cafb1f2....json, .sqlx/query-1fb0532a....json, .sqlx/query-32a0cea2....json, .sqlx/query-4a2fb967....json, .sqlx/query-4e58a898....json, .sqlx/query-82b31436....json, .sqlx/query-883cf05f....json
Deletes prior SQLx descriptors for combined delete-and-log/reschedule flows and namespace meta query.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor Client
  participant API as API (Task enqueue)
  participant Service as Service (TaskQueue)
  participant DB as DB (task/task_log)

  Client->>API: enqueue task (entity_id, entity_name, ...)
  API->>Service: TaskMetadata{entity_id, entity_name, ...}
  Service->>DB: INSERT INTO task (..., entity_name)
  DB-->>Service: RETURNING task row (entity_name)
  Service-->>Client: Task { ..., entity_name }

  rect rgb(235, 245, 255)
  note right of DB: On completion/failure
  Service->>DB: INSERT INTO task_log (..., entity_name) on conflict do nothing
  end

  Client->>API: list/get tasks
  API->>DB: SELECT ... entity_name FROM active_tasks UNION task_log
  DB-->>API: rows with entity_name
  API-->>Client: Task(s) include entity_name
Loading
sequenceDiagram
  participant Cat as Catalog (tables/views)
  participant Id as Identifier (TableIdent)
  participant Svc as Service (NamedEntity)
  participant TQ as TaskQueue

  Cat->>Id: obtain identifier
  Id->>Svc: into_name_parts()
  Svc-->>Cat: Vec<String> (entity_name)
  Cat->>TQ: schedule purge/expiration with TaskMetadata{entity_name}
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Poem

In rows where busy tasks once ran,
We stitched their names, a gentle span.
Arrays of whispers, paths of fame,
Now every job recalls its name.
Hop-hop I log, with tidy aim—
A rabbit proud of entity_name. 🐇✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 55.56% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The PR title "feat: Add Entity Names to Tasks" is concise, follows conventional commit style, and accurately summarizes the primary change: adding an entity_name field propagated through task models, database queries/migrations, and API surfaces. It is specific enough for a reviewer scanning history to understand the main intent.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch ct/task-entity-names

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 7

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (3)
crates/lakekeeper/src/implementations/postgres/tabular/table/mod.rs (1)

1815-1821: Populate entity_name for all scheduled Tabular tasks; confirm name-part order

into_name_parts() in table/mod.rs is good — confirm it returns [namespace segments..., table] as the API/UI expect. Several other scheduling sites build TaskMetadata without entity_name (will produce NULLs). Populate entity_name (use into_name_parts() or propagate task.task_metadata.entity_name) at these locations:

  • crates/lakekeeper/src/catalog/namespace.rs:500
  • crates/lakekeeper/src/catalog/views/drop.rs:74,102
  • crates/lakekeeper/src/catalog/tables.rs:773,801
  • crates/lakekeeper/src/implementations/postgres/tabular/view/mod.rs:876
  • crates/lakekeeper/src/service/task_queue/tabular_expiration_queue.rs:239,360
  • crates/lakekeeper/src/implementations/postgres/tasks/resolve_tasks.rs:137
  • crates/lakekeeper/src/implementations/postgres/tasks/list_tasks.rs:357
  • crates/lakekeeper/src/implementations/postgres/tasks.rs:60,291,950
  • crates/lakekeeper/src/implementations/postgres/tasks/get_task_details.rs:567
crates/lakekeeper/src/implementations/postgres/namespace.rs (1)

372-381: Fix array misalignment: ensure all array aggregations filter consistently and are deterministically ordered.

Currently fs_protocol, fs_location, and typ arrays are not filtered by deleted_at and none of the arrays are ordered; this can desynchronize tuples during izip, pairing wrong ids with locations/types. Critical for correctness.

Apply this diff to align filters and add ORDER BY across arrays:

-            ARRAY(SELECT tabular_id FROM tabulars where deleted_at is NULL) AS "child_tabulars!",
-            ARRAY(SELECT namespace_name FROM tabulars where deleted_at is NULL) AS "child_tabulars_namespace_names!: Vec<Vec<String>>",
-            ARRAY(SELECT table_name FROM tabulars where deleted_at is NULL) AS "child_tabulars_table_names!",
-            ARRAY(SELECT tabular_id FROM tabulars where deleted_at is not NULL) AS "child_tabulars_deleted!",
-            ARRAY(SELECT namespace_id FROM child_namespaces) AS "child_namespaces!",
-            ARRAY(SELECT fs_protocol FROM tabulars) AS "child_tabular_fs_protocol!",
-            ARRAY(SELECT fs_location FROM tabulars) AS "child_tabular_fs_location!",
-            ARRAY(SELECT typ FROM tabulars) AS "child_tabular_typ!: Vec<TabularType>",
-            ARRAY(SELECT task_id FROM tasks) AS "child_tabular_task_id!: Vec<Uuid>"
+            ARRAY(SELECT tabular_id FROM tabulars WHERE deleted_at IS NULL ORDER BY tabular_id) AS "child_tabulars!",
+            ARRAY(SELECT namespace_name FROM tabulars WHERE deleted_at IS NULL ORDER BY tabular_id) AS "child_tabulars_namespace_names!: Vec<Vec<String>>",
+            ARRAY(SELECT table_name FROM tabulars WHERE deleted_at IS NULL ORDER BY tabular_id) AS "child_tabulars_table_names!",
+            ARRAY(SELECT tabular_id FROM tabulars WHERE deleted_at IS NOT NULL ORDER BY tabular_id) AS "child_tabulars_deleted!",
+            ARRAY(SELECT namespace_id FROM child_namespaces ORDER BY namespace_id) AS "child_namespaces!",
+            ARRAY(SELECT fs_protocol FROM tabulars WHERE deleted_at IS NULL ORDER BY tabular_id) AS "child_tabular_fs_protocol!",
+            ARRAY(SELECT fs_location FROM tabulars WHERE deleted_at IS NULL ORDER BY tabular_id) AS "child_tabular_fs_location!",
+            ARRAY(SELECT typ FROM tabulars WHERE deleted_at IS NULL ORDER BY tabular_id) AS "child_tabular_typ!: Vec<TabularType>",
+            ARRAY(SELECT task_id FROM tasks ORDER BY task_id) AS "child_tabular_task_id!: Vec<Uuid>"
crates/lakekeeper/src/implementations/postgres/tasks/get_task_details.rs (1)

156-179: Add DEFAULT for entity_name on task and task_log or document why omission is safe

SQL mapping overall LGTM; union logic + application-side ordering by attempt is sound. crates/lakekeeper/migrations/20250919101934_add_task_entity_name.sql updates existing rows and then ALTERs both task.entity_name and task_log.entity_name to NOT NULL, but it does NOT set a DEFAULT — add e.g. ALTER TABLE task ALTER COLUMN entity_name SET DEFAULT ARRAY['unknown']::text[]; and the same for task_log, or document/ensure all writers always supply entity_name.

🧹 Nitpick comments (20)
.sqlx/query-0eb0f3cbb5503a213c1ee958c308d11ab8464a826455f5f447e4284a77ea544f.json (2)

98-112: Nullable metadata for config is unknown (null)

Descriptor leaves nullable unknown for config. That’s fine for sqlx, but if you want stronger checks, CAST or COALESCE the subselect to set a definitive nullability (e.g., COALESCE(tc.config, 'null'::jsonb)) and regenerate the descriptor.


3-3: Timeout pickup semantics: consider null last_heartbeat_at

For non-scheduled tasks, the filter uses (now() - last_heartbeat_at) > …; if last_heartbeat_at can be NULL, these won’t be reclaimed. Consider COALESCE(last_heartbeat_at, picked_up_at) to make reclamation more robust.

.sqlx/query-c6eb029d46d257f500c7a43809a450c4de2c07ca660c0ee94cba4a5f2abd087b.json (2)

3-3: Idempotency behavior is fine; document the None result.

ON CONFLICT (task_id, attempt) DO NOTHING achieves safe retries. Please document that a second execution returns no row via RETURNING and is not an error.

Consider logging a debug message on the caller when 0 rows are returned to aid ops troubleshooting.


3-3: Minor: attempt predicate on DELETE is likely redundant.

If task.task_id is PK, filtering by attempt is unnecessary. Keeping it is harmless but adds a redundant check.

Either remove attempt from the DELETE predicate or leave as-is for extra safety.

.sqlx/query-f8e2335bb0a90c64853dfaa5931636ce1ddf13c8d8416d0850ce4ca382727286.json (2)

3-3: Guard against mismatched entity filter arrays

unnest($10::uuid[], $11::entity_type[]) silently pads with NULLs if lengths differ. Prefer validating lengths in Rust or filtering NULL pairs in SQL.

-        WITH selected_entities AS (
-            SELECT entity_id, entity_type
-            FROM unnest($10::uuid[], $11::entity_type[]) AS t(entity_id, entity_type)
-        ),
+        WITH selected_entities AS (
+            SELECT entity_id, entity_type
+            FROM unnest($10::uuid[], $11::entity_type[]) AS t(entity_id, entity_type)
+            WHERE entity_id IS NOT NULL AND entity_type IS NOT NULL
+        ),

Alternatively, validate equal lengths before calling the query.


3-3: Pagination accuracy: inner LIMITs can drop newer rows

Limiting inside both CTEs and again on the outer query can cause the union to miss some of the globally “top N” rows. Consider removing inner LIMITs and only LIMIT in the outer SELECT.

-            ORDER BY task_created_at DESC, task_id DESC
-            LIMIT $2
+            ORDER BY task_created_at DESC, task_id DESC
.sqlx/query-096eba228becd7427130d0d94a6318374dfbb6d982ab8c43ae4575f6661a46db.json (2)

3-3: Keep task.updated_at consistent on reschedule

We update multiple fields but don’t bump updated_at. If other code relies on it for freshness, add it here.

-        UPDATE task
-        SET 
+        UPDATE task
+        SET 
             scheduled_for = (CASE WHEN $3 THEN now() ELSE $2 END),
             status = 'scheduled',
             progress = 0.0,
             execution_details = NULL,
-            picked_up_at = NULL
+            picked_up_at = NULL,
+            updated_at = now()

3-3: Duration can be NULL; optional CASE for clarity

For should-stop tasks without picked_up_at, now() - picked_up_at is NULL. That may be fine, but consider CASE to make intent explicit.

-                duration,
+                duration,
@@
-                now() - picked_up_at,
+                CASE WHEN picked_up_at IS NOT NULL THEN now() - picked_up_at ELSE NULL END,
.sqlx/query-eb90b100455918b5d3cecf606bd61e506550a2f94c6e1ed80c70381d28b5cf92.json (1)

3-3: Also update updated_at on reset-to-scheduled

Mirror other UPDATEs by setting updated_at = now() to maintain recency semantics.

             UPDATE task t
             SET 
                 status = 'scheduled',
                 progress = 0.0,
                 picked_up_at = NULL,
-                execution_details = NULL
+                execution_details = NULL,
+                updated_at = now()
.sqlx/query-01136443202988753fd0134372e025f5353617f565347f9c18ddb98a5e44a788.json (1)

3-3: Prefer qualifying ambiguous columns

Minor: qualify warehouse_id with the base alias for clarity.

-            WHERE warehouse_id = $1 AND (ta.namespace_id = $2 AND metadata_location IS NOT NULL OR (ta.namespace_id = ANY (SELECT namespace_id FROM child_namespaces)))
+            WHERE ta.warehouse_id = $1 AND (ta.namespace_id = $2 AND metadata_location IS NOT NULL OR (ta.namespace_id = ANY (SELECT namespace_id FROM child_namespaces)))
crates/lakekeeper/src/implementations/postgres/tasks/resolve_tasks.rs (1)

137-144: Populate entity_name in queued test tasks.

Good to ensure test fixtures reflect the new required field.

If callers of resolve_tasks would benefit from names, consider extending its return type to include entity_name to save extra lookups. Non-blocking if handled elsewhere.

crates/lakekeeper/src/implementations/postgres/tabular/view/mod.rs (1)

875-883: Consistency: include namespace in entity_name (optional).

Here only ["myview"] is provided, while tables use into_name_parts() (namespace + table). For parity and uniqueness, consider carrying namespace too (e.g., ["my_namespace", "myview"]) or deriving via a NamedEntity impl similar to tables.

Would you like me to patch the test to capture the namespace from prepare_view(...) and build entity_name accordingly?

crates/lakekeeper/src/service/catalog.rs (1)

255-257: Tuple expansion looks good; consider a small type alias to avoid index confusion

The added TableIdent is useful. To reduce tuple-index brittleness at call sites, you could alias the triple:

+type ChildTableTriple = (TabularId, String, TableIdent); // (table-id, location, table-ident)

 pub struct NamespaceDropInfo {
   pub child_namespaces: Vec<NamespaceId>,
-  // table-id, location, table-ident
-  pub child_tables: Vec<(TabularId, String, TableIdent)>,
+  // table-id, location, table-ident
+  pub child_tables: Vec<ChildTableTriple>,
   pub open_tasks: Vec<TaskId>,
 }

Please confirm all implementers returning NamespaceDropInfo now populate the third element (TableIdent) in the same order.

docs/docs/api/management-open-api.yaml (1)

4907-4912: Adding required Task.entity-name is consistent with the spec

Schema change is coherent with DB and service changes. Consider adding a brief example snippet for Task including entity-name to help clients.

Please confirm downstream clients/codegen were regenerated and still compile with entity-name required.

Also applies to: 4929-4934

.sqlx/query-7fce6648e54d340cc27905240e2ec6044454fa0a5f433cd25a8802ce61b70291.json (1)

3-3: Queue insert now carries entity_name — minor refinement possible

Passing entity_name as JSONB[] and converting via jsonb_array_elements_text works. If convenient with SQLx in your setup, consider Text[][] to avoid JSON conversion, but this is optional.

Please confirm the app always sends JSON arrays of strings for entity_name; non-array JSON would error at jsonb_array_elements_text().

crates/lakekeeper/src/implementations/postgres/tasks/list_tasks.rs (1)

245-249: Nit: fix placeholder comments to match SQL parameters

Inline comments for $10–$14 are off by one, which can mislead future edits.

Apply this small cleanup:

-        entity_ids as Vec<_>, // 11
-        entity_types as Vec<_>, // 12
-        entities_filter_is_none, // 13
-        created_after, // 14
-        created_before,
+        entity_ids as Vec<_>,          // $10
+        entity_types as Vec<_>,        // $11
+        entities_filter_is_none,       // $12
+        created_after,                 // $13
+        created_before,                // $14
crates/lakekeeper/src/implementations/postgres/tasks/get_task_details.rs (1)

598-618: Add an assertion that entity_name round-trips via API.

We verify it on the picked task; also assert on GetTaskDetailsResponse.task.entity_name for completeness.

Apply this diff:

         // Verify task details
         assert_eq!(result.task.task_id, task_id);
         assert_eq!(result.task.warehouse_id, warehouse_id);
         assert_eq!(result.task.queue_name.as_str(), tq_name.as_str());
         assert_eq!(result.task.attempt, 1);
         assert!(matches!(result.task.status, APITaskStatus::Running));
         assert!(result.task.picked_up_at.is_some());
         assert!((result.task.progress - 0.5).abs() < f32::EPSILON);
         assert!(result.task.last_heartbeat_at.is_some());
         assert!(result.task.parent_task_id.is_none());
         assert_eq!(result.task.scheduled_for, scheduled_for);
+        assert_eq!(result.task.entity_name, entity_name, "entity_name should be propagated to API task");
crates/lakekeeper/src/implementations/postgres/tasks.rs (3)

52-58: Preserve error source and use a specific error type for entity_name serialization.

Carry the serde_json::Error as source and use a dedicated type to aid debugging/alerting consistency.

-        entity_names.push(serde_json::to_value(&entity_name).map_err(|e| {
-            ErrorModel::internal(
-                format!("Failed to serialize entity name: {entity_name:?}, error: {e}"),
-                "InternalError",
-                None,
-            )
-        })?);
+        entity_names.push(serde_json::to_value(&entity_name).map_err(|e| {
+            ErrorModel::internal(
+                format!("Failed to serialize entity name: {entity_name:?}"),
+                "TaskEntityNameSerializationError",
+                Some(Box::new(e)),
+            )
+        })?);

Also applies to: 65-66, 72-72, 77-83


86-117: Qualify correlated column in ARRAY(jsonb_array_elements_text(...)) for clarity and to avoid accidental shadowing.

The subselect should explicitly reference the outer alias; this also future‑proofs the query if a same‑named column ever appears in scope.

-            i.entity_types,
-            ARRAY(SELECT jsonb_array_elements_text(entity_name))
+            i.entity_types,
+            ARRAY(SELECT jsonb_array_elements_text(i.entity_name))

Also applies to: 129-141, 146-156


916-917: Remove unnecessary use std::vec;.

The prelude already provides Vec and the vec![] macro; this import is unused.

-    use std::vec;
+    // (removed unused import)
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3efaeea and 324701b.

📒 Files selected for processing (36)
  • .sqlx/query-01136443202988753fd0134372e025f5353617f565347f9c18ddb98a5e44a788.json (1 hunks)
  • .sqlx/query-0700e1e2beeaa8c70abbee2b863cdc301a3d1d3977623f5645808ed1e3dae731.json (5 hunks)
  • .sqlx/query-096eba228becd7427130d0d94a6318374dfbb6d982ab8c43ae4575f6661a46db.json (1 hunks)
  • .sqlx/query-0cafb1f2b425d73de902ab03975754f64fc80810ca8dc5d7775090d0bacd7a28.json (0 hunks)
  • .sqlx/query-0eb0f3cbb5503a213c1ee958c308d11ab8464a826455f5f447e4284a77ea544f.json (4 hunks)
  • .sqlx/query-1fb0532a75303ad5e0d53182aeef688252b654c83072bf913dfba3416db026a1.json (0 hunks)
  • .sqlx/query-32a0cea2cc0b1631c1d2b058a0949f266063a120f8ae1cd2dbd9539a3603ab05.json (0 hunks)
  • .sqlx/query-41195f72677b1ba635509c7b2367e5ac8c6835f640639cde39af5058a27d32b5.json (1 hunks)
  • .sqlx/query-47a083adbfa09b2359c6d5ff706c35a72190ddb2cd3890c1ae2912bf3b9e48e1.json (1 hunks)
  • .sqlx/query-4a2fb9673a30b4d7614a649c6420e574996807e106fde250df9525a194a2a121.json (0 hunks)
  • .sqlx/query-4e58a898292fe6b27cb195293b891761df16f035aa1e84bb8a2300c7a54b6417.json (0 hunks)
  • .sqlx/query-7fce6648e54d340cc27905240e2ec6044454fa0a5f433cd25a8802ce61b70291.json (3 hunks)
  • .sqlx/query-82b3143673d6932b2311d45d3f333362140392a005eb75604445f4b2b793bb45.json (0 hunks)
  • .sqlx/query-883cf05f80797b83966b5dc5fc50df81f5eef600eae7ea9ac2c84bdc3d674bbc.json (0 hunks)
  • .sqlx/query-c6eb029d46d257f500c7a43809a450c4de2c07ca660c0ee94cba4a5f2abd087b.json (1 hunks)
  • .sqlx/query-eb90b100455918b5d3cecf606bd61e506550a2f94c6e1ed80c70381d28b5cf92.json (1 hunks)
  • .sqlx/query-f71b45c190e90bc54f058fe90f2776c338d2f3b6e612a401cd66444323c1a41b.json (1 hunks)
  • .sqlx/query-f8e2335bb0a90c64853dfaa5931636ce1ddf13c8d8416d0850ce4ca382727286.json (5 hunks)
  • crates/lakekeeper/migrations/20250919101934_add_task_entity_name.sql (1 hunks)
  • crates/lakekeeper/src/api/management/v1/tasks.rs (1 hunks)
  • crates/lakekeeper/src/catalog/namespace.rs (3 hunks)
  • crates/lakekeeper/src/catalog/tables.rs (3 hunks)
  • crates/lakekeeper/src/catalog/views/drop.rs (3 hunks)
  • crates/lakekeeper/src/implementations/postgres/namespace.rs (5 hunks)
  • crates/lakekeeper/src/implementations/postgres/tabular/table/mod.rs (2 hunks)
  • crates/lakekeeper/src/implementations/postgres/tabular/view/mod.rs (1 hunks)
  • crates/lakekeeper/src/implementations/postgres/tasks.rs (26 hunks)
  • crates/lakekeeper/src/implementations/postgres/tasks/get_task_details.rs (18 hunks)
  • crates/lakekeeper/src/implementations/postgres/tasks/list_tasks.rs (9 hunks)
  • crates/lakekeeper/src/implementations/postgres/tasks/resolve_tasks.rs (1 hunks)
  • crates/lakekeeper/src/service/catalog.rs (1 hunks)
  • crates/lakekeeper/src/service/mod.rs (1 hunks)
  • crates/lakekeeper/src/service/task_queue/mod.rs (1 hunks)
  • crates/lakekeeper/src/service/task_queue/tabular_expiration_queue.rs (9 hunks)
  • crates/lakekeeper/src/tests/tasks.rs (1 hunks)
  • docs/docs/api/management-open-api.yaml (2 hunks)
💤 Files with no reviewable changes (7)
  • .sqlx/query-1fb0532a75303ad5e0d53182aeef688252b654c83072bf913dfba3416db026a1.json
  • .sqlx/query-4a2fb9673a30b4d7614a649c6420e574996807e106fde250df9525a194a2a121.json
  • .sqlx/query-0cafb1f2b425d73de902ab03975754f64fc80810ca8dc5d7775090d0bacd7a28.json
  • .sqlx/query-4e58a898292fe6b27cb195293b891761df16f035aa1e84bb8a2300c7a54b6417.json
  • .sqlx/query-82b3143673d6932b2311d45d3f333362140392a005eb75604445f4b2b793bb45.json
  • .sqlx/query-883cf05f80797b83966b5dc5fc50df81f5eef600eae7ea9ac2c84bdc3d674bbc.json
  • .sqlx/query-32a0cea2cc0b1631c1d2b058a0949f266063a120f8ae1cd2dbd9539a3603ab05.json
🧰 Additional context used
🧠 Learnings (7)
📚 Learning: 2025-09-21T09:54:54.849Z
Learnt from: c-thiel
PR: lakekeeper/lakekeeper#1348
File: .sqlx/query-1c1a32de33e3f54464a1107f7d4d4b8cbd99dd69aae1c740561c3cbbea2eaa19.json:9-10
Timestamp: 2025-09-21T09:54:54.849Z
Learning: In the lakekeeper codebase, ServerId newtype uses manual conversion between uuid::Uuid and ServerId at query call sites rather than sqlx transparent annotations like #[sqlx(transparent)]. The manual conversion approach is the preferred pattern in this codebase.

Applied to files:

  • crates/lakekeeper/src/service/mod.rs
📚 Learning: 2025-08-31T11:28:55.756Z
Learnt from: c-thiel
PR: lakekeeper/lakekeeper#1316
File: .sqlx/query-0aeb5d6e3f65746cefe75e374c69780174a7474580da84345cb777e2343d0280.json:4-22
Timestamp: 2025-08-31T11:28:55.756Z
Learning: The task_final_status PostgreSQL enum and the primary key constraint on task_log(task_id, attempt) were both established in migration 20250523101407_tasks_store_their_state.sql, not missing from the schema.

Applied to files:

  • crates/lakekeeper/migrations/20250919101934_add_task_entity_name.sql
  • .sqlx/query-f71b45c190e90bc54f058fe90f2776c338d2f3b6e612a401cd66444323c1a41b.json
  • .sqlx/query-096eba228becd7427130d0d94a6318374dfbb6d982ab8c43ae4575f6661a46db.json
  • .sqlx/query-c6eb029d46d257f500c7a43809a450c4de2c07ca660c0ee94cba4a5f2abd087b.json
  • .sqlx/query-eb90b100455918b5d3cecf606bd61e506550a2f94c6e1ed80c70381d28b5cf92.json
  • .sqlx/query-41195f72677b1ba635509c7b2367e5ac8c6835f640639cde39af5058a27d32b5.json
  • .sqlx/query-47a083adbfa09b2359c6d5ff706c35a72190ddb2cd3890c1ae2912bf3b9e48e1.json
📚 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/20250919101934_add_task_entity_name.sql
  • .sqlx/query-f71b45c190e90bc54f058fe90f2776c338d2f3b6e612a401cd66444323c1a41b.json
  • .sqlx/query-7fce6648e54d340cc27905240e2ec6044454fa0a5f433cd25a8802ce61b70291.json
  • .sqlx/query-c6eb029d46d257f500c7a43809a450c4de2c07ca660c0ee94cba4a5f2abd087b.json
  • .sqlx/query-eb90b100455918b5d3cecf606bd61e506550a2f94c6e1ed80c70381d28b5cf92.json
  • .sqlx/query-41195f72677b1ba635509c7b2367e5ac8c6835f640639cde39af5058a27d32b5.json
  • crates/lakekeeper/src/implementations/postgres/tasks.rs
  • .sqlx/query-47a083adbfa09b2359c6d5ff706c35a72190ddb2cd3890c1ae2912bf3b9e48e1.json
  • crates/lakekeeper/src/implementations/postgres/tasks/list_tasks.rs
📚 Learning: 2025-09-18T16:16:50.743Z
Learnt from: c-thiel
PR: lakekeeper/lakekeeper#1254
File: .sqlx/query-cc971caec9f8981502e9ea21682482378d65cee50c8017bf251256fa7085053a.json:3-3
Timestamp: 2025-09-18T16:16:50.743Z
Learning: In the lakekeeper database schema, the namespace.namespace_name column is defined as `Text [] collate "case_insensitive"` (a PostgreSQL text array) that stores namespace name segments. Queries comparing `n.namespace_name = $1` where $1 is TextArray are valid array-to-array equality checks, not type mismatches.

Applied to files:

  • crates/lakekeeper/migrations/20250919101934_add_task_entity_name.sql
📚 Learning: 2025-08-31T11:58:20.890Z
Learnt from: c-thiel
PR: lakekeeper/lakekeeper#1316
File: .sqlx/query-755974eeec0224a16075e26d11f8d81d667eaa293e72ba1ccdec9050eb74e778.json:3-3
Timestamp: 2025-08-31T11:58:20.890Z
Learning: In .sqlx/query-755974eeec0224a16075e26d11f8d81d667eaa293e72ba1ccdec9050eb74e778.json, the UPDATE statement that sets progress = 0.0, picked_up_at = NULL, and execution_details = NULL is correct because this code branch only executes when max_retries_exceeded is true, and the intention is to reset the task state to make it available for pickup again in the retry mechanism.

Applied to files:

  • .sqlx/query-f71b45c190e90bc54f058fe90f2776c338d2f3b6e612a401cd66444323c1a41b.json
  • .sqlx/query-096eba228becd7427130d0d94a6318374dfbb6d982ab8c43ae4575f6661a46db.json
  • .sqlx/query-eb90b100455918b5d3cecf606bd61e506550a2f94c6e1ed80c70381d28b5cf92.json
  • .sqlx/query-41195f72677b1ba635509c7b2367e5ac8c6835f640639cde39af5058a27d32b5.json
📚 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:

  • .sqlx/query-f71b45c190e90bc54f058fe90f2776c338d2f3b6e612a401cd66444323c1a41b.json
  • .sqlx/query-c6eb029d46d257f500c7a43809a450c4de2c07ca660c0ee94cba4a5f2abd087b.json
  • .sqlx/query-eb90b100455918b5d3cecf606bd61e506550a2f94c6e1ed80c70381d28b5cf92.json
  • .sqlx/query-41195f72677b1ba635509c7b2367e5ac8c6835f640639cde39af5058a27d32b5.json
  • crates/lakekeeper/src/implementations/postgres/tasks.rs
  • .sqlx/query-47a083adbfa09b2359c6d5ff706c35a72190ddb2cd3890c1ae2912bf3b9e48e1.json
📚 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-01136443202988753fd0134372e025f5353617f565347f9c18ddb98a5e44a788.json
🧬 Code graph analysis (6)
crates/lakekeeper/src/implementations/postgres/tasks/resolve_tasks.rs (2)
crates/lakekeeper/src/service/mod.rs (1)
  • to_uuid (473-475)
crates/lakekeeper/src/service/task_queue/mod.rs (1)
  • to_uuid (186-190)
crates/lakekeeper/src/implementations/postgres/namespace.rs (2)
crates/iceberg-ext/src/catalog/rest/error.rs (1)
  • internal (161-172)
crates/lakekeeper/src/service/storage/mod.rs (1)
  • join_location (893-895)
crates/lakekeeper/src/service/task_queue/tabular_expiration_queue.rs (2)
crates/lakekeeper/src/implementations/postgres/tabular/table/mod.rs (1)
  • initialize_table (991-1074)
crates/lakekeeper/src/api/iceberg/mod.rs (1)
  • remove (166-171)
crates/lakekeeper/src/implementations/postgres/tasks/get_task_details.rs (3)
crates/lakekeeper/src/implementations/postgres/tasks/list_tasks.rs (1)
  • queue_task_helper (327-343)
crates/lakekeeper/src/implementations/postgres/tasks/resolve_tasks.rs (1)
  • queue_task_helper (124-150)
crates/lakekeeper/src/implementations/postgres/tasks.rs (1)
  • task_metadata (1568-1576)
crates/lakekeeper/src/implementations/postgres/tasks.rs (2)
crates/lakekeeper/src/service/task_queue/mod.rs (6)
  • tasks (373-390)
  • queue_name (98-98)
  • queue_name (308-310)
  • task (438-438)
  • task (450-450)
  • to_uuid (186-190)
crates/iceberg-ext/src/catalog/rest/error.rs (1)
  • internal (161-172)
crates/lakekeeper/src/implementations/postgres/tasks/list_tasks.rs (1)
crates/lakekeeper/src/implementations/postgres/tasks.rs (1)
  • generate_tq_name (965-967)
⏰ 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). (5)
  • GitHub Check: docker / docker
  • GitHub Check: test
  • GitHub Check: check-generated-openapi-matches
  • GitHub Check: sqlx-check
  • GitHub Check: clippy
🔇 Additional comments (46)
.sqlx/query-0eb0f3cbb5503a213c1ee958c308d11ab8464a826455f5f447e4284a77ea544f.json (2)

31-34: Confirm non-null contract for entity_name (TextArray) across models

Descriptor marks entity_name as non-null. Ensure all Rust structs and API types use Vec (not Option) and serializers default to [] when empty to avoid mismatches.


35-90: Column ordinal shift: verify FromRow mappings

Adding entity_name at ordinal 3 shifts downstream ordinals. Verify every sqlx::query_as consumer of this statement updated field order accordingly to prevent mis-bound fields at runtime.

You can grep usages by statement hash or the query text.

.sqlx/query-c6eb029d46d257f500c7a43809a450c4de2c07ca660c0ee94cba4a5f2abd087b.json (5)

3-3: Confirm 'success' status is correct for this path.

Hard-coding status to 'success' assumes this delete path always represents successful completion. Validate against task_final_status semantics for cancellations/timeouts.

If needed, parameterize status or branch to the appropriate enum value.


13-17: Parameter order and types look consistent.

$1: Uuid (task_id), $2: Text (message), $3: Int4 (attempt). Matches the SQL usage.

Ensure the Rust binding passes attempt as i32 and message as &str/String.


3-3: Confirm task_log.entity_name exists and is text[] in migrations

Entity name propagation looks correct.

Automated repo search returned no results; confirm migrations that create/alter task_log define entity_name as type text[] (or a compatible type) and that the .sqlx descriptor was regenerated after the migration. If missing or typed differently, add/alter the migration and regenerate the descriptor.


3-3: Resolved — fetch_optional is used for this query.

The SQL call in crates/lakekeeper/src/implementations/postgres/tasks.rs is followed by .fetch_optional(...), so the 0-row RETURNING case is handled and no change is required.


23-23: Regenerate SQLX descriptor (.sqlx/*.json) and commit changes

Run locally or in CI: cargo sqlx prepare -- --all-features; commit any changed .sqlx/*.json (e.g. .sqlx/query-c6eb029d46d257f500c7a43809a450c4de2c07ca660c0ee94cba4a5f2abd087b.json). Sandbox execution failed (error: "Could not locate working directory: no /proc/self/exe available"); run the prepare step outside this environment and push the updated descriptor.

.sqlx/query-47a083adbfa09b2359c6d5ff706c35a72190ddb2cd3890c1ae2912bf3b9e48e1.json (1)

3-3: LGTM; entity_name propagated into logs

Delete-then-log flow looks consistent, including entity_name. No blockers from me.

Please confirm $4::task_final_status is always a final state (e.g., cancelled for cancellations) at call sites.

crates/lakekeeper/src/api/management/v1/tasks.rs (3)

259-315: Transaction scope for list_tasks is read-only; good

Read txn + commit are consistent with other endpoints. No issues found.


317-383: AuthZ split looks correct

Warehouse-level gate + per-table fallback is sound. No changes requested.


43-44: Public API change: new required field entity_name — update OpenAPI, generated clients, and docs

  • Tests/internal impls already reference the field (crates/lakekeeper/src/api/management/v1/tasks.rs:44; crates/lakekeeper/src/tests/tasks.rs:137).
  • No occurrences of "entity-name" under docs/ — update the OpenAPI schema, regenerate client libraries/consumers, and add a docs example for the new field.
.sqlx/query-f8e2335bb0a90c64853dfaa5931636ce1ddf13c8d8416d0850ce4ca382727286.json (1)

41-44: Confirmed — migration populates column and sets NOT NULL

crates/lakekeeper/migrations/20250919101934_add_task_entity_name.sql adds entity_name to task and task_log, updates existing rows to populate it, then runs ALTER TABLE ... SET NOT NULL for both tables; the entity_name!: Vec<String> mapping is supported.

.sqlx/query-01136443202988753fd0134372e025f5353617f565347f9c18ddb98a5e44a788.json (1)

3-3: Fix invalid ANY(subquery) usage; use IN or ARRAY(...)

t.entity_id = ANY (SELECT tabular_id FROM tabulars) is not valid; ANY expects an array. Use IN (SELECT ...) (simplest) or wrap with ARRAY(...).

-            SELECT t.task_id, t.status as task_status from task t
-            WHERE t.status = 'running' AND t.entity_id = ANY (SELECT tabular_id FROM tabulars) AND t.warehouse_id = $1 AND t.entity_type = 'tabular' AND queue_name = 'tabular_expiration'
+            SELECT t.task_id, t.status as task_status FROM task t
+            WHERE t.status = 'running'
+              AND t.entity_id IN (SELECT tabular_id FROM tabulars)
+              AND t.warehouse_id = $1
+              AND t.entity_type = 'tabular'
+              AND t.queue_name = 'tabular_expiration'

Likely an incorrect or invalid review comment.

crates/lakekeeper/src/implementations/postgres/tabular/table/mod.rs (1)

901-902: Importing NamedEntity for into_name_parts is correct.

This brings the trait into scope for the method call on TableIdent in tests. LGTM.

crates/lakekeeper/src/tests/tasks.rs (1)

129-140: Tests updated to include entity_name in TaskMetadata.

Looks consistent with the new schema; minimal, readable setup.

crates/lakekeeper/src/service/task_queue/mod.rs (1)

171-177: TaskMetadata.entity_name — migration backfilled and SET NOT NULL; no DB DEFAULT

  • Migration crates/lakekeeper/migrations/20250919101934_add_task_entity_name.sql adds entity_name Text[] collate case_insensitive, backfills rows with namespace+name or ARRAY['unknown'], then ALTER COLUMN ... SET NOT NULL.
  • Backfill + NOT NULL satisfy deserialization for pre-migration rows. No DEFAULT is defined — add DEFAULT '{}'::text[] (or jsonb DEFAULT '[]') for a DB-level default or confirm all insert paths populate entity_name to avoid future insert failures.
  • Optional: introduce newtype NameParts(Vec) with Display/From to centralize join/parsing.
crates/lakekeeper/src/catalog/views/drop.rs (2)

19-20: Importing NamedEntity is appropriate

Import set is correct for into_name_parts(). LGTM.


72-80: Populate TaskMetadata.entity_name — verified
All TaskMetadata constructions found include entity_name (crates/lakekeeper/src/implementations/postgres/tasks.rs — lines ~1503, 1514, 1571).

.sqlx/query-0700e1e2beeaa8c70abbee2b863cdc301a3d1d3977623f5645808ed1e3dae731.json (1)

3-3: Entity name plumbed through get_task_details descriptor — LGTM

Projection and describe metadata for entity_name (TextArray → Vec) look correct.

Also applies to: 31-35

.sqlx/query-f71b45c190e90bc54f058fe90f2776c338d2f3b6e612a401cd66444323c1a41b.json (1)

3-3: Delete→log path includes entity_name — LGTM

Parameters and column mapping (including entity_name) are consistent with schema.

Also applies to: 7-37

crates/lakekeeper/src/implementations/postgres/tasks/list_tasks.rs (2)

29-30: Propagating entity_name end‑to‑end — LGTM

Row mapping, CTE projections, and API parsing all align. Good coverage.

Also applies to: 53-54, 160-161, 189-190, 217-218


333-365: Tests updated to exercise entity_name — nice

Helpers and assertions validate the new field; good signal.

Also applies to: 392-415

crates/lakekeeper/migrations/20250919101934_add_task_entity_name.sql (1)

1-11: Migration is sound — INSERT/UPDATE paths verified

Primary insert paths set entity_name: crates/lakekeeper/src/implementations/postgres/tasks.rs (batch INSERT / task_log inserts), crates/lakekeeper/src/service/task_queue/*, API types and tests; backfill + NOT NULL are fine.

crates/lakekeeper/src/catalog/namespace.rs (2)

31-31: Importing NamedEntity is correct and required for into_name_parts().

No issues spotted.


494-506: Good: propagate entity_name when scheduling purge tasks.

This will greatly aid traceability of child tabular purges kicked off by namespace drops.

Consider adding a small assertion in an existing recursive-drop test to validate that the queued TabularPurgeTask carries the expected entity_name parts.

crates/lakekeeper/src/implementations/postgres/namespace.rs (2)

5-8: New imports (TableIdent, izip) are appropriate.

Matches the new return shape of child_tables and mapping logic below.


492-513: Mapping to (TabularId, location, TableIdent) looks solid.

Error mapping on NamespaceIdent::from_vec is appropriate; join_location usage is correct.

crates/lakekeeper/src/catalog/tables.rs (3)

61-63: Expose NamedEntity here – good.

Required for into_name_parts() below.


772-790: Include entity_name on purge task metadata (hard delete).

Right approach; ensures API/observability can display human-friendly context.


800-808: Include entity_name on expiration task metadata — verified.
Repo-wide scan shows all TaskMetadata instantiations include entity_name.

crates/lakekeeper/src/implementations/postgres/tasks/get_task_details.rs (3)

20-20: Add entity_name to TaskDetailsRow – good.

Keeps parity with new schema.


97-98: Pass entity_name through to APITask.

Exactly what the API needs for UI/debugging.


552-581: Helper updated to accept entity_name – good.

Keeps tests aligned with new API.

crates/lakekeeper/src/service/task_queue/tabular_expiration_queue.rs (3)

239-246: Good: forward entity_name to the chained purge task.

Preserves context across the expiration→purge handoff.


290-292: Tests: importing NamedEntity is appropriate.

Trait is used below to derive name parts.


360-366: Tests: include entity_name when scheduling expiration.

Nice coverage; ensures metadata is populated at enqueue time.

crates/lakekeeper/src/implementations/postgres/tasks.rs (10)

267-299: Propagating entity_name through pick_task is correct.

Mapping task.entity_name -> TaskMetadata.entity_name keeps name parts available to workers.


334-354: Include entity_name in task_log on success. LGTM.

Keeps audit entries self‑contained.


412-433: Include entity_name in task_log on permanent failure. LGTM.

Consistent with success path.


469-490: Include entity_name in task_log on retryable failure. LGTM.

Consistent propagation across branches.


663-684: Reschedule path logs running attempts with entity_name. LGTM.

This preserves context for failed running attempts created by reschedule.


794-812: Cancellation (by warehouse) logs entity_name. LGTM.

Matches other task_log writers and keeps metadata intact.


862-880: Cancellation (by ids) logs entity_name. LGTM.

Consistent with warehouse filter branch.


949-958: Tests: good coverage for entity_name round‑trip.

The helper injects entity_name, and assertions verify propagation through pick_task.

Also applies to: 1568-1576


1494-1559: Batch queue test: validates per‑row entity_name. LGTM.

Asserts confirm correct mapping per item; nice.


118-143: Approve — ON CONFLICT keys match unique index; entity_name migration present

Verified: crates/lakekeeper/migrations/20250919101934_add_task_entity_name.sql adds entity_name (Text[] collate "case_insensitive"); crates/lakekeeper/migrations/20250523101407_tasks_store_their_state.sql contains unique index task_warehouse_id_entity_type_entity_id_queue_name_idx. LGTM.

Comment thread crates/lakekeeper/src/service/mod.rs Resolved
@c-thiel

c-thiel commented Sep 21, 2025

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Sep 21, 2025

Copy link
Copy Markdown
Contributor
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 4

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/namespace.rs (1)

373-380: Array misalignment bug: inconsistent filters and no ordering across ARRAY selects.

Several ARRAY subselects use different filters (some include soft-deleted rows, others exclude) and none specify ordering. izip! then pairs elements by index, risking wrong pairs or dropped entries.

Apply this to filter to non-deleted consistently and order deterministically by tabular_id:

-            ARRAY(SELECT tabular_id FROM tabulars where deleted_at is NULL) AS "child_tabulars!",
-            ARRAY(SELECT to_jsonb(namespace_name) FROM tabulars where deleted_at is NULL) AS "child_tabulars_namespace_names!: Vec<serde_json::Value>",
-            ARRAY(SELECT table_name FROM tabulars where deleted_at is NULL) AS "child_tabulars_table_names!",
-            ARRAY(SELECT tabular_id FROM tabulars where deleted_at is not NULL) AS "child_tabulars_deleted!",
-            ARRAY(SELECT fs_protocol FROM tabulars) AS "child_tabular_fs_protocol!",
-            ARRAY(SELECT fs_location FROM tabulars) AS "child_tabular_fs_location!",
-            ARRAY(SELECT typ FROM tabulars) AS "child_tabular_typ!: Vec<TabularType>",
+            ARRAY(SELECT tabular_id              FROM tabulars WHERE deleted_at IS NULL ORDER BY tabular_id) AS "child_tabulars!",
+            ARRAY(SELECT to_jsonb(namespace_name)FROM tabulars WHERE deleted_at IS NULL ORDER BY tabular_id) AS "child_tabulars_namespace_names!: Vec<serde_json::Value>",
+            ARRAY(SELECT table_name              FROM tabulars WHERE deleted_at IS NULL ORDER BY tabular_id) AS "child_tabulars_table_names!",
+            ARRAY(SELECT tabular_id              FROM tabulars WHERE deleted_at IS NOT NULL ORDER BY tabular_id) AS "child_tabulars_deleted!",
+            ARRAY(SELECT fs_protocol             FROM tabulars WHERE deleted_at IS NULL ORDER BY tabular_id) AS "child_tabular_fs_protocol!",
+            ARRAY(SELECT fs_location             FROM tabulars WHERE deleted_at IS NULL ORDER BY tabular_id) AS "child_tabular_fs_location!",
+            ARRAY(SELECT typ                     FROM tabulars WHERE deleted_at IS NULL ORDER BY tabular_id) AS "child_tabular_typ!: Vec<TabularType>",
🧹 Nitpick comments (6)
.sqlx/query-4f951124303e67a24d2adb738c8bc2b747eaf04a1dd2a15a40d05ee57807c572.json (2)

3-3: Make “task_log_exists!” reflect actual log existence, not task deletion.

Currently it’s (EXISTS(task_log_attempt) OR EXISTS(moved)), which can be true even if no log row exists. Prefer OR with log_insert to directly encode “exists or was just inserted.”

Apply this focused change:

-            (EXISTS(SELECT 1 FROM task_log_attempt) OR EXISTS(SELECT 1 FROM moved)) as "task_log_exists!",
+            (EXISTS(SELECT 1 FROM task_log_attempt) OR EXISTS(SELECT 1 FROM log_insert)) as "task_log_exists!",

If you adopt this, regenerate SQLx data (e.g., cargo sqlx prepare) so the descriptor hash stays in sync.


3-3: Use clock_timestamp() and guard NULL to avoid stale/NULL durations.

now() is transaction start time; clock_timestamp() better reflects “end time.” Also, if picked_up_at can be NULL in edge cases, duration becomes NULL.

Apply this focused change:

-                    now() - picked_up_at,
+                    COALESCE(clock_timestamp() - picked_up_at, interval '0 seconds'),

Please confirm picked_up_at is always set before this path; if guaranteed NOT NULL, we can drop the COALESCE and just switch to clock_timestamp().

.sqlx/query-d1868c515fade0961c685d7a5ccdc580b776b14de0cdcbae5f4a6979b5e122c7.json (1)

3-3: Minor: duration can be NULL when picked_up_at is NULL.

Assuming that’s acceptable for “failed-before-pickup” cases. If not, coalesce: COALESCE(now() - picked_up_at, interval '0').

Optional diff:

-    now() - picked_up_at,
+    COALESCE(now() - picked_up_at, interval '0'),
crates/lakekeeper/src/implementations/postgres/namespace.rs (2)

488-504: Guard against future misalignment in Rust side or switch to row-wise aggregation.

Even with the SQL fix, izip! silently truncates to the shortest vector. If a future edit reintroduces a length mismatch, entries will be dropped with no error.

  • Add a debug assert on equal lengths before zipping, or
  • Prefer a single JSON aggregation in SQL (one row per tabular with all fields) to avoid parallel arrays.

Example assert:

-        child_tables: izip!(
+        debug_assert_eq!(info.child_tabulars.len(), info.child_tabular_fs_protocol.len());
+        debug_assert_eq!(info.child_tabulars.len(), info.child_tabular_fs_location.len());
+        debug_assert_eq!(info.child_tabulars.len(), info.child_tabular_typ.len());
+        debug_assert_eq!(info.child_tabulars.len(), info.child_tabulars_namespace_names.len());
+        debug_assert_eq!(info.child_tabulars.len(), info.child_tabulars_table_names.len());
+        child_tables: izip!(

512-546: Avoid JSON round‑trip for namespace_name; return typed arrays directly.

json_value_to_namespace_ident is correct but unnecessary overhead. You already read namespace_name as Vec<String> elsewhere; prefer typed arrays here too if feasible with SQLx offline.

Option:

-            ARRAY(SELECT to_jsonb(namespace_name) FROM tabulars WHERE deleted_at IS NULL ORDER BY tabular_id) AS "child_tabulars_namespace_names!: Vec<serde_json::Value>",
+            ARRAY(SELECT namespace_name FROM tabulars WHERE deleted_at IS NULL ORDER BY tabular_id) AS "child_tabulars_namespace_names!: Vec<Vec<String>>",

Then:

-            let table_ident = TableIdent::new(json_value_to_namespace_ident(ns_name)?, t_name);
+            let table_ident = TableIdent::new(NamespaceIdent::from_vec(ns_name)?, t_name);

If SQLx typing here proves tricky, keep your helper but accept &serde_json::Value and clone only on success to reduce moves.

.sqlx/query-0b6e6f3160161132b4e3731700120c214d206457591bf3eacbda3fb0ec38c1bc.json (1)

3-3: Add ORDER BY for deterministic array element order

Without ORDER BY, ARRAY(SELECT ...) returns unspecified ordering, which is brittle for clients comparing elements by position. Order by tabular_id (or a stable key) everywhere arrays are produced.

-            ARRAY(SELECT tabular_id FROM tabulars where deleted_at is NULL) AS "child_tabulars!",
+            ARRAY(SELECT tabular_id FROM tabulars WHERE deleted_at IS NULL ORDER BY tabular_id) AS "child_tabulars!",
-            ARRAY(SELECT to_jsonb(namespace_name) FROM tabulars where deleted_at is NULL) AS "child_tabulars_namespace_names!: Vec<serde_json::Value>",
+            ARRAY(SELECT to_jsonb(namespace_name) FROM tabulars WHERE deleted_at IS NULL ORDER BY tabular_id) AS "child_tabulars_namespace_names!: Vec<serde_json::Value>",
-            ARRAY(SELECT table_name FROM tabulars where deleted_at is NULL) AS "child_tabulars_table_names!",
+            ARRAY(SELECT table_name FROM tabulars WHERE deleted_at IS NULL ORDER BY tabular_id) AS "child_tabulars_table_names!",
-            ARRAY(SELECT tabular_id FROM tabulars where deleted_at is not NULL) AS "child_tabulars_deleted!",
+            ARRAY(SELECT tabular_id FROM tabulars WHERE deleted_at IS NOT NULL ORDER BY tabular_id) AS "child_tabulars_deleted!",
-            ARRAY(SELECT namespace_id FROM child_namespaces) AS "child_namespaces!",
+            ARRAY(SELECT namespace_id FROM child_namespaces ORDER BY namespace_id) AS "child_namespaces!",
-            ARRAY(SELECT fs_protocol FROM tabulars WHERE deleted_at IS NULL) AS "child_tabular_fs_protocol!",
+            ARRAY(SELECT fs_protocol FROM tabulars WHERE deleted_at IS NULL ORDER BY tabular_id) AS "child_tabular_fs_protocol!",
-            ARRAY(SELECT fs_location FROM tabulars WHERE deleted_at IS NULL) AS "child_tabular_fs_location!",
+            ARRAY(SELECT fs_location FROM tabulars WHERE deleted_at IS NULL ORDER BY tabular_id) AS "child_tabular_fs_location!",
-            ARRAY(SELECT typ FROM tabulars WHERE deleted_at IS NULL) AS "child_tabular_typ!: Vec<TabularType>",
+            ARRAY(SELECT typ FROM tabulars WHERE deleted_at IS NULL ORDER BY tabular_id) AS "child_tabular_typ!: Vec<TabularType>",
-            ARRAY(SELECT task_id FROM tasks) AS "child_tabular_task_id!: Vec<Uuid>"
+            ARRAY(SELECT task_id FROM tasks ORDER BY task_id) AS "child_tabular_task_id!: Vec<Uuid>"
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 324701b and d0ddbc7.

📒 Files selected for processing (7)
  • .sqlx/query-0b6e6f3160161132b4e3731700120c214d206457591bf3eacbda3fb0ec38c1bc.json (1 hunks)
  • .sqlx/query-4f951124303e67a24d2adb738c8bc2b747eaf04a1dd2a15a40d05ee57807c572.json (1 hunks)
  • .sqlx/query-7c06f9bb89efad1f2237875549ecaa391db5bdad89adf2d0a49e80d56d25a00d.json (1 hunks)
  • .sqlx/query-9bea16fe09b12ee4c913067a742febfbe81642b2b167123d25903460ac3ff598.json (4 hunks)
  • .sqlx/query-d1868c515fade0961c685d7a5ccdc580b776b14de0cdcbae5f4a6979b5e122c7.json (1 hunks)
  • crates/lakekeeper/src/implementations/postgres/namespace.rs (6 hunks)
  • crates/lakekeeper/src/implementations/postgres/tasks.rs (29 hunks)
✅ Files skipped from review due to trivial changes (1)
  • .sqlx/query-7c06f9bb89efad1f2237875549ecaa391db5bdad89adf2d0a49e80d56d25a00d.json
🧰 Additional context used
🧠 Learnings (7)
📓 Common learnings
Learnt from: c-thiel
PR: lakekeeper/lakekeeper#1353
File: crates/lakekeeper/src/implementations/postgres/tasks/get_task_details.rs:163-165
Timestamp: 2025-09-21T15:13:20.507Z
Learning: The entity_name column in the task and task_log tables is NOT NULL as enforced by the migration 20250919101934_add_task_entity_name.sql, which backfills existing rows and sets the constraint, so no NULL checking is needed in queries.
📚 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/namespace.rs
📚 Learning: 2025-09-21T15:13:20.507Z
Learnt from: c-thiel
PR: lakekeeper/lakekeeper#1353
File: crates/lakekeeper/src/implementations/postgres/tasks/get_task_details.rs:163-165
Timestamp: 2025-09-21T15:13:20.507Z
Learning: The entity_name column in the task and task_log tables is NOT NULL as enforced by the migration 20250919101934_add_task_entity_name.sql, which backfills existing rows and sets the constraint, so no NULL checking is needed in queries.

Applied to files:

  • .sqlx/query-9bea16fe09b12ee4c913067a742febfbe81642b2b167123d25903460ac3ff598.json
  • crates/lakekeeper/src/implementations/postgres/tasks.rs
📚 Learning: 2025-08-31T11:28:55.756Z
Learnt from: c-thiel
PR: lakekeeper/lakekeeper#1316
File: .sqlx/query-0aeb5d6e3f65746cefe75e374c69780174a7474580da84345cb777e2343d0280.json:4-22
Timestamp: 2025-08-31T11:28:55.756Z
Learning: The task_final_status PostgreSQL enum and the primary key constraint on task_log(task_id, attempt) were both established in migration 20250523101407_tasks_store_their_state.sql, not missing from the schema.

Applied to files:

  • .sqlx/query-4f951124303e67a24d2adb738c8bc2b747eaf04a1dd2a15a40d05ee57807c572.json
  • .sqlx/query-d1868c515fade0961c685d7a5ccdc580b776b14de0cdcbae5f4a6979b5e122c7.json
📚 Learning: 2025-08-31T11:58:20.890Z
Learnt from: c-thiel
PR: lakekeeper/lakekeeper#1316
File: .sqlx/query-755974eeec0224a16075e26d11f8d81d667eaa293e72ba1ccdec9050eb74e778.json:3-3
Timestamp: 2025-08-31T11:58:20.890Z
Learning: In .sqlx/query-755974eeec0224a16075e26d11f8d81d667eaa293e72ba1ccdec9050eb74e778.json, the UPDATE statement that sets progress = 0.0, picked_up_at = NULL, and execution_details = NULL is correct because this code branch only executes when max_retries_exceeded is true, and the intention is to reset the task state to make it available for pickup again in the retry mechanism.

Applied to files:

  • .sqlx/query-d1868c515fade0961c685d7a5ccdc580b776b14de0cdcbae5f4a6979b5e122c7.json
📚 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/src/implementations/postgres/tasks.rs
📚 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/src/implementations/postgres/tasks.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: test
  • GitHub Check: sqlx-check
  • GitHub Check: docker / docker
  • GitHub Check: docker / docker
  • GitHub Check: docker / docker
🔇 Additional comments (21)
.sqlx/query-4f951124303e67a24d2adb738c8bc2b747eaf04a1dd2a15a40d05ee57807c572.json (2)

3-3: Entity name propagation looks correct.

Including entity_name in the INSERT … SELECT path aligns with the NOT NULL column guarantee from the migration and keeps logs consistent with tasks.


3-3: Optionally expose a clearer conflict signal.

If callers need to distinguish “we inserted” vs “pre‑existing conflict”, return EXISTS(SELECT 1 FROM task_log_attempt) AS "conflicted!" instead of deriving it from the two booleans.
Could not find any usages of "task_log_exists!" in the repo—verify callers rely on the current semantics before changing.

rg -n -C2 -F '"task_log_exists!"' --type=rust --type=sql || true
.sqlx/query-d1868c515fade0961c685d7a5ccdc580b776b14de0cdcbae5f4a6979b5e122c7.json (3)

3-3: Good: entity_name is propagated into task_log.

Matches the NOT NULL schema from the migration; no extra NULL handling needed.


34-40: Regenerate SQLx descriptor and commit updated .sqlx

You added "task_updated!" — regenerate the SQLx descriptors and commit the updated .sqlx file:

cargo sqlx prepare --workspace -- --all-features
git add .sqlx
git commit -m "sqlx: update query descriptors"

Affected descriptor: .sqlx/query-d1868c515fade0961c685d7a5ccdc580b776b14de0cdcbae5f4a6979b5e122c7.json


27-33: Parameters look correct — verify call-site bindings

rg shows sqlx::query! invocations in crates/lakekeeper/src/implementations/postgres/tasks.rs (≈lines 321–400, 430–498, 562–576). Output only shows *task_id being bound; message and attempt bindings aren’t visible. Confirm every call binds parameters in order: task_id: Uuid, message: &str, attempt: i32.

crates/lakekeeper/src/implementations/postgres/namespace.rs (4)

5-7: Scoped imports look good.

Adding TableIdent and narrowing itertools to izip is tidy and precise.


346-351: Including protected flags early is good.

Carrying protected in namespace_info and child_namespaces up front simplifies downstream checks.


1005-1007: Solid test: verifies TableIdent reconstruction.

Asserting (TabularId, TableIdent) matches the initialized table tightens coverage of the new mapping.


357-361: Qualify tabular columns and confirm view-inclusion logic.

File: crates/lakekeeper/src/implementations/postgres/namespace.rs (around lines 357–361)

  • Qualify unqualified columns: use ta.warehouse_id and ta.metadata_location for clarity and future-proofing.
  • The current WHERE applies metadata_location IS NOT NULL only to the direct-namespace arm, which will exclude views (views often have metadata_location = NULL). Decide whether views should be included.

Option A (include views — preferred if views should appear):

-            WHERE warehouse_id = $1 AND ((ta.namespace_id = $2 AND metadata_location IS NOT NULL) OR (ta.namespace_id = ANY (SELECT namespace_id FROM child_namespaces)))
+            WHERE ta.warehouse_id = $1
+              AND (
+                (ta.namespace_id = $2 AND (ta.metadata_location IS NOT NULL OR ta.typ = 'view'))
+                OR ta.namespace_id = ANY (SELECT namespace_id FROM child_namespaces)
+              )

Option B (exclude views; require metadata_location for both arms):

-            WHERE warehouse_id = $1 AND ((ta.namespace_id = $2 AND metadata_location IS NOT NULL) OR (ta.namespace_id = ANY (SELECT namespace_id FROM child_namespaces)))
+            WHERE ta.warehouse_id = $1
+              AND (
+                (ta.namespace_id = $2 AND ta.metadata_location IS NOT NULL)
+                OR (ta.namespace_id = ANY (SELECT namespace_id FROM child_namespaces) AND ta.metadata_location IS NOT NULL)
+              )

Confirm how views are represented in the codebase (ta.typ value or TabularType enum) and apply Option A if views should be included, otherwise apply Option B.

.sqlx/query-0b6e6f3160161132b4e3731700120c214d206457591bf3eacbda3fb0ec38c1bc.json (2)

62-81: Enum array mapping looks correct

Nice use of Postgres enum tabular_type[] with SQLx Custom type mapping to Vec. No issues noted.


3-3: Guard is_protected! against NULL (COALESCE the subquery)

(SELECT protected FROM namespace_info) can be NULL if the namespace doesn't exist — COALESCE it or ensure callers validate existence.

Location: crates/lakekeeper/src/implementations/postgres/namespace.rs (query SELECT list, ~line 368)

-            (SELECT protected FROM namespace_info) AS "is_protected!",
+            COALESCE((SELECT protected FROM namespace_info), false) AS "is_protected!",

Verify call sites validate (warehouse_id, namespace_id) before running this query; if they don't, apply the COALESCE change.

.sqlx/query-9bea16fe09b12ee4c913067a742febfbe81642b2b167123d25903460ac3ff598.json (2)

32-34: LGTM! The entity_name field is correctly added to the SQL query descriptor.

The addition of entity_name as a TextArray type in the query descriptor is consistent with the database schema and the SQL query that includes entity_name in both the INSERT and SELECT clauses.


105-106: Confirmed NOT NULL in migration — verify .sqlx ordinal mapping

Migration 20250919101934_add_task_entity_name.sql updates task and task_log and sets entity_name NOT NULL; .sqlx/query-9bea16fe09b12ee4c913067a742febfbe81642b2b167123d25903460ac3ff598.json contains "name": "entity_name" but inspection did not locate a corresponding "nullable" boolean array to map ordinals. Verify the generated JSON's nullable/column-order mapping so the non-nullable flag aligns with entity_name's index.

crates/lakekeeper/src/implementations/postgres/tasks.rs (8)

52-57: LGTM! Entity names are correctly propagated through the task queueing system.

The addition of entity_names vector collection and JSON serialization properly handles the new entity_name field from TaskMetadata. The error handling for serialization failures is appropriate.

Also applies to: 77-83


96-116: LGTM! SQL query properly handles entity_name insertion.

The SQL query correctly:

  • Includes entity_name in the unnest function call (parameter $10)
  • Maps it in the SELECT statement
  • Converts from JSONB array to text array using ARRAY(SELECT jsonb_array_elements_text(entity_name))
  • Inserts into the entity_name column

Also applies to: 127-140


222-242: LGTM! Task picking correctly propagates entity_name.

The SQL query and result mapping properly handle entity_name:

  • Includes entity_name in both INSERT INTO task_log and SELECT clauses
  • Returns entity_name in the final RETURNING clause
  • Maps the returned entity_name to TaskMetadata correctly

Also applies to: 268-269, 298-299


740-760: LGTM! Entity names are correctly included in task cancellation and rescheduling operations.

All the SQL queries for reschedule_tasks_for and cancel_scheduled_tasks properly include entity_name in their INSERT INTO task_log statements, ensuring audit trail consistency.

Also applies to: 871-888, 939-956


993-994: LGTM! Test helper functions properly construct entity_name for testing.

The test changes correctly:

  • Add entity_name construction in helper functions
  • Assert that picked tasks have the expected entity_name values
  • Generate meaningful entity_name values based on entity_id for test scenarios

Also applies to: 1031-1031, 1571-1572, 1580-1580, 1591-1591, 1627-1627, 1635-1635, 1648-1648


1924-2213: Excellent test coverage for edge cases and error conditions.

The new tests comprehensively cover:

  • Conflict detection for duplicate success/failure records
  • Not found errors for non-existent tasks
  • Normal success/failure scenarios
  • Proper error response codes and messages

This significantly improves the robustness and reliability of the task management system.


323-387: Resolve — record_success duplicate-handling verified

Found a dedicated test test_record_success_conflict_on_duplicate in crates/lakekeeper/src/implementations/postgres/tasks.rs that exercises the duplicate/log conflict path; no further changes required.


432-577: Verify record_failure SQL restructuring and duplicate-handling tests

New CTEs (task_log_attempt, log_insert, task_update) were added and the function now returns (task_log_exists, log_inserted, conflicting_message, conflicting_created_at). A test named test_record_failure_conflict_on_duplicate exists in crates/lakekeeper/src/implementations/postgres/tasks.rs. Confirm that:

  • The test covers both branches (max_retries_exceeded and retry) and the not-found path.
  • Concurrent-race scenarios are exercised (another process inserting into task_log before/after DELETE/UPDATE) so ON CONFLICT/EXISTS behavior is correct.
  • The function returns the intended errors (not_found vs recorded failure) in all edge cases.

@c-thiel

c-thiel commented Sep 21, 2025 •

Copy link
Copy Markdown
Member Author

@CodeRabbit review

@coderabbitai

coderabbitai Bot commented Sep 21, 2025

Copy link
Copy Markdown
Contributor
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 4

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/namespace.rs (1)

484-504: Guard against silent truncation when zipping arrays.

Even with ORDER BY, detect mismatches before izip to avoid data loss.

-        child_tables: izip!(
+        // Sanity-check equal lengths to prevent izip! from truncating silently
+        child_tables: {
+            let l0 = info.child_tabulars.len();
+            let l1 = info.child_tabular_fs_protocol.len();
+            let l2 = info.child_tabular_fs_location.len();
+            let l3 = info.child_tabular_typ.len();
+            let l4 = info.child_tabulars_namespace_names.len();
+            let l5 = info.child_tabulars_table_names.len();
+            if !(l0 == l1 && l0 == l2 && l0 == l3 && l0 == l4 && l0 == l5) {
+                return Err(ErrorModel::internal(
+                    "Mismatched result sizes assembling child tables",
+                    "NamespaceDropAssemblyError",
+                    None,
+                ).into());
+            }
+            izip!(
             info.child_tabulars,
             info.child_tabular_fs_protocol,
             info.child_tabular_fs_location,
             info.child_tabular_typ,
             info.child_tabulars_namespace_names,
             info.child_tabulars_table_names
-        )
-        .map(|(id, protocol, fs_location, typ, ns_name, t_name)| {
+        )
+        .map(|(id, protocol, fs_location, typ, ns_name, t_name)| {
             let table_ident = TableIdent::new(json_value_to_namespace_ident(ns_name)?, t_name);
             Ok::<_, ErrorModel>((
                 match typ {
                     TabularType::Table => TabularId::Table(id),
                     TabularType::View => TabularId::View(id),
                 },
                 join_location(protocol.as_str(), fs_location.as_str()),
                 table_ident,
             ))
-        })
-        .collect::<Result<Vec<_>, _>>()?,
+        })
+        .collect::<Result<Vec<_>, _>>()?
+        }
🧹 Nitpick comments (18)
.sqlx/query-051e5bb69a2990241ffbc88d2a00308eea09eaf3af24db1698dcdefa087883ed.json (3)

3-3: Consider guarding scheduled_for against past timestamps

CASE WHEN $3 THEN now() ELSE $2 END will accept any $2, including past times. If unintended, wrap as GREATEST($2, now()).


3-3: Optional: avoid NULL duration when picked_up_at is NULL

now() - picked_up_at yields NULL if picked_up_at is NULL. If task_log.duration must be non‑NULL, use COALESCE(now() - picked_up_at, INTERVAL '0').


3-3: Locking behavior: evaluate SKIP LOCKED to reduce blocking

FOR UPDATE without SKIP LOCKED can block if another worker holds the row. If this runs in a scheduler loop, consider SKIP LOCKED to avoid head‑of‑line blocking and deadlocks.

.sqlx/query-5524e81f1eb8b7b1376a67df248b110810d5acfda79b5c0c7eda26b02ca4145c.json (3)

3-3: Guard against NULL picked_up_at to avoid NULL/negative duration in logs.

If this path can run when a task times out before pickup, started_at/duration become NULL. Consider COALESCE.

-                    started_at,
-                    duration,
+                    started_at,
+                    duration,
...
-                    picked_up_at,
-                    now() - picked_up_at,
+                    COALESCE(picked_up_at, now()),
+                    now() - COALESCE(picked_up_at, now()),

3-3: Consider UPSERT … DO UPDATE to retain latest message instead of dropping on conflict.

Current ON CONFLICT DO NOTHING can hide a fresher failure reason. If you prefer last-write-wins, switch to DO UPDATE.

-                ON CONFLICT (task_id, attempt) DO NOTHING
+                ON CONFLICT (task_id, attempt) DO UPDATE
+                SET message = EXCLUDED.message

3-3: Optional: avoid no-op writes.

Gate the UPDATE to rows not already scheduled.

-                WHERE t.task_id = locked.task_id AND t.attempt = locked.attempt
+                WHERE t.task_id = locked.task_id
+                  AND t.attempt = locked.attempt
+                  AND t.status <> 'scheduled'
crates/lakekeeper/src/implementations/postgres/tasks.rs (5)

139-140: Qualify outer reference in subselect to avoid ambiguity.

Prefer explicitly qualifying the correlated column to the outer CTE row.

-            ARRAY(SELECT jsonb_array_elements_text(entity_name))
+            ARRAY(SELECT jsonb_array_elements_text(i.entity_name))

77-83: Avoid leaking internal error details and potentially sensitive entity names in client-facing errors.

Returning the full serialization error and the entity_name in the API response is unnecessary. Log details server-side and surface a generic message to clients.

-        entity_names.push(serde_json::to_value(&entity_name).map_err(|e| {
-            ErrorModel::internal(
-                format!("Failed to serialize entity name: {entity_name:?}, error: {e}"),
-                "InternalError",
-                None,
-            )
-        })?);
+        entity_names.push(serde_json::to_value(&entity_name).map_err(|e| {
+            tracing::error!(?e, entity_name_len = entity_name.len(), "Failed to serialize entity_name");
+            ErrorModel::internal(
+                "Failed to serialize entity name.",
+                "InternalError",
+                None,
+            )
+        })?);

195-213: Timeout logging on stale attempts is sound; include entity_name for observability.

LGTM. Consider making the timeout message a constant so producers/consumers can match on it reliably.

Also applies to: 214-256, 256-283


323-409: race: concurrent record_success calls can surface 404 instead of 409

If two writers race, the loser might observe neither the task row (already deleted) nor the log row (not yet inserted) and return 404 NotFound. If you prefer “idempotent completion” semantics, consider treating “no active task AND no log” as a conflict-retry case instead of NotFound, or re-check for a log after deletion fallback using a small retry.

Would you like a follow-up patch that converts the 404 in this narrow race to a 409 with a second-chance read of task_log?


996-998: Unnecessary use std::vec;.

The prelude already brings vec! into scope. Safe to drop.

-    use std::vec;
+    // unused import removed
crates/lakekeeper/src/implementations/postgres/namespace.rs (2)

361-361: Qualify warehouse_id to the tabular alias.

Avoid future ambiguity and improve readability.

-            WHERE warehouse_id = $1 AND ((ta.namespace_id = $2 AND metadata_location IS NOT NULL) OR (ta.namespace_id = ANY (SELECT namespace_id FROM child_namespaces)))
+            WHERE ta.warehouse_id = $1
+              AND (
+                (ta.namespace_id = $2 AND metadata_location IS NOT NULL)
+                OR ta.namespace_id = ANY (SELECT namespace_id FROM child_namespaces)
+              )

1005-1008: Add an assertion for the storage path to fully exercise join_location mapping.

Covers the second tuple element and validates fs_protocol/location wiring.

-        let r0 = &drop_info.child_tables[0];
-        assert_eq!(r0.0, TabularId::Table(*table.table_id));
-        assert_eq!(r0.2, table.table_ident);
+        let r0 = &drop_info.child_tables[0];
+        assert_eq!(r0.0, TabularId::Table(*table.table_id));
+        assert_eq!(r0.2, table.table_ident);
+        assert!(r0.1.ends_with(&format!("/{}/{}", table.namespace.join("."), table.table_name))),
.sqlx/query-b7f487b0716ee001fdc7da96025add0062c807d672989a180572e491a1676860.json (5)

3-3: Qualify warehouse_id for clarity and plan stability.

In tabulars CTE, use ta.warehouse_id for explicitness and to avoid accidental shadowing in future edits.

-            WHERE warehouse_id = $1 AND ((ta.namespace_id = $2 AND metadata_location IS NOT NULL) OR (ta.namespace_id = ANY (SELECT namespace_id FROM child_namespaces)))
+            WHERE ta.warehouse_id = $1 AND ((ta.namespace_id = $2 AND metadata_location IS NOT NULL) OR (ta.namespace_id = ANY (SELECT namespace_id FROM child_namespaces)))

3-3: Optional: Return cohesive JSON objects instead of parallel arrays.

To eliminate alignment risks entirely and simplify consumers, emit one jsonb_agg of per-tabular objects for both sets (deleted and non-deleted). This aligns with the new “entity_name” work across the PR.

-            ARRAY(SELECT tabular_id FROM tabulars WHERE deleted_at IS NULL ORDER BY tabular_id) AS "child_tabulars!",
-            ARRAY(SELECT to_jsonb(namespace_name) FROM tabulars WHERE deleted_at IS NULL ORDER BY tabular_id) AS "child_tabulars_namespace_names!: Vec<serde_json::Value>",
-            ARRAY(SELECT table_name FROM tabulars WHERE deleted_at IS NULL ORDER BY tabular_id) AS "child_tabulars_table_names!",
+            COALESCE(
+              (SELECT jsonb_agg(
+                 jsonb_build_object(
+                   'id', tabular_id,
+                   'entity_name', to_jsonb(namespace_name || ARRAY[table_name]),
+                   'namespace_name', to_jsonb(namespace_name),
+                   'table_name', table_name
+                 ) ORDER BY tabular_id)
+               FROM tabulars WHERE deleted_at IS NULL),
+              '[]'::jsonb
+            ) AS "child_tabulars!: serde_json::Value",

Note: Changing types requires updating the Rust model and re-preparing SQLx metadata.

After refactor, run cargo sqlx prepare to refresh artifacts.


3-3: Integrate entity_name output to align with the PR’s new task/entity naming.

Expose a combined entity_name for non-deleted tabulars to match the new NamedEntity semantics, avoiding client-side concatenation. No NULL checks needed per migration.

             ARRAY(SELECT table_name FROM tabulars WHERE deleted_at IS NULL ORDER BY tabular_id) AS "child_tabulars_table_names!",
+            ARRAY(SELECT to_jsonb(namespace_name || ARRAY[table_name]) FROM tabulars WHERE deleted_at IS NULL ORDER BY tabular_id) AS "child_tabulars_entity_name!: Vec<serde_json::Value>",

Context: entity_name is NOT NULL in task/task_log (migration 20250919101934_add_task_entity_name.sql), so downstream can rely on presence.


3-3: Minor: Prefer JOIN over = ANY(subquery) in tasks CTE for plan quality.

A semi-join tends to give better plans than scalar ANY; also keeps style consistent.

-        tasks AS (
-            SELECT t.task_id, t.status as task_status from task t
-            WHERE t.status = 'running' AND t.entity_id = ANY (SELECT tabular_id FROM tabulars) AND t.warehouse_id = $1 AND t.entity_type = 'tabular' AND queue_name = 'tabular_expiration'
-        )
+        tasks AS (
+            SELECT t.task_id, t.status AS task_status
+            FROM task t
+            JOIN tabulars ta2 ON t.entity_id = ta2.tabular_id
+            WHERE t.status = 'running'
+              AND t.warehouse_id = $1
+              AND t.entity_type = 'tabular'
+              AND t.queue_name = 'tabular_expiration'
+        )

32-35: Type naming nit: consider TextArray for namespace names if JSON not required.

If consumers don’t need JSONB specifically, returning text[] (Vec<Vec>) for namespace_name would be simpler and smaller over the wire.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d0ddbc7 and c419c54.

📒 Files selected for processing (5)
  • .sqlx/query-051e5bb69a2990241ffbc88d2a00308eea09eaf3af24db1698dcdefa087883ed.json (1 hunks)
  • .sqlx/query-5524e81f1eb8b7b1376a67df248b110810d5acfda79b5c0c7eda26b02ca4145c.json (1 hunks)
  • .sqlx/query-b7f487b0716ee001fdc7da96025add0062c807d672989a180572e491a1676860.json (1 hunks)
  • crates/lakekeeper/src/implementations/postgres/namespace.rs (6 hunks)
  • crates/lakekeeper/src/implementations/postgres/tasks.rs (30 hunks)
🧰 Additional context used
🧠 Learnings (9)
📓 Common learnings
Learnt from: c-thiel
PR: lakekeeper/lakekeeper#1353
File: crates/lakekeeper/src/implementations/postgres/tasks/get_task_details.rs:163-165
Timestamp: 2025-09-21T15:13:20.507Z
Learning: The entity_name column in the task and task_log tables is NOT NULL as enforced by the migration 20250919101934_add_task_entity_name.sql, which backfills existing rows and sets the constraint, so no NULL checking is needed in queries.
📚 Learning: 2025-08-31T11:28:55.756Z
Learnt from: c-thiel
PR: lakekeeper/lakekeeper#1316
File: .sqlx/query-0aeb5d6e3f65746cefe75e374c69780174a7474580da84345cb777e2343d0280.json:4-22
Timestamp: 2025-08-31T11:28:55.756Z
Learning: The task_final_status PostgreSQL enum and the primary key constraint on task_log(task_id, attempt) were both established in migration 20250523101407_tasks_store_their_state.sql, not missing from the schema.

Applied to files:

  • .sqlx/query-5524e81f1eb8b7b1376a67df248b110810d5acfda79b5c0c7eda26b02ca4145c.json
  • .sqlx/query-051e5bb69a2990241ffbc88d2a00308eea09eaf3af24db1698dcdefa087883ed.json
📚 Learning: 2025-08-31T11:58:20.890Z
Learnt from: c-thiel
PR: lakekeeper/lakekeeper#1316
File: .sqlx/query-755974eeec0224a16075e26d11f8d81d667eaa293e72ba1ccdec9050eb74e778.json:3-3
Timestamp: 2025-08-31T11:58:20.890Z
Learning: In .sqlx/query-755974eeec0224a16075e26d11f8d81d667eaa293e72ba1ccdec9050eb74e778.json, the UPDATE statement that sets progress = 0.0, picked_up_at = NULL, and execution_details = NULL is correct because this code branch only executes when max_retries_exceeded is true, and the intention is to reset the task state to make it available for pickup again in the retry mechanism.

Applied to files:

  • .sqlx/query-5524e81f1eb8b7b1376a67df248b110810d5acfda79b5c0c7eda26b02ca4145c.json
  • .sqlx/query-051e5bb69a2990241ffbc88d2a00308eea09eaf3af24db1698dcdefa087883ed.json
📚 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/namespace.rs
📚 Learning: 2025-09-21T15:13:20.507Z
Learnt from: c-thiel
PR: lakekeeper/lakekeeper#1353
File: crates/lakekeeper/src/implementations/postgres/tasks/get_task_details.rs:163-165
Timestamp: 2025-09-21T15:13:20.507Z
Learning: The entity_name column in the task and task_log tables is NOT NULL as enforced by the migration 20250919101934_add_task_entity_name.sql, which backfills existing rows and sets the constraint, so no NULL checking is needed in queries.

Applied to files:

  • crates/lakekeeper/src/implementations/postgres/tasks.rs
📚 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/src/implementations/postgres/tasks.rs
📚 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/src/implementations/postgres/tasks.rs
📚 Learning: 2025-09-01T16:37:05.746Z
Learnt from: c-thiel
PR: lakekeeper/lakekeeper#1322
File: .sqlx/query-be44977ba6988c517a6b29dfcca66c0e442ba443d27543be53cf43eb083670a2.json:3-3
Timestamp: 2025-09-01T16:37:05.746Z
Learning: In the task picking SQL query, non-scheduled tasks can only reach that state through pickup, which always sets last_heartbeat_at. Therefore, COALESCE fallbacks to picked_up_at are unnecessary for the heartbeat timeout check since last_heartbeat_at will never be NULL for tasks with status != 'scheduled'.

Applied to files:

  • crates/lakekeeper/src/implementations/postgres/tasks.rs
📚 Learning: 2025-09-01T16:37:05.746Z
Learnt from: c-thiel
PR: lakekeeper/lakekeeper#1322
File: .sqlx/query-be44977ba6988c517a6b29dfcca66c0e442ba443d27543be53cf43eb083670a2.json:3-3
Timestamp: 2025-09-01T16:37:05.746Z
Learning: The task picking query uses `(status = 'scheduled') OR (status != 'scheduled' AND heartbeat_check)` logic where scheduled tasks are always eligible for pickup regardless of heartbeat status, and only non-scheduled tasks need heartbeat timeout validation.

Applied to files:

  • crates/lakekeeper/src/implementations/postgres/tasks.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). (4)
  • GitHub Check: docker / docker
  • GitHub Check: docker / docker
  • GitHub Check: docker / docker
  • GitHub Check: docker / docker
🔇 Additional comments (18)
.sqlx/query-051e5bb69a2990241ffbc88d2a00308eea09eaf3af24db1698dcdefa087883ed.json (2)

3-3: Confirm attempt semantics across reschedule/pickup

UPDATE doesn’t bump task.attempt. If the next pickup increments attempt (common pattern), great. If not, subsequent logs may still target the same attempt and collide. Please confirm the pickup path increments attempt on new runs.


3-3: Good: entity_name is persisted in task_log insert

Including entity_name aligns with the NOT NULL constraint introduced by the migration; no extra COALESCE needed here.

.sqlx/query-5524e81f1eb8b7b1376a67df248b110810d5acfda79b5c0c7eda26b02ca4145c.json (2)

3-3: CTE-based reschedule + log looks solid; entity_name is propagated.

Row lock + idempotent insert via PK on (task_id, attempt) is correct. Aligns with NOT NULL entity_name migration.


5-31: Approved: SQL result columns match Rust mappings and intent of no in-place attempt increment is confirmed

crates/lakekeeper/src/implementations/postgres/tasks.rs (8)

86-116: Batch enqueue SQL and bindings look consistent.

Bindings, types, ON CONFLICT target, and text[] materialization from JSONB check out. Nice use of UNNEST to keep it set-based.

Also applies to: 127-140, 142-156


269-301: Entity name properly propagated in pick_task.

Selecting entity_name and threading through TaskMetadata is correct and matches the NOT NULL contract from the migration.


433-499: Failure recording paths are consistent (permanent vs retry) and propagate entity_name.

The CTE structure and status transitions look good. Nice touch resetting last_heartbeat_at on reschedule.

Also applies to: 501-579, 582-601


777-785: Reschedule resets last_heartbeat_at and picked_up_at — correct.

This matches the “fresh attempt” expectation when moving back to scheduled.


868-907: Cancellation logs now include entity_name — good for auditability.

Insert lists and SELECT sources are aligned; ON CONFLICT DO NOTHING preserves idempotency.

Also applies to: 929-974


1574-1639: Batch queue/pick tests validate entity_name round‑trip.

Assertions cover both tasks; good signal.


1927-2001: record_success tests cover conflict and not‑found cases well.

Nice coverage of first-write-wins and duplicate submissions.

Also applies to: 2003-2045


2111-2199: record_failure tests exercise both retry and terminal failure, including duplicate conflicts.

Good balance and clear expectations.

Also applies to: 2200-2219

crates/lakekeeper/src/implementations/postgres/namespace.rs (5)

5-8: LGTM: imports are appropriate.

Bringing in TableIdent and izip matches the new wiring below.


346-346: LGTM: selecting namespace_name for later TableIdent derivation.


351-351: LGTM: include child namespace_name for per-tabular derivation.


361-361: Nice: explicit parentheses fix the AND/OR precedence.


512-546: LGTM: robust JSON-to-NamespaceIdent conversion with helpful diagnostics.

.sqlx/query-b7f487b0716ee001fdc7da96025add0062c807d672989a180572e491a1676860.json (1)

8-10: Double-check non-null contract vs. upstream validation.

"is_protected!" is asserted non-null. Ensure callers never query nonexistent namespace_id for a warehouse; otherwise, this will fail at decode time.

@c-thiel

c-thiel commented Sep 21, 2025

Copy link
Copy Markdown
Member Author

@CodeRabbit review

@coderabbitai

coderabbitai Bot commented Sep 21, 2025

Copy link
Copy Markdown
Contributor
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@github-actions

Copy link
Copy Markdown
Contributor

✅ PR Title Formatted Correctly

The title of this PR match the correct format. Thank you!

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (12)
.sqlx/query-a2c36625c1e60e31d18c6128eaf39b7f6120636c1744e89b0cb92f7664dad758.json (1)

3-3: Simplify active-warehouse check; remove redundant IN-subquery

You already constrain namespace rows with warehouse_id = $1. The additional warehouse_id IN (SELECT warehouse_id ... AND warehouse_id = $1) is redundant and harder to read. Prefer an EXISTS (or a USING join) to gate deletions on the warehouse being active. This also makes intent explicit and avoids tying the subquery to the target table’s column.

Also confirm desired behavior: if the warehouse is inactive, this silently deletes 0 rows. If you expect an explicit error, perform a prior check or return a domain error upstream.

-            AND warehouse_id IN (
-                SELECT warehouse_id FROM warehouse WHERE status = 'active'
-                AND warehouse_id = $1
-            )
+            AND EXISTS (
+                SELECT 1 FROM warehouse
+                WHERE warehouse_id = $1 AND status = 'active'
+            )

Alternative (often clearer/planner-friendly):

DELETE FROM namespace n
USING warehouse w
WHERE n.warehouse_id = $1
  AND (n.namespace_id = ANY($2) OR n.namespace_id = $3)
  AND w.warehouse_id = $1
  AND w.status = 'active';
.sqlx/query-fa7cc5c2ddd163fc220261184ff53c71564497451e7ae6c2c451dc1d316453b6.json (3)

3-3: Add ORDER BY to all ARRAY(...) subqueries to ensure deterministic results.

ARRAY(SELECT ...) without ORDER BY yields non-deterministic ordering, which can cause flaky API responses and tests. Order by a stable key (e.g., tabular_id, table_name, namespace_id, task_id).

Example SQL-focused diff (illustrative subset):

-ARRAY(SELECT tabular_id FROM tabulars where deleted_at is NULL) AS "child_tabulars!",
+ARRAY(
+  SELECT tabular_id FROM tabulars
+  WHERE deleted_at IS NULL
+  ORDER BY tabular_id
+) AS "child_tabulars!",

-ARRAY(SELECT to_jsonb(namespace_name) FROM tabulars where deleted_at is NULL) AS "child_tabulars_namespace_names!: Vec<serde_json::Value>",
+ARRAY(
+  SELECT to_jsonb(namespace_name) FROM tabulars
+  WHERE deleted_at IS NULL
+  ORDER BY table_name
+) AS "child_tabulars_namespace_names!: Vec<serde_json::Value>",

-ARRAY(SELECT table_name FROM tabulars where deleted_at is NULL) AS "child_tabulars_table_names!",
+ARRAY(
+  SELECT table_name FROM tabulars
+  WHERE deleted_at IS NULL
+  ORDER BY table_name
+) AS "child_tabulars_table_names!",

-ARRAY(SELECT fs_protocol FROM tabulars where deleted_at is NULL) AS "child_tabular_fs_protocol!",
+ARRAY(
+  SELECT fs_protocol FROM tabulars
+  WHERE deleted_at IS NULL
+  ORDER BY tabular_id
+) AS "child_tabular_fs_protocol!",

-ARRAY(SELECT fs_location FROM tabulars where deleted_at is NULL) AS "child_tabular_fs_location!",
+ARRAY(
+  SELECT fs_location FROM tabulars
+  WHERE deleted_at IS NULL
+  ORDER BY tabular_id
+) AS "child_tabular_fs_location!",

-ARRAY(SELECT typ FROM tabulars where deleted_at is NULL) AS "child_tabular_typ!: Vec<TabularType>",
+ARRAY(
+  SELECT typ FROM tabulars
+  WHERE deleted_at IS NULL
+  ORDER BY tabular_id
+) AS "child_tabular_typ!: Vec<TabularType>",

-ARRAY(SELECT tabular_id FROM tabulars where deleted_at is not NULL) AS "child_tabulars_deleted!",
+ARRAY(
+  SELECT tabular_id FROM tabulars
+  WHERE deleted_at IS NOT NULL
+  ORDER BY tabular_id
+) AS "child_tabulars_deleted!",

-ARRAY(SELECT namespace_id FROM child_namespaces) AS "child_namespaces!",
+ARRAY(
+  SELECT namespace_id FROM child_namespaces
+  ORDER BY namespace_id
+) AS "child_namespaces!",

-ARRAY(SELECT task_id FROM tasks) AS "child_tabular_task_id!: Vec<Uuid>"
+ARRAY(
+  SELECT task_id FROM tasks
+  ORDER BY task_id
+) AS "child_tabular_task_id!: Vec<Uuid>"

Remember to re-run sqlx prepare to refresh the artifact.


3-3: Use a JOIN instead of ANY(SELECT ...) for tasks CTE.

JOINing task to the tabulars CTE is typically clearer and helps the planner use indexes more effectively.

-WITH ...,
-        tasks AS (
-            SELECT t.task_id, t.queue_name, t.status as task_status from task t
-            WHERE t.entity_id = ANY (SELECT tabular_id FROM tabulars) AND t.warehouse_id = $1 AND t.entity_type = 'tabular'
-        )
+WITH ...,
+        tasks AS (
+            SELECT t.task_id, t.queue_name, t.status AS task_status
+            FROM task t
+            JOIN tabulars ta ON t.entity_id = ta.tabular_id
+            WHERE t.warehouse_id = $1
+              AND t.entity_type = 'tabular'
+        )

3-3: Prefix match on namespace_name may need indexing support.

The slice-prefix comparison on namespace_name arrays can be expensive. Consider ltree/ltxtquery or a functional index on the array slice to keep this fast as namespace counts grow.

crates/lakekeeper/src/implementations/postgres/namespace.rs (5)

357-362: Qualify columns in WHERE for clarity (non-functional change)

Unqualified warehouse_id and metadata_location read from tabular ta, but explicit qualification improves readability and guards future refactors.

Apply this diff:

-            WHERE warehouse_id = $1 AND metadata_location IS NOT NULL AND (ta.namespace_id = $2 OR (ta.namespace_id = ANY (SELECT namespace_id FROM child_namespaces)))
+            WHERE ta.warehouse_id = $1
+              AND ta.metadata_location IS NOT NULL
+              AND (ta.namespace_id = $2 OR ta.namespace_id = ANY (SELECT namespace_id FROM child_namespaces))

Earlier feedback discussed AND/OR precedence. Please confirm the intent is to require metadata_location IS NOT NULL for both the root namespace and its children. If the original intent was only to enforce it for the root, we should use: ta.warehouse_id = $1 AND ((ta.namespace_id = $2 AND ta.metadata_location IS NOT NULL) OR ta.namespace_id = ANY(...)).


368-378: Type-annotate ARRAY fields for stronger compile-time guarantees

Add explicit SQLx type hints to avoid accidental Vec<Option<_>> inference and enforce non-null element types where appropriate.

Apply this diff:

-            ARRAY(SELECT to_jsonb(namespace_name) FROM tabulars where deleted_at is NULL) AS "child_tabulars_namespace_names!: Vec<serde_json::Value>",
-            ARRAY(SELECT table_name FROM tabulars where deleted_at is NULL) AS "child_tabulars_table_names!",
-            ARRAY(SELECT fs_protocol FROM tabulars where deleted_at is NULL) AS "child_tabular_fs_protocol!",
-            ARRAY(SELECT fs_location FROM tabulars where deleted_at is NULL) AS "child_tabular_fs_location!",
+            ARRAY(SELECT to_jsonb(namespace_name) FROM tabulars where deleted_at is NULL) AS "child_tabulars_namespace_names!: Vec<serde_json::Value>",
+            ARRAY(SELECT table_name        FROM tabulars where deleted_at is NULL) AS "child_tabulars_table_names!: Vec<String>",
+            ARRAY(SELECT fs_protocol       FROM tabulars where deleted_at is NULL) AS "child_tabular_fs_protocol!: Vec<String>",
+            ARRAY(SELECT fs_location       FROM tabulars where deleted_at is NULL) AS "child_tabular_fs_location!: Vec<String>",

Confirm the underlying columns are non-null; otherwise use Vec<Option<String>>.


449-450: Minor: redundant warehouse filter in DELETE subquery

AND warehouse_id = $1 is already enforced outside; keeping it twice is harmless but noisy.

Consider simplifying to:

-            AND warehouse_id IN (
-                SELECT warehouse_id FROM warehouse WHERE status = 'active'
-                AND warehouse_id = $1
-            )
+            AND EXISTS (
+                SELECT 1 FROM warehouse w
+                WHERE w.warehouse_id = $1 AND w.status = 'active'
+            )

490-505: Add defensive length checks before zipping multiple arrays

Although the arrays originate from the same CTE and filters, a debug-time assertion helps catch future query changes that break alignment.

Apply this diff:

     Ok(NamespaceDropInfo {
         child_namespaces: info.child_namespaces.into_iter().map(Into::into).collect(),
-        child_tables: izip!(
+        child_tables: {
+            debug_assert_eq!(info.child_tabulars.len(),                 info.child_tabular_fs_protocol.len());
+            debug_assert_eq!(info.child_tabulars.len(),                 info.child_tabular_fs_location.len());
+            debug_assert_eq!(info.child_tabulars.len(),                 info.child_tabular_typ.len());
+            debug_assert_eq!(info.child_tabulars.len(),                 info.child_tabulars_namespace_names.len());
+            debug_assert_eq!(info.child_tabulars.len(),                 info.child_tabulars_table_names.len());
+            izip!(
             info.child_tabulars,
             info.child_tabular_fs_protocol,
             info.child_tabular_fs_location,
             info.child_tabular_typ,
             info.child_tabulars_namespace_names,
             info.child_tabulars_table_names
-        )
+            )
         .map(|(id, protocol, fs_location, typ, ns_name, t_name)| {
             let table_ident = TableIdent::new(json_value_to_namespace_ident(ns_name)?, t_name);
             Ok::<_, ErrorModel>((
                 match typ {
                     TabularType::Table => TabularId::Table(id),
                     TabularType::View => TabularId::View(id),
                 },
                 join_location(protocol.as_str(), fs_location.as_str()),
                 table_ident,
             ))
-        })
-        .collect::<Result<Vec<_>, _>>()?,
+        })
+        .collect::<Result<Vec<_>, _>>()?
+        },

513-547: json_value_to_namespace_ident: tiny polish

Pre-allocate and tighten error messages; logic is otherwise sound.

Apply this diff:

-    if let serde_json::Value::Array(arr) = v {
-        let str_vec: Result<Vec<String>, ErrorModel> = arr
+    if let serde_json::Value::Array(arr) = v {
+        let mut out = Vec::with_capacity(arr.len());
+        let str_vec: Result<Vec<String>, ErrorModel> = arr
             .into_iter()
             .map(|item| {
                 if let serde_json::Value::String(s) = item {
-                    Ok(s)
+                    Ok(s)
                 } else {
                     Err(ErrorModel::internal(
                         "Error converting namespace",
                         "NamespaceConversionError",
                         None,
                     )
                     .append_detail(format!(
                         "Expected string in namespace array, found: {item:?}"
                     )))
                 }
             })
             .collect();
.sqlx/query-d7dd04f6a1cd6cfc7d6105516f8dc4230ebc3d20fb42bc4ef718745eb7d4059e.json (1)

3-3: Polish: simpler aggregation and leaner CTE.

  • Prefer COUNT(*) over COUNT(task_id).
  • Drop status from the CTE select if unused.
  • Rename active_tasks → unfinished_tasks to reflect semantics.
crates/lakekeeper/src/implementations/postgres/warehouse.rs (2)

449-449: Fix misleading error text.

This path no longer deletes tasks; it counts unfinished tasks. Update message for accuracy.

-    ).fetch_all(&mut **transaction).await.map_err(|e| e.into_error_model("Error deleting tasks for warehouse"))?;
+    ).fetch_all(&mut **transaction).await.map_err(|e| e.into_error_model("Error fetching unfinished tasks for warehouse"))?;

446-448: Optional: filter only non‑terminal task statuses using a typed array param (avoid string literals).

Change the query in crates/lakekeeper/src/implementations/postgres/warehouse.rs (around lines ~445–448) to add a status filter like AND status = ANY($2::task_intermediate_status[]) and pass a Vec of the non‑terminal/intermediate statuses from a helper (e.g., TaskStatus::unfinished_variants() returning Scheduled, Running, ShouldStop). No such helper was found in the repo; other queries already use the ::task_intermediate_status[] pattern.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c419c54 and ba8259b.

📒 Files selected for processing (6)
  • .sqlx/query-a2c36625c1e60e31d18c6128eaf39b7f6120636c1744e89b0cb92f7664dad758.json (2 hunks)
  • .sqlx/query-d7dd04f6a1cd6cfc7d6105516f8dc4230ebc3d20fb42bc4ef718745eb7d4059e.json (2 hunks)
  • .sqlx/query-fa7cc5c2ddd163fc220261184ff53c71564497451e7ae6c2c451dc1d316453b6.json (1 hunks)
  • crates/lakekeeper/src/catalog/namespace.rs (3 hunks)
  • crates/lakekeeper/src/implementations/postgres/namespace.rs (8 hunks)
  • crates/lakekeeper/src/implementations/postgres/warehouse.rs (1 hunks)
🧰 Additional context used
🧠 Learnings (8)
📓 Common learnings
Learnt from: c-thiel
PR: lakekeeper/lakekeeper#1353
File: crates/lakekeeper/src/implementations/postgres/tasks/get_task_details.rs:163-165
Timestamp: 2025-09-21T15:13:20.532Z
Learning: The entity_name column in the task and task_log tables is NOT NULL as enforced by the migration 20250919101934_add_task_entity_name.sql, which backfills existing rows and sets the constraint, so no NULL checking is needed in queries.
📚 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/warehouse.rs
📚 Learning: 2025-08-31T11:58:20.890Z
Learnt from: c-thiel
PR: lakekeeper/lakekeeper#1316
File: .sqlx/query-755974eeec0224a16075e26d11f8d81d667eaa293e72ba1ccdec9050eb74e778.json:3-3
Timestamp: 2025-08-31T11:58:20.890Z
Learning: In .sqlx/query-755974eeec0224a16075e26d11f8d81d667eaa293e72ba1ccdec9050eb74e778.json, the UPDATE statement that sets progress = 0.0, picked_up_at = NULL, and execution_details = NULL is correct because this code branch only executes when max_retries_exceeded is true, and the intention is to reset the task state to make it available for pickup again in the retry mechanism.

Applied to files:

  • .sqlx/query-d7dd04f6a1cd6cfc7d6105516f8dc4230ebc3d20fb42bc4ef718745eb7d4059e.json
📚 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/namespace.rs
📚 Learning: 2025-09-21T21:31:17.161Z
Learnt from: c-thiel
PR: lakekeeper/lakekeeper#1353
File: crates/lakekeeper/src/implementations/postgres/namespace.rs:0-0
Timestamp: 2025-09-21T21:31:17.161Z
Learning: In PostgreSQL queries with multiple ARRAY() subqueries from the same CTE/table, when the subqueries are simple (without complex joins or processing that might reorder results), explicit ORDER BY clauses are not required for index-wise alignment between arrays. The aggregate functions will process rows in the same order as supplied by the FROM clause, ensuring consistent ordering across multiple array aggregates.

Applied to files:

  • crates/lakekeeper/src/implementations/postgres/namespace.rs
📚 Learning: 2025-09-21T21:30:52.078Z
Learnt from: c-thiel
PR: lakekeeper/lakekeeper#1353
File: .sqlx/query-b7f487b0716ee001fdc7da96025add0062c807d672989a180572e491a1676860.json:0-0
Timestamp: 2025-09-21T21:30:52.078Z
Learning: In PostgreSQL queries using ARRAY(SELECT ...) constructs from the same CTE or table source, explicit ORDER BY clauses are not required when the arrays need to maintain index alignment, as the aggregate functions will process rows in the same order from the same source.

Applied to files:

  • crates/lakekeeper/src/implementations/postgres/namespace.rs
📚 Learning: 2025-09-18T17:32:31.061Z
Learnt from: c-thiel
PR: lakekeeper/lakekeeper#1254
File: .sqlx/query-c3d504db2b139d6f6cbd1802987414791825a842cf6cbdc26e0dbf1a2467eb64.json:3-3
Timestamp: 2025-09-18T17:32:31.061Z
Learning: When reviewing PostgreSQL queries with ARRAY_AGG/JSONB_AGG in simple subqueries without complex joins or processing that might reorder results, explicit ORDER BY clauses are not required for consistency. The aggregate functions will process rows in the same order across executions when the underlying data and query execution plan remain stable.

Applied to files:

  • crates/lakekeeper/src/implementations/postgres/namespace.rs
📚 Learning: 2025-09-18T20:08:00.663Z
Learnt from: c-thiel
PR: lakekeeper/lakekeeper#1254
File: .sqlx/query-552ddb89100de8fb3c374e95c885dfd2da32c9d51d30acf2d60811edbd545dbc.json:3-3
Timestamp: 2025-09-18T20:08:00.663Z
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/namespace.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). (8)
  • GitHub Check: docker / docker
  • GitHub Check: docker / docker
  • GitHub Check: docker / docker
  • GitHub Check: docker / docker
  • GitHub Check: test
  • GitHub Check: check-generated-openapi-matches
  • GitHub Check: clippy
  • GitHub Check: sqlx-check
🔇 Additional comments (12)
.sqlx/query-a2c36625c1e60e31d18c6128eaf39b7f6120636c1744e89b0cb92f7664dad758.json (1)

15-15: Hash update looks consistent with the query change

Mechanical update; no issues. Remember to rerun sqlx prepare after any further edits.

.sqlx/query-fa7cc5c2ddd163fc220261184ff53c71564497451e7ae6c2c451dc1d316453b6.json (2)

3-3: Confirm intent: include tasks for deleted tabulars?

tasks is derived from all tabulars (deleted and non-deleted), while downstream arrays split deleted vs non-deleted tabulars. If tasks should only reflect active tabulars, restrict tasks to ta.deleted_at IS NULL.


32-35: Validate sqlx mapping for jsonb[] → Vec<serde_json::Value>.

Alias suggests Vec<serde_json::Value> for JsonbArray. This is generally fine, but confirm the consuming Rust type matches exactly and that you’re on a sqlx version that supports jsonb arrays without a custom decoder.

Also applies to: 84-87

crates/lakekeeper/src/catalog/namespace.rs (2)

31-31: LGTM: surface import of NamedEntity

Import aligns with usage of into_name_parts below.


493-505: Good: propagate entity_name into purge tasks

Using tabular_ident.into_name_parts() ensures a stable, fully-qualified entity name for tracing/UI.

Please confirm the intended semantics: do we want the full ident (namespace parts + object) as entity_name, not just the leaf name? If yes, this is correct.

crates/lakekeeper/src/implementations/postgres/namespace.rs (7)

5-8: LGTM: new imports for TableIdent and izip

Both are used appropriately in drop_namespace.


346-356: LGTM: include protection flags in CTEs

Selecting protected in namespace_info and child_namespaces supports the later checks without extra queries.


364-366: LGTM: tasks CTE scoped correctly

Filters by entity_type, warehouse_id, and the relevant entity IDs.


372-372: LGTM: explicit running-expiration guard

The tabular_expiration running check prevents racing with active lifecycle tasks.


435-439: LGTM: conflict on running expiration

Clear user-facing error; matches the guard above.


946-967: LGTM: negative test for missing namespace

Covers NOT_FOUND path on drop.


1028-1031: LGTM: verifies TableIdent round-trip

Ensures the new composite (namespace + table name) is reconstructed correctly.

@c-thiel

c-thiel commented Sep 22, 2025

Copy link
Copy Markdown
Member Author

@CodeRabbit review
Anything still open?

@coderabbitai

coderabbitai Bot commented Sep 22, 2025

Copy link
Copy Markdown
Contributor

@c-thiel I'll review the changes and check for any open issues.

Looking at this PR, you've implemented a comprehensive feature to add entity names to tasks throughout the system. The changes include:

  • Database migration to add entity_name columns to both task and task_log tables
  • API updates to expose the new field in task responses
  • Service layer updates to propagate entity names through all task operations
  • Extensive SQLx query updates to handle the new field
  • Test updates across the codebase

The implementation looks thorough and well-integrated. The migration properly populates existing data with meaningful entity names derived from namespace and tabular information, defaulting to ['unknown'] where needed.

A few observations:

  1. The feature is consistently implemented across all task-related operations (creation, listing, details, logging)
  2. The database constraints are properly enforced (NOT NULL after population)
  3. API documentation has been updated to reflect the new field
  4. Test coverage appears comprehensive

I don't see any critical issues that would block this PR. The implementation follows good practices for schema evolution and maintains backward compatibility through proper migration handling.

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

mrjoe7 added a commit to mrjoe7/lakekeeper that referenced this pull request Oct 30, 2025
* 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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant