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:
westonpace
2026-04-23 13:08:20 -07:00
parent 1decf28f2a
commit 1d624f21de

View File

@@ -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))
}