mirror of
https://github.com/lancedb/lancedb.git
synced 2026-01-04 19:02:58 +00:00
fix: delete tables from DDB on drop_all_tables (#2194)
Prior to this commit, issuing drop_all_tables on a listing database with an external manifest store would delete physical tables but leave references behind in the manifest store. The table drop would succeed, but subsequent creation of a table with the same name would fail with a conflict. With this patch, the external manifest store is updated to account for the dropped tables so that dropped table names can be reused.
This commit is contained in:
@@ -175,6 +175,8 @@ maybeDescribe("storage_options", () => {
|
||||
|
||||
tableNames = await db.tableNames();
|
||||
expect(tableNames).toEqual([]);
|
||||
|
||||
await db.dropAllTables();
|
||||
});
|
||||
|
||||
it("can configure encryption at connection and table level", async () => {
|
||||
@@ -210,6 +212,8 @@ maybeDescribe("storage_options", () => {
|
||||
await table.add([{ a: 2, b: 3 }]);
|
||||
|
||||
await bucket.assertAllEncrypted("test/table2.lance", kmsKey.keyId);
|
||||
|
||||
await db.dropAllTables();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -298,5 +302,32 @@ maybeDescribe("DynamoDB Lock", () => {
|
||||
|
||||
const rowCount = await table.countRows();
|
||||
expect(rowCount).toBe(6);
|
||||
|
||||
await db.dropAllTables();
|
||||
});
|
||||
|
||||
it("clears dynamodb state after dropping all tables", async () => {
|
||||
const uri = `s3+ddb://${bucket.name}/test?ddbTableName=${commitTable.name}`;
|
||||
const db = await connect(uri, {
|
||||
storageOptions: CONFIG,
|
||||
readConsistencyInterval: 0,
|
||||
});
|
||||
|
||||
await db.createTable("foo", [{ a: 1, b: 2 }]);
|
||||
await db.createTable("bar", [{ a: 1, b: 2 }]);
|
||||
|
||||
let tableNames = await db.tableNames();
|
||||
expect(tableNames).toEqual(["bar", "foo"]);
|
||||
|
||||
await db.dropAllTables();
|
||||
tableNames = await db.tableNames();
|
||||
expect(tableNames).toEqual([]);
|
||||
|
||||
// We can create a new table with the same name as the one we dropped.
|
||||
await db.createTable("foo", [{ a: 1, b: 2 }]);
|
||||
tableNames = await db.tableNames();
|
||||
expect(tableNames).toEqual(["foo"]);
|
||||
|
||||
await db.dropAllTables();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user