Skip to content

fix(catalog): concurrent namespace property updates keep each other's changes - #2283

Merged
c-thiel merged 1 commit into
mainfrom
ct/namespace-properties-atomic
Nov 13, 2026
Merged

c-thiel merged 1 commit into
mainfrom
ct/namespace-properties-atomic

Conversation

@c-thiel

@c-thiel c-thiel commented Nov 13, 2026 •

Copy link
Copy Markdown
Member

Two clients updating the properties of one namespace at the same time could silently lose one client's change, even when they changed different keys.

Each update now changes only the keys it names, on the stored properties, under a lock on the namespace row. If two updates set the same key, the later one wins. Every request still returns 200, and updated, removed and missing describe what that request changed.

Release notes

Bug Fixes

  • Namespace properties: concurrent updates keep each other's changes. Each update changes only the keys it names. If two updates set the same key, the later one wins.

Downstream follow-up

  • CatalogStore::update_namespace_properties_impl and CatalogNamespaceOps::update_namespace_properties take updates: &HashMap<String, String> and removals: &[String] instead of the final property map. They return the new UpdatedNamespaceProperties: the namespace after the update and the properties the call replaced.

Summary by CodeRabbit

  • New Features
    • Namespace properties can now be updated or removed individually while preserving other properties.
    • When a property is both removed and updated in the same request, the update is applied.
  • Bug Fixes
    • Concurrent property changes are handled without overwriting unrelated updates. Responses accurately report changed, removed, and missing properties.

… changes

Two clients updating the properties of one namespace at the same time could silently lose one client's change, even when they changed different keys. Each update now locks the namespace row and changes only the keys it names on the stored properties. If two updates set the same key, the later one wins. Every request still returns 200, and `updated`, `removed` and `missing` describe what that request changed.
@coderabbitai

coderabbitai Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Namespace property updates now accept separate update and removal inputs. The catalog returns the updated namespace and prior properties. The server builds response key lists from those prior properties. PostgreSQL and integration tests cover partial changes and concurrent updates.

Changes

Namespace Property Updates

Layer / File(s) Summary
Catalog contract and property persistence
crates/lakekeeper/src/service/catalog_store/namespace.rs, crates/lakekeeper/src/service/catalog_store.rs, crates/lakekeeper-storage-postgres/src/catalog.rs, crates/lakekeeper-storage-postgres/src/namespace.rs, crates/lakekeeper-storage-postgres/src/migrations/mod.rs
The catalog accepts updates and removals separately and returns the updated namespace with prior properties. PostgreSQL applies removals before updates and preserves other keys. Storage tests cover partial updates and empty properties.
Server update and response handling
crates/lakekeeper/src/server/namespace.rs
The server passes normalized updates and removals to the catalog. Its response reports updated, removed, and missing keys based on prior properties.
Property update test coverage
crates/lakekeeper-integration-tests/tests/namespace_ops.rs
Integration tests check concurrent distinct-key updates, mixed additions and removals, and concurrent removals of the same key. Existing helpers and call sites use the updated API inputs.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Bug fix

Sequence Diagram(s)

sequenceDiagram
  participant NamespaceAPI
  participant CatalogNamespaceOps
  participant PostgreSQL
  NamespaceAPI->>CatalogNamespaceOps: Send updates and removals
  CatalogNamespaceOps->>PostgreSQL: Apply removals, then updates
  PostgreSQL-->>CatalogNamespaceOps: Return updated namespace and prior properties
  CatalogNamespaceOps-->>NamespaceAPI: Return update outcome
  NamespaceAPI->>NamespaceAPI: Build updated, removed, and missing key response
Loading

Suggested reviewers: brgr-s

Merge Risk: Minimal · up to b751d

This change makes concurrent namespace property updates keep each other's changes by locking the namespace row and modifying only the named keys. Added tests cover concurrent updates, removals and mixed operations. No concrete merge-blocking risk was identified.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the main change: concurrent namespace property updates no longer overwrite each other's changes. The raw summary shows the core change is that updates and removals now apply per key un…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: concurrent namespace property updates no longer overwrite each other's changes. The raw summary shows the core change is that updates and removals now apply per key under a row lock on the namespace, with separate updates and removals inputs. The title matches the PR objective and the changed files. It uses the conventional commit form and stays within one line.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

A rabbit watched the keys take flight,
Then saw new values land just right.
The old ones left, the new ones stayed,
While many careful calls were made.
The rabbit thumped: “The lists are clear!”

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 9649318e-5374-4564-b880-72dcd186b2c5
Commits

Reviewing files that changed from the base of the PR and between 04526c4 and b751d3a.

Files ignored due to path filters: 2

  • .sqlx/query-1f603817b5ec654dc66fe39f4540ca2c8109c4c61af3408b15183ea94574caba.json is excluded by !.sqlx/**
  • .sqlx/query-3504ceb67bdb755a9f33194d960e897f0c6e09a3816531f352a35b57ee6bc482.json is excluded by !.sqlx/**
Files selected for processing: 7

  • crates/lakekeeper-integration-tests/tests/namespace_ops.rs
  • crates/lakekeeper-storage-postgres/src/catalog.rs
  • crates/lakekeeper-storage-postgres/src/migrations/mod.rs
  • crates/lakekeeper-storage-postgres/src/namespace.rs
  • crates/lakekeeper/src/server/namespace.rs
  • crates/lakekeeper/src/service/catalog_store.rs
  • crates/lakekeeper/src/service/catalog_store/namespace.rs

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

@github-actions

Copy link
Copy Markdown
Contributor

✅ PR Title Formatted Correctly

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

@c-thiel
c-thiel merged commit 215080e into main Nov 13, 2026
73 checks passed
@c-thiel
c-thiel deleted the ct/namespace-properties-atomic branch November 13, 2026 09:03
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