Skip to content

Commit

Permalink
More debugging of bad write sizes
Browse files Browse the repository at this point in the history
  • Loading branch information
kriszyp committed Mar 29, 2024
1 parent 5f2e524 commit c22aac1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
7 changes: 6 additions & 1 deletion dependencies/lmdb/libraries/liblmdb/mdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -4468,6 +4468,10 @@ mdb_page_flush(MDB_txn *txn, int keep)
for (n=1; n<=pagecount; n++) {
dp = dl[n].mptr;
dl_nump[n] = IS_OVERFLOW(dp) ? dp->mp_pages : 1;
if (dl_nump[n] < 0) {
fprintf(stderr, "Invalid page count %i at index %i for page no %i\n", dl_nump[n], n, dl[n].mid);
return MDB_BAD_TXN;
}
pgno_t p = dl[n].mid + dl_nump[n];
if (p > pgno)
pgno = p;
Expand Down Expand Up @@ -4551,6 +4555,7 @@ mdb_page_flush(MDB_txn *txn, int keep)
pos = pgno * psize;
size = psize;
nump = dl_nump[i];
mdb_tassert(txn, nump > 0);
pages_written += nump;
size *= nump;
}
Expand Down Expand Up @@ -4624,7 +4629,7 @@ mdb_page_flush(MDB_txn *txn, int keep)
goto retry_write;
fprintf(stderr, "Write error: %s position %u, size %u", strerror(rc), wpos, wsize);
last_error = malloc(100);
sprintf(last_error, "Attempting to write page at position %u, size %u", wpos, wsize);
sprintf(last_error, "Attempting to write page at position %u, size %u, blocks %u, buffer sizes %i %i %i", wpos, wsize, n, iov[0].iov_len, iov[1].iov_len, iov[2].iov_len);
} else {
rc = EIO; /* TODO: Use which error code? */
DPUTS("short write, filesystem full?");
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "lmdb",
"author": "Kris Zyp",
"version": "3.0.3",
"version": "3.0.3-debug.1",
"description": "Simple, efficient, scalable, high-performance LMDB interface",
"license": "MIT",
"repository": {
Expand Down Expand Up @@ -68,7 +68,7 @@
"prebuild-win32": "prebuildify-platform-packages --debug --target 20.0.0 && prebuildify-platform-packages --debug --target 18.17.1 && set ENABLE_V8_FUNCTIONS=false&& prebuildify-platform-packages --debug --napi --platform-packages --target 18.17.1",
"prebuild-libc-arm7": "ENABLE_V8_FUNCTIONS=false prebuildify-platform-packages --debug --napi --platform-packages --tag-libc --target 18.17.1",
"prebuildify": "prebuildify-platform-packages --debug --napi --target 18.17.1",
"full-publish": "cd prebuilds/win32-x64 && npm publish --access public && cd ../darwin-x64 && npm publish --access public && cd ../darwin-arm64 && npm publish --access public && cd ../linux-x64 && npm publish --access public && cd ../linux-arm64 && npm publish --access public && cd ../linux-arm && npm publish --access public && cd ../.. && npm publish && node util/remove-optional-deps.cjs",
"full-publish": "cd prebuilds/win32-x64 && npm publish --tag test --access public && cd ../darwin-x64 && npm publish --tag test --access public && cd ../darwin-arm64 && npm publish --tag test --access public && cd ../linux-x64 && npm publish --tag test --access public && cd ../linux-arm64 && npm publish --tag test --access public && cd ../linux-arm && npm publish --tag test --access public && cd ../.. && npm publish --tag test && node util/remove-optional-deps.cjs",
"recompile": "node-gyp clean && node-gyp configure && node-gyp build",
"test": "mocha test/**.test.js --expose-gc --recursive",
"deno-test": "deno run --allow-ffi --allow-write --allow-read --allow-env --allow-net --unstable test/deno.ts",
Expand Down

0 comments on commit c22aac1

Please sign in to comment.