summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSun He <sunheehnus@gmail.com>2015-02-06 11:18:58 +0800
committerantirez <antirez@gmail.com>2015-02-11 11:01:46 +0100
commitaa3de042324f4fd71dece81d7776e18d98ec376d (patch)
treee85f28ba25dc73680f333d380ddec26377af5fc6
parent252ebcd973614c14e81d7744826cd1ab0248546c (diff)
downloadredis-aa3de042324f4fd71dece81d7776e18d98ec376d.tar.gz
dict.c/dictRehash: check again to update
-rw-r--r--src/dict.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/dict.c b/src/dict.c
index e0adfbc99..9b2be81ff 100644
--- a/src/dict.c
+++ b/src/dict.c
@@ -282,6 +282,13 @@ int dictRehash(dict *d, int n) {
d->ht[0].table[d->rehashidx] = NULL;
d->rehashidx++;
}
+ /* Check again if we already rehashed the whole table... */
+ if (d->ht[0].used == 0) {
+ zfree(d->ht[0].table);
+ d->ht[0] = d->ht[1];
+ _dictReset(&d->ht[1]);
+ d->rehashidx = -1;
+ }
return 1;
}