diff options
author | Huang Zhw <huang_zhw@126.com> | 2021-03-28 20:16:30 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-28 15:16:30 +0300 |
commit | a79bb86856d677db2fd2d16c603f29dd9f3c7614 (patch) | |
tree | 7ddf0eafbcdc651a5c55a55b65749a68e1ab59e6 /src/defrag.c | |
parent | e138698e54e97bfaababf56507026bf92dd4deb4 (diff) | |
download | redis-a79bb86856d677db2fd2d16c603f29dd9f3c7614.tar.gz |
Remove redundant defrag dictEntry in activeDefragSdsListAndDict. (#8713)
In activeDefragSdsListAndDict when defrag list key sucess, the key
in dict is also replaced. Then the corresponding dictEntry is
defraged. But the dictEntry will be defraged in next step by defrag
the dict values too.
Diffstat (limited to 'src/defrag.c')
-rw-r--r-- | src/defrag.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/defrag.c b/src/defrag.c index 2b28d523d..3dfb8679c 100644 --- a/src/defrag.c +++ b/src/defrag.c @@ -347,7 +347,9 @@ long activeDefragSdsListAndDict(list *l, dict *d, int dict_val_type) { if ((newsds = activeDefragSds(sdsele))) { /* When defragging an sds value, we need to update the dict key */ uint64_t hash = dictGetHash(d, newsds); - replaceSatelliteDictKeyPtrAndOrDefragDictEntry(d, sdsele, newsds, hash, &defragged); + dictEntry **deref = dictFindEntryRefByPtrAndHash(d, sdsele, hash); + if (deref) + (*deref)->key = newsds; ln->value = newsds; defragged++; } |