diff --git a/rust/lancedb/src/connection.rs b/rust/lancedb/src/connection.rs index e0a4c22fa..85f2be24e 100644 --- a/rust/lancedb/src/connection.rs +++ b/rust/lancedb/src/connection.rs @@ -1472,6 +1472,33 @@ mod tests { ); } + // A default connection to a commit-engine URI must disable the manifest + // namespace: the `__manifest` table under the root has no `ddbTableName` + // query, so building its commit handler would fail. See the DynamoDB + // regression fixed alongside the Lance v9 bump. + #[cfg(feature = "dynamodb")] + #[tokio::test] + async fn test_default_connect_disables_manifest_for_commit_engine() { + for uri in [ + "s3+ddb://bucket/db?ddbTableName=manifest", + "s3://bucket/db?engine=ddb&ddbTableName=manifest", + ] { + let db = connect(uri) + .storage_option("region", "us-east-1") + .execute() + .await + .unwrap_or_else(|e| panic!("expected {uri} to connect, got {e:?}")); + + let (ns_impl, properties) = db.namespace_client_config().await.unwrap(); + assert_eq!(ns_impl, "dir"); + assert_eq!( + properties.get("manifest_enabled"), + Some(&"false".to_string()), + "manifest should be disabled for commit-engine URI {uri}" + ); + } + } + #[tokio::test] async fn test_manifest_enabled_connection_migrates_root_listing_table() { let tmp_dir = tempdir().unwrap(); diff --git a/rust/lancedb/src/database/listing.rs b/rust/lancedb/src/database/listing.rs index f31274698..d5ecc4957 100644 --- a/rust/lancedb/src/database/listing.rs +++ b/rust/lancedb/src/database/listing.rs @@ -323,12 +323,21 @@ impl ListingDatabase { namespace_client_properties: HashMap, read_consistency_interval: Option, session: Arc, + uses_commit_engine: bool, ) -> Result> { - let ns_properties = Self::build_namespace_client_properties( + let mut ns_properties = Self::build_namespace_client_properties( uri, &storage_options, namespace_client_properties, ); + // The directory namespace enables manifest-based listing by default, which + // opens a `__manifest` table under the root. That is incompatible with an + // external commit engine (e.g. `s3+ddb://`): the manifest table URI has no + // `ddbTableName` query, so building its commit handler fails. Disable the + // manifest so these connections fall back to directory listing. + if uses_commit_engine { + ns_properties.insert("manifest_enabled".to_string(), "false".to_string()); + } Ok(Arc::new( LanceNamespaceDatabase::connect( "dir", @@ -503,6 +512,12 @@ impl ListingDatabase { } } + // A commit engine is in use either via an explicit `engine=` query + // param or a `+` URI scheme (e.g. `s3+ddb`). The + // manifest namespace is incompatible with these, so track it to + // disable the manifest below. + let uses_commit_engine = engine.is_some() || url.scheme().contains('+'); + // Filter out the commit store query param -- it's a lancedb param url.query_pairs_mut().clear(); url.query_pairs_mut().extend_pairs(filtered_querys); @@ -575,6 +590,7 @@ impl ListingDatabase { request.namespace_client_properties.clone(), request.read_consistency_interval, session.clone(), + uses_commit_engine, ) .await?; @@ -629,6 +645,7 @@ impl ListingDatabase { namespace_client_properties, read_consistency_interval, session.clone(), + false, ) .await?;