-
Notifications
You must be signed in to change notification settings - Fork 23.5k
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
base: unstable
Are you sure you want to change the base?
Conversation
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.
c160ce9
to
a60a8a2
Compare
There was a problem hiding this 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.
/* plink points to the bucket. There's no prev entry. */ | ||
*plink = dictGetNext(he); |
There was a problem hiding this comment.
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).
There was a problem hiding this comment.
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.
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. |
|
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.