Skip to content

Commit

Permalink
Add more debugging information for conflicting freelist
Browse files Browse the repository at this point in the history
  • Loading branch information
kriszyp committed Feb 5, 2025
1 parent 9de294a commit 6c2715f
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 4 deletions.
28 changes: 25 additions & 3 deletions dependencies/lmdb/libraries/liblmdb/mdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -4451,10 +4451,32 @@ mdb_freelist_save(MDB_txn *txn)
rc = MDB_BAD_TXN;
break;
}
if (mdb_midl_xmerge(&test_idl, (MDB_ID *) data.mv_data)) {
fprintf(stderr, "freelist duplicates/overlaps in free list\n", start_written);
if (rc = mdb_midl_xmerge(&test_idl, (MDB_ID *) data.mv_data)) {
last = *(txnid_t *) key.mv_data;
fprintf(stderr, "freelist duplicates/overlaps in free list %u %u %u %u %u %u %i %i %i %i %i %u %u\n", last, data.mv_size, start_written,
pglast, env->me_freelist_start, env->me_freelist_end,
freelist_written_start, env->me_freelist_written_start, freelist_written_end, env->me_freelist_written_end,
i, fl_writes[0], fl_writes[1]);
fprintf(stderr, "conflicting freelist to save:\n");
mdb_midl_print(stderr, test_idl);
fprintf(stderr, "from the original freelist to save:\n");
mdb_midl_print(stderr, pghead);
fprintf(stderr, "All the entries that we are saving to the freelist:\n");
// print out all the entries that we are saving to the freelist
test_idl = mdb_midl_alloc(16);
key.mv_size = sizeof(start_written);
key.mv_data = &start_written;
rc = mdb_cursor_get(&mc, &key, &data, MDB_SET);
size_t last = 0;
while (rc == 0) {
last = *(txnid_t *) key.mv_data;
fprintf(stderr, "entry %u:\n", last);
mdb_midl_print(stderr, (MDB_ID *) data.mv_data);
if (last >= env->me_freelist_end) break;
rc = mdb_cursor_get(&mc, &key, &data, MDB_NEXT);
}
last_error = malloc(100);
sprintf(last_error, "freelist entry %u not in new free list\n", start_written);
sprintf(last_error, "freelist entry %u had bad/duplicate entries, error code %u\n", last, rc);
rc = MDB_BAD_TXN;
break;
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "lmdb",
"author": "Kris Zyp",
"version": "3.2.4",
"version": "3.2.5",
"description": "Simple, efficient, scalable, high-performance LMDB interface",
"license": "MIT",
"repository": {
Expand Down

0 comments on commit 6c2715f

Please sign in to comment.