From e5ff759c15217419977826ce411990169cb74d9a Mon Sep 17 00:00:00 2001 From: Wyatt Alt Date: Fri, 14 Aug 2026 01:23:53 -0700 Subject: [PATCH] fix: leave untouched storage accessors alone when stripping creation keys The strip rebuilt the accessor unconditionally, so a provider-backed accessor with no static options became one caching an empty map, and its credentials were never fetched. The accessor is now rebuilt only when a creation key was actually removed, and a provider-only accessor is rebuilt with the provider alone. Co-Authored-By: Claude Fable 5 --- rust/lancedb/src/database/listing.rs | 38 +++++++++++++++++----------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/rust/lancedb/src/database/listing.rs b/rust/lancedb/src/database/listing.rs index 300112339..62a4a8d46 100644 --- a/rust/lancedb/src/database/listing.rs +++ b/rust/lancedb/src/database/listing.rs @@ -821,29 +821,37 @@ impl ListingDatabase { // The new-table keys are creation configuration, not store options: // strip them so a request carrying only them keeps the connection's - // store instead of forking a new one. + // store instead of forking a new one. An accessor that carried none + // of them is left alone -- rebuilding a provider-backed accessor + // around a cached map would stop its credentials being fetched. if let Some(store_params) = write_params.store_params.as_mut() { let mut options = store_params.storage_options().cloned().unwrap_or_default(); + let mut removed = false; for key in [ OPT_NEW_TABLE_STORAGE_VERSION, OPT_NEW_TABLE_V2_MANIFEST_PATHS, OPT_NEW_TABLE_ENABLE_STABLE_ROW_IDS, ] { - options.remove(key); + removed |= options.remove(key).is_some(); + } + if removed { + let provider = store_params + .storage_options_accessor + .as_ref() + .and_then(|accessor| accessor.provider().cloned()); + store_params.storage_options_accessor = match (options.is_empty(), provider) { + (true, None) => None, + (true, Some(provider)) => { + Some(Arc::new(StorageOptionsAccessor::with_provider(provider))) + } + (false, Some(provider)) => Some(Arc::new( + StorageOptionsAccessor::with_initial_and_provider(options, provider), + )), + (false, None) => Some(Arc::new(StorageOptionsAccessor::with_static_options( + options, + ))), + }; } - let provider = store_params - .storage_options_accessor - .as_ref() - .and_then(|accessor| accessor.provider().cloned()); - store_params.storage_options_accessor = match (options.is_empty(), provider) { - (true, None) => None, - (_, Some(provider)) => Some(Arc::new( - StorageOptionsAccessor::with_initial_and_provider(options, provider), - )), - (false, None) => Some(Arc::new(StorageOptionsAccessor::with_static_options( - options, - ))), - }; } // Only modify the storage options if we actually have something to