mirror of
https://github.com/lancedb/lancedb.git
synced 2026-05-14 02:20:40 +00:00
fix: remove .lance-reserved marker after writing table in namespace mode
lance v6.0.0-beta.2 introduced a `.lance-reserved` marker file in declare_table to prevent directory scans from seeing incomplete tables. lancedb calls declare_table to get the canonical URI, then writes data separately via NativeTable::create_from_namespace, but never cleaned up the marker. This caused list_directory_tables() to skip tables with the marker, making newly created tables invisible in table_names(). After writing the table, delete the marker using the dataset's configured object store so it works for both local and cloud storage. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -8,7 +8,9 @@ use std::sync::Arc;
|
||||
|
||||
use async_trait::async_trait;
|
||||
use lance::io::commit::namespace_manifest::LanceNamespaceExternalManifestStore;
|
||||
use lance_io::object_store::{ObjectStoreParams, StorageOptionsAccessor};
|
||||
use lance_io::object_store::{
|
||||
ObjectStore as LanceObjectStore, ObjectStoreParams, ObjectStoreRegistry, StorageOptionsAccessor,
|
||||
};
|
||||
use lance_namespace::{
|
||||
LanceNamespace,
|
||||
models::{
|
||||
@@ -341,6 +343,20 @@ impl Database for LanceNamespaceDatabase {
|
||||
)
|
||||
.await?;
|
||||
|
||||
// lance >= v6.0.0-beta.2: declare_table creates a `.lance-reserved` marker file to
|
||||
// prevent directory scanning from seeing an incomplete table. After writing data we
|
||||
// must remove it so the table appears in directory listings.
|
||||
if let Ok(dataset) = native_table.dataset.get().await {
|
||||
let registry = Arc::new(ObjectStoreRegistry::default());
|
||||
if let Ok(table_path) = LanceObjectStore::extract_path_from_uri(registry, dataset.uri())
|
||||
{
|
||||
let _ = dataset
|
||||
.object_store
|
||||
.delete(&table_path.child(".lance-reserved"))
|
||||
.await;
|
||||
}
|
||||
}
|
||||
|
||||
Ok(Arc::new(native_table))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user