Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

duplicate key enablement #1

Open
elfman2 opened this issue Jun 28, 2017 · 1 comment
Open

duplicate key enablement #1

elfman2 opened this issue Jun 28, 2017 · 1 comment

Comments

@elfman2
Copy link

elfman2 commented Jun 28, 2017

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.

@pfalcon
Copy link
Owner

pfalcon commented Jun 29, 2017

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.

elfman2 added a commit to elfman2/micropython that referenced this issue Jul 1, 2017
Added a flag definition in modbtree
Added a test
modified btree.rst to describe duplicate key

The test actually triggers a coredump due to berkeleydb bt_delete design error
The issue is reported pfalcon/berkeley-db-1.xx#1

The correction will be provided in the next commit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants