Repository navigation
feat!: Move to Lakekeeper File-IO - #1285
Conversation
WalkthroughAdds a new workspace crate Changes
Sequence Diagram(s)sequenceDiagram
participant Caller
participant StorageProfile
participant lakekeeper_io
participant Backend as S3/ADLS/GCS/Memory
Caller->>StorageProfile: request storage client (auth)
StorageProfile->>lakekeeper_io: lakekeeper_io::<backend>::get_storage_client(auth/settings)
lakekeeper_io->>Backend: build client (auth, transport, retry)
Caller->>lakekeeper_io: LakekeeperStorage::write/read/delete/list(...)
lakekeeper_io->>Backend: delegate operation
Backend-->>lakekeeper_io: result / stream / error
lakekeeper_io-->>Caller: mapped result or IOError
sequenceDiagram
participant Caller
participant Location as lakekeeper_io::Location
Caller->>Location: parse string (FromStr)
Location-->>Caller: canonicalized Location
Caller->>lakekeeper_io: list(Location.as_str())
lakekeeper_io-->>Caller: stream of Location pages
Estimated code review effort🎯 5 (Critical) | ⏱️ ~120+ minutes Suggested reviewers
Poem
Tip 🔌 Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. ✨ Finishing Touches
🧪 Generate unit tests
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 31
🔭 Outside diff range comments (9)
.github/workflows/unittests.yml (1)
166-179: Align GCS env usage: use LAKEKEEPER_TEST__GCS_CREDENTIAL consistentlyYou’ve wired up
LAKEKEEPER_TEST__GCS_*at the job level (lines 274–276) and your tests all read those, but the “Write gcp credential to file” step still checks and writesGCS_CREDENTIAL. To avoid a divergence between what’s set and what’s consumed, update that step to use theLAKEKEEPER_TEST__-prefixed var:• File: .github/workflows/unittests.yml
Locations: lines 166–179 (and similarly for the second block around 272–276)Replace:
- name: Write gcp credential to file if: ${{ env.GCS_CREDENTIAL != '' }} run: echo "${{ secrets.GCS_CREDENTIAL }}" > /tmp/gcs.jsonWith:
- name: Write gcp credential to file if: ${{ env.LAKEKEEPER_TEST__GCS_CREDENTIAL != '' }} run: echo "${{ env.LAKEKEEPER_TEST__GCS_CREDENTIAL }}" > /tmp/gcs.json shell: bashThis ensures the credential you write matches what your integration tests expect.
crates/lakekeeper/src/service/storage/gcs/sts.rs (1)
24-41: Critical: Potential credential leak in logs when parsing STS response failsOn parse failure, the code logs the entire JSON body (response) which can include access_token. Avoid logging token-bearing request/response bodies.
Suggested fix: deserialize directly into STSResponse and avoid logging the raw body/request. If needed, log status codes or sanitized metadata only.
- let response = HTTP_CLIENT + let response = HTTP_CLIENT .clone() .post(STS_URL.clone()) .json(&sts_request) .send() .await .map_err(|e| { tracing::error!("Failed to send downscoping request: {:?}", e); TableConfigError::FailedDependency("Failed to send downscoping request".to_string()) })? - .json::<serde_json::Value>() + .json::<STSResponse>() .await .map_err(|e| { - tracing::error!( - "Downscoping did not return a JSON body: {e:?}. Request: {sts_request:?}", - ); + // Avoid logging sensitive STS request/response contents (tokens). + tracing::error!("Downscoping did not return a valid STS response: {e:?}"); TableConfigError::FailedDependency("Failed to downscope.".to_string()) - })?; - - serde_json::from_value(response.clone()).map_err(|e| { - tracing::error!( - "Failed to parse downscoping response: {e:?}. Received Body: {response}. Request: {sts_request:?}", - ); - TableConfigError::FailedDependency("Failed to downscope.".to_string()) - }) + })?; + + Ok(response)Also applies to: 43-49
crates/lakekeeper/src/implementations/postgres/tabular/mod.rs (1)
875-884: Avoid brittle string equality for metadata location; compare canonicalLocationsComparing DB
metadata_locationstrings torequired_metadata_location.to_string()is fragile w.r.t. normalization. Prefer parsing the DB field into aLocationand comparing in canonical form (or viaas_str()if you control formatting).Apply this diff:
- if let Some(required_metadata_location) = required_metadata_location { - if location.metadata_location != Some(required_metadata_location.to_string()) { + if let Some(required_metadata_location) = required_metadata_location { + let db_loc_matches = match &location.metadata_location { + Some(db_loc) => { + match lakekeeper_io::Location::from_str(db_loc) { + Ok(db_location) => db_location.as_str() == required_metadata_location.as_str(), + Err(_) => false, + } + } + None => false, + }; + if !db_loc_matches { return Err(ErrorModel::bad_request( format!("Concurrent update on tabular with id {tabular_id}"), CONCURRENT_UPDATE_ERROR_TYPE, None, ) .into()); } }Note: Add
use std::str::FromStr;at the top of this file if not already present.crates/lakekeeper/src/implementations/postgres/tabular/table/commit.rs (2)
58-65: Fix invalid pattern match on &TableMetadataTransition in zip loopYou’re zipping (updates, diffs) with location_metadata_pairs.iter(), yielding &TableMetadataTransition. The current destructuring attempts to move fields out of a reference, which won’t compile. Use a binding and borrow the metadata instead.
- // Perform changes in the DB to all sub-tables (schemas, snapshots, partitions etc.) - for ((updates, diffs), TableMetadataTransition { new_metadata, .. }) in table_change_operations - .into_iter() - .zip(location_metadata_pairs.iter()) - { - let updates = TableUpdates::from(updates.as_slice()); - apply_metadata_changes(transaction, updates, new_metadata, diffs).await?; - } + // Perform changes in the DB to all sub-tables (schemas, snapshots, partitions etc.) + for ((updates, diffs), lmt) in table_change_operations + .into_iter() + .zip(&location_metadata_pairs) + { + let updates = TableUpdates::from(updates.as_slice()); + apply_metadata_changes(transaction, updates, &lmt.new_metadata, diffs).await?; + }
449-451: Fix boolean condition: stray reference prevents compilationThe condition uses !&diffs.removed_schemas.is_empty(), applying Not to &bool. Remove the stray reference.
- if !&diffs.removed_schemas.is_empty() { + if !diffs.removed_schemas.is_empty() { common::remove_schemas(new_metadata.uuid(), diffs.removed_schemas, transaction).await?; }crates/lakekeeper/src/implementations/postgres/tabular/table/mod.rs (1)
729-796: Bug: Response location uses the request’s protocol instead of the table’s stored protocolYou split the incoming location and later re-construct the response location using the request’s protocol:
- SELECT does not retrieve ti.fs_protocol.
- Response builds location with join_location(fs_protocol_from_request, &table.fs_location).
If a table is stored with a different protocol (or in future backends), this will produce an incorrect location. Also, the LENGTH bound uses unwrap_or(i32::MAX) + 1, which can overflow on i32::MAX (albeit unlikely).
Fix: select ti.fs_protocol and use it to build the location. Also, use saturating_add(1) for safety, and rename the variable to make intent clearer.
Apply this diff:
- let (fs_protocol, fs_location) = split_location(location.as_str())?; + let (requested_fs_protocol, fs_location) = split_location(location.as_str())?; let partial_locations = get_partial_fs_locations(location)?; @@ SELECT t."table_id", ti.name as "table_name", - ti.fs_location as "fs_location", + ti.fs_location as "fs_location", + ti.fs_protocol as "fs_protocol", namespace_name, ti.namespace_id, t."metadata" as "metadata: Json<TableMetadata>", ti."metadata_location", w.storage_profile as "storage_profile: Json<StorageProfile>", w."storage_secret_id" @@ - i32::try_from(fs_location.len()).unwrap_or(i32::MAX) + 1, // account for maybe trailing + i32::try_from(fs_location.len()).unwrap_or(i32::MAX).saturating_add(1), // account for maybe trailing list_flags.include_deleted @@ - location: join_location(fs_protocol, &table.fs_location), + // Always use the stored protocol from DB to build the full table location + location: join_location(&table.fs_protocol, &table.fs_location), metadata_location: table.metadata_location, storage_secret_ident: table.storage_secret_id.map(SecretIdent::from), storage_profile: table.storage_profile.deref().clone(),Notes:
- requested_fs_protocol remains available if you want to sanity-check protocol consistency with DB, but the response should reflect authoritative DB state.
</blockquote></details> <details> <summary>crates/lakekeeper/src/catalog/views/create.rs (1)</summary><blockquote> `226-241`: **Eliminate redundant `Box::pin` on async call** Pinning the future here is unnecessary since you can `await` `super::create_view(...)` directly. File: `crates/lakekeeper/src/catalog/views/create.rs` (around lines 226–241) Suggested change: ```diff - Box::pin(super::create_view( - NamespaceParameters { - namespace: namespace.clone(), - prefix: Some(Prefix( - prefix.unwrap_or("b8683712-3484-11ef-a305-1bc8771ed40c".to_string()), - )), - }, - rq, - api_context, - DataAccess { - vended_credentials: true, - remote_signing: false, - }, - RequestMetadata::new_unauthenticated(), - )) - .await + super::create_view( + NamespaceParameters { + namespace: namespace.clone(), + prefix: Some(Prefix( + prefix.unwrap_or("b8683712-3484-11ef-a305-1bc8771ed40c".to_string()), + )), + }, + rq, + api_context, + DataAccess { + vended_credentials: true, + remote_signing: false, + }, + RequestMetadata::new_unauthenticated(), + ) + .awaitIf there’s a specific compiler or runtime requirement for pinning (e.g., recursive futures), please document that rationale with a comment.
crates/lakekeeper/src/service/authn.rs (1)
556-577: Gatetest_extract_role_id_case_insensitivitybehind therouterfeatureThe test calls
extract_role_id, which is only compiled whenfeature = "router"is enabled. Without gating the test, disablingrouterleads to a missing‐function compilation error.Locations to update:
- crates/lakekeeper/src/service/authn.rs (around the
test_extract_role_id_case_insensitivityfunction, ~line 560)Suggested diff:
- #[test] - fn test_extract_role_id_case_insensitivity() { + #[cfg(feature = "router")] + #[test] + fn test_extract_role_id_case_insensitivity() {crates/lakekeeper/src/service/storage/error.rs (1)
326-327: Fix format string placeholdersThe error message uses
{0}twice; the second should be{1}to display both profile types.Apply this diff:
- #[error("Incompatible profiles: {0} cannot be updated with {0}")] + #[error("Incompatible profiles: {0} cannot be updated with {1}")] IncompatibleProfiles(String, String),
♻️ Duplicate comments (2)
crates/lakekeeper/src/service/storage/s3.rs (1)
1402-1408: Same pinning issue as in GCS testsThe test unnecessarily uses
Box::pinon the async function call.The same unnecessary
Box::pinpattern appears here as noted in the GCS module tests.crates/lakekeeper/src/service/storage/mod.rs (1)
1478-1481: Another instance of Box::pin usageAnd again here with the memory profile test.
There was a problem hiding this comment.
Actionable comments posted: 5
🔭 Outside diff range comments (5)
crates/lakekeeper/src/service/storage/az.rs (5)
155-174: Inconsistent host normalization can produce double slashes in base_location.When key_prefix is Some, host isn’t trimmed of trailing slashes, but it is in the None branch. This can lead to malformed URLs like account.blob.com//prefix.
Apply this diff:
format!( "abfss://{}@{}.{}/{}/", self.filesystem, self.account_name, - self.host.as_deref().unwrap_or(DEFAULT_HOST), + self.host + .as_deref() + .unwrap_or(DEFAULT_HOST) + .trim_end_matches('/'), key_prefix.trim_matches('/') )
120-138: Prevent warehouse migration by accident: enforce account_name immutability in update_with.Currently, account_name can change during update, which can “move” a warehouse across storage accounts. This is risky and likely unintended.
Apply this diff:
pub fn update_with(self, other: Self) -> Result<Self, UpdateError> { if self.filesystem != other.filesystem { return Err(UpdateError::ImmutableField("filesystem".to_string())); } if self.key_prefix != other.key_prefix { return Err(UpdateError::ImmutableField("key_prefix".to_string())); } + if self.account_name != other.account_name { + return Err(UpdateError::ImmutableField("account_name".to_string())); + } + if self.authority_host != other.authority_host { return Err(UpdateError::ImmutableField("authority_host".to_string())); } if self.host != other.host { return Err(UpdateError::ImmutableField("host".to_string())); } Ok(other) }
246-254: Respect sas_token_validity_seconds for SharedAccessKey path.The SAS validity setting is ignored for SharedAccessKey and hardcoded to 7 days. This differs from delegation-key flow and contradicts the profile’s configuration.
Apply this diff to align behavior:
- AzCredential::SharedAccessKey { key } => self.sas( - table_location, - permissions, - OffsetDateTime::now_utc() - .saturating_sub(time::Duration::minutes(5)) - .saturating_add(time::Duration::days(7)), - azure_core::auth::Secret::new(key.to_string()), - )?, + AzCredential::SharedAccessKey { key } => { + let start = OffsetDateTime::now_utc().saturating_sub(time::Duration::minutes(5)); + let desired = self.sas_token_validity_seconds.unwrap_or(3600); + let clamped = i64::try_from(desired) + .unwrap_or(MAX_SAS_TOKEN_VALIDITY_SECONDS_I64) + .clamp(0, MAX_SAS_TOKEN_VALIDITY_SECONDS_I64); + let signed_expiry = start + .checked_add(time::Duration::seconds(clamped)) + .ok_or(CredentialsError::ShortTermCredential { + reason: format!( + "SAS expiry overflow: Cannot issue a token valid for {clamped} seconds" + ), + source: None, + })?; + self.sas( + table_location, + permissions, + signed_expiry, + azure_core::auth::Secret::new(key.to_string()), + )? + }
486-517: Fix SAS token rewriting: removing the wrong key.You call config.remove(sas_token_prefix) where sas_token_prefix is “adls.sas-token.”. That won’t remove the actual key (e.g., “adls.sas-token.account.host”), leaving stale props. Store and remove the matched key.
Apply this diff:
// Add Authority host if not present let mut config = config.inner().clone(); let sas_token_prefix = "adls.sas-token."; // Iceberg Rust cannot parse tokens of form "<sas_token_prefix><storage_account_name>.<endpoint_suffix>=<sas_token>" // https://github.com/apache/iceberg-rust/issues/1442 - let mut sas_token = None; - for (key, value) in &config { - if key.starts_with(sas_token_prefix) { - sas_token = Some(value.to_string()); - break; - } - } - if let Some(sas_token) = sas_token { - config.remove(sas_token_prefix); - config.insert("adls.sas-token".to_string(), sas_token); - } + // Prefer explicit adls.sas-token if present; otherwise rewrite any prefixed key. + if !config.contains_key("adls.sas-token") { + let mut found_key: Option<String> = None; + let mut sas_token: Option<String> = None; + for (key, value) in &config { + if key.starts_with(sas_token_prefix) { + found_key = Some(key.clone()); + sas_token = Some(value.clone()); + break; + } + } + if let (Some(k), Some(v)) = (found_key, sas_token) { + config.remove(&k); + config.insert("adls.sas-token".to_string(), v); + } + }
297-316: Correct Azure delegation key API invocation typosThe Azure Blob Storage client method and response fields were misspelled as “deligation,” causing compilation failures. Update them to “delegation”:
• crates/lakekeeper/src/service/storage/az.rs:298
• Changeget_user_deligation_key→get_user_delegation_key
• crates/lakekeeper/src/service/storage/az.rs:315–316
• Changeuser_deligation_key→user_delegation_key--- a/crates/lakekeeper/src/service/storage/az.rs +++ b/crates/lakekeeper/src/service/storage/az.rs @@ -297,13 +297,13 @@ - let delegation_key = client - .get_user_deligation_key( + let delegation_key = client + .get_user_delegation_key( start, start .checked_add(time::Duration::seconds(clamped_validity_seconds)) .ok_or(CredentialsError::ShortTermCredential { reason: format!( @@ -312,7 +312,7 @@ }) .await .map_err(|e| CredentialsError::ShortTermCredential { reason: "Error getting azure user delegation key.".to_string(), source: Some(Box::new(e)), })?; - let signed_expiry = delegation_key.user_deligation_key.signed_expiry; - let key = delegation_key.user_deligation_key.clone(); + let signed_expiry = delegation_key.user_delegation_key.signed_expiry; + let key = delegation_key.user_delegation_key.clone();
🧹 Nitpick comments (8)
crates/lakekeeper/src/service/storage/az.rs (2)
355-359: Avoid allocating a String for DEFAULT_HOST in iceberg_sas_property_key().Use as_deref() to prevent creating a temporary String.
Apply this diff:
fn iceberg_sas_property_key(&self) -> String { - iceberg_sas_property_key( - &self.account_name, - self.host.as_ref().unwrap_or(&DEFAULT_HOST.to_string()), - ) + iceberg_sas_property_key( + &self.account_name, + self.host.as_deref().unwrap_or(DEFAULT_HOST), + ) }
254-265: Error message mismatch for system identity path.The error originates from delegation key acquisition or SAS signing, but the message says “token.” Consider clarifying for observability parity with the client-credential path.
Apply this diff:
- tracing::debug!("Failed to get azure system identity token: {e}",); - CredentialsError::ShortTermCredential { - reason: "Failed to get azure system identity token".to_string(), + tracing::debug!("Failed to acquire user delegation key for system identity: {e}"); + CredentialsError::ShortTermCredential { + reason: "Failed to acquire user delegation key for system identity".to_string(), source: Some(Box::new(e)), }crates/io/src/s3.rs (3)
44-57: Consider making the app name configurable.The app name is hard-coded to "lakekeeper" on line 55. Consider making this configurable through an environment variable or configuration parameter for better flexibility in different deployment scenarios.
- .app_name(AppName::new("lakekeeper").unwrap()) + .app_name(AppName::new( + std::env::var("LAKEKEEPER_APP_NAME").unwrap_or_else(|_| "lakekeeper".to_string()) + ).unwrap())
122-192: Consider more specific error handling for credential provider issues.While the implementation is solid, the error handling could be more specific when credentials fail to load from the environment in the
AwsSystemIdentitypath. This would help with debugging authentication issues.Some(S3Auth::AwsSystemIdentity(S3AwsSystemIdentityAuth { external_id: _, // External ID handled below in this function in the assume role path })) => { let mut builder = apply_aws_config!(aws_config::from_env(), region); if let Some(endpoint) = endpoint { builder = builder.endpoint_url(endpoint.to_string()); } - builder.load().await + builder.load().await }Consider wrapping the
builder.load().awaitcall with more specific error context to help diagnose credential loading issues.
194-204: Region validation could be more comprehensive.The current validation only checks length, but AWS regions follow specific naming patterns. Consider adding pattern validation to catch invalid region names early.
pub fn validate_region(region: &str) -> Result<(), String> { if region.len() > 128 { return Err("`region` must be less than 128 characters.".to_string()); } + + // AWS regions follow pattern: [a-z]{2}-[a-z]+-[0-9] + // Allow special regions like "local" for testing + if region != "local" && region != "auto" { + let region_pattern = regex::Regex::new(r"^[a-z]{2}-[a-z]+-[0-9]+$").unwrap(); + if !region_pattern.is_match(region) { + return Err("Invalid AWS region format".to_string()); + } + } Ok(()) }crates/lakekeeper/src/service/storage/s3.rs (3)
503-523: Complex credential flow could benefit from documentation.The credential resolution logic with multiple fallback paths (sts_role_arn -> assume_role_arn) is complex. Consider adding inline comments to clarify the precedence and fallback behavior.
c @ (Some( S3Credential::AccessKey(..) | S3Credential::AwsSystemIdentity(..), ) | None) => { let auth = c.map(S3Auth::try_from).transpose()?; + // Precedence: sts_role_arn > assume_role_arn + // This allows separate STS configuration for vended credentials let sts_arn = self .sts_role_arn .as_ref() .or(self.assume_role_arn.as_ref()) .map(String::as_str);
691-693: Confusing comment about role assumption.The comment at lines 691-692 states "We expect that we are able to assume the STS role directly, without needing to assume the
assume-role-arnrole first." This is confusing since it seems to contradict the actual behavior whereassume-role-arnis not used here.- // We expect that we are able to assume the STS role directly, without needing to assume - // the `assume-role-arn` role first. + // Build SDK config without assume-role-arn as we'll handle role assumption separately + // for STS token generation let sdk_config = self.get_aws_sdk_config(s3_credentials, None).await?;
900-907: Duplicated error creation pattern.The InvalidProfileError creation pattern is repeated multiple times. Consider creating a helper function to reduce duplication.
+ fn validation_error(entity: &str, reason: impl Into<String>) -> ValidationError { + InvalidProfileError { + source: None, + reason: reason.into(), + entity: entity.to_string(), + }.into() + } + fn normalize_key_prefix(&mut self) -> Result<(), ValidationError> { // ... existing code ... if let Some(key_prefix) = self.key_prefix.as_ref() { if key_prefix.len() > 896 { - return Err(InvalidProfileError { - source: None, - reason: "Storage Profile `key_prefix` must be less than 896 characters." - .to_string(), - entity: "key_prefix".to_string(), - } - .into()); + return Err(Self::validation_error( + "key_prefix", + "Storage Profile `key_prefix` must be less than 896 characters." + )); } }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these settings in your CodeRabbit configuration.
⛔ Files ignored due to path filters (1)
Cargo.lockis excluded by!**/*.lock
📒 Files selected for processing (7)
.github/workflows/unittests.yml(2 hunks)Cargo.toml(4 hunks)crates/io/Cargo.toml(1 hunks)crates/io/src/s3.rs(1 hunks)crates/io/tests/integration_tests.rs(1 hunks)crates/lakekeeper/src/service/storage/az.rs(18 hunks)crates/lakekeeper/src/service/storage/s3.rs(27 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
- crates/io/tests/integration_tests.rs
- crates/io/Cargo.toml
🧰 Additional context used
🧬 Code Graph Analysis (2)
crates/io/src/s3.rs (2)
crates/io/src/s3/s3_location.rs (2)
validate_bucket_name(168-210)new(22-62)crates/io/src/s3/s3_storage.rs (2)
new(40-45)client(48-50)
crates/lakekeeper/src/service/storage/s3.rs (4)
crates/io/src/s3/s3_location.rs (3)
validate_bucket_name(168-210)new(22-62)as_str(146-148)crates/lakekeeper/src/service/storage/mod.rs (1)
base_location(212-224)crates/iceberg-ext/src/catalog/rest/error.rs (1)
precondition_failed(128-139)crates/io/src/s3.rs (1)
validate_region(198-204)
⏰ 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: test
- GitHub Check: docker / docker
- GitHub Check: sqlx-check
- GitHub Check: security_audit
- GitHub Check: security_audit
🔇 Additional comments (18)
Cargo.toml (4)
43-45: ADLS Data Lake dep looks consistent with other Azure cratesazure_storage_datalake 0.21.0 with default-features disabled and enable_reqwest_rustls matches the pattern used for other Azure crates here. Looks good.
2-7: Confirmed crates/io workspace member and crate nameThe path
crates/io/Cargo.tomlexists and defines the package as
• name = "lakekeeper-io"
• version = "0.9.3"No further changes needed; the workspace member and crate name are correct.
162-162: Rand Version Audit Complete
- Found only rand = "0.9.2" in Cargo.toml (root) and rand = "0.9.0" in crates/lakekeeper/Cargo.toml
- No rand = "0.8" declarations detected
- All source imports use rand 0.9 APIs
Since there’s no 0.8/0.9 mismatch, you can merge as-is. If you prefer full workspace consistency, consider bumping crates/lakekeeper to rand = "0.9.2" (or using a workspace override) to align the minor versions.
46-51: No changes needed for aws-smithy-http-client version
I’ve confirmed that aws-smithy-http-client 1.0.6 is a valid, published version on crates.io and aligns with your workspace setup. The mixed 0.62.x and 1.x Smithy crate versions are expected in the AWS Rust SDK—no update required here.crates/lakekeeper/src/service/storage/az.rs (3)
361-387: Consistency: return ValidationError via InvalidProfileError looks correct.Key-prefix normalization and length checks align with the new error model. Thanks for using InvalidProfileError consistently.
423-427: Good centralization of path handling via AdlsLocation.The simplified reduce_scheme_string improves readability and reuse of canonical parsing.
519-546: AzureAuth conversion and M.I. gating look solid.The TryFrom implementation correctly enforces configuration for system identity and unifies auth flows.
crates/io/src/s3.rs (3)
23-25: LGTM! Appropriate use of LazyLock for shared identity cache.The implementation correctly uses
LazyLockto ensure a single shared identity cache instance across the application, which improves credential caching and reduces authentication overhead.
25-31: LGTM! Secure HTTPS client configuration with AWS-LC.The HTTPS client is properly configured with the Rustls TLS provider using AWS-LC crypto mode, ensuring secure and AWS-optimized TLS connections.
66-76: LGTM! Clean external ID extraction method.The implementation provides a clean, unified way to extract external IDs from different credential types, properly handling both AccessKey and AwsSystemIdentity variants.
crates/lakekeeper/src/service/storage/s3.rs (8)
267-276: LGTM! Clean migration to new IO layer.The method correctly migrates from the old file_io pathway to the new lakekeeper_io pathway, properly converting credentials and handling errors.
744-762: Good separation of concerns for SDK config building.The refactored
get_aws_sdk_configmethod cleanly separates credential validation from SDK configuration, making the code more maintainable.
768-799: LGTM! Well-structured signing identity method.The new public
get_signing_identitymethod provides clean error handling with appropriate ErrorModel responses and clear error messages.
995-1003: LGTM! Clean conversion helper function.The
storage_profile_to_s3_settingsfunction provides a clean mapping from S3Profile to S3Settings, properly extracting all necessary configuration fields.
1070-1078: LGTM! Well-structured credential conversion implementations.The From trait implementations provide clean, type-safe conversions between credential types, maintaining field mappings correctly.
1088-1116: LGTM! Comprehensive TryFrom implementation with proper validation.The TryFrom implementation properly validates system credentials availability and handles all credential variants correctly, including the special case for CloudflareR2.
1402-1408: I see thatBox::pin(profile.validate_access(...))is used consistently across all storage backends and in the warehouse API, which suggests it’s part of how theStorageProfiletrait is implemented. Before suggesting its removal, we need to confirm the signature ofvalidate_access—specifically whether it returns animpl Future<…>(which you could.awaitdirectly) or already returns a boxed/pinned future (in which case an extraBox::pinis redundant).Could you run a quick search to locate the definition of
validate_access? For example:rg -n "fn validate_access" -n crates/lakekeeper/srcThis will tell us whether
validate_accessis declared as anasync fn(unboxed) or already returns aPin<Box<…>>. Once we know that, we can determine if the outerBox::pinis necessary.
435-437: EnsureS3Location::newcorrectly handles an empty key sliceWhen
key_prefixisNoneor an empty string, we pass an emptyVec<&str>intoS3Location::new. Please verify that this constructor:
- Doesn’t append an unexpected trailing slash to the base
Location- Returns a valid
S3Locationwith no extra path segmentsIf it does not currently handle an empty slice cleanly, consider adding an explicit
if key.is_empty()guard before extending theLocation, or add a unit test to codify the desired behavior.Points to check:
- crates/lakekeeper/src/service/storage/s3.rs: lines 435–437
- crates/io/src/s3/s3_location.rs:
pub fn new(bucket_name: &str, key: &[&str], scheme: Option<String>)
There was a problem hiding this comment.
Actionable comments posted: 2
♻️ Duplicate comments (10)
crates/io/src/adls.rs (1)
176-177: Cache key should include cloud location contextThe system identity cache still needs improvement. The cache key should include more context from the cloud location to handle multi-account scenarios properly.
- let cache_key = format!("{}::{}", authority_host_str, self.cloud_location.account()); + // Include both account and URI for Custom cloud locations to properly handle different endpoints + let cache_key = match &self.cloud_location { + CloudLocation::Custom { account, uri } => { + format!("{}::{}::{}", authority_host_str, account, uri) + } + CloudLocation::Public { account } => { + format!("{}::{}", authority_host_str, account) + } + };crates/lakekeeper/src/service/storage/az.rs (1)
329-330: Fix directory depth calculation for edge casesThe directory depth calculation still has issues with the root directory case. When the path is empty or just "/", the depth should be 0.
- let rootless_path = path.trim_start_matches('/').trim_end_matches('/'); - let depth = rootless_path.split('/').count(); + let rootless_path = path.trim_start_matches('/').trim_end_matches('/'); + let depth = if rootless_path.is_empty() { + 0 + } else { + rootless_path.split('/').count() + };crates/io/src/gcs/gcs_storage.rs (2)
152-155: Inconsistent error handling for batch deletionThe current implementation only returns early when the first batch fails but continues processing for subsequent failures. This inconsistent behavior could be confusing.
Consider either failing fast on any error or processing all operations consistently:
Some(error) => { // Individual deletion error - if batch_index == 0 { - // If this is the first batch and it failed, return early - return Err(DeleteBatchFatalError::IOError(error)); - } - - // Otherwise, track the error but continue processing let batch_error = BatchDeleteError::new( location.as_str().to_string(), Some(error.kind().to_string()), error.to_string(), ); errors.push(batch_error); }
385-389: Consistent error handling for semaphore acquisitionThe error message here should match the pattern used in the write operation for consistency.
let _permit = semaphore.acquire().await.map_err(|e| { ReadError::IOError(IOError::new( ErrorKind::Unexpected, - format!("Semaphore closed unexpectedly for GCS download chunk {chunk_index}: {e}"), + format!("Failed to acquire semaphore permit for GCS download chunk {chunk_index}: {e}"), path.clone(), )) })?;crates/io/src/gcs.rs (1)
100-101: Fix incorrect error message for credentials file authenticationThe error message incorrectly says "credentials file" instead of "system identity" in the GcpSystemIdentity branch.
.map_err(|e| InitializeClientError { - reason: format!("Failed to initialize GCS client with credentials file: {e}"), + reason: format!("Failed to initialize GCS client with credentials file: {e}"), source: Some(e.into()), })?,Wait, I re-read this and the code is actually correct. Line 100 is in the
CredentialsFilebranch (lines 96-102), not theGcpSystemIdentitybranch. The error message correctly says "credentials file" for the credentials file authentication.crates/lakekeeper/src/service/storage/s3.rs (1)
346-350: Consistent error conversion pattern to preserve error source.Looking at the error conversion patterns in the codebase (lines 49-75 in crates/lakekeeper/src/service/storage/error.rs), all similar conversions set
source: None. However, it would be better to preserve the original error for better error tracing.validate_bucket_name(&self.bucket).map_err(|e| InvalidProfileError { - source: None, + source: Some(Box::new(e.clone())), reason: e.to_string(), entity: "bucket".to_string(), })?;crates/io/src/adls/adls_location.rs (2)
66-71: Fix error message reference to correct protocol type.The error message incorrectly references "S3 location" when this is an ADLS location handler.
- reason: format!("ADLS location must use abfss, or wasbs protocol. Found: {scheme}"), + reason: format!("ADLS location must use abfss or wasbs protocol. Found: {scheme}"),
142-148: URL encoding implementation seems incomplete.The
blob_namemethod only replaces question marks with%3F, but other special characters might also need encoding. Consider using proper URL encoding for all special characters.pub fn blob_name(&self) -> String { - self.location - .path() - .unwrap_or_default() - .to_string() - .replace('?', "%3F") + use percent_encoding::{percent_encode, NON_ALPHANUMERIC}; + let path = self.location.path().unwrap_or_default(); + percent_encode(path.as_bytes(), NON_ALPHANUMERIC).to_string() }crates/io/src/location.rs (2)
30-45: Potential host extraction issue for malformed URLs.The
host_str()method doesn't validate if the location actually has a valid authority section. For edge cases likescheme://path(no authority), this might incorrectly extract parts of the path as the host.Consider adding validation for the authority section:
#[must_use] pub fn host_str(&self) -> Option<&str> { + // Check if this looks like it has an authority section + if !self.authority_and_path.contains('@') && !self.authority_and_path.starts_with('/') && self.authority_and_path.contains('/') { + // Likely has an authority section + } else if self.authority_and_path.starts_with('/') { + // No authority section, path starts immediately + return None; + } + // Everything between @ and the first slash
72-76: Improved username extraction with consistent API.The username extraction is now simplified and returns
Option<&str>which is consistent with other accessor methods likehost_str()andpath(). The logic correctly handles both userinfo with password (user:pass) and without password (user) cases.
🧹 Nitpick comments (6)
crates/lakekeeper/src/tests/mod.rs (2)
40-42: MemoryProfile import is correct; consider feature-gating S3-specific imports.Pulling in MemoryProfile alongside S3 types looks consistent with the new IO abstraction. However, if S3 is built behind a cargo feature in some build matrices, the nested import of S3 symbols inside this grouped
usemay fail when the feature is disabled. Consider splitting storage-related imports and adding#[cfg(feature = "s3")]to the S3 ones to keep tests compiling across feature sets.Example (requires splitting the grouped
use):use crate::service::storage::{MemoryProfile, StorageCredential, StorageProfile}; #[cfg(feature = "s3")] use crate::service::storage::{s3::S3AccessKeyCredential, S3Credential, S3Flavor, S3Profile};
247-248: Additional warehouses forced to memory storage — confirm this is intentional when primary storage is non-memory.Within the setup() helper, extra warehouses always use
memory_io_profile(). If the first warehouse is configured for a different backend (e.g., S3), this mixes backends across warehouses. If tests rely on homogeneity across warehouses, this could mask backend-specific issues or cause confusion.If heterogeneity is desired for isolation and speed in tests, keep as-is. Otherwise, consider accepting a storage profile factory or reusing/cloning the provided
storage_profilefor additional warehouses.crates/lakekeeper/src/catalog/s3_signer/sign.rs (2)
695-698: Simplify location constructionThe S3Location construction creates an intermediate vector just to get a reference slice, which can be simplified.
- let location = - S3Location::new(&bucket, &key.split('/').collect::<Vec<_>>(), None) - .map_err(ValidationError::from)?; + let key_segments: Vec<&str> = key.split('/').collect(); + let location = S3Location::new(&bucket, &key_segments, None) + .map_err(ValidationError::from)?;
784-785: Simplify vector borrowing patternThe code creates
path_segments_borrowedjust to convert owned strings to borrowed slices. This pattern can be simplified.- let path_segments_borrowed: Vec<&str> = path_segments.iter().map(String::as_str).collect(); - Ok(ParsedSignRequest { url: uri.clone(), locations: vec![S3Location::new( - path_segments_borrowed[0], - if path_segments_borrowed.len() > 1 { - &(path_segments_borrowed[1..]) + &path_segments[0], + if path_segments.len() > 1 { + &path_segments[1..].iter().map(String::as_str).collect::<Vec<_>>() } else { &[] },crates/lakekeeper/src/service/storage/s3.rs (2)
691-693: Clarify comment about STS role assumption behavior.The comment suggests direct STS role assumption, but the implementation actually supports both direct assumption and the traditional two-step approach (assume
assume_role_arnfirst, then STS role). The comment should be more precise about this behavior.- // We expect that we are able to assume the STS role directly, without needing to assume - // the `assume-role-arn` role first. + // Assume the STS role directly using the provided credentials. + // The `assume_role_arn` parameter is for intermediate role assumption if needed.
1402-1408: Pin syntax usage in test could be more idiomatic.The
Box::pin()usage in the test seems unnecessarily complex for an async function call. Consider using the async function directly since the test runtime should handle the future properly.- Box::pin(profile.validate_access( - Some(&cred), - None, - &RequestMetadata::new_unauthenticated(), - )) - .await - .unwrap(); + profile.validate_access( + Some(&cred), + None, + &RequestMetadata::new_unauthenticated(), + ) + .await + .unwrap();
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these settings in your CodeRabbit configuration.
📒 Files selected for processing (24)
crates/io/src/adls.rs(1 hunks)crates/io/src/adls/adls_location.rs(1 hunks)crates/io/src/adls/adls_storage.rs(1 hunks)crates/io/src/error.rs(1 hunks)crates/io/src/gcs.rs(1 hunks)crates/io/src/gcs/gcs_location.rs(1 hunks)crates/io/src/gcs/gcs_storage.rs(1 hunks)crates/io/src/location.rs(1 hunks)crates/io/src/s3/s3_error.rs(1 hunks)crates/io/src/s3/s3_storage.rs(1 hunks)crates/lakekeeper/src/catalog/compression_codec.rs(2 hunks)crates/lakekeeper/src/catalog/mod.rs(3 hunks)crates/lakekeeper/src/catalog/s3_signer/sign.rs(11 hunks)crates/lakekeeper/src/implementations/postgres/endpoint_statistics/mod.rs(2 hunks)crates/lakekeeper/src/implementations/postgres/task_queues.rs(1 hunks)crates/lakekeeper/src/service/storage/az.rs(18 hunks)crates/lakekeeper/src/service/storage/error.rs(2 hunks)crates/lakekeeper/src/service/storage/s3.rs(27 hunks)crates/lakekeeper/src/tests/drop_recursive.rs(1 hunks)crates/lakekeeper/src/tests/drop_warehouse.rs(1 hunks)crates/lakekeeper/src/tests/endpoint_stats.rs(1 hunks)crates/lakekeeper/src/tests/mod.rs(2 hunks)crates/lakekeeper/src/tests/stats.rs(1 hunks)crates/lakekeeper/src/tests/tasks.rs(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (13)
- crates/lakekeeper/src/implementations/postgres/task_queues.rs
- crates/lakekeeper/src/catalog/compression_codec.rs
- crates/lakekeeper/src/tests/stats.rs
- crates/lakekeeper/src/tests/drop_recursive.rs
- crates/io/src/s3/s3_storage.rs
- crates/lakekeeper/src/tests/tasks.rs
- crates/lakekeeper/src/tests/drop_warehouse.rs
- crates/lakekeeper/src/implementations/postgres/endpoint_statistics/mod.rs
- crates/io/src/error.rs
- crates/io/src/s3/s3_error.rs
- crates/io/src/adls/adls_storage.rs
- crates/io/src/gcs/gcs_location.rs
- crates/lakekeeper/src/catalog/mod.rs
🧰 Additional context used
🧬 Code Graph Analysis (10)
crates/io/src/gcs/gcs_storage.rs (4)
crates/io/src/lib.rs (9)
delete(164-167)delete(317-335)calculate_ranges(542-550)delete_not_found_is_ok(587-593)safe_usize_to_i32(38-46)safe_usize_to_i64(48-56)validate_file_size(58-75)new(127-134)assemble_chunks(560-584)crates/io/src/gcs/gcs_error.rs (1)
parse_error(5-62)crates/io/src/location.rs (2)
path(58-60)from_str(263-299)crates/io/src/gcs/gcs_location.rs (6)
new(22-46)location(65-67)try_from_str(98-105)object_name(60-62)bucket_name(50-52)from_str(129-131)
crates/lakekeeper/src/tests/mod.rs (2)
crates/io/src/memory.rs (1)
default(26-28)crates/lakekeeper/src/service/storage/mod.rs (1)
default(755-763)
crates/lakekeeper/src/service/storage/s3.rs (6)
crates/io/src/s3/s3_storage.rs (2)
client(48-50)new(40-45)crates/io/src/s3/s3_location.rs (3)
validate_bucket_name(168-210)new(22-62)as_str(146-148)crates/lakekeeper/src/service/storage/error.rs (15)
from(50-56)from(60-66)from(70-76)from(80-86)from(90-92)from(96-98)from(102-104)from(108-110)from(114-129)from(133-135)from(139-141)from(145-163)from(167-172)from(176-228)from(232-234)crates/iceberg-ext/src/catalog/rest/error.rs (1)
precondition_failed(128-139)crates/lakekeeper/src/request_metadata.rs (1)
new_unauthenticated(78-88)crates/lakekeeper/src/lib.rs (1)
test_block_on(60-71)
crates/io/src/gcs.rs (2)
crates/io/src/gcs/gcs_location.rs (2)
validate_bucket_name(143-209)new(22-46)crates/io/src/gcs/gcs_storage.rs (3)
client(58-60)new(52-54)fmt(42-46)
crates/io/src/adls/adls_location.rs (4)
crates/io/src/error.rs (5)
new(100-106)new(134-142)location(178-180)reason(184-186)fmt(110-117)crates/io/src/gcs/gcs_location.rs (6)
new(22-46)key(55-57)location(65-67)from_str(129-131)try_from_location(73-92)try_from_str(98-105)crates/io/src/s3/s3_location.rs (6)
new(22-62)key(70-72)location(75-77)try_from_location(85-123)try_from_str(131-138)fmt(152-154)crates/io/src/location.rs (3)
scheme(25-27)from_str(263-299)fmt(255-257)
crates/lakekeeper/src/service/storage/az.rs (5)
crates/lakekeeper/src/service/storage/s3.rs (3)
lakekeeper_io(267-276)base_location(431-438)try_from(1091-1115)crates/lakekeeper/src/service/storage/gcs/mod.rs (3)
lakekeeper_io(174-184)base_location(246-261)try_from(426-442)crates/io/src/adls/adls_location.rs (7)
normalize_host(298-321)validate_account_name(328-347)validate_filesystem_name(241-290)location(117-119)new(52-114)account_name(122-124)filesystem(127-129)crates/io/src/location.rs (2)
from_str(263-299)path(58-60)crates/io/src/adls/adls_storage.rs (2)
client(91-93)new(83-88)
crates/lakekeeper/src/catalog/s3_signer/sign.rs (3)
crates/io/src/s3/s3_location.rs (3)
try_from_str(131-138)location(75-77)new(22-62)crates/lakekeeper/src/service/storage/error.rs (16)
from(50-56)from(60-66)from(70-76)from(80-86)from(90-92)from(96-98)from(102-104)from(108-110)from(114-129)from(133-135)from(139-141)from(145-163)from(167-172)from(176-228)from(232-234)from(248-262)crates/io/src/location.rs (1)
path_segments(63-69)
crates/lakekeeper/src/service/storage/error.rs (1)
crates/iceberg-ext/src/catalog/rest/error.rs (8)
source(86-90)bad_request(107-113)internal(141-152)not_implemented(115-126)precondition_failed(128-139)IcebergErrorResponse(62-64)From(27-31)From(54-58)
crates/io/src/location.rs (1)
crates/iceberg-ext/src/configs/primitives/location.rs (6)
Location(10-123)tests(225-294)Location(6-6)PartialLocationsIter(125-130)partial_locations(110-122)as_str(22-24)
crates/lakekeeper/src/tests/endpoint_stats.rs (1)
crates/lakekeeper/src/tests/mod.rs (1)
memory_io_profile(49-51)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (9)
- GitHub Check: docker / docker
- GitHub Check: docker / docker
- GitHub Check: docker / docker
- GitHub Check: docker / docker
- GitHub Check: check-generated-openapi-matches
- GitHub Check: clippy
- GitHub Check: sqlx-check
- GitHub Check: test
- GitHub Check: security_audit
🔇 Additional comments (38)
crates/lakekeeper/src/tests/mod.rs (1)
49-51: Verified removal of old helper referencesNo occurrences of
test_io_profile(orTestProfileremain in the codebase. Approving the newmemory_io_profilehelper.crates/lakekeeper/src/tests/endpoint_stats.rs (1)
648-648: Switch to memory_io_profile helper: LGTM.Matches the new in-memory IO test profile used across the suite; behavior stays the same.
crates/lakekeeper/src/service/storage/s3.rs (12)
267-276: LGTM! Clean integration with the new IO layer.The new
lakekeeper_iomethod properly leverages the centralized IO layer, converting credentials toS3Authand using the settings-based approach. The error handling is appropriate.
431-438: Enhanced return type provides better error context.The change from returning a generic
ValidationErrorto a specificInvalidLocationErrorimproves error specificity and type safety. The implementation correctly validates the bucket name and constructs the location using the newS3Location::newmethod.
503-523: Simplified credential conversion with unified S3Auth.The conversion to
S3Authunifies the credential handling and simplifies the STS token generation flow. The error handling appropriately propagates conversion failures.
744-762: Improved SDK config generation with unified settings.The refactored method uses the new
storage_profile_to_s3_settingshelper and delegates to the IO layer's SDK config generation. This centralizes configuration logic and improves maintainability.
768-799: Enhanced signing identity method with better error handling.The new
get_signing_identitymethod properly converts credentials toS3Auth, obtains the SDK config with role assumption, and provides detailed error messages for failure cases. The public visibility makes it available for external use.
900-907: Consistent error construction pattern.The error construction follows the same pattern as other validation methods in the file, maintaining consistency in error handling.
915-922: Consistent error construction pattern.The error construction follows the same pattern as other validation methods in the file, maintaining consistency in error handling.
940-946: Consistent error construction pattern.The error construction follows the same pattern as other validation methods in the file, maintaining consistency in error handling.
995-1003: Well-designed helper function for settings conversion.The
storage_profile_to_s3_settingsfunction cleanly mapsS3Profilefields toS3Settings, providing a clear abstraction layer between the profile and the IO layer settings.
1040-1046: Improved error handling with specific IcebergFileIoError.The change from generic
FileIoErrorto specificIcebergFileIoErrorprovides better error context and aligns with the new error handling patterns introduced in the IO layer refactoring.
1070-1116: Excellent credential conversion implementations.The new
Fromimplementations provide clean conversions between the credential types and the unifiedS3Authenum. TheTryFromimplementation forS3Credentialproperly handles the system credentials configuration check and provides appropriate error handling for disabled system credentials.
1447-1482: New test methods provide good coverage for signing identity.The new test methods
test_signing_identityandtest_signing_identity_with_assumed_roleprovide valuable coverage for the signing identity functionality, including testing both direct credentials and role assumption scenarios.crates/io/src/adls/adls_location.rs (9)
82-89: LGTM! Proper path segment validation.The validation correctly checks for slashes in path segments and provides clear error messages with the problematic segment included in the context.
91-96: Good use of helper function for host normalization.The code properly delegates host normalization to the dedicated helper function and provides good error context by including the debug location string.
160-204: Excellent scheme validation and custom variant handling.The
try_from_locationmethod properly validates ADLS schemes, handles both standard (abfss) and custom variant (wasbs) protocols with appropriate allow/disallow logic, and provides clear error messages for invalid schemes.
192-198: Good host parsing with clear error message.The host parsing correctly splits on the first dot to separate account name from endpoint suffix and provides a clear error message explaining the expected format.
241-290: Comprehensive filesystem name validation.The
validate_filesystem_namefunction implements thorough validation according to Azure Storage naming rules, including proper length checks, character restrictions, and consecutive hyphen detection. The error messages are detailed and helpful.
298-321: Robust host normalization with proper validation.The
normalize_hostfunction correctly handles empty strings, validates against slashes, and uses theurl::Host::parsemethod for proper hostname validation. The error handling is comprehensive.
328-347: Proper account name validation following Azure rules.The
validate_account_namefunction correctly implements Azure storage account naming rules with appropriate length and character restrictions. The validation logic is sound.
490-500: Good test coverage with roundtrip validation.The test cases cover various ADLS location formats and importantly include roundtrip testing (parse and then format back to string) to ensure consistency between parsing and display logic.
519-539: Excellent test for variant handling behavior.The test properly validates that
wasbslocations are accepted whenallow_variants = trueand rejected whenallow_variants = false, ensuring the scheme variant logic works correctly in both modes.crates/io/src/location.rs (8)
116-131: Efficient duplicate slash removal implementation.The implementation now uses a single-pass algorithm to collapse consecutive slashes, which is much more efficient than the previous while loop approach. This addresses the O(n²) performance concern with malicious inputs containing many consecutive slashes.
178-187: LGTM! Proper sublocation checking logic.The
is_sublocation_ofmethod correctly handles the equality case and uses trailing slash normalization to ensure proper directory-based comparison. The logic properly identifies sublocations.
190-202: Well-designed partial locations iterator.The
partial_locationsmethod provides a clean API for iterating over location prefixes, properly calculating the scheme index and using reverse match indices to walk the path structure from full to partial locations.
207-219: Robust parent location calculation.The
parentmethod correctly finds the last slash while preserving trailing slashes and handles edge cases where there might be no parent (root level). The implementation maintains the authority and host information properly.
240-252: Clean iterator implementation for partial locations.The
PartialLocationsItercorrectly implements the iterator pattern, yielding the full location first and then progressively shorter prefixes. The scheme index boundary check prevents yielding invalid partial locations.
264-299: Comprehensive URL parsing with proper validation.The
FromStrimplementation properly validates URLs using theurl::Urlparser, rejects base URLs and fragments, ensures exactly one "://" separator, and constructs the internal representation correctly. The error handling provides clear diagnostic information.
369-387: Comprehensive test coverage for sublocation logic.The test cases cover various sublocation scenarios including exact matches, proper sublocations, and edge cases like similar prefixes that shouldn't match (e.g., "foo" vs "foo-bar"). This ensures the sublocation detection logic is robust.
390-420: Thorough testing of partial locations with edge cases.The test covers multiple scenarios including paths with and without trailing slashes, and root-level locations. The sorting of results ensures deterministic test behavior regardless of iteration order.
crates/lakekeeper/src/service/storage/error.rs (7)
198-205: Good destructuring pattern avoids partial moves.The destructuring of
InvalidProfileErrorin the pattern match correctly avoids partial move issues and cleanly extracts all needed fields in a single operation.
49-87: Consistent error conversion patterns for ADLS and GCS errors.All the
Fromimplementations for ADLS and GCS validation errors follow a consistent pattern, properly wrapping them inInvalidProfileErrorand then boxing them for theValidationError. The entity field appropriately identifies the problematic field.
113-130: Comprehensive IOErrorExt conversion handling.The conversion properly handles all
IOErrorExtvariants, mapping them to appropriateValidationErrortypes with proper error chaining and context preservation. The error messages are informative.
144-164: Good error routing for TableConfigError variants.The implementation properly routes different
TableConfigErrorvariants to appropriateValidationErrortypes, maintaining error context and providing meaningful error categorization.
247-263: Comprehensive IcebergFileIoError to ErrorModel conversion.The conversion properly handles all error variants with appropriate HTTP status codes and error types. The error messages provide good context for debugging.
353-381: Well-structured CredentialsError to ErrorModel mapping.The conversion maps each credential error type to the appropriate HTTP status code and error type, providing consistent error responses across different credential failure scenarios.
191-196: Avoid move-out-of-box pattern in error matching.The current pattern uses
matches!(e.as_ref(), ...)which is correct and avoids the move-out-of-box issue. However, there's still an issue with passingSome(e)instead of using the existing boxed error directly.ValidationError::Credentials(e) => { if matches!(e.as_ref(), CredentialsError::UnexpectedStorageType(_)) { - ErrorModel::bad_request(e.to_string(), "UnexpectedStorageProfileType", Some(e)) + ErrorModel::bad_request(e.to_string(), "UnexpectedStorageProfileType", Some(e as Box<dyn std::error::Error + Send + Sync + 'static>)) } else { (*e).into() } }Likely an incorrect or invalid review comment.
There was a problem hiding this comment.
Actionable comments posted: 1
♻️ Duplicate comments (3)
crates/lakekeeper/src/service/storage/s3.rs (1)
310-315: Return type inconsistency with error handling pattern.The error construction uses
InvalidProfileErrorbut the function returnsValidationError. This creates an inconsistent conversion pattern. Consider using the establishedFromimplementations.if self.sts_enabled && matches!(self.flavor, S3Flavor::Aws) && self.sts_role_arn.is_none() && self.assume_role_arn.is_none() { - return Err(InvalidProfileError { - source: None, - reason: "Either `sts-role-arn` or `assume-role-arn` is required for Storage Profiles with AWS flavor if STS is enabled.".to_string(), - entity: "sts-role-arn".to_string(), - }.into()); + return Err(ValidationError::InvalidProfile(Box::new(InvalidProfileError { + source: None, + reason: "Either `sts-role-arn` or `assume-role-arn` is required for Storage Profiles with AWS flavor if STS is enabled.".to_string(), + entity: "sts-role-arn".to_string(), + }))); }crates/io/src/adls/adls_storage.rs (1)
119-215: Consider documenting the batch delete behavior.The current implementation processes deletes individually rather than using Azure's batch delete API (when available). The TODO comment on line 119 already indicates awareness of this limitation.
crates/lakekeeper/src/service/storage/az.rs (1)
328-331: Fix directory depth calculation for root paths.The current implementation incorrectly calculates depth for root paths. An empty path after trimming would still return a count of 1 from
split('/').Apply this diff:
- let path = reduce_scheme_string(path.as_ref()); - let rootless_path = path.trim_start_matches('/').trim_end_matches('/'); - let depth = rootless_path.split('/').count(); + let path = reduce_scheme_string(path.as_ref()); + let rootless_path = path.trim_start_matches('/').trim_end_matches('/'); + let depth = if rootless_path.is_empty() { + 0 + } else { + rootless_path.split('/').count() + };
🧹 Nitpick comments (3)
crates/io/src/adls/adls_storage.rs (2)
26-28: Consider documenting the rationale for these chunk size limits.The constants
MAX_BYTES_PER_REQUEST(7 MB) andDEFAULT_BYTES_PER_REQUEST(4 MB) appear to be carefully chosen values for ADLS operations. Consider adding documentation explaining why these specific values were selected (e.g., ADLS API limits, performance characteristics).
141-147: Consider making the semaphore limit configurable.The hard-coded limit of 1000 concurrent delete operations might need adjustment based on deployment characteristics or ADLS rate limits.
Consider making this configurable through the storage configuration:
- let semaphore = std::sync::Arc::new(tokio::sync::Semaphore::new(1000)); + let semaphore = std::sync::Arc::new(tokio::sync::Semaphore::new( + self.max_concurrent_deletes.unwrap_or(1000) + ));crates/lakekeeper/src/service/storage/az.rs (1)
424-428: Consider adding error logging for path reduction failures.When
AdlsLocation::try_from_strfails, the function silently falls back to the original path. Consider logging this for debugging purposes.pub(crate) fn reduce_scheme_string(path: &str) -> String { AdlsLocation::try_from_str(path, true) .map(|l| l.blob_name().to_string()) - .unwrap_or(path.to_string()) + .unwrap_or_else(|_| { + tracing::trace!("Failed to parse ADLS location from path: {}", path); + path.to_string() + }) }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these settings in your CodeRabbit configuration.
📒 Files selected for processing (4)
crates/io/src/adls/adls_storage.rs(1 hunks)crates/io/tests/integration_tests.rs(1 hunks)crates/lakekeeper/src/service/storage/az.rs(18 hunks)crates/lakekeeper/src/service/storage/s3.rs(27 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- crates/io/tests/integration_tests.rs
🧰 Additional context used
🧬 Code Graph Analysis (3)
crates/io/src/adls/adls_storage.rs (4)
crates/io/src/adls/adls_error.rs (1)
parse_error(5-63)crates/io/src/lib.rs (11)
calculate_ranges(542-550)delete_not_found_is_ok(587-593)safe_usize_to_i64(48-56)validate_file_size(58-75)new(127-134)delete(164-167)delete(317-335)errors(493-498)read(199-202)read(378-396)assemble_chunks(560-584)crates/io/src/adls/adls_location.rs (5)
location(117-119)account_name(122-124)new(52-114)scheme(137-139)filesystem(127-129)crates/io/src/location.rs (4)
path(58-60)as_ref(303-305)scheme(25-27)authority_with_host(48-55)
crates/lakekeeper/src/service/storage/s3.rs (5)
crates/io/src/s3/s3_storage.rs (2)
client(48-50)new(40-45)crates/io/src/s3/s3_location.rs (3)
validate_bucket_name(168-210)new(22-62)as_str(146-148)crates/iceberg-ext/src/catalog/rest/error.rs (1)
precondition_failed(128-139)crates/lakekeeper/src/request_metadata.rs (1)
new_unauthenticated(78-88)crates/lakekeeper/src/lib.rs (1)
test_block_on(60-71)
crates/lakekeeper/src/service/storage/az.rs (2)
crates/io/src/adls/adls_location.rs (6)
normalize_host(298-321)validate_account_name(328-347)validate_filesystem_name(241-290)location(117-119)account_name(122-124)filesystem(127-129)crates/io/src/location.rs (2)
from_str(263-299)path(58-60)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
- GitHub Check: docker / docker
- GitHub Check: docker / docker
- GitHub Check: docker / docker
- GitHub Check: docker / docker
- GitHub Check: test
- GitHub Check: sqlx-check
🔇 Additional comments (21)
crates/lakekeeper/src/service/storage/s3.rs (12)
262-276: LGTM! Method migration to Lakekeeper IO is well-structured.The new
lakekeeper_iomethod correctly replaces the legacy file_io approach with a clean interface tolakekeeper_io::S3Storage.
290-294: Error conversion preserves original error correctly.The validation properly converts bucket name validation errors to
InvalidProfileErrorformat, maintaining the error reason while standardizing the error surface.
375-382: Improved error handling for location validation.The method now returns
InvalidLocationErrorwhich better aligns with the lakekeeper-io error model. The string splitting logic is sound for key prefix handling.
447-467: Clean credential conversion to S3Auth.The migration from credential handling to
S3Authis well-implemented, correctly using the new conversion methods and maintaining the existing STS logic.
596-596: Parameter type migration aligns with new auth model.The change from credential types to
S3Authmaintains compatibility while aligning with the lakekeeper-io authentication interface.
683-706: Well-structured SDK config integration.The method correctly uses the new
storage_profile_to_s3_settingshelper and integrates cleanly with the lakekeeper-io S3 settings model. The credential validation logic is preserved.
708-743: Excellent signing identity method implementation.The public method correctly converts credentials to
S3Auth, uses the updated SDK config method, and provides appropriate error handling withErrorModel. The credential provider validation is robust.
939-947: Clean helper function for settings conversion.The
storage_profile_to_s3_settingsfunction correctly maps relevant S3Profile fields to the lakekeeper-ioS3Settingsstructure, maintaining the separation of concerns.
984-990: Consistent error handling pattern.The region validation correctly delegates to lakekeeper-io while maintaining the
InvalidProfileErrorinterface for consistent error surfaces.
1014-1060: Comprehensive credential conversion implementations.The
FromandTryFromimplementations correctly handle the credential type conversions with proper error handling for system credentials and appropriate CloudflareR2 credential mapping.
1346-1352: Updated test method signatures align with validation changes.The test correctly uses
Box::pinfor the async validation call, reflecting the updated storage profile validation interface.
1391-1427: New comprehensive signing identity tests.The added tests for
get_signing_identitywith and without assumed roles provide good coverage of the new authentication pathways and ensure proper integration with the lakekeeper-io auth model.crates/io/src/adls/adls_storage.rs (5)
1-18: LGTM!The imports are well-organized and appropriate for the ADLS storage implementation.
186-189: Verify the first-batch failure behavior is intentional.The code returns early with a fatal error if the first batch fails, but continues processing for subsequent batches. This asymmetric behavior might be confusing.
Is this intentional behavior where the first delete operation failure is considered fatal but subsequent failures are not? This could lead to inconsistent error handling depending on the order of operations.
364-374: Good defensive programming with last-modified time check.Excellent implementation of checking
last_modifiedtime during multi-part downloads to detect concurrent modifications. This prevents data corruption from race conditions.
395-396: Ensure path normalization is consistent.The path formatting adds a trailing slash, but this should be validated to ensure it works correctly with paths that already have trailing slashes.
The implementation correctly handles trailing slashes by using
trim_end_matches('/')before adding one back, ensuring consistent formatting.
471-479: LGTM! Clear validation logic.The
require_keyhelper function properly validates that operations have a non-empty path within the filesystem.crates/lakekeeper/src/service/storage/az.rs (4)
183-195: LGTM! Clean CloudLocation construction.The method properly handles both custom and public cloud locations based on the presence of a host configuration.
203-213: LGTM! Proper error propagation.The blob service client creation properly converts credentials and handles errors appropriately.
520-548: LGTM! Proper credential conversion with system identity check.The implementation correctly validates that system identity is enabled before allowing its use, providing clear error messages.
586-590: LGTM! Test environment variables properly updated.The test environment variables have been correctly updated to use the
LAKEKEEPER_TEST__prefix, aligning with the new IO pathway conventions.
There was a problem hiding this comment.
Actionable comments posted: 0
🔭 Outside diff range comments (2)
crates/lakekeeper/src/service/storage/az.rs (2)
297-317: Fix typos in Azure SDK calls: use “delegation”, not “deligation” (won’t compile).Method and field names are misspelled (
get_user_deligation_key,user_deligation_key). The Azure SDK uses “delegation”. This will fail at compile time.Apply this diff:
- let delegation_key = client - .get_user_deligation_key( + let delegation_key = client + .get_user_delegation_key( start, start .checked_add(time::Duration::seconds(clamped_validity_seconds)) .ok_or(CredentialsError::ShortTermCredential { reason: format!( "SAS expiry overflow: Cannot issue a token valid for {clamped_validity_seconds} seconds", ) .to_string(), source: None, })?, ) .await .map_err(|e| CredentialsError::ShortTermCredential { reason: "Error getting azure user delegation key.".to_string(), source: Some(Box::new(e)), })?; - let signed_expiry = delegation_key.user_deligation_key.signed_expiry; - let key = delegation_key.user_deligation_key.clone(); + let signed_expiry = delegation_key.user_delegation_key.signed_expiry; + let key = delegation_key.user_delegation_key.clone();
493-506: Remove the correct SAS token key; current code removes the prefix string, not the matched key.
config.remove(sas_token_prefix)won’t remove the actual entry (e.g.,adls.sas-token.<account>.<endpoint>). This leaves the original key in the map and adds a secondadls.sas-token, which may cause ambiguity.Apply this diff:
- let mut sas_token = None; + let mut sas_token: Option<String> = None; + let mut matched_key: Option<String> = None; for (key, value) in &config { if key.starts_with(sas_token_prefix) { - sas_token = Some(value.to_string()); + sas_token = Some(value.to_string()); + matched_key = Some(key.clone()); break; } } if let Some(sas_token) = sas_token { - config.remove(sas_token_prefix); + if let Some(key) = matched_key { + config.remove(&key); + } config.insert("adls.sas-token".to_string(), sas_token); }
♻️ Duplicate comments (1)
crates/lakekeeper/src/service/storage/az.rs (1)
328-331: Compute directory depth correctly for SAS when targeting the root path.For an empty path,
split('/')returns 1, yielding an incorrect depth. Handle the empty string explicitly.Apply this diff:
- let path = reduce_scheme_string(path.as_ref()); - let rootless_path = path.trim_start_matches('/').trim_end_matches('/'); - let depth = rootless_path.split('/').count(); + let path = reduce_scheme_string(path.as_ref()); + let rootless_path = path.trim_start_matches('/').trim_end_matches('/'); + let depth = if rootless_path.is_empty() { + 0 + } else { + rootless_path.split('/').count() + };
🧹 Nitpick comments (1)
crates/lakekeeper/src/service/storage/az.rs (1)
355-359: Avoid unnecessary allocation when building the Iceberg SAS property key.Use
as_deref().unwrap_or(DEFAULT_HOST)to bypass creating a temporaryString.Apply this diff:
- iceberg_sas_property_key( - &self.account_name, - self.host.as_ref().unwrap_or(&DEFAULT_HOST.to_string()), - ) + iceberg_sas_property_key( + &self.account_name, + self.host.as_deref().unwrap_or(DEFAULT_HOST), + )
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these settings in your CodeRabbit configuration.
📒 Files selected for processing (1)
crates/lakekeeper/src/service/storage/az.rs(18 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
crates/lakekeeper/src/service/storage/az.rs (2)
crates/io/src/adls/adls_location.rs (7)
normalize_host(298-321)validate_account_name(328-347)validate_filesystem_name(241-290)location(117-119)new(52-114)account_name(122-124)filesystem(127-129)crates/io/src/location.rs (2)
from_str(263-299)path(58-60)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (9)
- GitHub Check: docker / docker
- GitHub Check: docker / docker
- GitHub Check: docker / docker
- GitHub Check: docker / docker
- GitHub Check: test
- GitHub Check: clippy
- GitHub Check: check-generated-openapi-matches
- GitHub Check: sqlx-check
- GitHub Check: security_audit
🔇 Additional comments (9)
crates/lakekeeper/src/service/storage/az.rs (9)
155-181: Base location construction looks correct and robust.Nice handling of optional key prefix, host normalization, and error mapping into
InvalidLocationError.
183-201: Good abstraction for Cloud/Azure settings.Mapping
hostpresence toCloudLocation::CustomvsPublicand bundling intoAzureSettingsis clean and aligns with multi-cloud support.
203-213: Client wiring via AzureAuth is sound.Converting
AzCredentialintoAzureAuthand delegating client creation through IO’sAzureSettingssurface is a solid separation of concerns.
214-227: Lakekeeper IO surface integration LGTM.Returning
AdlsStoragevia the IO crate keeps storage-specific concerns isolated. Error translation intoCredentialsErroris appropriate.
321-353: SAS canonical resource and permissions look appropriate; verify container-root behavior.Using Blob service resource with
BlobSignedResource::Directoryis correct for ADLS Gen2. With the depth fix applied above, please verify that generating a SAS for the filesystem root behaves as expected on consumer side (some SDKs are sensitive to trailing slashes for root directories).Would you like me to add a focused unit/integration test that asserts a root-path SAS is accepted by the client libraries?
424-428: Path reduction via AdlsLocation is a nice improvement.Falling back to the input string on parse failures ensures resilience across protocol variants.
520-547: Credential gating for system identity is correct.Guarding MSI behind configuration and unifying credentials through
TryFrom<AzCredential> for AzureAuthis clean and safe.
562-576: Unit tests for reduce_scheme_string are solid.Coverage for both
abfss://andwasbs://plus a non-matching URL is sufficient.
586-621: Environment variable names updated; ensure docs and CI envs match.The tests use
LAKEKEEPER_TEST__AZURE_*variables. Make sure README/CONTRIBUTING and CI secrets reflect this rename to avoid red builds.I can open a follow-up PR to update any remaining docs or CI configs. Want me to do that?
There was a problem hiding this comment.
Actionable comments posted: 3
♻️ Duplicate comments (3)
crates/io/src/gcs/gcs_storage.rs (1)
82-148: Inconsistent error handling for batch deletion.The past review comment about inconsistent early return logic for batch deletion errors is still valid. The current implementation fails fast on any individual deletion error without first attempting all deletions.
crates/io/src/error.rs (1)
63-69: Incorrect error message in ReadError.The error message says "Failed to delete object" but this is for read operations.
crates/io/src/lib.rs (1)
220-295: Potential error information loss in remove_all.The past review comment about complex error handling in
remove_allpotentially losing error details is still valid. Only the first error is preserved when multiple errors occur.
🧹 Nitpick comments (12)
crates/io/src/gcs/gcs_storage.rs (1)
150-273: Consider using a semaphore for multipart upload parallelism.Currently, multipart uploads are executed with parallelism of 1 (Line 225), which means chunks are uploaded sequentially. This could be inefficient for large files.
Consider using the same semaphore-based approach as the read operation to allow controlled parallel chunk uploads:
- // Wait for all uploads to complete - let upload_stream = execute_with_parallelism(upload_futures, 1).map(|result| { + // Wait for all uploads to complete with controlled parallelism + let upload_stream = execute_with_parallelism(upload_futures, 10).map(|result| { result.map_err(|join_err| { WriteError::IOError(IOError::new( ErrorKind::Unexpected, format!("Task join error during multipart upload: {join_err}"), "multipart_upload".to_string(), )) }) });crates/io/src/error.rs (2)
1-4: Remove commented-out code.These commented lines at the beginning of the file appear to be leftover from development and should be removed for cleaner production code.
-// use lakekeeper::{api::ErrorModel, service::storage::error::InvalidLocationError}; - -// use crate::OperationType; -
97-130: Remove large block of commented-out code.The commented-out
BatchDeleteErrorstruct and its implementation (lines 97-130) should be removed. If this functionality is needed later, it can be retrieved from version control.-// #[derive(Debug, Clone, PartialEq, Eq)] -// pub struct BatchDeleteError { -// /// The path that was failed for deletion, if available -// pub path: String, -// /// Error code from the storage service, if available -// pub error_code: Option<String>, -// /// Error message from the storage service -// pub error_message: String, -// } - -// impl BatchDeleteError { -// #[must_use] -// pub fn new(path: String, error_code: Option<String>, error_message: String) -> Self { -// Self { -// path, -// error_code, -// error_message, -// } -// } -// } - -// impl std::fmt::Display for BatchDeleteError { -// fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { -// write!(f, "Failed to delete path '{}': ", self.path)?; - -// match (&self.error_code, &self.error_message) { -// (Some(code), message) => write!(f, "{code} - {message}"), -// (None, message) => write!(f, "{message}"), -// } -// } -// } - -// impl std::error::Error for BatchDeleteError {} -crates/io/src/lib.rs (1)
82-91: Remove commented-out code.The commented-out
RefreshingLakekeeperIoandRefreshingIostructs should be removed.-// #[derive(Debug, Clone)] -// pub struct RefreshingLakekeeperIo<C: StorageCredentialProvider, I: LakekeeperStorage> { -// credential_provider: Arc<C>, -// lakekeeper_io: Arc<RwLock<(Arc<I>, std::time::Instant)>>, -// inner: Arc<RefreshingIo>, -// } - -// #[derive(Debug, Clone)] -// struct RefreshingIo {} -crates/io/src/memory.rs (1)
195-247: Inefficient location parsing in list method.The list method creates all Location objects upfront, which could be memory-intensive for large directories. Since you're already chunking the results, consider parsing locations lazily.
Consider parsing locations on-demand as chunks are created:
- let mut all_locations = Vec::new(); - for key in matching_keys { - let location_str = format!("{MEMORY_PREFIX}{key}"); - match location_str.parse::<Location>() { - Ok(location) => all_locations.push(location), - Err(e) => { - let error = IOError::new( - ErrorKind::Unexpected, - format!("Failed to parse location: {e}"), - location_str, - ) - .set_source(anyhow::anyhow!(e)); - // Return an error in the stream - return Ok(stream::iter(std::iter::once(Err(error))).boxed()); - } - } - } - - // Convert to Vec<Vec<Location>> by chunking, then create an iterator over those chunks - let chunks: Vec<Vec<Location>> = all_locations - .chunks(page_size) - .map(<[Location]>::to_vec) - .collect(); + // Create chunks of keys first + let key_chunks: Vec<Vec<String>> = matching_keys + .chunks(page_size) + .map(<[String]>::to_vec) + .collect(); + + // Parse locations lazily per chunk + let stream = stream::iter(key_chunks.into_iter().map(|chunk| { + let mut locations = Vec::new(); + for key in chunk { + let location_str = format!("{MEMORY_PREFIX}{key}"); + match location_str.parse::<Location>() { + Ok(location) => locations.push(location), + Err(e) => { + return Err(IOError::new( + ErrorKind::Unexpected, + format!("Failed to parse location: {e}"), + location_str, + ) + .set_source(anyhow::anyhow!(e))); + } + } + } + Ok(locations) + }));crates/io/tests/integration_tests.rs (7)
1-1: Remove unnecessaryuse core::panicimport
panic!is a macro in the prelude; the explicituse core::panic;is unused and can be dropped.-use core::panic;
60-67: Avoidunwrap()when parsing S3 endpoint; make path-style conditionalAn invalid
LAKEKEEPER_TEST__S3_ENDPOINTwill panic the test suite viaunwrap(). Also, forcingpath_style_access = Some(true)for AWS S3 can cause issues; better to enable it only when a custom endpoint is used (e.g., MinIO).Apply this diff:
- let s3_settings = lakekeeper_io::s3::S3Settings { - assume_role_arn: None, - endpoint: endpoint.map(|e| e.parse().unwrap()), - region, - path_style_access: Some(true), - aws_kms_key_arn: None, - }; + let endpoint_uri = match endpoint { + Some(e) => Some( + e.parse() + .map_err(|err| anyhow::anyhow!("Invalid S3 endpoint URL in LAKEKEEPER_TEST__S3_ENDPOINT: {err}"))? + ), + None => None, + }; + let s3_settings = lakekeeper_io::s3::S3Settings { + assume_role_arn: None, + endpoint: endpoint_uri.clone(), + region, + // Use path-style only for custom endpoints (e.g., MinIO); let SDK default otherwise. + path_style_access: if endpoint_uri.is_some() { Some(true) } else { None }, + aws_kms_key_arn: None, + };
414-420: Comment contradicts the assertion; tighten the commentThe assertion checks for equality, but the comment says “at least as many.” Align the comment with the check.
- // Just verify we have at least as many files as we wrote + // Verify we listed exactly the files we wrote (no extras)
493-505: Reduce verbose debug output in normal runsThe unconditional println! spam can make CI logs noisy. Consider gating behind an env flag or using
tracing/logwith level control.For example:
- println!( - "Expected {} files, found {} files:", - test_files.len(), - all_locations.len() - ); - for location in &all_locations { - println!(" Found: {location}"); - } - for path in &written_paths { - println!(" Expected: {path}"); - } + if std::env::var_os("LAKEKEEPER_TEST_DEBUG").is_some() { + println!( + "Expected {} files, found {} files:", + test_files.len(), + all_locations.len() + ); + for location in &all_locations { + println!(" Found: {location}"); + } + for path in &written_paths { + println!(" Expected: {path}"); + } + }
906-919: Make special-characters listing robust across backends by filtering directory entriesSome backends may return directory markers. Filter them out before asserting counts and membership to avoid flakes.
- // Verify all files with special characters are listed - let listed_locations: Vec<String> = all_locations.iter().map(ToString::to_string).collect(); - assert_eq!( - listed_locations.len(), - special_files.len(), - "Number of listed files should match the number of written files" - ); - - for expected_path in &written_paths { - assert!( - listed_locations.iter().any(|loc| loc == expected_path), - "Should find path {expected_path} in list results: {listed_locations:?}" - ) - } + // Verify all files with special characters are listed (ignore directory markers) + let files_only: Vec<String> = all_locations + .iter() + .map(ToString::to_string) + .filter(|s| !s.ends_with('/')) + .collect(); + assert_eq!( + files_only.len(), + special_files.len(), + "Number of listed files should match the number of written files (excluding directories)" + ); + + for expected_path in &written_paths { + assert!( + files_only.iter().any(|loc| loc == expected_path), + "Should find path {expected_path} in list results: {files_only:?}" + ) + }
980-980: Avoid double slash in non-existent directory pathPassing a suffix ending with
/totest_dir_pathproduces a trailing//. While most backends tolerate it, it’s brittle.- let non_existent_dir = config.test_dir_path("non-existent-directory/"); + let non_existent_dir = config.test_dir_path("non-existent-directory");
826-848: Consider reducing large test payload size or make it configurable128MB per run can be slow and expensive across remote backends. Optional: gate via env var or lower default (e.g., 32–64MB) while preserving coverage.
Example:
- // Create a 128MB file - let large_data = generate_test_data(128); + // Create a large file (default 64MB; override via LAKEKEEPER_TEST_LARGE_FILE_MB) + let size_mb = std::env::var("LAKEKEEPER_TEST_LARGE_FILE_MB") + .ok() + .and_then(|v| v.parse().ok()) + .unwrap_or(64); + let large_data = generate_test_data(size_mb);
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
⛔ Files ignored due to path filters (1)
Cargo.lockis excluded by!**/*.lock
📒 Files selected for processing (9)
crates/io/Cargo.toml(1 hunks)crates/io/src/adls/adls_storage.rs(1 hunks)crates/io/src/error.rs(1 hunks)crates/io/src/gcs/gcs_storage.rs(1 hunks)crates/io/src/lib.rs(1 hunks)crates/io/src/memory.rs(1 hunks)crates/io/src/s3/s3_error.rs(1 hunks)crates/io/src/s3/s3_storage.rs(1 hunks)crates/io/tests/integration_tests.rs(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
- crates/io/src/s3/s3_error.rs
- crates/io/src/adls/adls_storage.rs
- crates/io/src/s3/s3_storage.rs
🧰 Additional context used
🧬 Code Graph Analysis (3)
crates/io/src/gcs/gcs_storage.rs (4)
crates/io/src/lib.rs (20)
delete(160-163)delete(299-317)list(212-218)list(400-422)calculate_ranges(473-481)delete_not_found_is_ok(518-524)execute_with_parallelism(534-576)safe_usize_to_i32(34-42)safe_usize_to_i64(44-52)validate_file_size(54-71)new(123-130)delete_batch(179-182)delete_batch(319-337)write(185-189)write(339-358)read_single(204-207)read_single(380-398)read(195-198)read(360-378)assemble_chunks(491-515)crates/io/src/gcs/gcs_error.rs (1)
parse_error(5-62)crates/io/src/location.rs (2)
path(58-60)from_str(263-299)crates/io/src/gcs/gcs_location.rs (6)
new(22-46)location(65-67)try_from_str(98-105)object_name(60-62)bucket_name(50-52)from_str(129-131)
crates/io/src/memory.rs (2)
crates/io/src/error.rs (2)
new(143-151)from(89-94)crates/io/src/lib.rs (13)
new(123-130)delete(160-163)delete(299-317)delete_batch(179-182)delete_batch(319-337)write(185-189)write(339-358)read(195-198)read(360-378)list(212-218)list(400-422)remove_all(222-295)remove_all(424-441)
crates/io/src/lib.rs (7)
crates/io/src/error.rs (4)
location(187-189)context(205-207)new(143-151)from(89-94)crates/io/src/gcs/gcs_location.rs (3)
location(65-67)try_from(121-123)new(22-46)crates/io/src/s3/s3_location.rs (2)
location(75-77)new(22-62)crates/io/src/location.rs (4)
value(284-284)path(58-60)next(240-251)as_ref(303-305)crates/io/src/gcs/gcs_storage.rs (4)
new(49-51)delete(61-80)delete_batch(83-148)paths(88-115)crates/io/src/memory.rs (4)
new(36-38)delete(139-147)delete_batch(149-165)len(93-95)crates/io/src/s3/s3_storage.rs (3)
new(37-42)delete(56-69)delete_batch(71-82)
🪛 GitHub Check: clippy
crates/io/src/lib.rs
[failure] 533-533:
backticks are unbalanced
[failure] 526-526:
backticks are unbalanced
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (9)
- GitHub Check: docker / docker
- GitHub Check: docker / docker
- GitHub Check: docker / docker
- GitHub Check: docker / docker
- GitHub Check: test
- GitHub Check: check-generated-openapi-matches
- GitHub Check: sqlx-check
- GitHub Check: security_audit
- GitHub Check: security_audit
🔇 Additional comments (3)
crates/io/Cargo.toml (1)
1-90: LGTM! Well-structured Cargo manifest for multi-backend IO crate.The feature-gated backend design with optional dependencies is clean and follows Rust best practices. The default features provide good out-of-box experience with S3, ADLS, and GCS support.
crates/io/src/memory.rs (1)
36-69: Thread safety consideration for global store.The global store uses thread-local storage, which means different threads will have different stores. This could be confusing for users expecting a truly global in-memory store across threads.
Consider documenting this behavior more explicitly in the struct documentation or consider using a static
Arc<RwLock<>>for true global behavior:/// In-memory storage implementation for testing and development purposes. /// /// Note: When using the global store option, data is only shared within the same thread. /// Different threads will maintain separate stores. This is by design to avoid /// synchronization overhead in tests that run in parallel.crates/io/tests/integration_tests.rs (1)
30-169: Nice macro-driven, multi-backend test harnessGood use of feature-gated, parameterized tests and a shared runtime. The env-driven backends and base-path isolation via UUIDs are clean and minimize cross-test interference.
There was a problem hiding this comment.
Actionable comments posted: 1
♻️ Duplicate comments (1)
crates/io/tests/integration_tests.rs (1)
1392-1392: Fix incorrect rand API usageAs identified in the past review,
rand::rng()doesn't exist in rand 0.9.x. Userand::thread_rng()instead.- let mut rng = rand::rng(); + let mut rng = rand::thread_rng();
🧹 Nitpick comments (9)
crates/io/tests/integration_tests.rs (9)
1-1: Consider using a more specific importInstead of importing
core::panic, which is rarely needed directly, verify if this import is actually used in the code. If panic handling is needed, the standard library'sstd::panicis typically preferred.
12-21: Document the COMMON_RUNTIME pattern more clearlyThe shared runtime pattern here is a clever solution to the static client issue. Consider adding a more detailed comment explaining why this is necessary and perhaps a reference to where static clients are created, to help future maintainers understand this architectural decision.
-// we need to use a shared runtime since the static client is shared between tests here -// and tokio::test creates a new runtime for each test. For now, we only encounter the -// issue here, eventually, we may want to move this to a proc macro like tokio::test or -// sqlx::test +// IMPORTANT: We use a shared runtime because storage backends may use static/singleton clients +// internally (e.g., for connection pooling). Using tokio::test would create a new runtime for +// each test, potentially causing issues with these static clients. This pattern ensures all +// tests share the same runtime context. +// +// TODO: Consider extracting this to a proc macro like tokio::test or sqlx::test for reuse +// across other integration test modules that face similar constraints.
119-146: Consolidate GCS storage creation functionsThe
create_gcs_storagefunction takes abucket_env_varparameter to support both regular and HNS buckets, but this pattern differs from other storage backends. Consider creating separate functions for consistency or documenting why GCS requires this special handling.+/// Creates a GCS storage backend using the specified bucket environment variable. +/// GCS has two bucket types (regular and HNS) that require different configurations, +/// hence the parameterized approach. async fn create_gcs_storage(bucket_env_var: &str) -> anyhow::Result<(StorageBackend, TestConfig)> {
258-303: Consider uncommenting performance testsThe performance tests are commented out but appear to be complete implementations. If they're not being run due to CI constraints or flakiness, consider:
- Adding a feature flag to conditionally enable them
- Moving them to a separate benchmark suite
- Adding a comment explaining why they're disabled
359-359: Avoid division by near-zero valuesUsing
max(0.001)as a guard against division by zero could mask actual issues. Consider handling the zero case explicitly.- let init_ratio = - first_init_duration.as_secs_f64() / second_init_duration.as_secs_f64().max(0.001); + let init_ratio = if second_init_duration.as_secs_f64() > 0.0 { + first_init_duration.as_secs_f64() / second_init_duration.as_secs_f64() + } else { + f64::INFINITY + };Also applies to: 361-361
952-957: Document the ADLS empty file issueThe TODO comment mentions an issue with Azure blob client and empty files. Consider adding a tracking issue reference or more details about when this might be resolved.
- // ToDo: Revisit with new Azure storage. Azure blob client currently - // can't delete empty files, which fails with: <Error><Code>InvalidRange</Code><Message>The range specified is invalid for the current size of the resource + // TODO(#issue): Azure blob client currently can't delete empty files. + // Error: <Error><Code>InvalidRange</Code><Message>The range specified is invalid for the current size of the resource + // This should be revisited when the Azure SDK is updated or a workaround is found.
875-875: Consider making the eventual consistency delay configurableThe hardcoded 100ms delays for eventual consistency might not be sufficient for all storage backends or might be unnecessarily long for others. Consider making this configurable per storage type.
+ // Delay duration for eventual consistency, varies by storage backend + let consistency_delay = match storage { + StorageBackend::S3(_) => Duration::from_millis(100), + StorageBackend::Memory(_) => Duration::from_millis(0), + _ => Duration::from_millis(50), + }; // Wait a bit for eventual consistency (important for S3) - sleep(Duration::from_millis(100)).await; + sleep(consistency_delay).await;Also applies to: 926-926, 1224-1224
1384-1405: Optimize test data generationThe
generate_test_datafunction allocates temporary vectors in chunks. Consider using a more efficient approach that writes directly to the BytesMut buffer.fn generate_test_data(size_mb: usize) -> Bytes { use bytes::{BufMut, BytesMut}; use rand::RngCore; const CHUNK_SIZE: usize = 1024 * 1024; // 1MB chunks let total_size = size_mb * CHUNK_SIZE; let mut buffer = BytesMut::with_capacity(total_size); - let mut rng = rand::rng(); + let mut rng = rand::thread_rng(); - // Generate data in 1MB chunks to avoid large allocations - let mut remaining = total_size; - while remaining > 0 { - let chunk_size = remaining.min(CHUNK_SIZE); - let mut chunk = vec![0u8; chunk_size]; - rng.fill_bytes(&mut chunk); - buffer.put_slice(&chunk); - remaining -= chunk_size; - } + // Reserve the exact capacity needed + buffer.resize(total_size, 0); + // Fill the buffer directly + rng.fill_bytes(&mut buffer[..]); buffer.freeze() }
520-521: Document test size choicesThe constants for file counts (1100 and 200) appear to be chosen to exceed S3's batch limits. Add a comment explaining this choice for future maintainers.
- const EXISTING_FILES_COUNT: usize = 1100; // Larger than single S3 batch + const EXISTING_FILES_COUNT: usize = 1100; // Exceeds S3's single batch limit of 1000 objects const NON_EXISTENT_FILES_COUNT: usize = 200;
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (2)
crates/io/src/adls/adls_storage.rs(1 hunks)crates/io/tests/integration_tests.rs(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- crates/io/src/adls/adls_storage.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: security_audit
- GitHub Check: check-generated-openapi-matches
- GitHub Check: sqlx-check
- GitHub Check: test
There was a problem hiding this comment.
Actionable comments posted: 0
♻️ Duplicate comments (2)
crates/io/tests/integration_tests.rs (2)
54-54: Duplicate comment: Validate endpoint URL parsingThis has been previously flagged by a past review comment. The endpoint parsing uses
unwrap()which could panic if the environment variable contains an invalid URL.
1392-1392: Duplicate comment: Replacerand::rng()withrand::thread_rng()This issue has been previously flagged in the past review comments. The
rand::rng()function doesn't exist in rand 0.9.x series and will cause a compilation failure.
🧹 Nitpick comments (7)
crates/lakekeeper/src/catalog/views/commit.rs (4)
190-239: Unify compression codec derivation to prevent potential mismatch and improve clarityYou compute the codec twice via two different helpers: once when building the metadata location (via properties) and again for the write (via metadata). These should always agree, but computing it once avoids drift and makes intent explicit.
Apply this diff to compute the codec once and reuse it for both path derivation and writing:
@@ - let view_location = parse_view_location(requested_update_metadata.location())?; - let metadata_location = ctx.storage_profile.default_metadata_location( - &view_location, - &CompressionCodec::try_from_properties(requested_update_metadata.properties())?, - Uuid::now_v7(), - extract_count_from_metadata_location(&previous_metadata_location).map_or(0, |v| v + 1), - ); + let view_location = parse_view_location(requested_update_metadata.location())?; + let compression_codec = + CompressionCodec::try_from_properties(requested_update_metadata.properties())?; + let metadata_location = ctx.storage_profile.default_metadata_location( + &view_location, + &compression_codec, + Uuid::now_v7(), + extract_count_from_metadata_location(&previous_metadata_location).map_or(0, |v| v + 1), + ); @@ - write_file( - &file_io, - &metadata_location, - &requested_update_metadata, - CompressionCodec::try_from_metadata(&requested_update_metadata)?, - ) + write_file( + &file_io, + &metadata_location, + &requested_update_metadata, + compression_codec, + ) .await?;Rationale:
- Eliminates duplicate codec resolution code paths.
- Ensures file extension (location) and actual compression used for content stay in lock-step.
263-266: Use a more idiomatic and type-correctinspectclosure forOk(())
Result::inspectpasses&Tto the closure; hereTis(). Using|()|is brittle and non-idiomatic. Prefer|_|(or|&()|) to avoid confusion.Apply this diff:
- .inspect(|()| tracing::trace!("Deleted old view location")) + .inspect(|_| tracing::trace!("Deleted old view location"))This avoids pattern/type surprises and reads better.
403-409: Box::pin around async calls in tests is unnecessary noise
async fnreturn values can be awaited directly; pinning only to.awaitadds overhead and obscures intent. Unless there’s a specific need (e.g., storing futures in self-referential structs), dropBox::pin.Apply these diffs:
@@ - let view = Box::pin(create_view( - api_context.clone(), - namespace.clone(), - create_view_request(Some(view_name), None), - Some(prefix.clone()), - )) - .await - .unwrap(); + let view = create_view( + api_context.clone(), + namespace.clone(), + create_view_request(Some(view_name), None), + Some(prefix.clone()), + ) + .await + .unwrap(); @@ - let res = Box::pin(super::commit_view( - views::ViewParameters { - prefix: Some(Prefix(prefix.clone())), - view: TableIdent::from_strs( - namespace.inner().into_iter().chain([view_name.into()]), - ) - .unwrap(), - }, - rq, - api_context, - DataAccess { - vended_credentials: true, - remote_signing: false, - }, - crate::request_metadata::RequestMetadata::new_unauthenticated(), - )) - .await - .unwrap(); + let res = super::commit_view( + views::ViewParameters { + prefix: Some(Prefix(prefix.clone())), + view: TableIdent::from_strs( + namespace.inner().into_iter().chain([view_name.into()]), + ) + .unwrap(), + }, + rq, + api_context, + DataAccess { + vended_credentials: true, + remote_signing: false, + }, + crate::request_metadata::RequestMetadata::new_unauthenticated(), + ) + .await + .unwrap(); @@ - let _ = Box::pin(create_view( - api_context.clone(), - namespace.clone(), - create_view_request(Some(view_name), None), - Some(prefix.clone()), - )) - .await - .unwrap(); + let _ = create_view( + api_context.clone(), + namespace.clone(), + create_view_request(Some(view_name), None), + Some(prefix.clone()), + ) + .await + .unwrap(); @@ - let err = Box::pin(super::commit_view( - ViewParameters { - prefix: Some(Prefix(prefix.clone())), - view: TableIdent::from_strs( - namespace.inner().into_iter().chain([view_name.into()]), - ) - .unwrap(), - }, - rq, - api_context, - DataAccess { - vended_credentials: true, - remote_signing: false, - }, - crate::request_metadata::RequestMetadata::new_unauthenticated(), - )) - .await - .expect_err("This unexpectedly didn't fail the uuid assertion."); + let err = super::commit_view( + ViewParameters { + prefix: Some(Prefix(prefix.clone())), + view: TableIdent::from_strs( + namespace.inner().into_iter().chain([view_name.into()]), + ) + .unwrap(), + }, + rq, + api_context, + DataAccess { + vended_credentials: true, + remote_signing: false, + }, + crate::request_metadata::RequestMetadata::new_unauthenticated(), + ) + .await + .expect_err("This unexpectedly didn't fail the uuid assertion.");If pinning was added for a specific trait-bound or lifetime workaround, please point that out; otherwise this cleanup improves readability without changing behavior.
Also applies to: 413-431, 455-463, 466-483
359-364: Fix error message formatting to include the underlying errorThis uses a literal string containing
{e}; it never interpolates the error value, unlike other branches which useformat!.Apply this diff:
- ErrorModel::bad_request( - "Error setting current view version: {e}", - "SetCurrentViewVersionError", - Some(Box::new(e)), - ) + ErrorModel::bad_request( + format!("Error setting current view version: {e}"), + "SetCurrentViewVersionError", + Some(Box::new(e)), + )crates/io/tests/integration_tests.rs (3)
1313-1313: Inconsistent loop variable naming.The loop iterates over
list_dirbut uses singular form. Consider usinglist_dirsor&list_dirfor clarity.- for list_dir in &[format!("{base_dir}dir"), format!("{base_dir}dir/")] { + for list_dir in &[format!("{base_dir}dir"), format!("{base_dir}dir/")] {
1374-1375: Use?operator instead of ignoring errors.Using
let _ = storage.delete(&path).awaitsilently ignores cleanup errors. Consider usingunwrap_or_elsewith logging or at minimum document why errors are acceptable during cleanup.- let _ = storage.delete(&path).await; // Ignore errors during cleanup + if let Err(e) = storage.delete(&path).await { + eprintln!("Warning: Failed to cleanup path {}: {}", path, e); + }
258-303: Consider enabling performance tests conditionally.The commented-out performance tests provide valuable benchmarking capability. Consider adding a feature flag or environment variable to enable them selectively rather than commenting them out.
-// // Performance tests for storage backend initialization -// #[cfg(feature = "storage-in-memory")] -// #[test] -// fn test_initialization_performance_memory() -> anyhow::Result<()> { +// Performance tests for storage backend initialization +#[cfg(all(feature = "storage-in-memory", feature = "performance-tests"))] +#[test] +fn test_initialization_performance_memory() -> anyhow::Result<()> {
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (4)
crates/io/Cargo.toml(1 hunks)crates/io/src/lib.rs(1 hunks)crates/io/tests/integration_tests.rs(1 hunks)crates/lakekeeper/src/catalog/views/commit.rs(7 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
- crates/io/src/lib.rs
- crates/io/Cargo.toml
🧰 Additional context used
🧬 Code Graph Analysis (2)
crates/lakekeeper/src/catalog/views/commit.rs (4)
crates/io/src/lib.rs (2)
remove_all(212-285)remove_all(414-431)crates/lakekeeper/src/catalog/io.rs (2)
remove_all(74-79)write_file(12-25)crates/lakekeeper/src/service/storage/mod.rs (1)
file_io(146-206)crates/lakekeeper/src/catalog/views/create.rs (2)
create_view(31-196)create_view(214-242)
crates/io/tests/integration_tests.rs (2)
crates/io/src/lib.rs (4)
execute_with_parallelism(524-566)new(113-120)read_single(194-197)read_single(370-388)crates/io/src/memory.rs (4)
new(36-38)len(93-95)is_empty(98-100)read_single(191-193)
⏰ 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: test
- GitHub Check: sqlx-check
- GitHub Check: docker / docker
- GitHub Check: docker / docker
- GitHub Check: docker / docker
- GitHub Check: docker / docker
🔇 Additional comments (8)
crates/lakekeeper/src/catalog/views/commit.rs (2)
7-8: Migration to lakekeeper_io::Location looks correct and consistentThe import switch to
lakekeeper_io::Locationaligns with the new IO layer and matches usage inparse_view_locationand downstream calls. No issues spotted.
18-19: write_file/remove_all import swap aligns with new IO APIImporting
write_fileandremove_allfrom the localcatalog::iowrapper matches the new File-IO contract. This keeps call sites tidy and centralizes error mapping. LGTM.crates/io/tests/integration_tests.rs (6)
16-21: Well-designed shared runtime solution.The static
COMMON_RUNTIMEusingLazyLockelegantly addresses the client sharing issue between tests. The multi-threaded runtime with all features enabled is appropriate for integration testing.
148-198: Excellent parameterized test macro design.The
test_all_storages!macro elegantly generates test functions for all storage backends with proper feature gating. The inclusion of both regular and HNS GCS buckets shows thorough testing coverage.
200-219: Clean test configuration abstraction.The
TestConfigstruct with helper methods for generating test paths provides a clean abstraction that works across all storage backends with proper UUID uniqueness.
541-554: Efficient parallel write execution pattern.The use of
execute_with_parallelismwith proper pinning and streaming consumption demonstrates good async patterns for high-volume operations.
954-957: Appropriate ADLS empty file workaround.The conditional skip for ADLS empty file tests with clear documentation of the underlying Azure SDK limitation is a pragmatic approach.
991-991:read_singleis implemented across allStorageBackendvariants
Theread_singlemethod is declared in theStorageBackendtrait (crates/io/src/lib.rs:194–197) and each backend provides its own async implementation:
- Memory: crates/io/src/memory.rs:191–193
- S3: crates/io/src/s3/s3_storage.rs:324–327
- GCS: crates/io/src/gcs/gcs_storage.rs:275–279
- ADLS: crates/io/src/adls/adls_storage.rs:282–285
No changes are needed here—calls to
storage.read_single(&test_path).await?are valid for all enabled backends.
There was a problem hiding this comment.
Actionable comments posted: 0
♻️ Duplicate comments (4)
Cargo.toml (1)
82-82: Fix invalid bytes version constraint
bytes = "1.10"does not exist on crates.io (latest 1.x is 1.6.x). This will break resolution.Apply one of the following:
- bytes = "1.10" + bytes = "1"or, if you prefer pinning to the latest known minor:
- bytes = "1.10" + bytes = "1.6"crates/lakekeeper/src/service/storage/az.rs (1)
326-331: Off-by-one SAS directory depth for root pathFor the root path,
split('/')over an empty string returns 1, causingsigned_directory_depth(1)instead of 0 and potentially invalid SAS tokens for the root. Guard for empty path.Apply this diff:
- let path = reduce_scheme_string(path.as_ref()); - let rootless_path = path.trim_start_matches('/').trim_end_matches('/'); - let depth = rootless_path.split('/').count(); + let path = reduce_scheme_string(path.as_ref()); + let rootless_path = path.trim_start_matches('/').trim_end_matches('/'); + let depth = if rootless_path.is_empty() { + 0 + } else { + rootless_path.split('/').count() + };crates/lakekeeper/src/service/storage/s3.rs (1)
290-294: Preserve original bucket-name validation error as sourceThe conversion discards the underlying error. Preserve it to improve diagnosability.
Apply this diff:
- validate_bucket_name(&self.bucket).map_err(|e| InvalidProfileError { - source: None, - reason: e.to_string(), - entity: "bucket".to_string(), - })?; + validate_bucket_name(&self.bucket).map_err(|e| InvalidProfileError { + source: Some(Box::new(e)), + reason: e.to_string(), + entity: "bucket".to_string(), + })?;crates/io/src/lib.rs (1)
210-285: remove_all returns only the first error; consider aggregating errorsIf multiple batch deletions fail, only the first error is returned. Consider aggregating and returning a richer error (e.g., an error with collected contexts) so callers can reason about partial failures.
If you want, I can draft a compact multi-error type and adapt
remove_allto collect failures while still aborting on fatal errors.
🧹 Nitpick comments (5)
crates/lakekeeper/src/service/storage/gcs/mod.rs (1)
198-211: Consider validating the updated profile inupdate_withCurrently,
update_withenforces immutability but doesn’t validate thatotheris itself valid (e.g., empty/invalidbucketorkey_prefix). Consider normalizing/validatingotherand mapping failures to an appropriateUpdateErrorvariant to prevent propagating invalid state.Would you like me to sketch an
UpdateError::InvalidProfilevariant and wirenormalize()intoupdate_with?crates/lakekeeper/src/service/storage/s3.rs (3)
414-421: Duplicate insertion of client region property
client::Regionis inserted twice back-to-back. Remove the duplicate.Apply this diff:
config.insert(&s3::Region(self.region.to_string())); config.insert(&client::Region(self.region.to_string())); config.insert(&custom::CustomConfig { key: "region".to_string(), value: self.region.to_string(), }); - config.insert(&client::Region(self.region.to_string()));
427-427: Use logical OR (||), not bitwise OR (|), for booleans
|evaluates both sides unconditionally. Prefer||for clarity here.Apply this diff:
- if vended_credentials { - if self.sts_enabled | matches!(s3_credential, Some(S3Credential::CloudflareR2(..))) { + if vended_credentials { + if self.sts_enabled || matches!(s3_credential, Some(S3Credential::CloudflareR2(..))) {
966-966: Unnecessary clone of FileIOBuilderNo need to
.clone()the newly created builder.Apply this diff:
- let mut builder = iceberg::io::FileIOBuilder::new("s3").clone(); + let mut builder = iceberg::io::FileIOBuilder::new("s3");crates/io/src/lib.rs (1)
575-583: Guard against zero chunk size in calculate_ranges
step_by(chunksize)panics ifchunksize == 0. If external inputs can reach here, add a guard/assert to make this failure mode explicit.Apply this diff:
pub(crate) fn calculate_ranges(total_size: usize, chunksize: usize) -> Vec<(usize, usize)> { + debug_assert!(chunksize > 0, "chunksize must be > 0");Optionally, return an empty vec or an error if
chunksize == 0depending on expected semantics.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
⛔ Files ignored due to path filters (1)
Cargo.lockis excluded by!**/*.lock
📒 Files selected for processing (5)
Cargo.toml(4 hunks)crates/io/src/lib.rs(1 hunks)crates/lakekeeper/src/service/storage/az.rs(18 hunks)crates/lakekeeper/src/service/storage/gcs/mod.rs(13 hunks)crates/lakekeeper/src/service/storage/s3.rs(27 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-08-14T11:35:37.248Z
Learnt from: c-thiel
PR: lakekeeper/lakekeeper#1285
File: crates/lakekeeper/src/service/storage/gcs/mod.rs:485-491
Timestamp: 2025-08-14T11:35:37.248Z
Learning: In the Lakekeeper codebase, `Box::pin` is intentionally used around large futures (like `validate_access` calls) as an optimization technique to move the future data to the heap, reducing stack usage and improving efficiency during async operations.
Applied to files:
crates/lakekeeper/src/service/storage/gcs/mod.rs
🧬 Code Graph Analysis (4)
crates/lakekeeper/src/service/storage/az.rs (3)
crates/lakekeeper/src/service/storage/mod.rs (1)
base_location(212-224)crates/io/src/adls/adls_storage.rs (2)
client(96-98)new(88-93)crates/io/src/adls/adls_location.rs (1)
new(52-114)
crates/io/src/lib.rs (1)
crates/io/src/error.rs (2)
new(143-151)from(89-94)
crates/lakekeeper/src/service/storage/s3.rs (6)
crates/io/src/s3/s3_storage.rs (2)
client(45-47)new(37-42)crates/io/src/s3/s3_location.rs (3)
validate_bucket_name(168-210)new(22-62)as_str(146-148)crates/lakekeeper/src/service/storage/mod.rs (1)
base_location(212-224)crates/io/src/location.rs (1)
as_str(20-22)crates/lakekeeper/src/service/storage/error.rs (15)
from(50-56)from(60-66)from(70-76)from(80-86)from(90-92)from(96-98)from(102-104)from(108-110)from(114-129)from(133-135)from(139-141)from(145-163)from(167-172)from(176-228)from(232-234)crates/iceberg-ext/src/catalog/rest/error.rs (1)
precondition_failed(128-139)
crates/lakekeeper/src/service/storage/gcs/mod.rs (3)
crates/io/src/gcs/gcs_location.rs (2)
validate_bucket_name(143-209)new(22-46)crates/io/src/gcs/gcs_storage.rs (1)
new(49-51)crates/lakekeeper/src/request_metadata.rs (1)
new_unauthenticated(78-88)
⏰ 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). (10)
- GitHub Check: docker / docker
- GitHub Check: docker / docker
- GitHub Check: docker / docker
- GitHub Check: docker / docker
- GitHub Check: test
- GitHub Check: security_audit
- GitHub Check: sqlx-check
- GitHub Check: check-generated-openapi-matches
- GitHub Check: clippy
- GitHub Check: security_audit
🔇 Additional comments (7)
crates/lakekeeper/src/service/storage/az.rs (2)
422-426: Cleaner ADLS path reduction via AdlsLocationNice improvement using
AdlsLocation::try_from_strto reliably derive the blob name and normalize the path.
632-639: Box::pin use in async validation tests is intentional and good hereAcknowledging the explicit use of
Box::pinfor large futures to reduce stack usage, consistent with project conventions.crates/lakekeeper/src/service/storage/gcs/mod.rs (2)
169-184: Lakekeeper IO migration for GCS looks goodThe new
lakekeeper_iopath viaGcsAuthandGCSSettingscleanly replaces the old FileIO construction. Error typing aligns withCredentialsError.
484-491: Box::pin in tests: keep as-isPer maintainers’ guidance, boxing large futures here is intentional and helps with stack usage. No change needed.
Also applies to: 545-552
crates/lakekeeper/src/service/storage/s3.rs (2)
709-743: New signing identity helper is well-factoredPublic
get_signing_identitywith precise error typing (ErrorModel) is a good addition and reads cleanly with the existing auth/config plumbing.
1346-1353: Box::pin usage in async tests is aligned with repo conventionsKeeping the boxed futures in tests is intentional for large futures and helps with stack pressure.
Also applies to: 1441-1448, 1499-1506, 1564-1571
crates/io/src/lib.rs (1)
628-636: Doc fix LGTMThe backtick imbalance is fixed in the “Returns” doc for
execute_with_parallelism.
There was a problem hiding this comment.
Actionable comments posted: 5
♻️ Duplicate comments (8)
crates/io/src/s3/s3_location.rs (1)
65-67: Duplicate comment: Fix bucket_name accessor implementationThis issue was already identified in a previous review. The current implementation returns an empty string when host is missing by calling
unwrap_or_default(), but this masks potential configuration issues. The accessor should returnOption<&str>to make the absence of a host explicit.crates/lakekeeper/src/service/storage/az.rs (1)
329-330: Handle root directory depth correctly for SAS directory tokensFor an empty path,
split('/')still returns one element (the empty string), which yields an incorrect depth of 1. The current trimming approach handles this partially but could be more robust.Apply this diff to correctly handle the root directory case:
- let rootless_path = path.trim_start_matches('/').trim_end_matches('/'); - let depth = rootless_path.split('/').count(); + let rootless_path = path.trim_start_matches('/').trim_end_matches('/'); + let depth = if rootless_path.is_empty() { + 0 + } else { + rootless_path.split('/').count() + };crates/lakekeeper/src/service/storage/gcs/mod.rs (2)
201-211: Add validation to prevent empty strings inupdate_withThe
update_withmethod checks for field inequality but doesn't validate that the new values are non-empty. This could lead to issues if empty strings are passed.
460-463: Document the double underscore convention in environment variablesThe environment variables use
LAKEKEEPER_TEST__prefix (with double underscore) which might cause confusion. Consider adding a comment explaining this convention.Add a comment above the function to explain the naming convention:
+ // Note: Environment variables use double underscore (LAKEKEEPER_TEST__) + // as a namespace separator convention in the test suite pub(crate) fn get_storage_profile() -> (GcsProfile, GcsCredential) {crates/io/src/lib.rs (2)
215-286: Consider simplifying error collection inremove_all.The current implementation has complex error handling with multiple nested match statements. The error collection could be simplified and made more maintainable.
Consider this simplified approach:
- // Wait for all deletion futures to complete, collecting errors - let mut return_error = None; - - while let Some(result) = join_set.join_next().await { - match result { - Ok(Ok(())) => {} - Ok(Err(e)) => { - // Fatal error supersedes PartialErrors - return_error = match e { - DeleteBatchError::InvalidLocation(e) => Some(e.into()), - DeleteBatchError::IOError(e) => Some(e.into()), - } - } - Err(e) => { - return_error = Some(DeleteError::IOError(IOError::new( - ErrorKind::Unexpected, - format!("Failed to join batch deletion task handle: {e}"), - path.to_string(), - ))); - } - } - } - - // Return the first error if any occurred - match return_error { - Some(e) => Err(e), - None => Ok(()), - } + // Wait for all deletion futures to complete + while let Some(result) = join_set.join_next().await { + match result { + Ok(Ok(())) => continue, + Ok(Err(e)) => return Err(e.into()), + Err(e) => { + return Err(DeleteError::IOError(IOError::new( + ErrorKind::Unexpected, + format!("Failed to join batch deletion task handle: {e}"), + path.to_string(), + ))) + } + } + } + + Ok(())
629-635: Fix unbalanced backticks in documentation.The documentation contains unbalanced backticks that break markdown formatting.
/// Executes futures in parallel with a specified parallelism limit using `JoinSet`. /// /// # Arguments /// * `futures` - An iterator of futures to execute /// * `parallelism` - Maximum number of futures to execute concurrently /// /// # Returns -/// A stream of results from futures as they complete, or ends with a `JoinError`` +/// A stream of results from futures as they complete, or ends with a `JoinError`crates/lakekeeper/src/service/storage/mod.rs (2)
389-410: Complex error handling pattern could be simplified.The nested Result pattern with
Ok(Ok(()))andOk(Err(other))is confusing and could be simplified.- match is_empty(&io, &test_location).await { - Err(ValidationError::IoOperationFailed(io_error)) => { - tracing::info!( - ?io_error, - "Error while checking location is empty: {io_error}" - ); - Err(ValidationError::IoOperationFailed(io_error)) - } - Ok(false) => Err(InvalidLocationError::new( - test_location.to_string(), - "Files are left after remove_all on test location".to_string(), - ) - .into()), - Ok(true) => { - tracing::debug!("Location is empty"); - Ok(Ok(())) - } - Err(other) => { - tracing::info!("Unrecoverable error: {other:?}"); - Ok(Err(other)) - } - }??; + let is_location_empty = is_empty(&io, &test_location).await?; + if !is_location_empty { + return Err(InvalidLocationError::new( + test_location.to_string(), + "Files are left after remove_all on test location".to_string(), + ) + .into()); + } + tracing::debug!("Location is empty");
131-135: Memory profile update not implemented.The Memory profile update returns
unimplemented!()which will panic at runtime. Consider implementing it or returning a proper error.#[cfg(test)] (StorageProfile::Memory(_this_profile), StorageProfile::Memory(_other_profile)) => { - unimplemented!("Local profile update not implemented") + Err(UpdateError::NotSupported("Memory profile update not supported".to_string())) }
🧹 Nitpick comments (16)
crates/io/src/s3/s3_storage.rs (4)
89-108: Consider adding size validation for small filesWhile the logic correctly handles small vs large files, there's no validation that the file size is reasonable. Consider adding a check to ensure the file isn't unexpectedly large for a "small file" operation.
if bytes.len() < MAX_BYTES_PER_REQUEST { + // Validate file size is reasonable for single PUT + if bytes.len() > 5 * 1024 * 1024 * 1024 { // 5GB S3 limit + return Err(WriteError::IOError(IOError::new( + ErrorKind::ConfigInvalid, + "File too large for single PUT operation", + s3_location.as_str().to_string(), + ))); + } // Small file - use single PUT request
112-120: Validate chunk size calculationThe chunk size calculation could result in very small chunks if the file is extremely large. Consider adding a minimum chunk size constraint.
// Calculate optimal chunk size to respect MAX_PARTS_PER_UPLOAD constraint let mut chunk_size = DEFAULT_BYTES_PER_REQUEST; let estimated_parts = file_size.div_ceil(chunk_size); if estimated_parts > MAX_PARTS_PER_UPLOAD { // Increase chunk size to stay within MAX_PARTS_PER_UPLOAD chunk_size = file_size.div_ceil(MAX_PARTS_PER_UPLOAD); + // Ensure minimum chunk size (5MB is S3's minimum for all parts except the last) + chunk_size = chunk_size.max(5 * 1024 * 1024); }
262-263: Handle potential negative content lengthThe AWS SDK returns
Option<i64>for content length, and whileunwrap_or(0)handles theNonecase, there's no validation that the content length isn't negative.- let content_length = head_response.content_length().unwrap_or(0); - let file_size = validate_file_size(content_length, path)?; + let content_length = head_response.content_length().unwrap_or(0); + if content_length < 0 { + return Err(ReadError::IOError(IOError::new( + ErrorKind::Unexpected, + "Invalid negative content length from S3", + path.to_string(), + ))); + } + let file_size = validate_file_size(content_length, path)?;
355-356: Inconsistent path trimming logicThe path trimming logic assumes the input path should be treated as a directory prefix, but this might not always be correct. Consider making this behavior more explicit.
- let path = format!("{}/", path.as_ref().trim_end_matches('/')); + let path_str = path.as_ref(); + let path = if path_str.ends_with('/') { + path_str.to_string() + } else { + format!("{}/", path_str) + };crates/io/src/gcs/gcs_location.rs (2)
186-186: Fix inconsistent error message formattingThe error message has an inconsistent leading space compared to other validation error messages in the same function.
- reason: " must not contain two adjacent periods.".to_string(), + reason: "must not contain two adjacent periods.".to_string(),
234-234: Test case validation issueThe test expects
validate_bucket_name("invalid_bucket_name")to fail due to underscores, but according to the implementation (line 156), only lowercase letters, digits, dots, and hyphens are allowed. The test is correct, but the comment on line 218 incorrectly mentions underscores are allowed.- // Bucket names can only contain lowercase letters, numeric characters, dashes (-), underscores (_), and dots (.). Spaces are not allowed. Names containing dots require verification. + // Bucket names can only contain lowercase letters, numeric characters, dashes (-), and dots (.). Spaces are not allowed. Names containing dots require verification.crates/lakekeeper/src/service/storage/error.rs (1)
257-276: Consider uncommenting or removing the dead codeThis commented-out code for
IOCreationErrorshould either be removed if it's no longer needed, or uncommented if it will be used soon. Keeping commented code in production can lead to confusion and maintenance issues.crates/io/src/memory.rs (3)
53-54: Unnecessary redundant check foris_none()Line 53 already checks
store_ref.is_none(), making the condition redundant. The Arc will always be stored when it's None.Apply this diff to remove the redundant check:
- if store_ref.is_none() { - *store_ref = Some(data.clone()); - } + *store_ref = Some(data.clone());
183-187: Consider using a more descriptive error variantUsing
ErrorKind::NotFoundfor memory storage is appropriate, but the error message could be more specific about it being a memory storage error rather than a generic file system error.Apply this diff to improve the error message:
None => Err(ReadError::IOError(IOError::new( ErrorKind::NotFound, - "Object not found in memory storage", + format!("Key '{}' not found in memory storage", key), path_str.to_string(), ))),
409-411: Potential index out of bounds errorThe slicing operation
&test_files[0..3]assumes there are at least 3 items, but the test has 4 items. The comment suggests checking the first 3 files insubdir, but the slice should be0..3which is correct. However, for clarity and maintainability, consider using a more explicit approach.Apply this diff for better clarity:
// Verify subdir files are deleted - for (path, _) in &test_files[0..3] { + for (path, _) in test_files.iter().take(3) { let read_result = storage.read(path).await; assert!(read_result.is_err()); }crates/lakekeeper/src/service/storage/az.rs (1)
635-641: Consider adding timeout or cancellation for validationThe validation operation is wrapped in
Box::pin(which is intentional for large futures as per previous learnings), but consider adding a timeout to prevent indefinite hangs during validation.Would you like me to suggest a timeout implementation for the validation call to improve reliability in test environments?
crates/io/src/adls.rs (2)
35-36: Fix typo in commentThere's a typo in the comment: "cheep" should be "cheap".
Apply this diff to fix the typo:
-// Reqwest client is already cheep to clone. We need this `HTTP_CLIENT_ARC` for the Azure SDK which requires an `Arc<dyn HttpClient>`. +// Reqwest client is already cheap to clone. We need this `HTTP_CLIENT_ARC` for the Azure SDK which requires an `Arc<dyn HttpClient>`.
143-149: Consider making retry configuration configurableThe retry options are hardcoded with 3 max retries and 5-second total elapsed time. Consider making these values configurable through AzureSettings for different deployment scenarios.
Consider adding retry configuration fields to
AzureSettings:#[derive(Debug, Clone, typed_builder::TypedBuilder)] pub struct AzureSettings { // -------- Azure Settings for multiple services -------- /// The authority host to use for authentication. Example: `https://login.microsoftonline.com`. #[builder(default, setter(strip_option))] pub authority_host: Option<Url>, // Contains the account name and possible a custom URI pub cloud_location: CloudLocation, + /// Maximum number of retries for Azure operations + #[builder(default = 3)] + pub max_retries: u32, + /// Maximum total elapsed time for retries + #[builder(default = Duration::from_secs(5))] + pub max_retry_elapsed: Duration, }Then use these values in the client builders:
.client_options( azure_core::ClientOptions::default().retry(RetryOptions::fixed( FixedRetryOptions::default() - .max_retries(3u32) - .max_total_elapsed(std::time::Duration::from_secs(5)), + .max_retries(self.max_retries) + .max_total_elapsed(self.max_retry_elapsed), )), )crates/io/src/lib.rs (2)
15-16: Remove redundantInternalErrorfrom the public export list.The
InternalErrortype is not used within this module and appears to be an accidental inclusion. Consider removing it from the public exports to maintain a cleaner API surface.pub use error::{ DeleteBatchError, DeleteError, ErrorKind, IOError, InitializeClientError, - InvalidLocationError, ReadError, RetryableError, RetryableErrorKind, WriteError, + InvalidLocationError, ReadError, RetryableError, RetryableErrorKind, WriteError, };
649-656: Consider adding bounds checking for parallelism parameter.The function doesn't validate the
parallelismparameter. A value of 0 would cause the function to spawn no futures, potentially hanging indefinitely.Add a validation check:
) -> impl futures::Stream<Item = Result<T, tokio::task::JoinError>> where I: IntoIterator<Item = F>, F: Future<Output = T> + Send + 'static, T: Send + 'static, { + let parallelism = parallelism.max(1); // Ensure at least 1 async_stream::stream! { let mut join_set = JoinSet::new(); let mut futures_iter = futures.into_iter();crates/lakekeeper/src/service/storage/mod.rs (1)
1244-1257: Consider extracting test helper to a shared test utilities module.The
generate_table_metadatafunction is marked as#[allow(dead_code)]suggesting it might be useful in other test modules. Consider moving it to a shared test utilities module.Would you like me to help create a shared test utilities module for commonly used test helpers like
generate_table_metadata?
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (14)
crates/io/src/adls.rs(1 hunks)crates/io/src/adls/adls_location.rs(1 hunks)crates/io/src/adls/adls_storage.rs(1 hunks)crates/io/src/error.rs(1 hunks)crates/io/src/gcs/gcs_location.rs(1 hunks)crates/io/src/lib.rs(1 hunks)crates/io/src/memory.rs(1 hunks)crates/io/src/s3/s3_location.rs(1 hunks)crates/io/src/s3/s3_storage.rs(1 hunks)crates/lakekeeper/src/catalog/tables.rs(11 hunks)crates/lakekeeper/src/service/storage/az.rs(18 hunks)crates/lakekeeper/src/service/storage/error.rs(2 hunks)crates/lakekeeper/src/service/storage/gcs/mod.rs(13 hunks)crates/lakekeeper/src/service/storage/mod.rs(28 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
- crates/io/src/adls/adls_storage.rs
- crates/io/src/adls/adls_location.rs
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-08-14T11:35:37.248Z
Learnt from: c-thiel
PR: lakekeeper/lakekeeper#1285
File: crates/lakekeeper/src/service/storage/gcs/mod.rs:485-491
Timestamp: 2025-08-14T11:35:37.248Z
Learning: In the Lakekeeper codebase, `Box::pin` is intentionally used around large futures (like `validate_access` calls) as an optimization technique to move the future data to the heap, reducing stack usage and improving efficiency during async operations.
Applied to files:
crates/lakekeeper/src/service/storage/gcs/mod.rs
🧬 Code Graph Analysis (12)
crates/io/src/s3/s3_location.rs (2)
crates/io/src/adls/adls_location.rs (6)
new(52-109)scheme(132-134)location(112-114)try_from_location(151-206)try_from_str(214-223)fmt(345-348)crates/io/src/location.rs (4)
scheme(25-27)from_str(263-299)as_str(20-22)fmt(255-257)
crates/io/src/gcs/gcs_location.rs (2)
crates/io/src/s3/s3_location.rs (9)
new(22-62)bucket_name(65-67)key(70-72)validate_bucket_name(169-211)location(75-77)try_from_location(85-122)try_from_str(130-139)into_location(142-144)as_str(147-149)crates/io/src/location.rs (3)
from_str(263-299)scheme(25-27)as_str(20-22)
crates/io/src/s3/s3_storage.rs (4)
crates/io/src/lib.rs (22)
execute_with_parallelism(636-678)safe_usize_to_i32(34-42)validate_file_size(54-71)new(113-120)delete(150-153)delete(289-307)delete(436-441)delete(492-497)write(175-179)write(329-348)write(450-456)write(506-512)read(185-188)read(350-368)read(458-463)read(514-519)calculate_ranges(575-583)assemble_chunks(593-617)list(202-208)list(390-412)list(472-480)list(528-536)crates/io/src/s3/s3_error.rs (9)
parse_aws_sdk_error(190-202)parse_batch_delete_error(32-47)parse_create_multipart_upload_error(73-91)parse_delete_error(15-30)parse_get_object_error(130-148)parse_head_object_error(150-168)parse_list_objects_v2_error(170-188)parse_put_object_error(49-71)parse_upload_part_error(93-108)crates/io/src/error.rs (12)
new(14-20)new(215-223)new(342-349)from(62-64)from(68-70)from(91-93)from(97-99)from(120-122)from(126-128)from(149-151)from(155-157)from(161-166)crates/io/src/s3/s3_location.rs (3)
new(22-62)try_from_str(130-139)key(70-72)
crates/lakekeeper/src/service/storage/az.rs (2)
crates/io/src/adls/adls_location.rs (9)
normalize_host(293-316)validate_account_name(323-342)validate_filesystem_name(236-285)location(112-114)new(52-109)try_from_str(214-223)blob_name(137-143)account_name(117-119)filesystem(122-124)crates/io/src/adls/adls_storage.rs (2)
new(88-93)client(96-98)
crates/lakekeeper/src/catalog/tables.rs (5)
crates/lakekeeper/src/catalog/io.rs (3)
delete_file(27-32)read_metadata_file(53-72)write_file(12-25)crates/lakekeeper/src/service/storage/mod.rs (1)
is_empty(895-917)crates/lakekeeper/src/service/storage/error.rs (16)
from(44-50)from(54-60)from(64-70)from(74-80)from(84-86)from(90-92)from(96-98)from(102-123)from(127-129)from(133-135)from(139-155)from(159-164)from(168-220)from(224-226)from(240-254)from(293-307)crates/io/src/error.rs (3)
new(14-20)new(215-223)new(342-349)crates/lakekeeper/src/tests/mod.rs (1)
memory_io_profile(49-51)
crates/io/src/memory.rs (3)
crates/io/src/error.rs (13)
new(14-20)new(215-223)new(342-349)from(62-64)from(68-70)from(91-93)from(97-99)from(120-122)from(126-128)from(149-151)from(155-157)from(161-166)location(259-261)crates/lakekeeper/src/service/storage/mod.rs (2)
default(733-741)is_empty(895-917)crates/io/src/location.rs (1)
path(58-60)
crates/lakekeeper/src/service/storage/mod.rs (5)
crates/lakekeeper/src/service/storage/az.rs (3)
lakekeeper_io(219-227)from(453-480)base_location(153-181)crates/lakekeeper/src/service/storage/gcs/mod.rs (2)
lakekeeper_io(174-184)base_location(246-263)crates/lakekeeper/src/service/storage/s3.rs (3)
lakekeeper_io(267-276)s(379-379)base_location(375-382)crates/io/src/memory.rs (2)
new(36-38)default(26-28)crates/io/src/location.rs (2)
from_str(263-299)path(58-60)
crates/io/src/adls.rs (2)
crates/io/src/adls/adls_location.rs (5)
normalize_host(293-316)validate_account_name(323-342)validate_filesystem_name(236-285)new(52-109)account_name(117-119)crates/io/src/adls/adls_storage.rs (2)
new(88-93)client(96-98)
crates/io/src/lib.rs (7)
crates/io/src/error.rs (14)
location(259-261)context(277-279)new(14-20)new(215-223)new(342-349)from(62-64)from(68-70)from(91-93)from(97-99)from(120-122)from(126-128)from(149-151)from(155-157)from(161-166)crates/io/src/adls/adls_location.rs (3)
location(112-114)new(52-109)fmt(345-348)crates/io/src/gcs/gcs_location.rs (3)
location(65-67)try_from(122-124)new(22-46)crates/io/src/s3/s3_location.rs (3)
location(75-77)new(22-62)fmt(153-155)crates/io/src/location.rs (4)
value(284-284)fmt(255-257)path(58-60)as_ref(303-305)crates/io/src/memory.rs (8)
new(36-38)delete(139-147)delete_batch(149-165)write(167-174)read(176-189)read_single(191-193)list(195-247)remove_all(249-269)crates/io/src/gcs/gcs_storage.rs (9)
new(49-51)fmt(39-43)delete(61-80)delete_batch(83-148)paths(88-115)write(151-273)read(300-386)read_single(275-298)list(388-464)
crates/lakekeeper/src/service/storage/gcs/mod.rs (6)
crates/lakekeeper/src/service/storage/s3.rs (6)
lakekeeper_io(267-276)from(1009-1011)from(1015-1021)from(1025-1029)try_from(1035-1059)update_with(328-347)crates/io/src/gcs/gcs_location.rs (5)
validate_bucket_name(144-210)key(55-57)try_from(122-124)new(22-46)bucket(192-192)crates/lakekeeper/src/service/storage/error.rs (12)
from(44-50)from(54-60)from(64-70)from(74-80)from(84-86)from(90-92)from(96-98)from(102-123)from(127-129)from(133-135)from(139-155)from(159-164)crates/lakekeeper/src/service/storage/mod.rs (1)
update_with(120-140)crates/io/src/gcs/gcs_storage.rs (1)
new(49-51)crates/lakekeeper/src/request_metadata.rs (1)
new_unauthenticated(78-88)
crates/io/src/error.rs (4)
crates/io/src/adls/adls_location.rs (2)
new(52-109)location(112-114)crates/io/src/gcs/gcs_location.rs (2)
new(22-46)location(65-67)crates/io/src/s3/s3_location.rs (2)
new(22-62)location(75-77)crates/lakekeeper/src/service/storage/error.rs (15)
from(44-50)from(54-60)from(64-70)from(74-80)from(84-86)from(90-92)from(96-98)from(102-123)from(127-129)from(133-135)from(139-155)from(159-164)from(168-220)from(224-226)from(240-254)
crates/lakekeeper/src/service/storage/error.rs (2)
crates/io/src/error.rs (13)
from(62-64)from(68-70)from(91-93)from(97-99)from(120-122)from(126-128)from(149-151)from(155-157)from(161-166)new(14-20)new(215-223)new(342-349)reason(265-267)crates/lakekeeper/src/catalog/io.rs (2)
from(108-113)from(117-122)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (9)
- GitHub Check: docker / docker
- GitHub Check: docker / docker
- GitHub Check: docker / docker
- GitHub Check: security_audit
- GitHub Check: docker / docker
- GitHub Check: test
- GitHub Check: check-generated-openapi-matches
- GitHub Check: clippy
- GitHub Check: sqlx-check
🔇 Additional comments (14)
crates/io/src/error.rs (1)
1-366: LGTM! Well-structured error handling systemThe unified error model provides comprehensive coverage for IO operations with proper retry semantics. The trait-based approach for
RetryableErrorand the structured error hierarchy (IOError, ErrorKind, etc.) provide good separation of concerns for different error types and their handling strategies.The error conversions between different error types (WriteError, DeleteError, ReadError, etc.) maintain consistency across the codebase and ensure proper context propagation.
crates/lakekeeper/src/catalog/tables.rs (6)
23-23: LGTM! Updated location importThe import has been correctly updated to use
lakekeeper_io::Locationinstead of the previous path. This aligns with the PR's objective of moving to Lakekeeper File-IO.
232-238: LGTM! Improved location emptiness validationThe change from the retry-based
check_location_is_emptyto a directis_emptycheck with immediateInvalidLocationErroris cleaner and more explicit. This provides better error semantics by failing fast when locations are unexpectedly non-empty.
242-248: LGTM! Updated write_file signatureThe updated call to
write_filecorrectly passes the file_io reference and removes the trailing file IO parameter, aligning with the new signature incrates/lakekeeper/src/catalog/io.rs.
1289-1295: LGTM! Consistent write_file usageThe write operation in the commit context also correctly uses the updated
write_filesignature, maintaining consistency across the codebase.
1552-1572: LGTM! Improved API visibilityMaking
TableMetadataDiffsand its fields public enhances the API's usability while maintaining the existing functionality. This change enables external consumers to access diff information more directly.
2759-2759: LGTM! Updated test profileThe change from
test_io_profile()tomemory_io_profile()aligns with the new testing infrastructure and the broader move to Lakekeeper File-IO.crates/io/src/gcs/gcs_location.rs (1)
216-222: LGTM! Comprehensive validation logicThe bucket name validation correctly implements GCS naming requirements including length constraints, character restrictions, IP address detection, and "goog" prefix prohibition. The test coverage adequately validates both positive and negative cases.
crates/lakekeeper/src/service/storage/error.rs (2)
184-189: LGTM!The error handling correctly uses
matches!macro and properly boxes the error, aligning with the ErrorModel API requirements.
190-197: LGTM!The destructuring pattern correctly handles the boxed InvalidProfileError, extracting all fields in one operation to avoid partial moves.
crates/lakekeeper/src/service/storage/gcs/mod.rs (1)
486-492: LGTM! - Intentional use of Box::pin for large futuresThe use of
Box::pinaround thevalidate_accesscall is correct and intentional as an optimization for large futures, moving them to the heap to reduce stack usage.crates/io/src/adls.rs (1)
184-185: LGTM! - Comprehensive cache key includes both authority host and accountThe cache key properly includes both the authority host and account name, which correctly handles multi-account scenarios and prevents credential mixing.
crates/io/src/lib.rs (1)
685-714: Well-structured range calculation tests!The test cases thoroughly cover edge cases including empty files, single bytes, exact boundaries, and very small chunk sizes. The assertions are clear and demonstrate expected behavior.
crates/lakekeeper/src/service/storage/mod.rs (1)
871-888: Good separation of concerns with public utility functions.Making
split_locationandjoin_locationpublic utilities is a good design choice. The error handling is thorough with descriptive error messages.
There was a problem hiding this comment.
Actionable comments posted: 0
♻️ Duplicate comments (1)
crates/io/src/adls.rs (1)
179-186: Good fix: system identity cache key now includes authority host and account.This addresses the earlier review about insufficient cache key context in multi-account scenarios.
🧹 Nitpick comments (12)
crates/io/src/adls.rs (6)
35-37: Typo in comment (“cheep” → “cheap”) and minor wording tweak.Nit-level, but worth fixing for polish.
-// Reqwest client is already cheep to clone. We need this `HTTP_CLIENT_ARC` for the Azure SDK which requires an `Arc<dyn HttpClient>`. +// Reqwest client is already cheap to clone. We keep this `HTTP_CLIENT_ARC` because the Azure SDK requires an `Arc<dyn HttpClient>`.
49-55: Prefer unit variant for zero-field enum variant.Using a unit variant for
AzureSystemIdentityis more idiomatic and avoids the extra braces in pattern matches. Purely stylistic; no functional difference.pub enum AzureAuth { ClientCredentials(AzureClientCredentialsAuth), SharedAccessKey(AzureSharedAccessKeyAuth), - AzureSystemIdentity {}, + AzureSystemIdentity, }And update the match arm accordingly:
- AzureAuth::AzureSystemIdentity {} => { + AzureAuth::AzureSystemIdentity => { let identity: Arc<DefaultAzureCredential> = self.get_system_identity()?; StorageCredentials::token_credential(identity) }Also applies to: 124-127
145-151: Retry policy seems tight and duplicated; consider centralizing and allowing overrides.Max 5s total retry window can be too aggressive for transient Azure blips. Also, the retry config is duplicated between Data Lake and Blob clients.
Proposal:
- Extract a helper to build
ClientOptionswith retries.- Optionally allow configuring retry counts/durations via
AzureSettingsor a separateIoRetrySettings.Inline changes (call sites):
- .client_options( - azure_core::ClientOptions::default().retry(RetryOptions::fixed( - FixedRetryOptions::default() - .max_retries(3u32) - .max_total_elapsed(std::time::Duration::from_secs(5)), - )), - ) + .client_options(default_client_options())- .client_options( - azure_core::ClientOptions::default().retry(RetryOptions::fixed( - FixedRetryOptions::default() - .max_retries(3u32) - .max_total_elapsed(std::time::Duration::from_secs(5)), - )), - ) + .client_options(default_client_options())Add this helper (outside the shown ranges):
#[inline] fn default_client_options() -> azure_core::ClientOptions { azure_core::ClientOptions::default().retry( RetryOptions::fixed( FixedRetryOptions::default() .max_retries(3) .max_total_elapsed(Duration::from_secs(15)), // consider 15–30s ) ) }Also applies to: 169-175
41-47: Credential cache TTL choice: consider time-to-idle or longer TTL.You’re caching the credential object (not access tokens). Evicting after 30 minutes regardless of use may cause unnecessary re-initialization. Using time-to-idle (TTI) or a longer TTL can reduce churn without compromising correctness.
For example:
- moka::sync::Cache::builder() - .max_capacity(1000) - .time_to_live(Duration::from_secs(30 * 60)) - .build() + moka::sync::Cache::builder() + .max_capacity(1000) + .time_to_idle(Duration::from_secs(30 * 60)) + .time_to_live(Duration::from_secs(24 * 60 * 60)) + .build()
71-78: Minor doc grammar nit.“possible a custom URI” → “possibly a custom URI”.
- // Contains the account name and possible a custom URI + // Contains the account name and possibly a custom URI
180-184: Avoid an unnecessary clone of the default authority host.Tiny micro-optimization; functionally identical.
- let authority_host_str = (self.authority_host.as_ref()).map_or( - DEFAULT_AUTHORITY_HOST.clone().to_string(), - std::string::ToString::to_string, - ); + let authority_host_str = self + .authority_host + .as_ref() + .map_or(DEFAULT_AUTHORITY_HOST.as_str().to_string(), ToString::to_string);crates/io/src/s3.rs (6)
43-56: Avoid unwrap and consider pinning BehaviorVersion for stability
- You can drop the infallible unwrap by using AppName::from_static.
- Pinning BehaviorVersion instead of BehaviorVersion::latest() improves determinism across SDK upgrades.
Apply this change for the app name:
- .app_name(AppName::new("lakekeeper").unwrap()) + .app_name(AppName::from_static("lakekeeper"))Consider replacing BehaviorVersion::latest() with a fixed version (e.g., BehaviorVersion::v2024_11_05) once you decide which semantics you want to lock in.
84-92: Redact aws_access_key_id as well to minimize credential exposureWhile the secret is already partially redacted, the access key ID can still be considered sensitive in logs. Redact it as well.
pub struct S3AccessKeyAuth { - pub aws_access_key_id: String, + #[redact(partial)] + pub aws_access_key_id: String, #[redact(partial)] pub aws_secret_access_key: String,
94-107: Optional: simplify path_style_access to a boolpath_style_access is currently Option and treated as false when None. Unless you need to differentiate “unset” from “explicit false,” a plain bool with a default may simplify the API surface.
Example:
- #[builder(default)] - pub path_style_access: Option<bool>, + #[builder(default = false)] + pub path_style_access: bool,and
- if self.path_style_access.unwrap_or(false) { + if self.path_style_access { s3_builder.set_force_path_style(Some(true)); }
109-121: Prefer applying endpoint overrides at the service levelSetting the endpoint on the S3 service builder avoids accidentally leaking a non-AWS endpoint to other AWS service clients that might reuse the same SdkConfig. Consider moving the endpoint override here.
let mut s3_builder = s3_config.to_builder(); if self.path_style_access.unwrap_or(false) { s3_builder.set_force_path_style(Some(true)); } + if let Some(endpoint) = &self.endpoint { + s3_builder = s3_builder.endpoint_url(endpoint.as_str()); + }If you adopt this, remove the endpoint_url settings from get_sdk_config (see another comment).
152-154: Endpoint override: keep it S3-specific (and fix inconsistency)
- To avoid cross-service bleed, prefer removing these endpoint_url settings from the SdkConfig builder and apply them only in get_storage_client on the S3 builder (see earlier comment).
- If you decide to keep them here, use a consistent API: you mix endpoint_url and set_endpoint_url. Given you already use endpoint_url in the other branches, switching the None branch to endpoint_url maintains consistency.
Option A — remove endpoint overrides here (preferred):
- if let Some(endpoint) = endpoint { - builder = builder.endpoint_url(endpoint.to_string()); - } ... - if let Some(endpoint) = endpoint { - builder = builder.endpoint_url(endpoint.to_string()); - } ... - if let Some(endpoint) = endpoint { - builder.set_endpoint_url(Some(endpoint.to_string())); - }Option B — keep them here but fix the inconsistency in the None branch:
- if let Some(endpoint) = endpoint { - builder.set_endpoint_url(Some(endpoint.to_string())); - } + if let Some(endpoint) = endpoint { + builder = builder.endpoint_url(endpoint.to_string()); + }Also applies to: 161-163, 168-170
195-205: Region validation is currently shallow; consider either removing or strengthening itLimiting only by length won’t catch malformed regions (e.g., “us--1”). Either:
- remove validate_region and rely on the AWS SDK to validate, or
- add a minimal pattern check (e.g., “xx-xxxx-x” style) while still allowing special cases (“aws-global”, gov/cn partitions, FIPS/dualstack).
If you want, I can draft a small regex-based validator that accepts known formats and stays permissive for future regions.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (2)
crates/io/src/adls.rs(1 hunks)crates/io/src/s3.rs(1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
crates/io/src/s3.rs (2)
crates/io/src/s3/s3_location.rs (2)
validate_bucket_name(169-211)new(22-62)crates/io/src/s3/s3_storage.rs (2)
new(37-42)client(45-47)
⏰ 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: security_audit
- GitHub Check: docker / docker
- GitHub Check: docker / docker
- GitHub Check: sqlx-check
- GitHub Check: test
- GitHub Check: clippy
- GitHub Check: check-generated-openapi-matches
🔇 Additional comments (6)
crates/io/src/adls.rs (2)
21-26: Solid ADLS integration and cohesive public API surface.Clean separation of concerns, sensible re-exports, and a straightforward credential resolution path. The
AzureSettingsentry points (get_storage_client,get_datalake_client,get_blob_service_client) are easy to use and align with the rest of the IO backends. No functional issues spotted here.Also applies to: 70-78, 85-92, 131-139, 155-163
165-176: Blob service builder configuration verified
Ran a cross-check of the DataLake and Blob builder chains incrates/io/src/adls.rs(lines 143–146 vs. 167–170). Both use
TransportOptions::new(HTTP_CLIENT_ARC.clone())azure_core::ClientOptions::default().retry(RetryOptions::fixed(FixedRetryOptions::default().max_retries(3).max_total_elapsed(Duration::from_secs(5))))Assuming the Azure SDK in use supports passing a
reqwestclient directly, this is good to merge.crates/io/src/s3.rs (4)
23-31: Good centralization of shared AWS/Smithy clients and cachesThe static SharedIdentityCache and SharedHttpClient are correctly hoisted and reused, which avoids per-client allocations and yields consistent retry/timeout/app behavior.
59-76: Auth model looks clear and external_id accessor is spot onThe S3Auth enum and external_id() helper cleanly model the two credential flows and keep the assume-role logic ergonomic downstream.
175-189: AssumeRole flow is correctly layered and uses external_id when providedThe AssumeRoleProvider is configured against the base config, respects external_id, and wraps the resulting provider back into a new SdkConfig. This is the right shape and should compose well across auth modes.
36-40: Tokio runtime features are already enabled
The workspace’s Cargo.toml declarestokio = { version = "1.41", default-features = false, features = ["signal", "rt-multi-thread"] }so
TokioSleephas the required runtime support. No changes needed here.
✅ PR Title Formatted CorrectlyThe title of this PR match the correct format. Thank you! |
There was a problem hiding this comment.
Actionable comments posted: 0
♻️ Duplicate comments (2)
crates/lakekeeper/src/service/storage/az.rs (1)
328-330: Handle root directory depth correctly for SAS directory tokens.For an empty path, split('/').count() returns 1, which yields incorrect directory depth. Trimming both leading and trailing slashes makes the depth calculation robust for edge cases like root paths.
Apply this diff:
- let path = reduce_scheme_string(path.as_ref()); - let rootless_path = path.trim_start_matches('/').trim_end_matches('/'); - let depth = rootless_path.split('/').count(); + let path = reduce_scheme_string(path.as_ref()); + let rootless_path = path.trim_start_matches('/').trim_end_matches('/'); + let depth = if rootless_path.is_empty() { + 0 + } else { + rootless_path.split('/').count() + };crates/io/tests/integration_tests.rs (1)
1395-1395: Userand::thread_rng()instead ofrand::rng().
rand::rng()doesn't exist in the rand crate. The standard way to get a random number generator isrand::thread_rng().- let mut rng = rand::rng(); + let mut rng = rand::thread_rng();
🧹 Nitpick comments (1)
crates/io/src/gcs/gcs_location.rs (1)
186-186: Fix typo: remove extra space before "must".The error message has an extra space at the beginning.
- reason: " must not contain two adjacent periods.".to_string(), + reason: "must not contain two adjacent periods.".to_string(),
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (6)
crates/io/src/adls.rs(1 hunks)crates/io/src/gcs/gcs_location.rs(1 hunks)crates/io/src/lib.rs(1 hunks)crates/io/tests/integration_tests.rs(1 hunks)crates/lakekeeper/src/service/storage/az.rs(18 hunks)justfile(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
- justfile
- crates/io/src/adls.rs
🧰 Additional context used
🧬 Code Graph Analysis (3)
crates/io/tests/integration_tests.rs (2)
crates/io/src/lib.rs (6)
execute_with_parallelism(632-674)new(113-120)read_single(190-193)read_single(366-384)read_single(461-466)read_single(517-522)crates/io/src/memory.rs (4)
new(36-38)len(93-95)is_empty(98-100)read_single(191-193)
crates/lakekeeper/src/service/storage/az.rs (2)
crates/io/src/adls/adls_location.rs (7)
normalize_host(293-316)validate_account_name(323-342)validate_filesystem_name(236-285)location(112-114)new(52-109)account_name(117-119)filesystem(122-124)crates/io/src/adls/adls_storage.rs (2)
new(88-93)client(96-98)
crates/io/src/gcs/gcs_location.rs (3)
crates/io/src/error.rs (5)
new(14-20)new(215-223)new(342-349)location(259-261)reason(265-267)crates/io/src/s3/s3_location.rs (7)
new(22-62)bucket_name(65-67)key(70-72)validate_bucket_name(169-211)location(75-77)try_from_location(85-122)as_str(147-149)crates/io/src/location.rs (3)
from_str(263-299)scheme(25-27)as_str(20-22)
🔇 Additional comments (2)
crates/io/src/lib.rs (2)
162-164: Documentation is accurate.The documentation correctly describes the return type as
Result<(), DeleteBatchError>, which matches the actual implementation.
624-631: Well-documented parallel execution utility.The documentation clearly explains the function's purpose, arguments, and return type. The implementation looks correct and efficient.
* 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]>
For single file uploads Azure is currently by far the slowest compared to S3 and GCS.
Mainly due to shortcomings in the Rust SDK: Azure/azure-sdk-for-rust#2911
Summary by CodeRabbit
New Features
Improvements
Breaking Changes
Tests
Chores