kriszyp / lmdb-js

Simple, efficient, ultra-fast, scalable data store wrapper for LMDB
Other
482 stars 39 forks source link

fixed "Invalid key or zero length key is not allowed in LMDB" error w… #147

Closed arthurmilliken closed 2 years ago

arthurmilliken commented 2 years ago

…hen trying to call db.drop() on an empty child table.

Steps to reproduce:

export async function main() {
  const db = open({ path: '.db' })
  const table = db.openDB({ name: 'table ' })
  await table.drop()
}

main()

/*
(node:1900) UnhandledPromiseRejectionWarning: Error: Invalid key or zero length key is not allowed in LMDB
    at writeInstructions (/home/arthur/src/crawler/node_modules/lmdb/write.js:158:12)
    at LMDBStore.drop (/home/arthur/src/crawler/node_modules/lmdb/write.js:662:4)
    at /home/arthur/src/crawler/src/index.ts:37:15
    at Generator.next (<anonymous>)
    at /home/arthur/src/crawler/src/index.ts:8:71
    at new Promise (<anonymous>)
    at __awaiter (/home/arthur/src/crawler/src/index.ts:4:12)
    at main2 (/home/arthur/src/crawler/src/index.ts:44:12)
    at Object.<anonymous> (/home/arthur/src/crawler/src/index.ts:41:1)
    at Module._compile (internal/modules/cjs/loader.js:1085:14)
*/
kriszyp commented 2 years ago

Looks great, thank you!

kriszyp commented 2 years ago

Published in v2.2.5.