berkeley-db-1.xx icon indicating copy to clipboard operation
berkeley-db-1.xx copied to clipboard

duplicate key enablement

Open elfman2 opened this issue 7 years ago • 1 comments

Hello,

To enable duplicate key in btree, one can call btree.open(flags=1)

after some tests we detected a coredump in bt_delete.c

You will find attached the patch: bt_delete.patch.txt

When some duplicated keys are searched, the first loop scans left to right, the second loop scans right to left. In the case where the btree leef h->upper == t->psize, i.e. when the free space is up to the right page limit, the first do while loop shall not be entered. Only the second loop is necessary to remove from right to left.

The test program uses a dbm module that could be in micropython-lib, if you need it i could provide it.

elfman2 avatar Jun 28 '17 17:06 elfman2

Thanks for the report! MicroPython doesn't currently support duplicate keys ("officially"), so looking into this would be of less priority. But please consider submitting a patch as a pull request here, and a testcase would be definitely needed to verify correctness of this change, so please post it to.

pfalcon avatar Jun 29 '17 10:06 pfalcon