Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
fb4ee7f0
Commit
fb4ee7f0
authored
May 08, 2019
by
yongman
Browse files
Fix uint64_t hash value in active defrag
parent
f674e832
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/defrag.c
View file @
fb4ee7f0
...
@@ -47,7 +47,7 @@ int je_get_defrag_hint(void* ptr, int *bin_util, int *run_util);
...
@@ -47,7 +47,7 @@ int je_get_defrag_hint(void* ptr, int *bin_util, int *run_util);
/* forward declarations*/
/* forward declarations*/
void
defragDictBucketCallback
(
void
*
privdata
,
dictEntry
**
bucketref
);
void
defragDictBucketCallback
(
void
*
privdata
,
dictEntry
**
bucketref
);
dictEntry
*
replaceSateliteDictKeyPtrAndOrDefragDictEntry
(
dict
*
d
,
sds
oldkey
,
sds
newkey
,
u
nsigned
in
t
hash
,
long
*
defragged
);
dictEntry
*
replaceSateliteDictKeyPtrAndOrDefragDictEntry
(
dict
*
d
,
sds
oldkey
,
sds
newkey
,
u
int64_
t
hash
,
long
*
defragged
);
/* Defrag helper for generic allocations.
/* Defrag helper for generic allocations.
*
*
...
@@ -355,7 +355,7 @@ long activeDefragSdsListAndDict(list *l, dict *d, int dict_val_type) {
...
@@ -355,7 +355,7 @@ long activeDefragSdsListAndDict(list *l, dict *d, int dict_val_type) {
sdsele
=
ln
->
value
;
sdsele
=
ln
->
value
;
if
((
newsds
=
activeDefragSds
(
sdsele
)))
{
if
((
newsds
=
activeDefragSds
(
sdsele
)))
{
/* When defragging an sds value, we need to update the dict key */
/* When defragging an sds value, we need to update the dict key */
u
nsigned
in
t
hash
=
dictGetHash
(
d
,
sdsele
);
u
int64_
t
hash
=
dictGetHash
(
d
,
sdsele
);
replaceSateliteDictKeyPtrAndOrDefragDictEntry
(
d
,
sdsele
,
newsds
,
hash
,
&
defragged
);
replaceSateliteDictKeyPtrAndOrDefragDictEntry
(
d
,
sdsele
,
newsds
,
hash
,
&
defragged
);
ln
->
value
=
newsds
;
ln
->
value
=
newsds
;
defragged
++
;
defragged
++
;
...
@@ -392,7 +392,7 @@ long activeDefragSdsListAndDict(list *l, dict *d, int dict_val_type) {
...
@@ -392,7 +392,7 @@ long activeDefragSdsListAndDict(list *l, dict *d, int dict_val_type) {
* moved. Return value is the the dictEntry if found, or NULL if not found.
* moved. Return value is the the dictEntry if found, or NULL if not found.
* NOTE: this is very ugly code, but it let's us avoid the complication of
* NOTE: this is very ugly code, but it let's us avoid the complication of
* doing a scan on another dict. */
* doing a scan on another dict. */
dictEntry
*
replaceSateliteDictKeyPtrAndOrDefragDictEntry
(
dict
*
d
,
sds
oldkey
,
sds
newkey
,
u
nsigned
in
t
hash
,
long
*
defragged
)
{
dictEntry
*
replaceSateliteDictKeyPtrAndOrDefragDictEntry
(
dict
*
d
,
sds
oldkey
,
sds
newkey
,
u
int64_
t
hash
,
long
*
defragged
)
{
dictEntry
**
deref
=
dictFindEntryRefByPtrAndHash
(
d
,
oldkey
,
hash
);
dictEntry
**
deref
=
dictFindEntryRefByPtrAndHash
(
d
,
oldkey
,
hash
);
if
(
deref
)
{
if
(
deref
)
{
dictEntry
*
de
=
*
deref
;
dictEntry
*
de
=
*
deref
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment