Repository navigation
Conversation
…se from LoadTableResult.
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the WalkthroughAdds ETAG support end-to-end: xxh3-based ETag generation in iceberg-ext, If-None-Match parsing, a new Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant Router
participant Service
participant Loader
Client->>Router: GET /tables/{id} (If-None-Match: ...)
Router->>Router: parse_if_none_match(headers) → Vec\<ETag>
Router->>Service: load_table(params, ..., etags)
Service->>Loader: load_table(..., etags)
alt etag matches current table
Loader-->>Service: NotModified (with current ETag)
Service-->>Router: NotModified
Router->>Router: IntoResponse → 304 + ETag header
Router-->>Client: 304 Not Modified + ETag
else not matched
Loader-->>Service: LoadTableResult (includes metadata_location)
Service-->>Router: LoadTableResult
Router->>Router: IntoResponse -> create_etag(metadata_location)
Router-->>Client: 200 OK + JSON body + ETag
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes
Possibly related PRs
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
|
There was a problem hiding this comment.
Actionable comments posted: 5
🧹 Nitpick comments (3)
crates/iceberg-ext/src/catalog/rest/table.rs (1)
173-207: Consider extracting duplicate test helper to a common module.The
create_table_metadata_mockfunction appears to be duplicated fromcrates/lakekeeper/src/api/iceberg/v1/tables.rs(lines 803-837). Consider extracting this to a shared test utility module to avoid code duplication and ensure consistency across tests.crates/lakekeeper/src/server/tables/load_table.rs (1)
27-43: ETag helper semantics are sound; consider tiny refinements
get_etagcorrectly derives an ETag fromTabularInfo.metadata_locationusing the samecreate_etaghelper as the HTTP response path, so 200/304 paths stay consistent.etag_already_present’s wildcard logic (*meaning “any representation”) also matches typicalIf-None-Matchsemantics. Two minor nits you could optionally address later:
etags.contains(&"*".to_string())allocates on each call;etags.iter().any(|e| e == "*")would avoid that.- If you ever reuse
etag_already_presentfor resources that legitimately have no ETag, returningNotModifiedResponse(etag.unwrap_or_default())would emit an emptyETag; today that can’t happen because active tables always have a metadata location, but it’s worth keeping the invariant in mind.crates/lakekeeper/src/api/iceberg/v1/tables.rs (1)
409-416:parse_etags/parse_if_none_matchnormalization is robust; consider multi-header support laterThe parsing helpers:
- Strip surrounding whitespace, outer and inner quotes, and leading
W/where present, so callers always see bare tag tokens (or"*").- Split on commas and filter out empty/whitespace-only segments, which matches how typical
If-None-Matchheaders are formatted.- Are thoroughly exercised by the tests, including mixed quoting, weak/strong tags, doubled quotes, and empty/space-only headers.
One optional improvement if you ever need stricter RFC handling:
parse_if_none_matchcurrently usesheaders.get(header::IF_NONE_MATCH)and therefore only sees a single header value; if multipleIf-None-Matchheaders are ever emitted separately, you could switch toget_all(...).iter()and join them with commas before passing intoparse_etags.Also applies to: 457-478
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
Cargo.lockis excluded by!**/*.lock
📒 Files selected for processing (9)
Cargo.toml(4 hunks)crates/iceberg-ext/Cargo.toml(1 hunks)crates/iceberg-ext/src/catalog/mod.rs(1 hunks)crates/iceberg-ext/src/catalog/rest/table.rs(2 hunks)crates/lakekeeper/src/api/iceberg/mod.rs(1 hunks)crates/lakekeeper/src/api/iceberg/v1/tables.rs(8 hunks)crates/lakekeeper/src/server/tables.rs(20 hunks)crates/lakekeeper/src/server/tables/load_table.rs(14 hunks)crates/lakekeeper/src/tests/soft_deletion.rs(2 hunks)
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2025-08-19T07:33:45.608Z
Learnt from: c-thiel
Repo: lakekeeper/lakekeeper PR: 1285
File: crates/lakekeeper/src/service/storage/mod.rs:1354-1356
Timestamp: 2025-08-19T07:33:45.608Z
Learning: In test code (#[cfg(test)]), unreachable!() is often appropriate when it indicates a programming error in test setup, unlike production code where graceful error handling is preferred. Test helpers should fail fast when called with invalid configurations.
Applied to files:
crates/lakekeeper/src/api/iceberg/v1/tables.rs
📚 Learning: 2025-11-07T15:17:22.491Z
Learnt from: c-thiel
Repo: lakekeeper/lakekeeper PR: 1484
File: crates/lakekeeper/src/server/tables.rs:820-859
Timestamp: 2025-11-07T15:17:22.491Z
Learning: In the lakekeeper codebase, when refreshing namespaces during table operations (e.g., in `refresh_warehouse_and_namespace` in `crates/lakekeeper/src/server/tables.rs`), the refresh should use `namespace.namespace_ident()` rather than `namespace.namespace_id()`. This ensures that if a namespace is renamed between the initial fetch and the refresh, the operation fails rather than silently continuing with the renamed namespace. User intent is bound to the namespace ident they specified, not the underlying stable namespace ID.
Applied to files:
crates/lakekeeper/src/server/tables.rs
🧬 Code graph analysis (5)
crates/iceberg-ext/src/catalog/rest/table.rs (1)
crates/lakekeeper/src/api/iceberg/v1/tables.rs (2)
create_table_metadata_mock(804-838)from(68-73)
crates/lakekeeper/src/api/iceberg/mod.rs (1)
crates/lakekeeper/src/implementations/postgres/tabular/table/mod.rs (1)
tables(491-491)
crates/iceberg-ext/src/catalog/mod.rs (1)
crates/iceberg-ext/src/catalog/rest/table.rs (1)
create_etag(109-112)
crates/lakekeeper/src/api/iceberg/v1/tables.rs (1)
crates/iceberg-ext/src/catalog/rest/table.rs (1)
into_response(116-124)
crates/lakekeeper/src/server/tables/load_table.rs (1)
crates/iceberg-ext/src/catalog/rest/table.rs (1)
create_etag(109-112)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (9)
- GitHub Check: test
- GitHub Check: clippy
- GitHub Check: check-generated-openapi-matches
- GitHub Check: sqlx-check
- GitHub Check: docker / docker
- GitHub Check: docker / docker
- GitHub Check: docker / docker
- GitHub Check: docker / docker
- GitHub Check: security_audit
🔇 Additional comments (12)
crates/iceberg-ext/Cargo.toml (1)
41-41: LGTM!The
xxhash-rustdependency with thexxh3feature is appropriate for efficient ETag generation.crates/iceberg-ext/src/catalog/mod.rs (1)
31-31: LGTM!The
create_etagfunction is appropriately exposed as part of the public API from the table module.crates/iceberg-ext/src/catalog/rest/table.rs (1)
1-8: LGTM!The imports are properly feature-gated for axum and include the necessary xxhash functionality.
crates/lakekeeper/src/tests/soft_deletion.rs (1)
14-15: Soft-deletion test adapts correctly to new ETag-aware APIUsing
Vec::new()foretagsand explicitly matching onLoadTableResultOrNotModified::LoadTableResultis the right way to keep this test focused on table restoration while treatingNotModifiedas an unexpected outcome.Also applies to: 221-237
crates/lakekeeper/src/api/iceberg/mod.rs (1)
25-32: Re-export ofLoadTableResultOrNotModifiedis consistent with the new tables APIAdding
LoadTableResultOrNotModifiedto the v1 tables re-exports keeps the public iceberg API aligned with the new load-table semantics and avoids scattered import paths.crates/lakekeeper/src/server/tables/load_table.rs (2)
47-55: EarlyIf-None-Matchshort‑circuit is correct and consistent with the ETag formatThe updated
load_table:
- Accepts
etags: Vec<String>from the router and normalizes the current ETag by stripping quotes before comparison, which matches howparse_if_none_matchnormalizes incoming values.- Short-circuits to
LoadTableResultOrNotModified::NotModifiedResponse(etag)before doing the heavier metadata load when any provided tag (or*) matches the current ETag.- Still falls back to the full
LoadTableResultpath, wrapped in the enum, so existing callers can destructure and keep their previous behavior.This keeps the hot path simple while enabling correct 304 responses without changing the storage/catalog logic.
Also applies to: 72-93, 161-170
243-337: ETag-specific tests cover the critical behaviorsThe new test setup (
setup_simple_table) plus the three NotModified tests exercise:
- Single matching ETag.
- Multiple ETags where only one matches.
- Wildcard
*behavior.All call
load_tabledirectly with parsed-style ETags (trimmed and with/without wildcard), aligning with howparse_if_none_matchfeeds the server. Treating anyNotModifiedas an error in the pre-existing snapshot tests (by matching onLoadTableResultOrNotModified::LoadTableResult) is also a good guardrail against accidental behavior changes.Also applies to: 917-1025
crates/lakekeeper/src/server/tables.rs (2)
363-382: Service implementation cleanly forwards the new ETag parameters and result typeUpdating
TablesService::load_tableto acceptetags: Vec<String>and returnResult<LoadTableResultOrNotModified>while delegating directly intoload_table::load_tablekeeps this module free of ETag logic and aligned with the v1 API trait.
1755-1926: Test suite updates correctly adapt toLoadTableResultOrNotModifiedAcross the test module:
CatalogServer::load_tablecalls now passVec::new()foretags, clearly signaling “no If-None-Match” in existing tests.- Call sites consistently destructure
LoadTableResultOrNotModifiedviaLoadTableResultOrNotModified::LoadTableResult(...), panicking onNotModified, which preserves the original test intent and ensures new cache behavior doesn’t silently mask regressions.The helper
load_tablefunction returningLoadTableResultin test code is also updated appropriately, centralizing the pattern for other tests to reuse.Also applies to: 2039-2059, 2202-2222, 2269-2289, 2414-2431, 2512-2530, 2645-2668, 2810-2881, 2919-2937, 3007-3024, 3139-3156, 3183-3214, 4289-4311
crates/lakekeeper/src/api/iceberg/v1/tables.rs (3)
1-2:LoadTableResultOrNotModifiedand itsIntoResponseimplementation look correctThe enum cleanly separates the normal
LoadTableResultpath from the 304 path:
NotModifiedResponse(etag)builds a304 Not Modifiedwith theETagheader set, mirroring what clients expect from conditional GETs.LoadTableResultdelegates to the existingLoadTableResult::into_response, preserving the existing response shape and ETag behavior for 200s.Given that all constructors in this PR pass ETags generated via
create_etag, theetag.parse().unwrap()should be safe in practice; if you ever allow arbitrary strings inNotModifiedResponse, consider downgrading theunwrap()to anexpectwith a clear message.Also applies to: 7-12, 76-95
127-136: Router and trait signature changes wireIf-None-Matchthrough as intended
TablesService::load_tablenow accepts anetags: Vec<String>and returnsResult<LoadTableResultOrNotModified>, aligning the trait with the new cache-aware semantics.- The GET handler for
/.../tables/{table}callsparse_if_none_match(&headers)and forwards the resulting vector intoload_table, so HTTPIf-None-Matchheaders directly influence the server-side ETag check.- Existing routes and other trait methods are untouched, so compatibility is preserved for non-load-table operations.
The change is minimal, well-contained, and keeps the HTTP/trait boundary clean.
Also applies to: 185-188, 251-276
499-508: New tests give good coverage of ETag responses andIf-None-Matchparsing
test_load_table_result_or_not_modified_from_not_modified_responseand the async test comparing bodies viaextract_body_from_responsevalidate that:
- The 304 path sets the correct status and ETag header.
- The 200 path via
LoadTableResultOrNotModified::LoadTableResultis byte-for-byte equivalent to the existingLoadTableResultresponse.- The
parse_if_none_matchtest set covers:
- Missing header.
- Single values, with/without spaces.
- Weak tags.
*wildcard.- Many pathological quoting combinations and empty/whitespace-only cases.
This gives strong confidence that the ETag plumbing will behave correctly across a wide variety of client header formats.
Also applies to: 758-838, 840-973, 975-1009
| impl IntoResponse for LoadTableResult { | ||
| fn into_response(self) -> axum::http::Response<axum::body::Body> { | ||
| // self.metadata_location | ||
| let metadata_location = self.metadata_location.clone().unwrap_or_default(); |
There was a problem hiding this comment.
I don't think we should return an ETag for staged tables (tables without metadata location), as fetching them would yield 404 anyway.
There was a problem hiding this comment.
Logic is now implemented. See #1509 (comment)
| let etag = create_etag(&metadata_location); | ||
|
|
||
| let mut header = HeaderMap::new(); | ||
| header.insert(header::ETAG, etag.parse().unwrap()); |
There was a problem hiding this comment.
We should handle the error gracefully and not panic. Lets use tracing::error to log the error and not return anything.
There was a problem hiding this comment.
This is also added in the current implementation. It will still return an empty HeaderMap and the JSON body, but it will log this error with the suggested method.
Add error handling for parsing into HeaderValue. Add tests for checking correct json body.
…og/rest/table.rs Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
|
@coderabbitai Added the handling of multiple separate If-None-Match Headers, concating all into a single vector. |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: Length of output: 952 @Midor Thanks for the update! I've reviewed the implementation and it looks great. Using The implementation correctly handles all valid scenarios:
Nice work! 👍 |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
crates/iceberg-ext/src/catalog/rest/table.rs(2 hunks)crates/lakekeeper/src/api/iceberg/v1/tables.rs(8 hunks)
🧰 Additional context used
🧠 Learnings (6)
📚 Learning: 2025-11-07T15:17:22.491Z
Learnt from: c-thiel
Repo: lakekeeper/lakekeeper PR: 1484
File: crates/lakekeeper/src/server/tables.rs:820-859
Timestamp: 2025-11-07T15:17:22.491Z
Learning: In the lakekeeper codebase, when refreshing namespaces during table operations (e.g., in `refresh_warehouse_and_namespace` in `crates/lakekeeper/src/server/tables.rs`), the refresh should use `namespace.namespace_ident()` rather than `namespace.namespace_id()`. This ensures that if a namespace is renamed between the initial fetch and the refresh, the operation fails rather than silently continuing with the renamed namespace. User intent is bound to the namespace ident they specified, not the underlying stable namespace ID.
Applied to files:
crates/iceberg-ext/src/catalog/rest/table.rs
📚 Learning: 2025-08-19T07:33:45.608Z
Learnt from: c-thiel
Repo: lakekeeper/lakekeeper PR: 1285
File: crates/lakekeeper/src/service/storage/mod.rs:1354-1356
Timestamp: 2025-08-19T07:33:45.608Z
Learning: In test code (#[cfg(test)]), unreachable!() is often appropriate when it indicates a programming error in test setup, unlike production code where graceful error handling is preferred. Test helpers should fail fast when called with invalid configurations.
Applied to files:
crates/iceberg-ext/src/catalog/rest/table.rscrates/lakekeeper/src/api/iceberg/v1/tables.rs
📚 Learning: 2025-09-25T18:44:19.943Z
Learnt from: c-thiel
Repo: lakekeeper/lakekeeper PR: 1267
File: .github/workflows/integration_test_matrix.yml:43-43
Timestamp: 2025-09-25T18:44:19.943Z
Learning: In the Lakekeeper project, the integration_test_workflow.yml dynamically parses test configuration from the test_name parameter format (e.g., spark_openfga-1.9.2) rather than requiring explicit mappings for each version. New version numbers can be added to the test matrix without modifying the workflow file itself.
Applied to files:
crates/iceberg-ext/src/catalog/rest/table.rs
📚 Learning: 2025-09-23T18:51:43.107Z
Learnt from: c-thiel
Repo: lakekeeper/lakekeeper PR: 1364
File: .github/workflows/integration_test_workflow.yml:59-59
Timestamp: 2025-09-23T18:51:43.107Z
Learning: In the Lakekeeper project, test configuration like SPARK_ICEBERG_VERSION is passed dynamically through the test matrix via test_name rather than being hardcoded as environment variables in the workflow files. This provides more flexibility for running different test configurations.
Applied to files:
crates/iceberg-ext/src/catalog/rest/table.rs
📚 Learning: 2025-10-13T10:31:34.544Z
Learnt from: c-thiel
Repo: lakekeeper/lakekeeper PR: 1435
File: crates/lakekeeper/src/service/catalog_store/namespace.rs:166-170
Timestamp: 2025-10-13T10:31:34.544Z
Learning: For the lakekeeper/lakekeeper repository: Do not flag or comment on potential compile errors. The maintainers have confirmed that all code that is pushed compiles successfully and is validated by their CI/CD pipeline.
Applied to files:
crates/iceberg-ext/src/catalog/rest/table.rs
📚 Learning: 2025-09-23T18:54:00.185Z
Learnt from: c-thiel
Repo: lakekeeper/lakekeeper PR: 1364
File: .github/workflows/release.yml:277-279
Timestamp: 2025-09-23T18:54:00.185Z
Learning: In the Lakekeeper project, the maintainers prefer dynamic test configuration through test matrix rather than hardcoded environment variables in workflow files. This approach allows testing multiple versions and configurations rather than being locked into a single version, which is considered superior to hardcoded environment variable approaches.
Applied to files:
crates/iceberg-ext/src/catalog/rest/table.rs
🧬 Code graph analysis (2)
crates/iceberg-ext/src/catalog/rest/table.rs (1)
crates/lakekeeper/src/api/management/mod.rs (1)
into_response(1287-1289)
crates/lakekeeper/src/api/iceberg/v1/tables.rs (1)
crates/iceberg-ext/src/catalog/rest/table.rs (3)
into_response(116-135)etag(125-125)create_table_metadata_mock(222-256)
⏰ 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: sqlx-check
- GitHub Check: docker / docker
- GitHub Check: docker / docker
- GitHub Check: docker / docker
- GitHub Check: docker / docker
🔇 Additional comments (6)
crates/iceberg-ext/src/catalog/rest/table.rs (2)
108-136: LGTM! ETag implementation properly handles edge cases.The implementation correctly:
- Generates ETags using xxh3_64 hashing
- Returns early when
metadata_locationis None (staged tables)- Handles header parsing errors gracefully with logging
- Uses idiomatic Rust patterns (let-else)
All previously raised concerns have been properly addressed.
145-257: Excellent test coverage!The test suite thoroughly validates:
- ETag generation correctness
- Header presence for tables with metadata_location
- Header absence for staged tables (None metadata_location)
- JSON body serialization/deserialization
The
create_table_metadata_mockhelper is well-designed and promotes test maintainability.crates/lakekeeper/src/api/iceberg/v1/tables.rs (4)
128-135: Well-designed API change for ETag support.The signature changes properly integrate ETag support:
- New
etagsparameter accepts parsed If-None-Match values- Return type
LoadTableResultOrNotModifiedclearly represents 200 vs 304 responses- Router correctly extracts ETags via
parse_if_none_match(&headers)Also applies to: 274-274
457-479: Robust ETag parsing implementation with excellent test coverage.The parsing functions correctly handle:
- Multiple ETags in a single header (comma-separated)
- Multiple separate If-None-Match headers
- Weak ETags (W/ prefix)
- Various quoting styles and edge cases
The implementation follows RFC 7232 requirements. The comprehensive test suite (lines 841-1025) validates correct behavior across all scenarios.
759-839: Good test coverage for the enum variants.The tests properly validate:
NotModifiedResponsereturns 304 with ETag headerLoadTableResultdelegates correctly and returns 200- Response body extraction and comparison
The duplicated
create_table_metadata_mockhelper is appropriately documented (line 804) as necessary for package independence.
841-1025: Outstanding test coverage for ETag parsing!The 14 test functions comprehensively validate:
- Empty and missing headers
- Single and multiple ETags
- Weak ETags (W/ prefix)
- Various quoting styles (including double quotes)
- Whitespace handling
- The special asterisk case
- Multiple separate headers
- Edge cases (empty strings, spaces only)
The
test_parse_if_none_match_returns_multiple_values_with_mixed_stylestest (lines 933-974) is particularly thorough, covering 12 different ETag format variations.This level of coverage provides strong confidence in the implementation's correctness.
…ing etag same as with LoadTableResult.
…ng etag HeaderValue
… remove iter twice.
…edResponse interface. Also impl From<String> and From<&str>.
…se as for iceberg-ext LoadTableResult::into_response
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
crates/lakekeeper/src/server/tables/load_table.rs (1)
27-40: ETag helper flow is correct; consider minor cleanups
get_etagcorrectly derives anOption<ETag>fromTabularInfo.metadata_locationandcreate_etag, which keeps the ETag tied to the metadata location/version.etag_already_presentcorrectly handles both exact matches and the*wildcard, and the normalization in the call site (as_str().trim_matches('"')) aligns with howIf-None-Matchis parsed elsewhere.- The early-return ETag check in
load_table(before the heavier business logic) is well‑placed and the new tests for single match, multiple match, and wildcard cover the main scenarios.Two minor, optional tweaks:
- You could simplify the API by only calling
etag_already_presentwhen an ETag exists and dropping theOptionparameter (i.e.,fn etag_already_present(etags: &[ETag], etag: &ETag)), since the only caller already does theOptionhandling.- The
TODO: Add handling for staged tablesmay no longer reflect current behavior (active tables only, staged become 404); consider either removing it or clarifying what additional behavior is intended.Also applies to: 79-88, 913-1019
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
crates/iceberg-ext/src/catalog/mod.rs(1 hunks)crates/iceberg-ext/src/catalog/rest/table.rs(2 hunks)crates/lakekeeper/src/api/iceberg/v1/tables.rs(8 hunks)crates/lakekeeper/src/server/tables.rs(21 hunks)crates/lakekeeper/src/server/tables/load_table.rs(14 hunks)
🧰 Additional context used
🧠 Learnings (7)
📚 Learning: 2025-09-08T09:10:07.658Z
Learnt from: c-thiel
Repo: lakekeeper/lakekeeper PR: 1328
File: crates/lakekeeper/src/service/authz/implementations/openfga/mod.rs:103-112
Timestamp: 2025-09-08T09:10:07.658Z
Learning: The OpenFGAAuthorizer constructor in crates/lakekeeper/src/service/authz/implementations/openfga/mod.rs should maintain backward compatibility during the transition away from nil UUIDs. Hard assertions that would panic on nil UUID input should be avoided to prevent breaking existing deployments.
Applied to files:
crates/lakekeeper/src/api/iceberg/v1/tables.rs
📚 Learning: 2025-08-19T07:33:45.608Z
Learnt from: c-thiel
Repo: lakekeeper/lakekeeper PR: 1285
File: crates/lakekeeper/src/service/storage/mod.rs:1354-1356
Timestamp: 2025-08-19T07:33:45.608Z
Learning: In test code (#[cfg(test)]), unreachable!() is often appropriate when it indicates a programming error in test setup, unlike production code where graceful error handling is preferred. Test helpers should fail fast when called with invalid configurations.
Applied to files:
crates/lakekeeper/src/api/iceberg/v1/tables.rscrates/iceberg-ext/src/catalog/rest/table.rs
📚 Learning: 2025-11-07T15:17:22.491Z
Learnt from: c-thiel
Repo: lakekeeper/lakekeeper PR: 1484
File: crates/lakekeeper/src/server/tables.rs:820-859
Timestamp: 2025-11-07T15:17:22.491Z
Learning: In the lakekeeper codebase, when refreshing namespaces during table operations (e.g., in `refresh_warehouse_and_namespace` in `crates/lakekeeper/src/server/tables.rs`), the refresh should use `namespace.namespace_ident()` rather than `namespace.namespace_id()`. This ensures that if a namespace is renamed between the initial fetch and the refresh, the operation fails rather than silently continuing with the renamed namespace. User intent is bound to the namespace ident they specified, not the underlying stable namespace ID.
Applied to files:
crates/iceberg-ext/src/catalog/rest/table.rscrates/lakekeeper/src/server/tables/load_table.rscrates/lakekeeper/src/server/tables.rs
📚 Learning: 2025-09-25T18:44:19.943Z
Learnt from: c-thiel
Repo: lakekeeper/lakekeeper PR: 1267
File: .github/workflows/integration_test_matrix.yml:43-43
Timestamp: 2025-09-25T18:44:19.943Z
Learning: In the Lakekeeper project, the integration_test_workflow.yml dynamically parses test configuration from the test_name parameter format (e.g., spark_openfga-1.9.2) rather than requiring explicit mappings for each version. New version numbers can be added to the test matrix without modifying the workflow file itself.
Applied to files:
crates/iceberg-ext/src/catalog/rest/table.rs
📚 Learning: 2025-09-23T18:51:43.107Z
Learnt from: c-thiel
Repo: lakekeeper/lakekeeper PR: 1364
File: .github/workflows/integration_test_workflow.yml:59-59
Timestamp: 2025-09-23T18:51:43.107Z
Learning: In the Lakekeeper project, test configuration like SPARK_ICEBERG_VERSION is passed dynamically through the test matrix via test_name rather than being hardcoded as environment variables in the workflow files. This provides more flexibility for running different test configurations.
Applied to files:
crates/iceberg-ext/src/catalog/rest/table.rs
📚 Learning: 2025-10-13T10:31:34.544Z
Learnt from: c-thiel
Repo: lakekeeper/lakekeeper PR: 1435
File: crates/lakekeeper/src/service/catalog_store/namespace.rs:166-170
Timestamp: 2025-10-13T10:31:34.544Z
Learning: For the lakekeeper/lakekeeper repository: Do not flag or comment on potential compile errors. The maintainers have confirmed that all code that is pushed compiles successfully and is validated by their CI/CD pipeline.
Applied to files:
crates/iceberg-ext/src/catalog/rest/table.rs
📚 Learning: 2025-09-23T18:54:00.185Z
Learnt from: c-thiel
Repo: lakekeeper/lakekeeper PR: 1364
File: .github/workflows/release.yml:277-279
Timestamp: 2025-09-23T18:54:00.185Z
Learning: In the Lakekeeper project, the maintainers prefer dynamic test configuration through test matrix rather than hardcoded environment variables in workflow files. This approach allows testing multiple versions and configurations rather than being locked into a single version, which is considered superior to hardcoded environment variable approaches.
Applied to files:
crates/iceberg-ext/src/catalog/rest/table.rs
🧬 Code graph analysis (4)
crates/lakekeeper/src/api/iceberg/v1/tables.rs (1)
crates/iceberg-ext/src/catalog/rest/table.rs (4)
into_response(138-159)etag(147-147)from(119-121)from(125-127)
crates/iceberg-ext/src/catalog/rest/table.rs (1)
crates/lakekeeper/src/api/iceberg/v1/tables.rs (3)
from(66-71)into_response(81-104)etag(88-88)
crates/iceberg-ext/src/catalog/mod.rs (1)
crates/iceberg-ext/src/catalog/rest/table.rs (1)
create_etag(131-134)
crates/lakekeeper/src/server/tables.rs (2)
crates/lakekeeper/src/api/iceberg/v1/tables.rs (2)
load_table(138-145)load_table(630-650)crates/lakekeeper/src/server/tables/load_table.rs (1)
load_table(44-167)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (9)
- GitHub Check: docker / docker
- GitHub Check: docker / docker
- GitHub Check: clippy
- GitHub Check: check-format
- GitHub Check: sqlx-check
- GitHub Check: test
- GitHub Check: check-generated-openapi-matches
- GitHub Check: docker / docker
- GitHub Check: docker / docker
🔇 Additional comments (8)
crates/iceberg-ext/src/catalog/mod.rs (1)
27-32: Public ETag exports look consistent and low-riskRe-exporting
ETagandcreate_etagfromrest::tablecleanly exposes the new ETag API at the catalog module boundary; naming and placement among the existing table-related types is consistent. No changes needed.crates/iceberg-ext/src/catalog/rest/table.rs (2)
108-134: ETag newtype and create_etag are well-scoped and type-safeWrapping the raw string in an
ETagnewtype withas_strandFromimpls gives good type-safety while staying lightweight.create_etag’s use ofxxh3_64plus returning a quoted hex string matches HTTP ETag expectations, and the unit test for a fixed input anchors the behavior. No changes needed.Also applies to: 169-185
136-160: LoadTableResult IntoResponse correctly manages optional ETagThe new
IntoResponseimpl forLoadTableResult:
- Omits the ETag header when
metadata_locationisNone(staged tables), which aligns with the earlier discussion about not emitting ETags for staged resources.- Computes the ETag from
metadata_locationand injects it into the response headers when present.- Gracefully logs and skips the header on
HeaderValueparse failure, instead of panicking.- Has solid test coverage for ETag presence, absence, and JSON body round‑trip.
This all looks correct and robust.
Also applies to: 185-243
crates/lakekeeper/src/api/iceberg/v1/tables.rs (3)
74-105: LoadTableResultOrNotModified models 200 vs 304 cleanlyThe new enum and its
IntoResponseimpl make the two possible outcomes explicit:
NotModifiedResponse(ETag)yields a304 Not Modifiedwith anETagheader when parsing succeeds, and logs+omits the header on parse failure instead of panicking.LoadTableResultdelegates to the existingLoadTableResult::into_response, keeping behavior consistent.The accompanying tests verify both branches and the parse-failure case. This is a nice improvement in clarity and safety.
Also applies to: 769-806, 1047-1055
137-146: Router and TablesService changes correctly thread ETagsUpdating
TablesService::load_tableto acceptetags: Vec<ETag>and returnResult<LoadTableResultOrNotModified>matches the server implementation, and the router now passesparse_if_none_match(&headers)as the last argument. This keeps the HTTP layer thin while centralizing ETag handling in the service.Existing callers within the file are updated consistently, and tests exercise the new signature via the router.
Also applies to: 261-286
467-490: If-None-Match parsing is robust and well-tested
parse_etagsandparse_if_none_matchprovide a thorough normalization pipeline:
- Handle multiple header instances (
get_all) and comma‑separated lists within a single header.- Trim whitespace, outer quotes (including double‑quoting), and optional
W/prefixes.- Preserve the
*wildcard as a distinctETagvalue.- Filter out empty/whitespace‑only entries and ignore non‑UTF‑8 header values.
The extensive unit tests around these helpers cover single/multiple values, weak/strong tags, varied quoting styles, multiple header lines, empty and whitespace‑only headers, and mixed oddball formats. This looks solid and should interoperate well with real‑world clients.
Also applies to: 851-1044
crates/lakekeeper/src/server/tables.rs (2)
17-20: Server wiring for ETag-aware load_table is consistent
- Importing
ETagandLoadTableResultOrNotModifiedand updating theTablesServiceimpl to takeetags: Vec<ETag>and return the enum aligns this layer with the API contract.- Delegating directly to
load_table::load_tablekeeps the server implementation thin and localized.This glue code looks correct.
Also applies to: 43-45, 363-382
1894-1926: Test adjustments preserve existing semantics under the new enumAcross the test module:
- Calls to
CatalogServer::load_tablenow passVec::new()for theetagsparameter, which means the existing tests explicitly exercise the “no conditional GET” behavior.- New pattern matches on
LoadTableResultOrNotModified::LoadTableResult(...)assert that these flows still return full table metadata and would fail loudly if aNotModifiedResponsewere accidentally returned.- The helper
load_tablefunction in the test module unwraps the enum back toLoadTableResult, minimizing churn in tests that don’t care about ETag semantics.These updates keep the prior test intent intact while accommodating the new ETag-aware return type.
Also applies to: 2002-2061, 2399-2531, 2819-2940, 3007-3214, 4289-4311
✅ PR Title Formatted CorrectlyThe title of this PR match the correct format. Thank you! |
Comparison between this implementation and Apache IcebergETag CreationThe RFC 723 - Hypertext Transfer Protocol (HTTP/1.1): Conditional Requests - 2.3. ETag mentions, that ETags need to be put in quotes, so strong ETags can be distinguished from weak ETags (containing a In the implemention from Apache Iceberg - ETagProvider the ETags are generated without those quotes. Also in the Unit-Tests They showed exactly this usage. And in some Implementations, which I guess are Test Fixtures they showed that it is used as-is and not quoted afterwards. "If-None-Match" Header ComparisonTo handle cases, where the "If-None-Match" is sent with an ETag missing the quotes, we extract the ETags and remove the surrounding quotes and so compare only the content. This ensures, that even if clients strip the quotes or have there own logic to rebuild the ETag, it should still work. Even without this handling this shouldn't be a problem at all, as the implementation from the Test Fixtures (it is also the same for other cases in the same file) implies to take the incoming "If-None-Match" header and compare it directly against the previously generated ETag. Additional Note: Another change we have in comparison to Apache Iceberg is the following. We also handle the case, that the "If-None-Match" header can be added multiple times to a request, whereas in the Test Fixtures only the first "If-None-Match" header is used, in which case some cache misses could happen. Typically a sender is advised to send a single header with comma separated values instead of multiple headers, so this change should not be a big problem, except for the use-case of a single header with multiple comma separated values, which are also handled as-is in Apache Iceberg. But it is also not forbidden, and so a recipient should be able to handle multiple headers the same way as comma separated values. See RFC 7230 - Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing - Field Order. |
Summary by CodeRabbit
New Features
Tests
✏️ Tip: You can customize this high-level summary in your review settings.