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

Dict entries exclude the 'next' pointer when NULL #11746

Draft
wants to merge 2 commits into
base: unstable
Choose a base branch
from

Conversation

zuiderkwast
Copy link
Contributor

This commit introduces a dictEntry with key and value, but no next field, which is used to save memory when there is no next. The pointer to the dictEntry is tagged in the LSB bits.

Whenever a 'next' pointer is set or unset, the dict entry may need to be reallocated. When this happens, the pointer to it needs to be updated and the entry metadata callback needs to be called.

There's some crash that I haven't figured out. Help debugging is appreciated.

Whenever a 'next' pointer is set or unset, the dict entry may need
to be reallocated. When this happens, the pointer to it needs to be
updated and the entry metadata callback needs to be called.
This commit introduces a dictEntry with key and value, but no next
field. The pointer to the dictEntry is tagged in the LSB bits.
Copy link
Member

@oranagra oranagra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i didn't find any bugs yet, didn't complete the review, but not sure when i'll get to resume and maybe my feedback can help.

src/dict.c Show resolved Hide resolved
src/dict.c Show resolved Hide resolved
Comment on lines +866 to +867
/* plink points to the bucket. There's no prev entry. */
*plink = dictGetNext(he);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is that comment right? it could be just a plain dictEntry (with no flags).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code doesn't care what kind of dictEntry it is. It matches how plink is created in dictTwoPhaseUnlinkFind. he and *plink can be any kind of dictEntry.

@zuiderkwast
Copy link
Contributor Author

i didn't find any bugs yet, didn't complete the review, but not sure when i'll get to resume and maybe my feedback can help.

Thanks for looking at this. Any feedback can definitely help. I have split the commit into one refactoring commit (that doesn't change any behaviour) and a second commit that adds dictEntryNoNext. With only the first commit, all tests pass. I trying to narrow down the bug in this way.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

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

Successfully merging this pull request may close these issues.

None yet

3 participants